mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-22 22:13:35 +02:00
Move CompoundMapObjectID to separate file
This commit is contained in:
parent
e89649ec1c
commit
9591ce1ab4
@ -13,6 +13,7 @@
|
||||
#include "../../lib/VCMI_Lib.h"
|
||||
#include "../../lib/CCreatureHandler.h"
|
||||
#include "../../lib/CHeroHandler.h"
|
||||
#include "../../lib/mapObjects/CompoundMapObjectID.h"
|
||||
#include "../../lib/mapObjectConstructors/AObjectTypeHandler.h"
|
||||
#include "../../lib/mapObjects/CGHeroInstance.h"
|
||||
#include "../../lib/mapObjects/CGTownInstance.h"
|
||||
|
@ -502,6 +502,7 @@ set(lib_MAIN_HEADERS
|
||||
mapObjects/IObjectInterface.h
|
||||
mapObjects/MapObjects.h
|
||||
mapObjects/MiscObjects.h
|
||||
mapObjects/CompoundMapObjectID.h
|
||||
mapObjects/ObjectTemplate.h
|
||||
mapObjects/ObstacleSetHandler.h
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../constants/EntityIdentifiers.h"
|
||||
#include "../mapObjects/CompoundMapObjectID.h"
|
||||
#include "../IHandlerBase.h"
|
||||
#include "../json/JsonNode.h"
|
||||
|
||||
@ -19,27 +19,6 @@ class AObjectTypeHandler;
|
||||
class ObjectTemplate;
|
||||
struct SObjectSounds;
|
||||
|
||||
struct DLL_LINKAGE CompoundMapObjectID
|
||||
{
|
||||
si32 primaryID;
|
||||
si32 secondaryID;
|
||||
|
||||
CompoundMapObjectID(si32 primID, si32 secID) : primaryID(primID), secondaryID(secID) {};
|
||||
|
||||
bool operator<(const CompoundMapObjectID& other) const
|
||||
{
|
||||
if(this->primaryID != other.primaryID)
|
||||
return this->primaryID < other.primaryID;
|
||||
else
|
||||
return this->secondaryID < other.secondaryID;
|
||||
}
|
||||
|
||||
bool operator==(const CompoundMapObjectID& other) const
|
||||
{
|
||||
return (this->primaryID == other.primaryID) && (this->secondaryID == other.secondaryID);
|
||||
}
|
||||
};
|
||||
|
||||
class CGObjectInstance;
|
||||
|
||||
using TObjectTypeHandler = std::shared_ptr<AObjectTypeHandler>;
|
||||
|
37
lib/mapObjects/CompoundMapObjectID.h
Normal file
37
lib/mapObjects/CompoundMapObjectID.h
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* CompoundMapObjectID.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
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../constants/EntityIdentifiers.h"
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
struct DLL_LINKAGE CompoundMapObjectID
|
||||
{
|
||||
si32 primaryID;
|
||||
si32 secondaryID;
|
||||
|
||||
CompoundMapObjectID(si32 primID, si32 secID) : primaryID(primID), secondaryID(secID) {};
|
||||
|
||||
bool operator<(const CompoundMapObjectID& other) const
|
||||
{
|
||||
if(this->primaryID != other.primaryID)
|
||||
return this->primaryID < other.primaryID;
|
||||
else
|
||||
return this->secondaryID < other.secondaryID;
|
||||
}
|
||||
|
||||
bool operator==(const CompoundMapObjectID& other) const
|
||||
{
|
||||
return (this->primaryID == other.primaryID) && (this->secondaryID == other.secondaryID);
|
||||
}
|
||||
};
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
@ -508,6 +508,11 @@ bool ObjectTemplate::canBePlacedAt(TerrainId terrainID) const
|
||||
return vstd::contains(allowedTerrains, terrainID);
|
||||
}
|
||||
|
||||
CompoundMapObjectID ObjectTemplate::getCompoundID() const
|
||||
{
|
||||
return CompoundMapObjectID(id, subid);
|
||||
}
|
||||
|
||||
void ObjectTemplate::recalculate()
|
||||
{
|
||||
calculateWidth();
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "../int3.h"
|
||||
#include "../filesystem/ResourcePath.h"
|
||||
#include "../serializer/Serializeable.h"
|
||||
#include "../mapObjects/CompoundMapObjectID.h"
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
@ -47,7 +48,6 @@ public:
|
||||
MapObjectID id;
|
||||
MapObjectSubID subid;
|
||||
|
||||
// TODO: get compound id
|
||||
/// print priority, objects with higher priority will be print first, below everything else
|
||||
si32 printPriority;
|
||||
/// animation file that should be used to display object
|
||||
@ -124,6 +124,8 @@ public:
|
||||
// Checks if object can be placed on specific terrain
|
||||
bool canBePlacedAt(TerrainId terrain) const;
|
||||
|
||||
CompoundMapObjectID getCompoundID() const;
|
||||
|
||||
ObjectTemplate();
|
||||
|
||||
void readTxt(CLegacyConfigParser & parser);
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../constants/EntityIdentifiers.h"
|
||||
#include "../mapObjects/CompoundMapObjectID.h"
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "../mapObjects/ObjectTemplate.h"
|
||||
#include "../constants/EntityIdentifiers.h"
|
||||
#include "../mapObjects/CompoundMapObjectID.h"
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
|
@ -21,7 +21,6 @@ class ObjectManager;
|
||||
class RmgMap;
|
||||
class CMapGenerator;
|
||||
class ObjectConfig;
|
||||
struct CompoundMapObjectID;
|
||||
|
||||
class TreasurePlacer: public Modificator
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user