1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

Update town visual when new structure is built

This commit is contained in:
Ivan Savenko 2023-03-22 14:41:36 +02:00
parent c81d57ab8c
commit ef07935fbc

View File

@ -514,6 +514,11 @@ void ApplyClientNetPackVisitor::visitNewStructures(NewStructures & pack)
{
callInterfaceIfPresent(cl, town->tempOwner, &IGameEventsReceiver::buildChanged, town, id, 1);
}
// invalidate section of map view with our object and force an update
CGI->mh->onObjectInstantRemove(town);
CGI->mh->onObjectInstantAdd(town);
}
void ApplyClientNetPackVisitor::visitRazeStructures(RazeStructures & pack)
{
@ -522,6 +527,10 @@ void ApplyClientNetPackVisitor::visitRazeStructures(RazeStructures & pack)
{
callInterfaceIfPresent(cl, town->tempOwner, &IGameEventsReceiver::buildChanged, town, id, 2);
}
// invalidate section of map view with our object and force an update
CGI->mh->onObjectInstantRemove(town);
CGI->mh->onObjectInstantAdd(town);
}
void ApplyClientNetPackVisitor::visitSetAvailableCreatures(SetAvailableCreatures & pack)
@ -607,7 +616,7 @@ void ApplyClientNetPackVisitor::visitSetObjectProperty(SetObjectProperty & pack)
if (pack.what == ObjProperty::OWNER)
{
// invalidate section of map view with our objec and force an update with new flag color
// invalidate section of map view with our object and force an update with new flag color
CGI->mh->onObjectInstantRemove(gs.getObjInstance(pack.id));
CGI->mh->onObjectInstantAdd(gs.getObjInstance(pack.id));
}