Source

zorkish / SelectAdventureStage.hpp

Full commit
/*
 * SelectAdventureStage.hpp
 *
 *  Created on: 20/08/2012
 *      Author: rhys
 */

#ifndef SELECTADVENTURESTAGE_HPP_
#define SELECTADVENTURESTAGE_HPP_

#include "TestAdventure.hpp"

class SelectAdventureStage : public ZorkishStage {
private:
    std::string message;

public:
    SelectAdventureStage(ZorkishGame& game) : ZorkishStage(game) {};

    virtual Status update(ActiveStageManager& smgr) {
        switch (this->input_int()) {
        case 1:
            smgr.set_next_stage(this->game.test_adventure().get());
            return GameStage::Status::FINISH;
        default:
            this->message = "Please select a number listed above.";
            break;
        }

        return GameStage::Status::CONTINUE;
    }

    virtual void draw() {
        using std::cout;
        cout << "===Select Adventure===\n";
        cout << "Choose your adventure:\n";
        cout << "1. Test world\n";
        if (!this->message.empty()) {
            cout << this->message << '\n';
            this->message.clear();
        }
        cout << "Select 1-1: ";
    }
};

#endif /* SELECTADVENTURESTAGE_HPP_ */