-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame.hpp
86 lines (78 loc) · 2.12 KB
/
Game.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#pragma once
#include <cstddef>
#include <memory>
#include "Map.hpp"
#include "Player.hpp"
#include "Time.hpp"
class Game {
public:
Game(size_t money, size_t gameDays, size_t finalGoal);
enum class MenuOption {
NoChoice,
PrintMap,
Travel,
PrintCargo,
Buy,
Sell,
HireCrew,
Exit
};
enum class CheckAnswer {
Yes,
No,
Error
};
void startGame();
private:
void printWelcomeScreen();
void printMenu();
void printHeader();
void printMap();
void printWinScreen();
void printLoseScreen();
void pressButtonToContinue();
void announcementGenerate(const std::string& announcenent);
void printResponse(const Store::Response& response,
const std::string& message);
void setUserCargo(std::string& cargoName, size_t& cargoAmount);
Island* generateDestinationIsland();
void setUserDestination();
void countingCurrentDay(size_t travelTime);
size_t getTravelDistance(Island* destinationIsland);
void generatingTravelInfo();
void travel();
void printCargo();
void printCargoFromStore();
void printCargoFromShip();
void buy();
void sell();
void manageCrew();
void hireCrew();
void dismissCrew();
void printCrew();
MenuOption exitGame();
bool isGameWon();
bool isGameLost();
bool isChoiceValid(const size_t& option);
CheckAnswer checkAnswer(const std::string& announcement);
MenuOption selectOption();
MenuOption actionMenu(MenuOption userAnswer);
bool isCrewNumber();
bool hasPlayerEnoughMoney(const size_t crew);
bool isNumberLowerThanZero(const int crew);
MenuOption menuOption_{MenuOption::NoChoice};
size_t money_{};
size_t gameDays_{};
const size_t finalGoal_{};
size_t currentDay_{};
Island* destinationIsland{nullptr};
size_t travelCoordX_{};
size_t travelCoordY_{};
size_t islandMax_{};
size_t islandNo_{};
size_t playerSpeed{};
size_t travelTime{};
std::shared_ptr<Time> time_;
std::shared_ptr<Map> map_;
std::shared_ptr<Player> player_;
};