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

Serializer will now smartly send over network CArtifact* and CHero*. Unified handling of items stored in vector.

Started making support for Black Market / Artifact merchant.
This commit is contained in:
Michał W. Urbańczyk
2010-06-26 16:02:10 +00:00
parent 627a1a5905
commit ec6342d9a7
20 changed files with 367 additions and 278 deletions

View File

@@ -487,7 +487,7 @@ DLL_EXPORT void SetHeroArtifacts::applyGs( CGameState *gs )
if(h->getArtPos(id) >= 0)
continue;
CArtifact &art = VLC->arth->artifacts[id];
CArtifact &art = *VLC->arth->artifacts[id];
art.addBonusesTo(&h->bonuses);
art.addBonusesTo(&gained);
}
@@ -503,7 +503,7 @@ DLL_EXPORT void SetHeroArtifacts::applyGs( CGameState *gs )
if(h->getArtPos(id) >= 0)
continue;
CArtifact &art = VLC->arth->artifacts[id];
CArtifact &art = *VLC->arth->artifacts[id];
art.removeBonusesFrom(&h->bonuses);
art.addBonusesTo(&lost);
}
@@ -606,6 +606,25 @@ DLL_EXPORT void NewObject::applyGs( CGameState *gs )
assert(o->defInfo);
}
DLL_EXPORT void SetAvailableArtifacts::applyGs( CGameState *gs )
{
if(id >= 0)
{
if(CGBlackMarket *bm = dynamic_cast<CGBlackMarket*>(gs->map->objects[id]))
{
bm->artifacts = arts;
}
else
{
tlog1 << "Wrong black market id!" << std::endl;
}
}
else
{
CGTownInstance::merchantArtifacts = arts;
}
}
DLL_EXPORT void NewTurn::applyGs( CGameState *gs )
{
gs->day = day;