mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Fixed crash on sieges.
This commit is contained in:
parent
4140711b6d
commit
5665ec1a0d
@ -7,7 +7,7 @@ GENERAL:
|
|||||||
- vcmimelkor - player loses
|
- vcmimelkor - player loses
|
||||||
|
|
||||||
ADVENTURE MAP:
|
ADVENTURE MAP:
|
||||||
* Neutral armies growth implemented (%10 weekly)
|
* Neutral armies growth implemented (10% weekly)
|
||||||
* Power rating of neutral stacks
|
* Power rating of neutral stacks
|
||||||
* Favourable Winds reduce sailing cost
|
* Favourable Winds reduce sailing cost
|
||||||
|
|
||||||
|
@ -32,7 +32,24 @@ CGDefInfo::CGDefInfo()
|
|||||||
{
|
{
|
||||||
handler = NULL;
|
handler = NULL;
|
||||||
visitDir = (8|16|32|64|128); //4,5,6,7,8 - any not-from-up direction
|
visitDir = (8|16|32|64|128); //4,5,6,7,8 - any not-from-up direction
|
||||||
|
|
||||||
|
width = height = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGDefInfo::fetchInfoFromMSK()
|
||||||
|
{
|
||||||
|
std::string nameCopy = name;
|
||||||
|
std::string msk = spriteh->getTextFile(nameCopy.replace( nameCopy.size()-4, 4, ".MSK" ));
|
||||||
|
|
||||||
|
width = msk[0];
|
||||||
|
height = msk[1];
|
||||||
|
for(int i=0; i<6; ++i)
|
||||||
|
{
|
||||||
|
coverageMap[i] = msk[i+2];
|
||||||
|
shadowCoverage[i] = msk[i+8];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CDefObjInfoHandler::load()
|
void CDefObjInfoHandler::load()
|
||||||
{
|
{
|
||||||
VLC->dobjinfo = this;
|
VLC->dobjinfo = this;
|
||||||
@ -102,13 +119,7 @@ void CDefObjInfoHandler::load()
|
|||||||
inp >> nobj->printPriority;
|
inp >> nobj->printPriority;
|
||||||
|
|
||||||
//coverageMap calculating
|
//coverageMap calculating
|
||||||
std::string nameCopy = nobj->name;
|
nobj->fetchInfoFromMSK();
|
||||||
std::string msk = spriteh->getTextFile(nameCopy.replace( nameCopy.size()-4, 4, ".MSK" ));
|
|
||||||
for(int i=0; i<6; ++i)
|
|
||||||
{
|
|
||||||
nobj->coverageMap[i] = msk[i+2];
|
|
||||||
nobj->shadowCoverage[i] = msk[i+8];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gobjs[nobj->id][nobj->subid] = nobj;
|
gobjs[nobj->id][nobj->subid] = nobj;
|
||||||
|
@ -46,6 +46,7 @@ public:
|
|||||||
& terrainMenu & width & height & type & printPriority & coverageMap & shadowCoverage;
|
& terrainMenu & width & height & type & printPriority & coverageMap & shadowCoverage;
|
||||||
}
|
}
|
||||||
CGDefInfo();
|
CGDefInfo();
|
||||||
|
void fetchInfoFromMSK();
|
||||||
};
|
};
|
||||||
class DLL_EXPORT CDefObjInfoHandler
|
class DLL_EXPORT CDefObjInfoHandler
|
||||||
{
|
{
|
||||||
|
11
lib/map.cpp
11
lib/map.cpp
@ -1325,16 +1325,7 @@ void Mapa::readDefInfo( const unsigned char * bufor, int &i)
|
|||||||
std::memset(vinya->blockMap,255,6);
|
std::memset(vinya->blockMap,255,6);
|
||||||
|
|
||||||
//calculating coverageMap
|
//calculating coverageMap
|
||||||
std::string nameCopy = vinya->name;
|
vinya->fetchInfoFromMSK();
|
||||||
std::string msk = spriteh->getTextFile(nameCopy.replace( nameCopy.size()-4, 4, ".MSK" ));
|
|
||||||
|
|
||||||
vinya->width = msk[0];
|
|
||||||
vinya->height = msk[1];
|
|
||||||
for(int i=0; i<6; ++i)
|
|
||||||
{
|
|
||||||
vinya->coverageMap[i] = msk[i+2];
|
|
||||||
vinya->shadowCoverage[i] = msk[i+8];
|
|
||||||
}
|
|
||||||
|
|
||||||
defy.push_back(vinya); // add this def to the vector
|
defy.push_back(vinya); // add this def to the vector
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user