mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Support roads and teams customization in engine
This commit is contained in:
@@ -51,6 +51,10 @@ public:
|
||||
/// The default value is EPlayerType::AI.
|
||||
EPlayerType::EPlayerType getPlayerType() const;
|
||||
void setPlayerType(EPlayerType::EPlayerType value);
|
||||
|
||||
/// Team id for this player. TeamID::NO_TEAM by default - team will be randomly assigned
|
||||
TeamID getTeam() const;
|
||||
void setTeam(TeamID value);
|
||||
|
||||
/// Constant for a random town selection.
|
||||
static const si32 RANDOM_TOWN = -1;
|
||||
@@ -59,6 +63,7 @@ public:
|
||||
PlayerColor color;
|
||||
si32 startingTown;
|
||||
EPlayerType::EPlayerType playerType;
|
||||
TeamID team;
|
||||
|
||||
public:
|
||||
template <typename Handler>
|
||||
@@ -67,6 +72,8 @@ public:
|
||||
h & color;
|
||||
h & startingTown;
|
||||
h & playerType;
|
||||
if(version >= 806)
|
||||
h & team;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -105,6 +112,9 @@ public:
|
||||
|
||||
EMonsterStrength::EMonsterStrength getMonsterStrength() const;
|
||||
void setMonsterStrength(EMonsterStrength::EMonsterStrength value);
|
||||
|
||||
bool isRoadEnabled(const std::string & roadName) const;
|
||||
void setRoadEnabled(const std::string & roadName, bool enable);
|
||||
|
||||
/// 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.
|
||||
@@ -113,6 +123,8 @@ public:
|
||||
/// 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.
|
||||
void setPlayerTypeForStandardPlayer(PlayerColor color, EPlayerType::EPlayerType playerType);
|
||||
|
||||
void setPlayerTeam(PlayerColor color, TeamID team = TeamID::NO_TEAM);
|
||||
|
||||
/// The random map template to generate the map with or empty/not set if the template should be chosen randomly.
|
||||
/// Default: Not set/random.
|
||||
@@ -147,6 +159,8 @@ private:
|
||||
EWaterContent::EWaterContent waterContent;
|
||||
EMonsterStrength::EMonsterStrength monsterStrength;
|
||||
std::map<PlayerColor, CPlayerSettings> players;
|
||||
std::set<std::string> disabledRoads;
|
||||
|
||||
const CRmgTemplate * mapTemplate;
|
||||
|
||||
public:
|
||||
@@ -168,11 +182,15 @@ public:
|
||||
{
|
||||
templateName = mapTemplate->getId();
|
||||
}
|
||||
//if(version > xxx) do not forget to bump version
|
||||
h & templateName;
|
||||
if(!h.saving)
|
||||
if(version >= 806)
|
||||
{
|
||||
setMapTemplate(templateName);
|
||||
h & templateName;
|
||||
if(!h.saving)
|
||||
{
|
||||
setMapTemplate(templateName);
|
||||
}
|
||||
|
||||
h & disabledRoads;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user