2011-12-14 00:23:17 +03:00
# pragma once
2009-04-16 14:14:13 +03:00
2010-12-20 23:22:53 +02:00
# include "../lib/ConstTransitivePtr.h"
2011-07-05 09:14:07 +03:00
# include "ResourceSet.h"
2010-12-20 23:22:53 +02:00
2009-04-15 17:03:31 +03:00
/*
* CBuildingHandler . 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
*/
//enum EbuildingType {NEUTRAL=-1, CASTLE, RAMPART, TOWER, INFERNO, NECROPOLIS, DUNGEON, STRONGHOLD, FORTRESS, CONFLUX};
2011-12-14 00:23:17 +03:00
class DLL_LINKAGE CBuilding //a typical building encountered in every castle ;]
2009-04-16 14:14:13 +03:00
{
public :
2009-05-22 02:50:45 +03:00
si32 tid , bid ; //town ID and structure ID
2011-07-05 09:14:07 +03:00
TResources resources ;
2009-04-16 14:14:13 +03:00
std : : string name ;
std : : string description ;
2009-09-27 14:37:15 +03:00
const std : : string & Name ( ) const ;
const std : : string & Description ( ) const ;
2009-04-16 14:14:13 +03:00
template < typename Handler > void serialize ( Handler & h , const int version )
{
h & tid & bid & resources & name & description ;
}
2009-05-22 02:50:45 +03:00
CBuilding ( int TID = - 1 , int BID = - 1 ) ;
2009-04-16 14:14:13 +03:00
} ;
2011-12-14 00:23:17 +03:00
class DLL_LINKAGE CBuildingHandler
2009-04-16 14:14:13 +03:00
{
public :
2012-02-16 20:10:58 +03:00
typedef bmap < int , ConstTransitivePtr < CBuilding > > TBuildingsMap ;
std : : vector < TBuildingsMap > buildings ; ///< vector by castle ID, second the building ID (in ERM-U format)
2010-12-20 23:22:53 +02:00
bmap < int , std : : pair < std : : string , std : : vector < std : : vector < std : : vector < int > > > > > hall ; //map<castle ID, pair<hall bg name, std::vector< std::vector<building id> >[5]> - external vector is the vector of buildings in the row, internal is the list of buildings for the specific slot
2009-04-16 14:14:13 +03:00
void loadBuildings ( ) ; //main loader
2009-05-07 20:20:41 +03:00
~ CBuildingHandler ( ) ; //d-tor
2010-08-03 14:36:52 +03:00
static int campToERMU ( int camp , int townType , std : : set < si32 > builtBuildings ) ;
2009-04-16 14:14:13 +03:00
template < typename Handler > void serialize ( Handler & h , const int version )
{
2010-12-20 23:22:53 +02:00
h & buildings & hall ;
2009-04-16 14:14:13 +03:00
}
} ;