mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
Fixed save/load maps with removed objects. Fixed spell scroll handling (really).
This commit is contained in:
3
map.cpp
3
map.cpp
@ -1585,8 +1585,9 @@ void Mapa::readObjects( unsigned char * bufor, int &i)
|
||||
{
|
||||
art->army = readCreatureSet(bufor,i,7,(version>RoE));
|
||||
}
|
||||
i+=4;
|
||||
}
|
||||
if(areSettings || defInfo->id==93)
|
||||
if(defInfo->id==93)
|
||||
{
|
||||
art->spell = readNormalNr(bufor,i);
|
||||
i+=4;
|
||||
|
9
map.h
9
map.h
@ -402,8 +402,16 @@ struct DLL_EXPORT Mapa : public CMapHeader
|
||||
for(int i=0; i<objects.size(); i++)
|
||||
{
|
||||
CGObjectInstance *&obj = objects[i];
|
||||
ui8 exists = (obj!=NULL);
|
||||
ui32 hlp;
|
||||
si32 shlp;
|
||||
h & exists;
|
||||
if(!exists)
|
||||
{
|
||||
if(!h.saving)
|
||||
obj = 0;
|
||||
continue;
|
||||
}
|
||||
h & (h.saving ? (hlp=obj->ID) : hlp);
|
||||
switch(hlp)
|
||||
{
|
||||
@ -504,6 +512,7 @@ struct DLL_EXPORT Mapa : public CMapHeader
|
||||
|
||||
for(int i=0; i<objects.size(); i++)
|
||||
{
|
||||
if(!objects[i]) continue;
|
||||
if(objects[i]->ID == 34)
|
||||
heroes.push_back(static_cast<CGHeroInstance*>(objects[i]));
|
||||
else if(objects[i]->ID == 98)
|
||||
|
@ -357,6 +357,7 @@ void CMapHandler::initObjectRects()
|
||||
//initializing objects / rects
|
||||
for(size_t f=0; f < map->objects.size(); ++f)
|
||||
{
|
||||
if(!map->objects[f]) continue;
|
||||
if((map->objects[f]->ID==34 && static_cast<CGHeroInstance*>(map->objects[f])->inTownGarrison)
|
||||
|| !map->objects[f]->defInfo)
|
||||
{
|
||||
|
Reference in New Issue
Block a user