Beispiel #1
0
void SoloGame::epilogue_done() {
    if (Preferences::preferences()->play_idle_music()) {
        StopAndUnloadSong();
    }

    if (g.next_level < 0) {
        _scenario = NULL;
    } else {
        _scenario = GetScenarioPtrFromChapter(g.next_level);
    }

    if (_scenario != NULL) {
        const int32_t chapter = _scenario->chapter_number();
        if (chapter >= 0) {
            Ledger::ledger()->unlock_chapter(chapter);
        } else {
            _scenario = NULL;
        }
    }

    if (_scenario != NULL) {
        _state = START_LEVEL;
    } else {
        _state = QUIT;
    }
    become_front();
}
Beispiel #2
0
    virtual void become_front() {
        switch (_state) {
        case NEW:
            _state = REPLAY;
            init();
            Randomize(4);  // For the decision to replay intro.
            _game_result = NO_GAME;
            gRandomSeed = _random_seed;
            globals()->gInputSource.reset(new ReplayInputSource(&_replay_data));
            stack()->push(new MainPlay(
                              GetScenarioPtrFromChapter(_replay_data.chapter_id), true, &_game_result));
            break;

        case REPLAY:
            stack()->pop(this);
            break;
        }
    }