-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathConfigLoader.hpp
More file actions
74 lines (61 loc) · 1.65 KB
/
Copy pathConfigLoader.hpp
File metadata and controls
74 lines (61 loc) · 1.65 KB
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
#pragma once
#include <string>
#include <fstream>
#include <vector>
#include <map>
#include "Tile.hpp"
using namespace std;
class ConfigLoader {
private:
static ConfigLoader* instance;
ConfigLoader();
ifstream currentFile;
string currentLine;
int currentParsedIndex;
string configFilePath;
bool isConfigValid;
map<int, int> railroadRentMap;
map<int, int> utilityMultiplierMap;
int taxPPHFlat;
double taxPPHPercent;
int taxPBMFlat;
int goSalary;
int jailFine;
int maxTurn;
int initialMoney;
class TileDefinition {
public:
int index;
string kode;
string nama;
string tipeStr;
TileDefinition(int index, const string& kode,
const string& nama, const string& tipeStr);
int getIndex() const;
string getKode() const;
string getNama() const;
string getTipeStr() const;
};
vector<TileDefinition> layoutDefinitions;
void readRailroadConfig();
void readUtilityConfig();
void readTaxConfig();
void readSpecialConfig();
void readMiscConfig();
void buildLayoutFromHardcode();
void buildLayoutFromFile();
Tile* instantiateTile(const TileDefinition& def);
void linkSpecialTiles();
public:
static ConfigLoader* getInstance();
~ConfigLoader();
void loadAllConfigs();
void parsePropertyConfig();
void parseActionTileConfig();
void validateBoardLayout();
void setConfigFilePath(const string& path);
bool getIsConfigValid() const;
// Getter untuk GameEngine setelah loadAllConfigs() selesai
int getMaxTurn() const;
int getInitialMoney() const;
};