2010-03-18 22:26:40 +01:00
// ==============================================================
// This file is part of Glest (www.glest.org)
//
2010-07-08 10:29:51 +02:00
// Copyright (C) 2001-2005 Martio Figueroa
2010-03-18 22:26:40 +01:00
//
// You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published
// by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version
// ==============================================================
# include "menu_state_scenario.h"
# include "renderer.h"
# include "menu_state_new_game.h"
# include "sound_renderer.h"
# include "core_data.h"
# include "menu_state_options.h"
# include "network_manager.h"
# include "config.h"
# include "auto_test.h"
# include "game.h"
# include "leak_dumper.h"
namespace Glest { namespace Game {
using namespace Shared : : Xml ;
// =====================================================
// class MenuStateScenario
// =====================================================
2010-09-01 08:05:28 +02:00
MenuStateScenario : : MenuStateScenario ( Program * program , MainMenu * mainMenu , const vector < string > & dirList , string autoloadScenarioName ) :
2010-03-18 22:26:40 +01:00
MenuState ( program , mainMenu , " scenario " )
{
2010-09-09 23:07:39 +02:00
containerName = " Scenario " ;
2011-03-31 00:14:51 +02:00
enableScenarioTexturePreview = false ;
scenarioLogoTexture = NULL ;
2011-03-31 02:33:40 +02:00
previewLoadDelayTimer = time ( NULL ) ;
needToLoadTextures = true ;
2011-03-31 00:14:51 +02:00
2010-03-18 22:26:40 +01:00
Lang & lang = Lang : : getInstance ( ) ;
NetworkManager & networkManager = NetworkManager : : getInstance ( ) ;
2010-09-01 08:05:28 +02:00
2010-09-09 23:07:39 +02:00
mainMessageBox . registerGraphicComponent ( containerName , " mainMessageBox " ) ;
2010-09-01 08:05:28 +02:00
mainMessageBox . init ( lang . get ( " Ok " ) ) ;
mainMessageBox . setEnabled ( false ) ;
mainMessageBoxState = 0 ;
this - > autoloadScenarioName = autoloadScenarioName ;
2010-03-18 22:26:40 +01:00
vector < string > results ;
this - > dirList = dirList ;
2011-03-31 02:33:40 +02:00
int startY = 100 ;
int startX = 350 ;
2010-09-09 23:07:39 +02:00
labelInfo . registerGraphicComponent ( containerName , " labelInfo " ) ;
2011-03-31 02:33:40 +02:00
labelInfo . init ( startX , startY + 130 ) ;
2010-03-18 22:26:40 +01:00
labelInfo . setFont ( CoreData : : getInstance ( ) . getMenuFontNormal ( ) ) ;
2010-09-09 23:07:39 +02:00
buttonReturn . registerGraphicComponent ( containerName , " buttonReturn " ) ;
2011-03-31 02:33:40 +02:00
buttonReturn . init ( startX , startY , 125 ) ;
2010-09-09 23:07:39 +02:00
buttonPlayNow . registerGraphicComponent ( containerName , " buttonPlayNow " ) ;
2011-03-31 02:33:40 +02:00
buttonPlayNow . init ( startX + 175 , startY , 125 ) ;
2010-03-18 22:26:40 +01:00
2010-09-09 23:07:39 +02:00
listBoxScenario . registerGraphicComponent ( containerName , " listBoxScenario " ) ;
2011-03-31 02:33:40 +02:00
listBoxScenario . init ( startX , startY + 160 , 190 ) ;
2010-09-09 23:07:39 +02:00
labelScenario . registerGraphicComponent ( containerName , " labelScenario " ) ;
2011-03-31 02:33:40 +02:00
labelScenario . init ( startX , startY + 190 ) ;
2010-03-18 22:26:40 +01:00
buttonReturn . setText ( lang . get ( " Return " ) ) ;
buttonPlayNow . setText ( lang . get ( " PlayNow " ) ) ;
labelScenario . setText ( lang . get ( " Scenario " ) ) ;
//scenario listbox
findDirs ( dirList , results ) ;
scenarioFiles = results ;
if ( results . size ( ) = = 0 ) {
2011-01-28 21:16:45 +01:00
throw runtime_error ( " There are no scenarios found to load " ) ;
2010-03-18 22:26:40 +01:00
}
for ( int i = 0 ; i < results . size ( ) ; + + i ) {
2010-09-01 08:05:28 +02:00
results [ i ] = formatString ( results [ i ] ) ;
2010-03-18 22:26:40 +01:00
}
listBoxScenario . setItems ( results ) ;
2011-01-02 17:55:52 +01:00
try {
loadScenarioInfo ( Scenario : : getScenarioPath ( dirList , scenarioFiles [ listBoxScenario . getSelectedItemIndex ( ) ] ) , & scenarioInfo ) ;
labelInfo . setText ( scenarioInfo . desc ) ;
2010-03-18 22:26:40 +01:00
2011-01-02 17:55:52 +01:00
GraphicComponent : : applyAllCustomProperties ( containerName ) ;
2010-09-09 23:07:39 +02:00
2011-01-02 17:55:52 +01:00
networkManager . init ( nrServer ) ;
}
catch ( const std : : exception & ex ) {
char szBuf [ 4096 ] = " " ;
sprintf ( szBuf , " In [%s::%s %d] Error detected: \n %s \n " , __FILE__ , __FUNCTION__ , __LINE__ , ex . what ( ) ) ;
SystemFlags : : OutputDebug ( SystemFlags : : debugError , szBuf ) ;
2011-03-29 11:45:15 +02:00
if ( SystemFlags : : getSystemSettingType ( SystemFlags : : debugSystem ) . enabled ) SystemFlags : : OutputDebug ( SystemFlags : : debugSystem , " %s " , szBuf ) ;
2011-01-02 17:55:52 +01:00
mainMessageBoxState = 1 ;
showMessageBox ( " Error: " + string ( ex . what ( ) ) , " Error detected " , false ) ;
}
2010-03-18 22:26:40 +01:00
}
void MenuStateScenario : : mouseClick ( int x , int y , MouseButton mouseButton ) {
CoreData & coreData = CoreData : : getInstance ( ) ;
SoundRenderer & soundRenderer = SoundRenderer : : getInstance ( ) ;
2010-09-01 08:05:28 +02:00
if ( mainMessageBox . getEnabled ( ) ) {
int button = 1 ;
if ( mainMessageBox . mouseClick ( x , y , button ) )
{
soundRenderer . playFx ( coreData . getClickSoundA ( ) ) ;
if ( button = = 1 )
{
mainMessageBox . setEnabled ( false ) ;
}
}
}
else if ( buttonReturn . mouseClick ( x , y ) ) {
2010-03-18 22:26:40 +01:00
soundRenderer . playFx ( coreData . getClickSoundA ( ) ) ;
mainMenu - > setState ( new MenuStateNewGame ( program , mainMenu ) ) ;
}
else if ( buttonPlayNow . mouseClick ( x , y ) ) {
soundRenderer . playFx ( coreData . getClickSoundC ( ) ) ;
launchGame ( ) ;
}
else if ( listBoxScenario . mouseClick ( x , y ) ) {
2011-01-02 18:06:07 +01:00
try {
loadScenarioInfo ( Scenario : : getScenarioPath ( dirList , scenarioFiles [ listBoxScenario . getSelectedItemIndex ( ) ] ) , & scenarioInfo ) ;
labelInfo . setText ( scenarioInfo . desc ) ;
}
catch ( const std : : exception & ex ) {
char szBuf [ 4096 ] = " " ;
sprintf ( szBuf , " In [%s::%s %d] Error detected: \n %s \n " , __FILE__ , __FUNCTION__ , __LINE__ , ex . what ( ) ) ;
SystemFlags : : OutputDebug ( SystemFlags : : debugError , szBuf ) ;
2011-03-29 11:45:15 +02:00
if ( SystemFlags : : getSystemSettingType ( SystemFlags : : debugSystem ) . enabled ) SystemFlags : : OutputDebug ( SystemFlags : : debugSystem , " %s " , szBuf ) ;
2011-01-02 18:06:07 +01:00
mainMessageBoxState = 1 ;
showMessageBox ( " Error: " + string ( ex . what ( ) ) , " Error detected " , false ) ;
}
2010-03-18 22:26:40 +01:00
}
}
void MenuStateScenario : : mouseMove ( int x , int y , const MouseState * ms ) {
2010-09-01 08:05:28 +02:00
if ( mainMessageBox . getEnabled ( ) ) {
mainMessageBox . mouseMove ( x , y ) ;
}
2010-03-18 22:26:40 +01:00
listBoxScenario . mouseMove ( x , y ) ;
buttonReturn . mouseMove ( x , y ) ;
buttonPlayNow . mouseMove ( x , y ) ;
}
void MenuStateScenario : : render ( ) {
Renderer & renderer = Renderer : : getInstance ( ) ;
2011-03-31 00:14:51 +02:00
if ( scenarioLogoTexture ! = NULL ) {
2011-03-31 02:33:40 +02:00
renderer . renderTextureQuad ( 300 , 350 , 400 , 300 , scenarioLogoTexture , 1.0f ) ;
//renderer.renderBackground(scenarioLogoTexture);
2011-03-31 00:14:51 +02:00
}
2010-09-01 08:05:28 +02:00
if ( mainMessageBox . getEnabled ( ) ) {
renderer . renderMessageBox ( & mainMessageBox ) ;
}
else {
renderer . renderLabel ( & labelInfo ) ;
renderer . renderLabel ( & labelScenario ) ;
renderer . renderListBox ( & listBoxScenario ) ;
2010-07-08 10:29:51 +02:00
2010-09-01 08:05:28 +02:00
renderer . renderButton ( & buttonReturn ) ;
renderer . renderButton ( & buttonPlayNow ) ;
}
2010-07-08 10:29:51 +02:00
if ( program ! = NULL ) program - > renderProgramMsgBox ( ) ;
2010-03-18 22:26:40 +01:00
}
void MenuStateScenario : : update ( ) {
2010-09-01 08:05:28 +02:00
if ( Config : : getInstance ( ) . getBool ( " AutoTest " ) ) {
2010-03-18 22:26:40 +01:00
AutoTest : : getInstance ( ) . updateScenario ( this ) ;
}
2010-09-01 08:05:28 +02:00
if ( this - > autoloadScenarioName ! = " " ) {
listBoxScenario . setSelectedItem ( formatString ( this - > autoloadScenarioName ) , false ) ;
if ( listBoxScenario . getSelectedItem ( ) ! = formatString ( this - > autoloadScenarioName ) ) {
mainMessageBoxState = 1 ;
showMessageBox ( " Could not find scenario name: " + formatString ( this - > autoloadScenarioName ) , " Scenario Missing " , false ) ;
this - > autoloadScenarioName = " " ;
}
else {
loadScenarioInfo ( Scenario : : getScenarioPath ( dirList , scenarioFiles [ listBoxScenario . getSelectedItemIndex ( ) ] ) , & scenarioInfo ) ;
labelInfo . setText ( scenarioInfo . desc ) ;
SoundRenderer & soundRenderer = SoundRenderer : : getInstance ( ) ;
CoreData & coreData = CoreData : : getInstance ( ) ;
soundRenderer . playFx ( coreData . getClickSoundC ( ) ) ;
launchGame ( ) ;
}
}
2011-03-31 02:33:40 +02:00
if ( needToLoadTextures ) {
// this delay is done to make it possible to switch faster
if ( difftime ( time ( NULL ) , previewLoadDelayTimer ) > = 2 ) {
loadScenarioPreviewTexture ( ) ;
needToLoadTextures = false ;
}
}
2010-03-18 22:26:40 +01:00
}
void MenuStateScenario : : launchGame ( ) {
GameSettings gameSettings ;
loadGameSettings ( & scenarioInfo , & gameSettings ) ;
program - > setState ( new Game ( program , & gameSettings ) ) ;
}
void MenuStateScenario : : setScenario ( int i ) {
listBoxScenario . setSelectedItemIndex ( i ) ;
loadScenarioInfo ( Scenario : : getScenarioPath ( dirList , scenarioFiles [ listBoxScenario . getSelectedItemIndex ( ) ] ) , & scenarioInfo ) ;
}
void MenuStateScenario : : loadScenarioInfo ( string file , ScenarioInfo * scenarioInfo ) {
Lang & lang = Lang : : getInstance ( ) ;
XmlTree xmlTree ;
xmlTree . load ( file ) ;
const XmlNode * scenarioNode = xmlTree . getRootNode ( ) ;
const XmlNode * difficultyNode = scenarioNode - > getChild ( " difficulty " ) ;
scenarioInfo - > difficulty = difficultyNode - > getAttribute ( " value " ) - > getIntValue ( ) ;
2011-01-28 21:16:45 +01:00
if ( scenarioInfo - > difficulty < dVeryEasy | | scenarioInfo - > difficulty > dInsane ) {
char szBuf [ 4096 ] = " " ;
sprintf ( szBuf , " Invalid difficulty value specified in scenario: %d must be between %d and %d " , scenarioInfo - > difficulty , dVeryEasy , dInsane ) ;
throw std : : runtime_error ( szBuf ) ;
2010-03-18 22:26:40 +01:00
}
const XmlNode * playersNode = scenarioNode - > getChild ( " players " ) ;
for ( int i = 0 ; i < GameConstants : : maxPlayers ; + + i ) {
XmlNode * playerNode ;
string factionTypeName ;
ControlType factionControl ;
if ( playersNode - > hasChildAtIndex ( " player " , i ) ) {
playerNode = playersNode - > getChild ( " player " , i ) ;
factionControl = strToControllerType ( playerNode - > getAttribute ( " control " ) - > getValue ( ) ) ;
2011-01-02 17:55:52 +01:00
2010-11-11 02:24:48 +01:00
if ( playerNode - > getAttribute ( " resource_multiplier " , false ) ! = NULL )
{ // if a multiplier exists use it
scenarioInfo - > resourceMultipliers [ i ] = playerNode - > getAttribute ( " resource_multiplier " ) - > getFloatValue ( ) ;
}
else
2011-01-02 17:55:52 +01:00
{ // if no multiplier exists use defaults
2010-12-11 01:20:31 +01:00
scenarioInfo - > resourceMultipliers [ i ] = GameConstants : : normalMultiplier ;
2010-11-11 02:24:48 +01:00
if ( factionControl = = ctCpuEasy )
{
2010-12-11 01:20:31 +01:00
scenarioInfo - > resourceMultipliers [ i ] = GameConstants : : easyMultiplier ;
2010-11-11 02:24:48 +01:00
}
if ( factionControl = = ctCpuUltra )
{
2010-12-11 01:20:31 +01:00
scenarioInfo - > resourceMultipliers [ i ] = GameConstants : : ultraMultiplier ;
2010-11-11 02:24:48 +01:00
}
else if ( factionControl = = ctCpuMega )
{
2010-12-11 01:20:31 +01:00
scenarioInfo - > resourceMultipliers [ i ] = GameConstants : : megaMultiplier ;
2010-11-11 02:24:48 +01:00
}
}
2011-01-02 17:55:52 +01:00
2010-03-18 22:26:40 +01:00
}
else {
factionControl = ctClosed ;
}
scenarioInfo - > factionControls [ i ] = factionControl ;
if ( factionControl ! = ctClosed ) {
int teamIndex = playerNode - > getAttribute ( " team " ) - > getIntValue ( ) ;
2011-01-28 21:16:45 +01:00
if ( teamIndex < 1 | | teamIndex > GameConstants : : maxPlayers ) {
char szBuf [ 4096 ] = " " ;
sprintf ( szBuf , " Invalid team value specified in scenario: %d must be between %d and %d " , teamIndex , 1 , GameConstants : : maxPlayers ) ;
throw std : : runtime_error ( szBuf ) ;
2010-03-18 22:26:40 +01:00
}
scenarioInfo - > teams [ i ] = playerNode - > getAttribute ( " team " ) - > getIntValue ( ) ;
scenarioInfo - > factionTypeNames [ i ] = playerNode - > getAttribute ( " faction " ) - > getValue ( ) ;
}
scenarioInfo - > mapName = scenarioNode - > getChild ( " map " ) - > getAttribute ( " value " ) - > getValue ( ) ;
scenarioInfo - > tilesetName = scenarioNode - > getChild ( " tileset " ) - > getAttribute ( " value " ) - > getValue ( ) ;
scenarioInfo - > techTreeName = scenarioNode - > getChild ( " tech-tree " ) - > getAttribute ( " value " ) - > getValue ( ) ;
scenarioInfo - > defaultUnits = scenarioNode - > getChild ( " default-units " ) - > getAttribute ( " value " ) - > getBoolValue ( ) ;
scenarioInfo - > defaultResources = scenarioNode - > getChild ( " default-resources " ) - > getAttribute ( " value " ) - > getBoolValue ( ) ;
scenarioInfo - > defaultVictoryConditions = scenarioNode - > getChild ( " default-victory-conditions " ) - > getAttribute ( " value " ) - > getBoolValue ( ) ;
}
//add player info
scenarioInfo - > desc = lang . get ( " Player " ) + " : " ;
for ( int i = 0 ; i < GameConstants : : maxPlayers ; + + i )
{
if ( scenarioInfo - > factionControls [ i ] = = ctHuman )
{
scenarioInfo - > desc + = formatString ( scenarioInfo - > factionTypeNames [ i ] ) ;
break ;
}
}
//add misc info
string difficultyString = " Difficulty " + intToStr ( scenarioInfo - > difficulty ) ;
scenarioInfo - > desc + = " \n " ;
scenarioInfo - > desc + = lang . get ( " Difficulty " ) + " : " + lang . get ( difficultyString ) + " \n " ;
scenarioInfo - > desc + = lang . get ( " Map " ) + " : " + formatString ( scenarioInfo - > mapName ) + " \n " ;
scenarioInfo - > desc + = lang . get ( " Tileset " ) + " : " + formatString ( scenarioInfo - > tilesetName ) + " \n " ;
scenarioInfo - > desc + = lang . get ( " TechTree " ) + " : " + formatString ( scenarioInfo - > techTreeName ) + " \n " ;
2010-04-24 05:57:38 +02:00
if ( scenarioNode - > hasChild ( " fog-of-war " ) = = true ) {
2011-03-31 01:48:27 +02:00
if ( scenarioNode - > getChild ( " fog-of-war " ) - > getAttribute ( " value " ) - > getValue ( ) = = " explored " ) {
scenarioInfo - > fogOfWar = true ;
scenarioInfo - > fogOfWar_exploredFlag = true ;
}
else {
scenarioInfo - > fogOfWar = scenarioNode - > getChild ( " fog-of-war " ) - > getAttribute ( " value " ) - > getBoolValue ( ) ;
scenarioInfo - > fogOfWar_exploredFlag = false ;
}
2011-01-10 01:05:31 +01:00
//printf("\nFOG OF WAR is set to [%d]\n",scenarioInfo->fogOfWar);
2010-04-24 05:57:38 +02:00
}
else {
2011-03-31 01:48:27 +02:00
scenarioInfo - > fogOfWar = true ;
scenarioInfo - > fogOfWar_exploredFlag = false ;
2010-04-24 05:57:38 +02:00
}
2011-03-31 02:33:40 +02:00
scenarioLogoTexture = NULL ;
previewLoadDelayTimer = time ( NULL ) ;
needToLoadTextures = true ;
}
2011-03-31 00:14:51 +02:00
2011-03-31 02:33:40 +02:00
void MenuStateScenario : : loadScenarioPreviewTexture ( ) {
2011-03-31 00:14:51 +02:00
enableScenarioTexturePreview = true ;
2011-03-31 02:33:40 +02:00
if ( enableScenarioTexturePreview = = true ) {
GameSettings gameSettings ;
loadGameSettings ( & scenarioInfo , & gameSettings ) ;
2011-03-31 00:14:51 +02:00
2011-03-31 02:33:40 +02:00
string scenarioLogo = " " ;
bool loadingImageUsed = false ;
2011-03-31 00:14:51 +02:00
2011-03-31 02:33:40 +02:00
Game : : extractScenarioLogoFile ( & gameSettings , scenarioLogo , loadingImageUsed ) ;
if ( scenarioLogo ! = " " ) {
scenarioLogoTexture = Renderer : : findFactionLogoTexture ( scenarioLogo ) ;
}
else {
scenarioLogoTexture = NULL ;
}
2011-03-31 00:14:51 +02:00
}
2010-03-18 22:26:40 +01:00
}
void MenuStateScenario : : loadGameSettings ( const ScenarioInfo * scenarioInfo , GameSettings * gameSettings ) {
int factionCount = 0 ;
gameSettings - > setDescription ( formatString ( scenarioFiles [ listBoxScenario . getSelectedItemIndex ( ) ] ) ) ;
gameSettings - > setMap ( scenarioInfo - > mapName ) ;
gameSettings - > setTileset ( scenarioInfo - > tilesetName ) ;
gameSettings - > setTech ( scenarioInfo - > techTreeName ) ;
gameSettings - > setScenario ( scenarioFiles [ listBoxScenario . getSelectedItemIndex ( ) ] ) ;
gameSettings - > setScenarioDir ( Scenario : : getScenarioPath ( dirList , scenarioFiles [ listBoxScenario . getSelectedItemIndex ( ) ] ) ) ;
gameSettings - > setDefaultUnits ( scenarioInfo - > defaultUnits ) ;
gameSettings - > setDefaultResources ( scenarioInfo - > defaultResources ) ;
gameSettings - > setDefaultVictoryConditions ( scenarioInfo - > defaultVictoryConditions ) ;
for ( int i = 0 ; i < GameConstants : : maxPlayers ; + + i ) {
ControlType ct = static_cast < ControlType > ( scenarioInfo - > factionControls [ i ] ) ;
if ( ct ! = ctClosed ) {
if ( ct = = ctHuman ) {
gameSettings - > setThisFactionIndex ( factionCount ) ;
}
gameSettings - > setFactionControl ( factionCount , ct ) ;
2010-11-25 23:45:08 +01:00
gameSettings - > setResourceMultiplierIndex ( factionCount , ( scenarioInfo - > resourceMultipliers [ i ] - 0.5f ) / 0.1f ) ;
2010-03-18 22:26:40 +01:00
gameSettings - > setTeam ( factionCount , scenarioInfo - > teams [ i ] - 1 ) ;
gameSettings - > setStartLocationIndex ( factionCount , i ) ;
gameSettings - > setFactionTypeName ( factionCount , scenarioInfo - > factionTypeNames [ i ] ) ;
factionCount + + ;
}
}
gameSettings - > setFactionCount ( factionCount ) ;
2010-04-24 05:57:38 +02:00
gameSettings - > setFogOfWar ( scenarioInfo - > fogOfWar ) ;
2011-01-10 01:05:31 +01:00
uint32 valueFlags1 = gameSettings - > getFlagTypes1 ( ) ;
2011-03-31 01:48:27 +02:00
if ( scenarioInfo - > fogOfWar = = false | | scenarioInfo - > fogOfWar_exploredFlag ) {
2011-01-10 01:05:31 +01:00
valueFlags1 | = ft1_show_map_resources ;
gameSettings - > setFlagTypes1 ( valueFlags1 ) ;
}
else {
valueFlags1 & = ~ ft1_show_map_resources ;
gameSettings - > setFlagTypes1 ( valueFlags1 ) ;
}
2010-08-11 23:55:08 +02:00
gameSettings - > setPathFinderType ( static_cast < PathFinderType > ( Config : : getInstance ( ) . getInt ( " ScenarioPathFinderType " , intToStr ( pfBasic ) . c_str ( ) ) ) ) ;
2010-03-18 22:26:40 +01:00
}
ControlType MenuStateScenario : : strToControllerType ( const string & str ) {
if ( str = = " closed " ) {
return ctClosed ;
}
else if ( str = = " cpu-easy " ) {
return ctCpuEasy ;
}
else if ( str = = " cpu " ) {
return ctCpu ;
}
else if ( str = = " cpu-ultra " ) {
return ctCpuUltra ;
}
else if ( str = = " cpu-mega " ) {
return ctCpuMega ;
}
else if ( str = = " human " ) {
return ctHuman ;
}
2011-01-28 21:16:45 +01:00
char szBuf [ 4096 ] = " " ;
sprintf ( szBuf , " Invalid controller value specified in scenario: [%s] must be one of the following: closed, cpu-easy, cpu, cpu-ultra, cpu-mega, human " , str . c_str ( ) ) ;
throw std : : runtime_error ( szBuf ) ;
2010-03-18 22:26:40 +01:00
}
2010-09-01 08:05:28 +02:00
void MenuStateScenario : : showMessageBox ( const string & text , const string & header , bool toggle ) {
if ( ! toggle ) {
mainMessageBox . setEnabled ( false ) ;
}
if ( ! mainMessageBox . getEnabled ( ) ) {
mainMessageBox . setText ( text ) ;
mainMessageBox . setHeader ( header ) ;
mainMessageBox . setEnabled ( true ) ;
}
else {
mainMessageBox . setEnabled ( false ) ;
}
}
2010-09-09 23:07:39 +02:00
void MenuStateScenario : : keyDown ( char key ) {
Config & configKeys = Config : : getInstance ( std : : pair < ConfigType , ConfigType > ( cfgMainKeys , cfgUserKeys ) ) ;
if ( key = = configKeys . getCharKey ( " SaveGUILayout " ) ) {
bool saved = GraphicComponent : : saveAllCustomProperties ( containerName ) ;
//Lang &lang= Lang::getInstance();
//console.addLine(lang.get("GUILayoutSaved") + " [" + (saved ? lang.get("Yes") : lang.get("No"))+ "]");
}
}
2010-03-18 22:26:40 +01:00
} } //end namespace