1
0
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:
Michał W. Urbańczyk
2009-02-01 23:56:45 +00:00
parent 5fe2dc32f8
commit ccaf244a54
3 changed files with 12 additions and 1 deletions

View File

@ -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
View File

@ -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)

View File

@ -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)
{