Pol  Revision:cb584c9
Pol::Core::ResourceDef Class Reference

#include <resource.h>

+ Inheritance diagram for Pol::Core::ResourceDef:

Public Member Functions

 ResourceDef (const char *name)
 
void consume (unsigned amount)
 
void counttiles ()
 
virtual size_t estimateSize () const POL_OVERRIDE
 
bool findmarker (xcoord x, ycoord y, Realms::Realm *realm, unsigned int objtype)
 
void produce (unsigned amount)
 
void read_config (Clib::ConfigElem &elem)
 
void read_data (Clib::ConfigElem &elem)
 
void regenerate (time_t now)
 
void write (Clib::StreamWriter &sw) const
 
- Public Member Functions inherited from Pol::Core::RegionGroup< ResourceRegion >
 RegionGroup (const char *name)
 
virtual ResourceRegiongetregion (xcoord x, ycoord y, Realms::Realm *realm)
 
virtual ResourceRegiongetregion (const std::string &regionname)
 
- Public Member Functions inherited from Pol::Core::RegionGroupBase
 RegionGroupBase (const char *name)
 
virtual ~RegionGroupBase ()
 
void create_bgnd_region (Clib::ConfigElem &elem)
 
const std::string & name () const
 
void read_region (Clib::ConfigElem &elem)
 

Private Attributes

int current_units_
 
unsigned int initial_units_
 
std::set< unsigned short > landtiles_
 
std::set< unsigned short > tiles_
 

Additional Inherited Members

- Protected Types inherited from Pol::Core::RegionGroupBase
typedef std::map< Realms::Realm *, RegionId ** > RegionRealms
 
- Protected Member Functions inherited from Pol::Core::RegionGroup< ResourceRegion >
virtual Regioncreate_region (Clib::ConfigElem &elem, RegionId id) const POL_OVERRIDE
 
- Protected Member Functions inherited from Pol::Core::RegionGroupBase
Regiongetregion_byloc (xcoord x, ycoord y, Realms::Realm *realm)
 
Regiongetregion_byname (const std::string &regionname)
 
- Protected Attributes inherited from Pol::Core::RegionGroupBase
RegionRealms regionrealms
 
std::vector< Region * > regions_
 

Detailed Description

Definition at line 100 of file resource.h.

Constructor & Destructor Documentation

Pol::Core::ResourceDef::ResourceDef ( const char *  name)
explicit

Definition at line 141 of file resource.cpp.

Referenced by Pol::Core::read_resource_cfg().

Member Function Documentation

void Pol::Core::ResourceDef::consume ( unsigned  amount)

Definition at line 228 of file resource.cpp.

References current_units_.

size_t Pol::Core::ResourceDef::estimateSize ( ) const
virtual

Reimplemented from Pol::Core::RegionGroupBase.

Definition at line 445 of file resource.cpp.

References Pol::Core::RegionGroupBase::estimateSize(), landtiles_, and tiles_.

bool Pol::Core::ResourceDef::findmarker ( xcoord  x,
ycoord  y,
Realms::Realm realm,
unsigned int  objtype 
)
void Pol::Core::ResourceDef::produce ( unsigned  amount)

Definition at line 233 of file resource.cpp.

References current_units_.

void Pol::Core::ResourceDef::read_config ( Clib::ConfigElem elem)
void Pol::Core::ResourceDef::read_data ( Clib::ConfigElem elem)

Definition at line 165 of file resource.cpp.

References current_units_, and Pol::Clib::ConfigElem::remove_ulong().

Referenced by Pol::Core::read_global_data().

void Pol::Core::ResourceDef::regenerate ( time_t  now)
void Pol::Core::ResourceDef::write ( Clib::StreamWriter sw) const

Member Data Documentation

int Pol::Core::ResourceDef::current_units_
private

Definition at line 119 of file resource.h.

Referenced by consume(), produce(), read_config(), read_data(), and write().

unsigned int Pol::Core::ResourceDef::initial_units_
private

Definition at line 118 of file resource.h.

Referenced by read_config().

std::set<unsigned short> Pol::Core::ResourceDef::landtiles_
private

Definition at line 120 of file resource.h.

Referenced by counttiles(), estimateSize(), findmarker(), and read_config().

std::set<unsigned short> Pol::Core::ResourceDef::tiles_
private

Definition at line 121 of file resource.h.

Referenced by estimateSize(), findmarker(), and read_config().


The documentation for this class was generated from the following files: