Pol  Revision:cb584c9
Pol::Core::ResourceRegion Class Reference

#include <resource.h>

+ Inheritance diagram for Pol::Core::ResourceRegion:

Public Member Functions

 ResourceRegion (Clib::ConfigElem &elem, RegionId id)
 Resource Management. More...
 
virtual size_t estimateSize () const POL_OVERRIDE
 
Bscript::BObjectImpget_harvest_difficulty (xcoord x, ycoord y, Realms::Realm *realm)
 [1] Harvest Difficulty More...
 
Bscript::BObjectImpharvest_resource (xcoord x, ycoord y, int b, int n)
 
void read_data (Clib::ConfigElem &elem)
 
void regenerate (time_t now)
 
void write (Clib::StreamWriter &sw, const std::string &resource_name) const
 
- Public Member Functions inherited from Pol::Core::Region
Bscript::BObjectImpget_region_string (const std::string &propname)
 
const std::string & name () const
 
RegionId regionid () const
 

Public Attributes

unsigned int tilecount_
 

Private Types

typedef std::map< unsigned int, unsigned short > Depletions
 

Private Attributes

unsigned int capacity_
 
Depletions depletions_
 
time_t last_regen_
 
const unsigned int seconds_per_regrow_
 
unsigned int units_
 
const unsigned int units_per_area_
 

Friends

class ResourceDef
 

Additional Inherited Members

- Protected Member Functions inherited from Pol::Core::Region
 Region (Clib::ConfigElem &elem, RegionId id)
 
virtual ~Region ()
 
void read_custom_config (Clib::ConfigElem &elem)
 
- Protected Attributes inherited from Pol::Core::Region
std::string name_
 
PropertyList proplist_
 
RegionId regionid_
 

Detailed Description

Definition at line 64 of file resource.h.

Member Typedef Documentation

typedef std::map<unsigned int, unsigned short> Pol::Core::ResourceRegion::Depletions
private

Definition at line 87 of file resource.h.

Constructor & Destructor Documentation

Pol::Core::ResourceRegion::ResourceRegion ( Clib::ConfigElem elem,
RegionId  id 
)
explicit

Resource Management.

Definition at line 33 of file resource.cpp.

Member Function Documentation

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

Reimplemented from Pol::Core::Region.

Definition at line 469 of file resource.cpp.

References Pol::Core::Region::estimateSize().

Bscript::BObjectImp * Pol::Core::ResourceRegion::get_harvest_difficulty ( xcoord  x,
ycoord  y,
Realms::Realm realm 
)

[1] Harvest Difficulty

Definition at line 56 of file resource.cpp.

References depletions_, passert, Pol::Clib::random_int(), and units_per_area_.

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

Bscript::BObjectImp * Pol::Core::ResourceRegion::harvest_resource ( xcoord  x,
ycoord  y,
int  b,
int  n 
)

Definition at line 79 of file resource.cpp.

References depletions_, passert, and units_per_area_.

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

void Pol::Core::ResourceRegion::read_data ( Clib::ConfigElem elem)

Definition at line 48 of file resource.cpp.

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

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

void Pol::Core::ResourceRegion::regenerate ( time_t  now)
void Pol::Core::ResourceRegion::write ( Clib::StreamWriter sw,
const std::string &  resource_name 
) const

Definition at line 457 of file resource.cpp.

References Pol::Core::RegionGroupBase::name_.

Referenced by Pol::Core::ResourceDef::write().

Friends And Related Function Documentation

friend class ResourceDef
friend

Definition at line 79 of file resource.h.

Member Data Documentation

unsigned int Pol::Core::ResourceRegion::capacity_
private

Definition at line 95 of file resource.h.

Depletions Pol::Core::ResourceRegion::depletions_
private

Definition at line 88 of file resource.h.

Referenced by get_harvest_difficulty(), harvest_resource(), and regenerate().

time_t Pol::Core::ResourceRegion::last_regen_
private

Definition at line 89 of file resource.h.

Referenced by regenerate().

const unsigned int Pol::Core::ResourceRegion::seconds_per_regrow_
private

Definition at line 86 of file resource.h.

Referenced by regenerate().

unsigned int Pol::Core::ResourceRegion::tilecount_

Definition at line 78 of file resource.h.

Referenced by Pol::Core::ResourceDef::counttiles().

unsigned int Pol::Core::ResourceRegion::units_
private

Definition at line 96 of file resource.h.

Referenced by read_data().

const unsigned int Pol::Core::ResourceRegion::units_per_area_
private

Definition at line 85 of file resource.h.

Referenced by get_harvest_difficulty(), harvest_resource(), and regenerate().


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