1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

troszku więcej zaczytywania obiektów, może jutro będzie więcej

This commit is contained in:
mateuszb 2007-06-12 20:09:23 +00:00
parent 252252ce6d
commit dde1d09194
2 changed files with 62 additions and 1 deletions

View File

@ -411,7 +411,36 @@ void CAmbarCendamo::deh3m()
nobj.x = bufor[i++];
nobj.y = bufor[i++];
nobj.z = bufor[i++];
nobj.defNumber = bufor[i++]; //TODO - zobaczyć co się dzieje, jak numer określającego defa jest większy niż 255
nobj.defNumber = readNormalNr(i, 4); i+=4;
i+=5;
switch(getDefType(map.defy[nobj.defNumber]))
{
case EDefType::EVENTOBJ_DEF:
{
CEventObjInfo spec;
bool guardMess;
guardMess = bufor[i]; ++i;
if(guardMess)
{
int messLong = readNormalNr(i, 4); i+=4;
if(messLong>0)
{
spec.isMessage = true;
for(int yy=0; yy<messLong; ++yy)
{
spec.message +=bufor[i+yy];
}
i+=messLong;
}
spec.areGuarders = bufor[i]; ++i;
if(spec.areGuarders)
{
//TODO: czytanie potworów w zapisie standardowym, to jest czêsto wykorzystywane
}
}
break;
}
}
//TODO - dokoñczyæ, du¿o do zrobienia - trzeba patrzeæ, co def niesie
}
////objects loaded
@ -475,5 +504,7 @@ EDefType CAmbarCendamo::getDefType(DefInfo &a)
return EDefType::TOWN_DEF;
case 219:
return EDefType::GARRISON_DEF;
default:
return EDefType::TERRAINOBJ_DEF;
}
}

View File

@ -3,11 +3,41 @@
#include <string>
#include <vector>
#include "CCreatureHandler.h"
#include "CArtHandler.h"
#include "CAbilityHandler.h"
#include "CSpellHandler.h"
class CSpecObjInfo //class with object - specific info (eg. different information for creatures and heroes); use inheritance to make object - specific classes
{
};
class CEventObjInfo : public CSpecObjInfo
{
public:
bool areGuarders; //true if there are
CCreatureSet guarders;
bool isMessage; //true if there is a message
std::string message;
unsigned int gainedExp;
int manaDiff; //amount of gained / lost mana
int moraleDiff; //morale modifier
int luckDiff; //luck modifier
int wood, mercury, ore, sulfur, crystal, gems, gold; //gained / lost resources
unsigned int attack; //added attack points
unsigned int defence; //added defence points
unsigned int power; //added power points
unsigned int knowledge; //added knowledge points
std::vector<CAbility> abilities; //gained abilities
std::vector<int> abilityLevels; //levels of gained abilities
std::vector<CArtifact> artifacts; //gained artifacts
std::vector<CSpell> spells; //gained spells
CCreatureSet creatures; //gained creatures
unsigned char availableFor; //players whom this event is available for
bool computerActivate; //true if computre player can activate this event
bool humanActivate; //true if human player can activate this event
};
class CObject //typical object that can be encountered on a map
{
public: