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
|
||||
|
||||
ADVENTURE MAP:
|
||||
* Neutral armies growth implemented (%10 weekly)
|
||||
* Neutral armies growth implemented (10% weekly)
|
||||
* Power rating of neutral stacks
|
||||
* Favourable Winds reduce sailing cost
|
||||
|
||||
|
@ -32,7 +32,24 @@ CGDefInfo::CGDefInfo()
|
||||
{
|
||||
handler = NULL;
|
||||
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()
|
||||
{
|
||||
VLC->dobjinfo = this;
|
||||
@ -102,13 +119,7 @@ void CDefObjInfoHandler::load()
|
||||
inp >> nobj->printPriority;
|
||||
|
||||
//coverageMap calculating
|
||||
std::string nameCopy = nobj->name;
|
||||
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];
|
||||
}
|
||||
nobj->fetchInfoFromMSK();
|
||||
|
||||
|
||||
gobjs[nobj->id][nobj->subid] = nobj;
|
||||
|
@ -46,6 +46,7 @@ public:
|
||||
& terrainMenu & width & height & type & printPriority & coverageMap & shadowCoverage;
|
||||
}
|
||||
CGDefInfo();
|
||||
void fetchInfoFromMSK();
|
||||
};
|
||||
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);
|
||||
|
||||
//calculating coverageMap
|
||||
std::string nameCopy = vinya->name;
|
||||
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];
|
||||
}
|
||||
vinya->fetchInfoFromMSK();
|
||||
|
||||
defy.push_back(vinya); // add this def to the vector
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user