mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-21 12:06:49 +02:00
* [bugfix] naprawa crashbuga przy wczytywaniu warunków porażki
* [bugfix] naprawa crashbuga przy zczytywaniu bohatera z portretem * [bugfix] naprawa crashbuga przy zczytywaniu bohatera z wojskiem * [bugfix] naprawa crashbuga przy zczytywaniu zdarzenia ze straznikami * przełącznik w CMT decydujący czy ma wczytać mapę o ustalonej nazwie, czy też tę wybraną * logi przy zczytywaniu oiektów, żeby widać bylo gdzie się psuje - jak wszystkie nie-ermowe mapy będą działać to skasuj * zamykanie pliku z mapą
This commit is contained in:
parent
9f7fe32284
commit
c1c15e9a1e
@ -256,17 +256,20 @@ void CAmbarCendamo::deh3m()
|
|||||||
map.lossCondition.castlePos.x=bufor[i++];
|
map.lossCondition.castlePos.x=bufor[i++];
|
||||||
map.lossCondition.castlePos.y=bufor[i++];
|
map.lossCondition.castlePos.y=bufor[i++];
|
||||||
map.lossCondition.castlePos.z=bufor[i++];
|
map.lossCondition.castlePos.z=bufor[i++];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case lossHero:
|
case lossHero:
|
||||||
{
|
{
|
||||||
map.lossCondition.heroPos.x=bufor[i++];
|
map.lossCondition.heroPos.x=bufor[i++];
|
||||||
map.lossCondition.heroPos.y=bufor[i++];
|
map.lossCondition.heroPos.y=bufor[i++];
|
||||||
map.lossCondition.heroPos.z=bufor[i++];
|
map.lossCondition.heroPos.z=bufor[i++];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case timeExpires:
|
case timeExpires:
|
||||||
{
|
{
|
||||||
map.lossCondition.timeLimit = readNormalNr(i++,2);
|
map.lossCondition.timeLimit = readNormalNr(i++,2);
|
||||||
i++;
|
i++;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
map.howManyTeams=bufor[i++]; //read number of teams
|
map.howManyTeams=bufor[i++]; //read number of teams
|
||||||
@ -310,8 +313,8 @@ void CAmbarCendamo::deh3m()
|
|||||||
CGameInfo::mainObj->arth->artifacts[(i-ist)*8+yy].isAllowed = false;
|
CGameInfo::mainObj->arth->artifacts[(i-ist)*8+yy].isAllowed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}//allowed artifacts have been read
|
||||||
//allowed artifacts have been read
|
|
||||||
//reading allowed spells (9 bytes)
|
//reading allowed spells (9 bytes)
|
||||||
ist=i; //starting i for loop
|
ist=i; //starting i for loop
|
||||||
for(i; i<ist+9; ++i)
|
for(i; i<ist+9; ++i)
|
||||||
@ -470,13 +473,17 @@ void CAmbarCendamo::deh3m()
|
|||||||
int howManyObjs = readNormalNr(i, 4); i+=4;
|
int howManyObjs = readNormalNr(i, 4); i+=4;
|
||||||
for(int ww=0; ww<howManyObjs; ++ww) //comment this line to turn loading objects off
|
for(int ww=0; ww<howManyObjs; ++ww) //comment this line to turn loading objects off
|
||||||
{
|
{
|
||||||
//std::cout << "object nr "<<ww<<std::endl;
|
std::cout << "object nr "<<ww<<"\ti= "<<i<<std::endl;
|
||||||
CObjectInstance nobj; //we will read this object
|
CObjectInstance nobj; //we will read this object
|
||||||
nobj.id = CGameInfo::mainObj->objh->objInstances.size();
|
nobj.id = CGameInfo::mainObj->objh->objInstances.size();
|
||||||
nobj.x = bufor[i++];
|
nobj.x = bufor[i++];
|
||||||
nobj.y = bufor[i++];
|
nobj.y = bufor[i++];
|
||||||
nobj.z = bufor[i++];
|
nobj.z = bufor[i++];
|
||||||
nobj.defNumber = readNormalNr(i, 4); i+=4;
|
nobj.defNumber = readNormalNr(i, 4); i+=4;
|
||||||
|
|
||||||
|
if (((nobj.x==0)&&(nobj.y==0)) || nobj.x>map.width || nobj.y>map.height || nobj.z>1 || nobj.defNumber>map.defy.size())
|
||||||
|
std::cout << "Alarm!!! Obiekt "<<ww<<" jest kopniety (lub wystaje poza mape)\n";
|
||||||
|
|
||||||
i+=5;
|
i+=5;
|
||||||
unsigned char buff [30];
|
unsigned char buff [30];
|
||||||
for(int ccc=0; ccc<30; ++ccc)
|
for(int ccc=0; ccc<30; ++ccc)
|
||||||
@ -508,7 +515,7 @@ void CAmbarCendamo::deh3m()
|
|||||||
spec->areGuarders = bufor[i]; ++i;
|
spec->areGuarders = bufor[i]; ++i;
|
||||||
if(spec->areGuarders)
|
if(spec->areGuarders)
|
||||||
{
|
{
|
||||||
spec->guarders = readCreatureSet(i); i+=32;
|
spec->guarders = readCreatureSet(i); i+=28;
|
||||||
}
|
}
|
||||||
i+=4;
|
i+=4;
|
||||||
}
|
}
|
||||||
@ -586,7 +593,9 @@ void CAmbarCendamo::deh3m()
|
|||||||
spec->experience = readNormalNr(i); i+=4;
|
spec->experience = readNormalNr(i); i+=4;
|
||||||
}
|
}
|
||||||
else spec->experience = 0;
|
else spec->experience = 0;
|
||||||
++i; //TODO - czy tu na pewno nie ma istotnej informacji?
|
bool portrait=bufor[i]; ++i;
|
||||||
|
if (portrait)
|
||||||
|
i++; //TODO read portrait nr, save, open
|
||||||
bool nonstandardAbilities = bufor[i]; ++i; //true if hero has specified abilities
|
bool nonstandardAbilities = bufor[i]; ++i; //true if hero has specified abilities
|
||||||
if(nonstandardAbilities)
|
if(nonstandardAbilities)
|
||||||
{
|
{
|
||||||
@ -601,7 +610,7 @@ void CAmbarCendamo::deh3m()
|
|||||||
spec->standardGarrison = standGarrison;
|
spec->standardGarrison = standGarrison;
|
||||||
if(standGarrison)
|
if(standGarrison)
|
||||||
{
|
{
|
||||||
spec->garrison = readCreatureSet(i); i+=7;
|
spec->garrison = readCreatureSet(i); i+=28; //4 bytes per slot
|
||||||
}
|
}
|
||||||
bool form = bufor[i]; ++i; //formation
|
bool form = bufor[i]; ++i; //formation
|
||||||
spec->garrison.formation = form;
|
spec->garrison.formation = form;
|
||||||
@ -752,7 +761,7 @@ void CAmbarCendamo::deh3m()
|
|||||||
//spells
|
//spells
|
||||||
bool areSpells = bufor[i]; ++i;
|
bool areSpells = bufor[i]; ++i;
|
||||||
|
|
||||||
if(areSpells) //TODO: sprawdzić
|
if(areSpells) //TODO: sprawdziæ //seems to be ok - tow
|
||||||
{
|
{
|
||||||
int ist = i;
|
int ist = i;
|
||||||
for(i; i<ist+9; ++i)
|
for(i; i<ist+9; ++i)
|
||||||
|
@ -9,6 +9,7 @@ enum EartClass {SartClass=0, TartClass, NartClass, JartClass, RartClass}; //arti
|
|||||||
class CArtifact //container for artifacts
|
class CArtifact //container for artifacts
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
bool isAllowed; //true if we can use this artifact (map information)
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string description;
|
std::string description;
|
||||||
std::string desc2;
|
std::string desc2;
|
||||||
@ -17,7 +18,6 @@ public:
|
|||||||
bool spellBook, warMachine1, warMachine2, warMachine3, warMachine4, misc1, misc2, misc3, misc4, misc5, feet, lRing, rRing, torso, lHand, rHand, neck, shoulders, head;
|
bool spellBook, warMachine1, warMachine2, warMachine3, warMachine4, misc1, misc2, misc3, misc4, misc5, feet, lRing, rRing, torso, lHand, rHand, neck, shoulders, head;
|
||||||
EartClass aClass;
|
EartClass aClass;
|
||||||
int number;
|
int number;
|
||||||
bool isAllowed; //true if we can use this artifact (map information)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CArtHandler //handles artifacts
|
class CArtHandler //handles artifacts
|
||||||
|
7
CMT.cpp
7
CMT.cpp
@ -325,13 +325,18 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||||||
{
|
{
|
||||||
mapstr+=pom;
|
mapstr+=pom;
|
||||||
}
|
}
|
||||||
|
gzclose(map);
|
||||||
unsigned char *initTable = new unsigned char[mapstr.size()];
|
unsigned char *initTable = new unsigned char[mapstr.size()];
|
||||||
for(int ss=0; ss<mapstr.size(); ++ss)
|
for(int ss=0; ss<mapstr.size(); ++ss)
|
||||||
{
|
{
|
||||||
initTable[ss] = mapstr[ss];
|
initTable[ss] = mapstr[ss];
|
||||||
}
|
}
|
||||||
|
#define CHOOSE
|
||||||
|
#ifdef CHOOSE
|
||||||
CAmbarCendamo * ac = new CAmbarCendamo(initTable); //4gryf
|
CAmbarCendamo * ac = new CAmbarCendamo(initTable); //4gryf
|
||||||
//CAmbarCendamo * ac = new CAmbarCendamo("4gryf"); //4gryf
|
#else
|
||||||
|
CAmbarCendamo * ac = new CAmbarCendamo("5gryf"); //4gryf
|
||||||
|
#endif
|
||||||
CMapHeader * mmhh = new CMapHeader(ac->bufor); //czytanie nag³ówka
|
CMapHeader * mmhh = new CMapHeader(ac->bufor); //czytanie nag³ówka
|
||||||
cgi->ac = ac;
|
cgi->ac = ac;
|
||||||
THC std::cout<<"Reading file: "<<tmh.getDif()<<std::endl;
|
THC std::cout<<"Reading file: "<<tmh.getDif()<<std::endl;
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
class CSpell
|
class CSpell
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
bool isAllowed; //true if we can use this spell (depends on map)
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string abbName; //abbreviated name
|
std::string abbName; //abbreviated name
|
||||||
int level;
|
int level;
|
||||||
@ -28,7 +29,6 @@ public:
|
|||||||
std::string noneTip, basTip, advTip, expTip; //descriptions of spell
|
std::string noneTip, basTip, advTip, expTip; //descriptions of spell
|
||||||
std::string attributes; //reference only attributes
|
std::string attributes; //reference only attributes
|
||||||
bool combatSpell; //is this spell combat (true) or adventure (false)
|
bool combatSpell; //is this spell combat (true) or adventure (false)
|
||||||
bool isAllowed; //true if we can use this spell (depends on map)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CSpellHandler
|
class CSpellHandler
|
||||||
|
2
nodrze.h
2
nodrze.h
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
//don't look here, it's a horrible, partially working implementation of RB trees
|
//don't look here, it's a horrible, partially working implementation of RB trees
|
||||||
|
|
||||||
|
//ignore comment above, it is simply TowDragon's envy. Everything (without removing) is working fine
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user