Login Languish
game_manager.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include <string>
11 #include <vector>
12 #include <map>
13 #include "rapidjson/document.h"
14 // #include "stages/stage.h"
15 
16 class Stage;
17 
23 {
24 public:
25  GameManager();
26  Stage* getStage(std::string stage);
27  void updateField(const rapidjson::Value &req);
28  void updateField(const std::string &stage, const std::string &field, const std::string &value);
29  // std::string getStage();
30  std::string getNextStage();
31  std::vector<std::string> getFieldErrors(const std::string &stage, const std::string &field);
32  rapidjson::Document getGameState();
33  void progressStage(const rapidjson::Value &req);
34  std::string getCurrentStageName();
35 
36 private:
37  std::map<std::string, Stage *> stages_map;
38  int stage_index;
39  std::vector<Stage* > stages;
40 
41  Stage* current_stage;
42  const int REQ_STAGE_INDEX = 0;
43 };
the Stage class is an abstract class that represents a stage in the game
Definition: stage.h:20
GameManager()
constructor for GameManager
Definition: game_manager.cpp:25
rapidjson::Document getGameState()
gets the game state
Definition: game_manager.cpp:139
std::string getNextStage()
progresses to the next stage is current stage is validated
Definition: game_manager.cpp:70
Stage * getStage(std::string stage)
gets the current stage
Definition: game_manager.cpp:61
the GameManager class is a class that controls the flow of the game
Definition: game_manager.h:22
void updateField(const rapidjson::Value &req)
updates the field
Definition: game_manager.cpp:86
std::vector< std::string > getFieldErrors(const std::string &stage, const std::string &field)
gets the field errors
Definition: game_manager.cpp:123