예제 #1
0
void
MainMenu::loadGameLoadButtonClicked(Button *)
{
    getSound()->playSound( "Click" );
    if( loadCityNG( mFilename ) ){
        quitState = INGAME;
        running = false;
    }
}
예제 #2
0
void Game::quickLoad(){
    closeAllDialogs();

    //load file
    getGameView()->printStatusMessage( "quick load...");
    std::string filename;
    filename.append( "quicksave.scn" );
    if( loadCityNG( filename ) ){
          getGameView()->printStatusMessage( "quick load successful.");
    } else {
          getGameView()->printStatusMessage( "quick load failed!");
    }
}
예제 #3
0
void
MainMenu::continueButtonClicked(Button* )
{
    getSound()->playSound( "Click" );
    quitState = INGAME;
    running = false;
    //only act if world is still clean
    if (!world.dirty)
    {
        //load current game if it exists
        if( ! loadCityNG( std::string( "9_currentGameNG.scn.gz" ) ) )
        {
            //by default create a new City
            new_city( &main_screen_originx, &main_screen_originy, 1 );
        }
    }
}
예제 #4
0
/**
 * 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
}
void initLincity()
{
    initLCengine();

    reset_start_time ();
  
    screen_full_refresh ();

    //load current game if it exists
    //ldsvguts.cpp load_saved_city (char *s)
    //does not work if file is missing...

    char* s = "9_currentGameNG.scn";
    char *cname = (char *) malloc (strlen (lc_save_dir) + strlen (s) + 2);
    sprintf (cname, "%s%c%s", lc_save_dir, PATH_SLASH, s);
    if( ! loadCityNG( std::string( cname ) ) ) {   
        //create a new City with village just in case 
        new_city( &main_screen_originx, &main_screen_originy, 1 );
    }
    free (cname);
}