mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-29 21:56:54 +02:00
Fixes for artifact system - instances are serialized and synchronized. However, still some serializer issue prevents Scroll from working.
This commit is contained in:
parent
b75cf89f86
commit
6cadd47f0d
@ -113,7 +113,7 @@ public:
|
||||
void heroVisitCastle(int obj, int heroID){};
|
||||
void stopHeroVisitCastle(int obj, int heroID){};
|
||||
void giveHeroArtifact(int artid, int hid, int position){}; //pos==-1 - first free slot in backpack=0; pos==-2 - default if available or backpack
|
||||
void giveCustomArtifact(int artid, int hid, int position, int value){};
|
||||
void giveNewArtifact(int hid, int position){};
|
||||
bool removeArtifact(CArtifact* art, int hid){return false;};
|
||||
void startBattleI(const CArmedInstance *army1, const CArmedInstance *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, bool creatureBank = false, boost::function<void(BattleResult*)> cb = 0, const CGTownInstance *town = NULL){}; //use hero=NULL for no hero
|
||||
void startBattleI(const CArmedInstance *army1, const CArmedInstance *army2, int3 tile, boost::function<void(BattleResult*)> cb = 0, bool creatureBank = false){}; //if any of armies is hero, hero will be used
|
||||
|
@ -183,7 +183,7 @@ void CArtifact::getParents(TCNodes &out, const CBonusSystemNode *root /*= NULL*/
|
||||
|
||||
void CScroll::Init()
|
||||
{
|
||||
bonuses.push_back (Bonus (Bonus::PERMANENT, Bonus::SPELL, Bonus::ARTIFACT, 0, id, spellid, Bonus::INDEPENDENT_MAX));
|
||||
bonuses.push_back (Bonus (Bonus::PERMANENT, Bonus::SPELL, Bonus::ARTIFACT, 1, id, spellid, Bonus::INDEPENDENT_MAX));
|
||||
//boost::algorithm::replace_first(description, "[spell name]", VLC->spellh->spells[spellid].name);
|
||||
}
|
||||
|
||||
@ -756,6 +756,8 @@ void CArtHandler::equipArtifact(std::map<ui16, CArtifact*> &artifWorn, ui16 slot
|
||||
{
|
||||
unequipArtifact(artifWorn, slotID);
|
||||
|
||||
if (newArtifact) //false when artifact is NULL -> slot set to empty
|
||||
{
|
||||
const CArtifact &artifact = *newArtifact;
|
||||
|
||||
// Add artifact.
|
||||
@ -787,6 +789,7 @@ void CArtHandler::equipArtifact(std::map<ui16, CArtifact*> &artifWorn, ui16 slot
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -588,7 +588,7 @@ DLL_EXPORT void NewObject::applyGs( CGameState *gs )
|
||||
}
|
||||
DLL_EXPORT void NewArtifact::applyGs( CGameState *gs )
|
||||
{
|
||||
CArtifact * art;
|
||||
IModableArt * art;
|
||||
|
||||
std::map<ui32,ui8>::iterator itr = VLC->arth->modableArtifacts.find(artid);
|
||||
switch (itr->second)
|
||||
@ -605,11 +605,11 @@ DLL_EXPORT void NewArtifact::applyGs( CGameState *gs )
|
||||
default:
|
||||
tlog1<<"unhandled customizable artifact!\n";
|
||||
};
|
||||
*art = *(VLC->arth->artifacts[artid]); //copy properties
|
||||
static_cast<IModableArt*>(art)->ID = gs->map->artInstances.size();
|
||||
*art = *static_cast<IModableArt*>(VLC->arth->artifacts[artid]); //copy properties
|
||||
art->ID = gs->map->artInstances.size();
|
||||
art->SetProperty (value); //init scroll, banner, commander art
|
||||
art->Init(); //set bonuses for new instance
|
||||
gs->map->artInstances.push_back(static_cast<IModableArt*>(art));
|
||||
gs->map->artInstances.push_back(art);
|
||||
}
|
||||
|
||||
DLL_EXPORT void SetAvailableArtifacts::applyGs( CGameState *gs )
|
||||
|
@ -289,7 +289,7 @@ struct DLL_EXPORT Mapa : public CMapHeader
|
||||
{
|
||||
h & static_cast<CMapHeader&>(*this);
|
||||
h & rumors & allowedSpell & allowedAbilities & allowedArtifact & allowedHeroes & events & grailPos;
|
||||
h & monsters & heroesToBeat & artInstances; //hoprfully serialization is now automagical?
|
||||
h & monsters & heroesToBeat & artInstances; //hopefully serialization is now automagical?
|
||||
|
||||
//TODO: viccondetails
|
||||
if(h.saving)
|
||||
|
Loading…
x
Reference in New Issue
Block a user