2009-04-16 14:14:13 +03:00
|
|
|
#ifndef __CDEFOBJINFOHANDLER_H__
|
|
|
|
#define __CDEFOBJINFOHANDLER_H__
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include "../global.h"
|
|
|
|
|
2009-04-15 17:03:31 +03:00
|
|
|
/*
|
|
|
|
* CDefObjInfoHandler.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
2009-04-16 14:14:13 +03:00
|
|
|
*/
|
|
|
|
|
2009-06-17 19:46:16 +03:00
|
|
|
class CDefEssential;
|
2009-04-16 14:14:13 +03:00
|
|
|
class CLodHandler;
|
|
|
|
class DLL_EXPORT CGDefInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string name;
|
|
|
|
|
|
|
|
ui8 visitMap[6];
|
|
|
|
ui8 blockMap[6];
|
2009-12-22 23:53:50 +02:00
|
|
|
ui8 coverageMap[6], shadowCoverage[6]; //to determine which tiles are covered by picture of this object
|
2009-04-16 14:14:13 +03:00
|
|
|
ui8 visitDir; //directions from which object can be entered, format same as for moveDir in CGHeroInstance(but 0 - 7)
|
|
|
|
si32 id, subid; //of object described by this defInfo
|
|
|
|
si32 terrainAllowed, //on which terrain it is possible to place object
|
|
|
|
terrainMenu; //in which menus in map editor object will be showed
|
|
|
|
si32 width, height; //tiles
|
|
|
|
si32 type; //(0- ground, 1- towns, 2-creatures, 3- heroes, 4-artifacts, 5- resources)
|
2009-06-17 19:46:16 +03:00
|
|
|
CDefEssential * handler;
|
2009-04-16 14:14:13 +03:00
|
|
|
si32 printPriority;
|
2009-07-25 19:35:47 +03:00
|
|
|
bool isVisitable() const;
|
|
|
|
bool operator<(const CGDefInfo& por) const
|
2009-04-16 14:14:13 +03:00
|
|
|
{
|
|
|
|
if(id!=por.id)
|
|
|
|
return id<por.id;
|
|
|
|
else
|
|
|
|
return subid<por.subid;
|
|
|
|
}
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2010-07-31 16:55:05 +03:00
|
|
|
h & name & visitMap & blockMap & visitDir & id & subid &terrainAllowed
|
2009-12-22 23:53:50 +02:00
|
|
|
& terrainMenu & width & height & type & printPriority & coverageMap & shadowCoverage;
|
2009-04-16 14:14:13 +03:00
|
|
|
}
|
|
|
|
CGDefInfo();
|
2010-08-01 21:12:53 +03:00
|
|
|
void fetchInfoFromMSK();
|
2009-04-16 14:14:13 +03:00
|
|
|
};
|
|
|
|
class DLL_EXPORT CDefObjInfoHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::map<int,std::map<int,CGDefInfo*> > gobjs;
|
|
|
|
std::map<int,CGDefInfo*> castles;
|
|
|
|
|
|
|
|
void load();
|
|
|
|
~CDefObjInfoHandler();
|
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & gobjs;
|
2010-08-01 17:04:48 +03:00
|
|
|
h & castles;
|
2009-04-16 14:14:13 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __CDEFOBJINFOHANDLER_H__
|