mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-29 01:35:42 +00:00
fix Terrain encoding and clean up some deleted code
This commit is contained in:
@@ -25,10 +25,6 @@ byte_vector ShardokSerializedClient::GetUnplacedUnits() {
|
||||
return serializer->serialize(controller->GetUnplacedUnits(playerId));
|
||||
}
|
||||
|
||||
/*byte_vector ShardokSerializedClient::GetUnitById(HeroId heroId) {
|
||||
return serializer->serialize(controller->GetUnitById(playerId, heroId));
|
||||
}*/
|
||||
|
||||
byte_vector ShardokSerializedClient::IsItMyTurn() {
|
||||
if (readOnly) return serializer->serialize(false);
|
||||
return serializer->serialize(controller->IsItMyTurn(playerId));
|
||||
|
||||
@@ -25,8 +25,8 @@ enum HexMapTerrainType {
|
||||
};
|
||||
|
||||
struct HexMapTerrain {
|
||||
static constexpr const char* const TERRAIN_TYPE_KEY = "terrainType";
|
||||
static constexpr const char* const TERRAIN_MODIFIER_KEY = "terrainModifier";
|
||||
static constexpr const char* const TERRAIN_TYPE_KEY = "type";
|
||||
static constexpr const char* const TERRAIN_MODIFIER_KEY = "modifier";
|
||||
|
||||
HexMapTerrainType type;
|
||||
TileModifier modifier;
|
||||
|
||||
+20
-13
@@ -119,6 +119,16 @@ struct GameStatus {
|
||||
};
|
||||
|
||||
struct HexMapInfo {
|
||||
private:
|
||||
static inline vector<HexMapTerrain> TerrainTypesToTerrains(const vector<HexMapTerrainType>& types) {
|
||||
vector<HexMapTerrain> terrain;
|
||||
for (auto type : types) {
|
||||
terrain.push_back(HexMapTerrain(type));
|
||||
}
|
||||
return terrain;
|
||||
}
|
||||
|
||||
public:
|
||||
MapIndex rowCount;
|
||||
MapIndex columnCount;
|
||||
bool oddRowsShorter;
|
||||
@@ -145,9 +155,9 @@ struct HexMapInfo {
|
||||
}
|
||||
|
||||
static HexMapInfo FromSerializable(const Serializable& map) {
|
||||
vector<HexMapTerrain> tv;
|
||||
vector<HexMapTerrainType> tv;
|
||||
for (const Serializable& val : map[TERRAIN_VALUES_KEY].arrayValue()) {
|
||||
tv.push_back(HexMapTerrain(val));
|
||||
tv.push_back(val.intValue<HexMapTerrainType>());
|
||||
}
|
||||
vector<vector<Coords>> attackerPositions = {};
|
||||
if (map.HasValueForKey(ATTACKER_STARTING_POSITIONS_KEY)) {
|
||||
@@ -173,6 +183,14 @@ struct HexMapInfo {
|
||||
std::vector<std::vector<Coords>> asp)
|
||||
: HexMapInfo(rc, cc, ors, tv, std::vector<UnitIdOptional>(tv.size(), UnitIdOptional::Absent()), dsp, asp) {}
|
||||
|
||||
HexMapInfo(MapIndex rc,
|
||||
MapIndex cc,
|
||||
bool ors,
|
||||
std::vector<HexMapTerrainType> tv,
|
||||
std::vector<Coords> dsp,
|
||||
std::vector<std::vector<Coords>> asp)
|
||||
: HexMapInfo(rc, cc, ors, TerrainTypesToTerrains(tv), std::vector<UnitIdOptional>(tv.size(), UnitIdOptional::Absent()), dsp, asp) {}
|
||||
|
||||
HexMapInfo(MapIndex rc,
|
||||
MapIndex cc,
|
||||
bool ors,
|
||||
@@ -190,17 +208,6 @@ struct HexMapInfo {
|
||||
}
|
||||
|
||||
HexMapInfo(const HexMapInfo& rhs) = default;
|
||||
|
||||
/* HexMapInfo& operator= (const HexMapInfo& rhs) {
|
||||
rowCount = rhs.rowCount;
|
||||
columnCount = rhs.columnCount;
|
||||
oddRowsShorter = rhs.oddRowsShorter;
|
||||
|
||||
terrainValues = rhs.terrainValues;
|
||||
occupants = rhs.occupants;
|
||||
|
||||
return *this;
|
||||
}*/
|
||||
};
|
||||
|
||||
struct ActionCost {
|
||||
|
||||
Reference in New Issue
Block a user