1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-24 00:36:29 +02:00

Replace static_cast's of Identifiers with getNum call

This commit is contained in:
Ivan Savenko
2023-11-02 16:56:02 +02:00
parent 8f25f1fd4b
commit 885dce0c27
13 changed files with 23 additions and 36 deletions

View File

@@ -71,16 +71,8 @@ void CMapEvent::serializeJson(JsonSerializeFormat & handler)
void CCastleEvent::serializeJson(JsonSerializeFormat & handler)
{
CMapEvent::serializeJson(handler);
{
std::vector<BuildingID> temp(buildings.begin(), buildings.end());
auto a = handler.enterArray("buildings");
a.syncSize(temp);
for(int i = 0; i < temp.size(); ++i)
{
a.serializeInt(i, temp[i]);
buildings.insert(temp[i]);
}
}
handler.serializeIdArray("buildings", buildings);
{
auto a = handler.enterArray("creatures");
a.syncSize(creatures);
@@ -393,7 +385,7 @@ const CGObjectInstance * CMap::getObjectiveObjectFrom(const int3 & pos, Obj type
// There is weird bug because of which sometimes heroes will not be found properly despite having correct position
// Try to workaround that and find closest object that we can use
logGlobal->error("Failed to find object of type %d at %s", static_cast<int>(type), pos.toString());
logGlobal->error("Failed to find object of type %d at %s", type.getNum(), pos.toString());
logGlobal->error("Will try to find closest matching object");
CGObjectInstance * bestMatch = nullptr;