Logo Search packages:      
Sourcecode: widelands version File versions  Download package

Worker Class Reference

#include <worker.h>

Inheritance diagram for Worker:

Bob Carrier

List of all members.


Detailed Description

Worker is the base class for all humans (and actually potential non-humans, too) that belong to a tribe.

Every worker can carry one (item) ware.

Workers can be in one of the following meta states:

Definition at line 38 of file worker.h.


Public Types

enum  {
  RESOURCE_REGENERATOR, AREAWATCHER, BOB, WARE,
  IMMOVABLE, BATTLE, ATTACKCONTROLLER, BUILDING,
  FLAG, ROAD
}
enum  { header_Map_Object = 1, header_Immovable = 2, header_Battle = 3, header_AttackController = 4 }
enum  Attribute {
  WAREHOUSE = 1, CONSTRUCTIONSITE, WORKER, SOLDIER,
  RESI, HIGHEST_FIXED_ATTRIBUTE
}
typedef void(Bob::* Ptr )(Game *, State *)
enum  Type { CRITTER, WORKER }
enum  WalkingDir {
  IDLE = 0, WALK_NE = 1, WALK_E = 2, WALK_SE = 3,
  WALK_SW = 4, WALK_W = 5, WALK_NW = 6
}

Public Member Functions

virtual void act (Game *, uint data)
Point calc_drawpos (const Editor_Game_Base &, const Point) const
void cancel_task_transfer (Game *g)
virtual void cleanup (Editor_Game_Base *g)
virtual void create_debug_panels (Editor_Game_Base *egbase, UI::Tab_Panel *tabs)
void create_needed_experience (Game *)
const std::string & descname () const throw ()
virtual void destroy (Editor_Game_Base *)
void end_walk ()
WareInstancefetch_carried_item (Game *g)
void force_skip_act ()
void gain_experience (Game *)
uint get_animation (const char *const str) const
int get_animstart () const
const char * get_becomes () const throw ()
virtual Bob::Type get_bob_type () const throw ()
const WareInstanceget_carried_item (const Editor_Game_Base *game) const
WareInstanceget_carried_item (Editor_Game_Base *egbase)
uint get_current_anim () const
int get_current_experience () const
Economy * get_economy () const throw ()
PlayerImmovableget_location (Editor_Game_Base *egbase)
LogSink * get_logsink ()
uint get_menu_pic () const throw ()
virtual uint get_movecaps () const throw ()
int get_needed_experience () const
Bobget_next_bob () const throw ()
Playerget_owner () const
const FCoords & get_position () const
uint get_serial () const
std::string get_signal ()
State * get_state (Task *task)
State * get_state ()
const Tribe_Descr * get_tribe () const throw ()
virtual int get_type () const throw ()
virtual Worker_Descr::Worker_Type get_worker_type () const throw ()
bool has_attribute (const uint attr) const throw ()
virtual bool has_new_save_support ()
void incorporate (Game *g)
virtual void init (Editor_Game_Base *g)
bool is_walking ()
bool is_world_bob () const throw ()
void level (Game *)
void log_general_info (Editor_Game_Base *)
 MO_DESCR (Descr)
const std::string & name () const throw ()
void pop_task ()
void push_task (const Task &task)
void remove (Editor_Game_Base *)
void reset_tasks (Game *)
virtual void save (Editor_Game_Base *, Widelands_Map_Map_Object_Saver *, FileWrite &)
uint schedule_act (Game *g, uint tdelta, uint data=0)
void schedule_act (Game *g, uint tdelta)
void schedule_destroy (Game *g)
void schedule_incorporate (Game *g)
void send_signal (Game *, std::string sig)
void set_animation (Editor_Game_Base *g, uint anim)
void set_carried_item (Game *g, WareInstance *item)
void set_economy (Economy *economy)
void set_location (PlayerImmovable *location)
void set_logsink (LogSink *sink)
void set_owner (Player *player)
void set_position (Editor_Game_Base *g, Coords f)
void set_signal (std::string sig)
void skip_act ()
void start_task_buildingwork ()
void start_task_dropoff (Game *g, WareInstance *item)
void start_task_fetchfromflag ()
void start_task_forcemove (const int dir, const DirAnimations &)
void start_task_fugitive (Game *g)
void start_task_geologist (const int attempts, const int radius, const std::string &subcommand)
virtual void start_task_gowarehouse ()
void start_task_idle (Game *, uint anim, int timeout)
void start_task_leavebuilding (Game *g, bool changelocation)
bool start_task_movepath (const Map &, const Path &, const int index, const DirAnimations &, const bool forceonlast=false, const int only_step=-1)
void start_task_movepath (const Path &, const DirAnimations &, const bool forceonlast=false, const int only_step=-1)
bool start_task_movepath (Game *, const Coords dest, const int persist, const DirAnimations &, const bool forceonlast=false, const int only_step=-1)
void start_task_program (const std::string &programname)
void start_task_return (Game *g, bool dropitem)
void start_task_transfer (Game *g, Transfer *t)
bool start_task_waitforcapacity (Game *g, Flag *flag)
int start_walk (Game *g, WalkingDir dir, uint anim, bool force=false)
State & top_state ()
void update_task_buildingwork (Game *g)
uint vision_range () const
bool wakeup_flag_capacity (Game *g, Flag *flag)
bool wakeup_leave_building (Game *g, Building *building)
 Worker (const Worker_Descr &)

Protected Member Functions

bool does_carry_ware ()
virtual void draw (const Editor_Game_Base &, RenderTarget &, const Point) const
void draw_inner (const Editor_Game_Base &, RenderTarget &, const Point) const
virtual void init_auto_task (Game *g)
void molog (const char *fmt,...) const __attribute__((format(printf

Protected Attributes

const Map_Object_Descr * m_descr
LogSink * m_logsink
uint m_serial

Static Protected Attributes

static Task taskBuildingwork
static Task taskDropoff
static Task taskFetchfromflag
static Task taskFugitive
static Task taskGeologist
static Task taskGowarehouse
static Task taskLeavebuilding
static Task taskProgram
static Task taskReturn
static Task taskTransfer
static Task taskWaitforcapacity

Private Member Functions

void buildingwork_signal (Game *g, State *state)
void buildingwork_update (Game *g, State *state)
void dropoff_update (Game *g, State *state)
void fetchfromflag_update (Game *g, State *state)
void fugitive_signal (Game *g, State *state)
void fugitive_update (Game *g, State *state)
void geologist_update (Game *g, State *state)
void gowarehouse_signal (Game *g, State *state)
void gowarehouse_update (Game *g, State *state)
void leavebuilding_signal (Game *g, State *state)
void leavebuilding_update (Game *g, State *state)
 MO_DESCR (Worker_Descr)
void program_signal (Game *g, State *state)
void program_update (Game *g, State *state)
void return_signal (Game *g, State *state)
void return_update (Game *g, State *state)
bool run_animation (Game *g, State *state, const Action *act)
bool run_create_bob (Game *g, State *state, const Action *act)
bool run_createitem (Game *g, State *state, const Action *act)
bool run_findobject (Game *g, State *state, const Action *act)
bool run_findresource (Game *g, State *state, const Action *act)
bool run_findspace (Game *g, State *state, const Action *act)
bool run_geologist (Game *g, State *state, const Action *act)
bool run_geologist_find (Game *g, State *state, const Action *act)
bool run_mine (Game *g, State *state, const Action *act)
bool run_object (Game *g, State *state, const Action *act)
bool run_plant (Game *g, State *state, const Action *act)
bool run_playFX (Game *g, State *state, const Action *act)
bool run_removeobject (Game *g, State *state, const Action *act)
bool run_return (Game *g, State *state, const Action *act)
bool run_setbobdescription (Game *g, State *state, const Action *act)
bool run_setdescription (Game *g, State *state, const Action *act)
bool run_walk (Game *g, State *state, const Action *act)
void transfer_mask (Game *g, State *state)
void transfer_signal (Game *g, State *state)
void transfer_update (Game *g, State *state)
void waitforcapacity_signal (Game *g, State *state)
void waitforcapacity_update (Game *g, State *state)

Private Attributes

Object_Ptr m_carried_item
 item we are carrying
int m_current_exp
 current experience
Economy * m_economy
 economy this worker is registered in
Object_Ptr m_location
 meta location of the worker, a PlayerImmovable
int m_needed_exp
 experience for next level
IdleWorkerSupply * m_supply
 supply while gowarehouse and not transfer

Friends

class Soldier
class Widelands_Map_Bob_Data_Packet
class Widelands_Map_Bobdata_Data_Packet
class WorkerProgram

Classes

struct  Action

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

Generated by  Doxygen 1.6.0   Back to index