/** * Either create selected random terrain or load a scenario. **/ void MainMenu::newGameStartButtonClicked(Button* ) { if( mFilename.empty() ){ // std::cout << "nothing selected\n"; return; } getSound()->playSound( "Click" ); int with_village = (getCheckButton(*currentMenu,"WithVillage")->state == CheckButton::STATE_CHECKED)?1:0; if( baseName == "RiverDelta" ){ new_city( &main_screen_originx, &main_screen_originy, with_village ); GameView* gv = getGameView(); if( gv ){ gv->readOrigin(); } quitState = INGAME; running = false; } else if( baseName == "DesertArea" ){ new_desert_city( &main_screen_originx, &main_screen_originy, with_village ); GameView* gv = getGameView(); if( gv ){ gv->readOrigin(); } quitState = INGAME; running = false; } else if( baseName == "TemperateArea" ){ new_temperate_city( &main_screen_originx, &main_screen_originy, with_village ); GameView* gv = getGameView(); if( gv ){ gv->readOrigin(); } quitState = INGAME; running = false; } else if( baseName == "SwampArea" ){ new_swamp_city( &main_screen_originx, &main_screen_originy, with_village ); GameView* gv = getGameView(); if( gv ){ gv->readOrigin(); } quitState = INGAME; running = false; } else { if( loadCityNG( mFilename ) ){ strcpy (given_scene, baseName.c_str()); quitState = INGAME; running = false; } } mFilename = "empty"; //don't erase scenarios later }
/* * Load City and do setup for Lincity NG. */ bool loadCityNG( std::string filename ){ if( file_exists( const_cast<char*>( filename.c_str()) ) ){ load_city(const_cast<char*>(filename.c_str())); update_avail_modules(0); GameView* gv = getGameView(); if( gv ){ gv->readOrigin(); } return true; } return false; }