1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Works more or less

This commit is contained in:
Tomasz Zieliński
2023-10-28 20:30:38 +02:00
parent a817e481d0
commit 07dac8b6d4
7 changed files with 414 additions and 207 deletions

View File

@@ -88,8 +88,11 @@ public:
/// The count of all (human or computer) players ranging from 1 to PlayerColor::PLAYER_LIMIT or RANDOM_SIZE for random. If you call
/// this method, all player settings are reset to default settings.
si8 getPlayerCount() const;
void setPlayerCount(si8 value);
si8 getHumanOrCpuPlayerCount() const;
void setHumanOrCpuPlayerCount(si8 value);
si8 getTotalPlayersCount() const;
si8 getPlayerLimit() const;
/// The count of the teams ranging from 0 to <players count - 1> or RANDOM_SIZE for random.
si8 getTeamCount() const;
@@ -117,6 +120,7 @@ public:
/// The first player colors belong to standard players and the last player colors belong to comp only players.
/// All standard players are by default of type EPlayerType::AI.
const std::map<PlayerColor, CPlayerSettings> & getPlayersSettings() const;
const std::map<PlayerColor, CPlayerSettings> & getSavedPlayersMap() const;
void setStartingTownForPlayer(const PlayerColor & color, si32 town);
/// Sets a player type for a standard player. A standard player is the opposite of a computer only player. The
/// values which can be chosen for the player type are EPlayerType::AI or EPlayerType::HUMAN.
@@ -139,12 +143,15 @@ public:
/// Returns false if there is no template available which fits to the currently selected options.
bool checkOptions() const;
/// Returns true if player colors or teams were set in game GUI
bool arePlayersCustomized() const;
static const si8 RANDOM_SIZE = -1;
private:
void initPlayersMap();
void resetPlayersMap();
void savePlayersMap();
int countHumanPlayers() const;
int countCompOnlyPlayers() const;
PlayerColor getNextPlayerColor() const;
@@ -154,11 +161,13 @@ private:
si32 width, height;
bool hasTwoLevels;
si8 playerCount, teamCount, compOnlyPlayerCount, compOnlyTeamCount;
si8 humanOrCpuPlayerCount, teamCount, compOnlyPlayerCount, compOnlyTeamCount;
EWaterContent::EWaterContent waterContent;
EMonsterStrength::EMonsterStrength monsterStrength;
std::map<PlayerColor, CPlayerSettings> players;
std::map<PlayerColor, CPlayerSettings> savedPlayerSettings;
std::set<RoadId> enabledRoads;
bool customizedPlayers;
const CRmgTemplate * mapTemplate;
@@ -169,7 +178,7 @@ public:
h & width;
h & height;
h & hasTwoLevels;
h & playerCount;
h & humanOrCpuPlayerCount;
h & teamCount;
h & compOnlyPlayerCount;
h & compOnlyTeamCount;