Simutrans Programm Version 124.5 r11993
Loading...
Searching...
No Matches
obj_t Class Referenceabstract

#include <simobj.h>

Inheritance diagram for obj_t:
Collaboration diagram for obj_t:

Public Types

enum  flag_values {
  no_flags = 0 , dirty = 1 << 0 , not_on_map = 1 << 1 , is_vehicle = 1 << 2 ,
  highlight = 1 << 3
}
enum  typ {
  undefined =-1 , obj =0 , baum =1 , zeiger =2 ,
  cloud =4 , gebaeude =7 , signal =8 , bruecke =9 ,
  tunnel =10 , bahndepot =12 , strassendepot =13 , schiffdepot = 14 ,
  leitung = 16 , pumpe = 17 , senke = 18 , roadsign = 19 ,
  pillar = 20 , airdepot = 21 , monoraildepot =22 , tramdepot =23 ,
  maglevdepot =24 , wayobj = 25 , way = 26 , label = 27 ,
  field = 28 , crossing = 29 , groundobj = 30 , narrowgaugedepot =31 ,
  pedestrian =64 , road_user =65 , road_vehicle =66 , rail_vehicle =67 ,
  monorail_vehicle =68 , maglev_vehicle =69 , narrowgauge_vehicle =70 , water_vehicle =80 ,
  air_vehicle =81 , movingobj =82 , old_wolke =3 , old_async_wolke =5 ,
  old_gebaeudefundament =11 , old_raucher =15 , old_automobil =32 , old_waggon =33 ,
  old_schiff =34 , old_aircraft =35 , old_monorailwaggon =36 , old_verkehr =41 ,
  old_fussgaenger =42 , old_choosesignal = 95 , old_presignal = 96 , old_roadsign = 97 ,
  old_pillar = 98 , old_airdepot = 99 , old_monoraildepot =100 , old_tramdepot =101
}
 all the different types of objects More...

Public Member Functions

sint8 get_owner_nr () const
void set_owner (player_t *player)
player_tget_owner () const
void set_flag (flag_values flag)
void clear_flag (flag_values flag)
bool get_flag (flag_values flag) const
sint8 get_xoff () const
sint8 get_yoff () const
bool is_moving () const
void set_xoff (sint8 xoff)
void set_yoff (sint8 yoff)
 obj_t (koord3d pos)
virtual ~obj_t ()
virtual void cleanup (player_t *)
virtual const char * get_name () const
virtual typ get_typ () const =0
virtual waytype_t get_waytype () const
virtual bool is_clipping_below_needed () const
 true if clipping below is needed
virtual bool check_season (const bool)
virtual void rotate90 ()
virtual image_id get_image () const =0
virtual image_id get_front_image () const
virtual FLAGGED_PIXVAL get_outline_colour () const
virtual image_id get_outline_image () const
virtual void rdwr (loadsave_t *file)
virtual void finish_rd ()
koord3d get_pos () const
void set_pos (koord3d k)
virtual void info (cbuffer_t &buf) const
virtual void show_info ()
virtual bool has_managed_lifecycle () const
virtual const char * get_removal_error (const player_t *player)
virtual void display (int xpos, int ypos CLIP_NUM_DEF) const
virtual void display_after (int xpos, int ypos, bool is_global) const
void mark_image_dirty (image_id image, sint16 yoff) const
virtual void calc_image ()

Static Public Attributes

static bool show_owner = false

Protected Member Functions

 obj_t ()
void set_owner_nr (uint8 value)

Static Protected Attributes

static karte_ptr_t welt

Private Member Functions

 obj_t (obj_t const &)
obj_toperator= (obj_t const &)
void init ()

Private Attributes

koord3d pos
sint8 xoff
sint8 yoff
uint8 owner_n:4
uint8 flags:4

Detailed Description

Base class of all objects on the map, obj == thing Since everything is a 'obj' on the map, we need to make this as compact and fast as possible.

Definition at line 26 of file simobj.h.

Member Enumeration Documentation

◆ flag_values

Enumerator
no_flags 
dirty 1 << 0 

no special properties

not_on_map 1 << 1 

mark image dirty when drawing

is_vehicle 1 << 2 

this object is not placed on any tile (e.g. vehicles in a depot)

highlight 1 << 3 

this object is a vehicle obviously

Definition at line 30 of file simobj.h.

◆ typ

enum obj_t::typ

all the different types of objects

Enumerator
undefined -1 
obj 
baum 
zeiger 
cloud 
gebaeude 
signal 
bruecke 
tunnel 10 
bahndepot 12 
strassendepot 13 
schiffdepot 14 
leitung 16 
pumpe 17 
senke 18 
roadsign 19 
pillar 20 
airdepot 21 
monoraildepot 22 
tramdepot 23 
maglevdepot 24 
wayobj 25 
way 26 
label 27 
field 28 
crossing 29 
groundobj 30 
narrowgaugedepot 31 
pedestrian 64 
road_user 65 
road_vehicle 66 
rail_vehicle 67 
monorail_vehicle 68 
maglev_vehicle 69 
narrowgauge_vehicle 70 
water_vehicle 80 
air_vehicle 81 
movingobj 82 
old_wolke 
old_async_wolke 
old_gebaeudefundament 11 
old_raucher 15 
old_automobil 32 
old_waggon 33 
old_schiff 34 
old_aircraft 35 
old_monorailwaggon 36 
old_verkehr 41 
old_fussgaenger 42 
old_choosesignal 95 
old_presignal 96 
old_roadsign 97 
old_pillar 98 
old_airdepot 99 
old_monoraildepot 100 
old_tramdepot 101 

Definition at line 115 of file simobj.h.

Constructor & Destructor Documentation

◆ obj_t() [1/3]

obj_t::obj_t ( obj_t const & )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ obj_t() [2/3]

obj_t::obj_t ( )
protected

Definition at line 54 of file simobj.cc.

Here is the call graph for this function:

◆ obj_t() [3/3]

obj_t::obj_t ( koord3d pos)

Constructor to set position of object This does not add the object to the tile

Definition at line 59 of file simobj.cc.

Here is the call graph for this function:

◆ ~obj_t()

obj_t::~obj_t ( )
virtual

Destructor: removes object from tile, should close any inspection windows

Definition at line 67 of file simobj.cc.

Here is the call graph for this function:

Member Function Documentation

◆ calc_image()

virtual void obj_t::calc_image ( )
inlinevirtual

Function for recalculating the image.

Reimplemented in baum_t, bruecke_t, crossing_t, gebaeude_t, groundobj_t, leitung_t, movingobj_t, pedestrian_t, pillar_t, private_car_t, pumpe_t, roadsign_t, senke_t, signal_t, tunnel_t, vehicle_base_t, vehicle_t, wayobj_t, and weg_t.

Definition at line 332 of file simobj.h.

◆ check_season()

virtual bool obj_t::check_season ( const bool )
inlinevirtual

called whenever the snowline height changes return false and the obj_t will be deleted

Reimplemented in baum_t, bruecke_t, crossing_t, gebaeude_t, groundobj_t, movingobj_t, tunnel_t, and weg_t.

Definition at line 224 of file simobj.h.

Here is the caller graph for this function:

◆ cleanup()

virtual void obj_t::cleanup ( player_t * )
inlinevirtual

Routine for cleanup if object is removed (ie book maintenance, cost for removal)

Reimplemented in baum_t, bruecke_t, field_t, gebaeude_t, groundobj_t, leitung_t, movingobj_t, roadsign_t, schiene_t, tunnel_t, and wayobj_t.

Definition at line 199 of file simobj.h.

Here is the caller graph for this function:

◆ clear_flag()

void obj_t::clear_flag ( flag_values flag)
inline

Definition at line 111 of file simobj.h.

Here is the caller graph for this function:

◆ display()

void obj_t::display ( int xpos,
int ypos CLIP_NUM_DEF ) const
virtual

Draw background image of object (but only single height) (everything that could be potentially behind vehicles) override for multi imge objects

draw the object the dirty-flag is reset from objlist_t::display_obj_fg, or objlist_t::display_overlay when multithreaded

Reimplemented in gebaeude_t.

Definition at line 194 of file simobj.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ display_after()

void obj_t::display_after ( int xpos,
int ypos,
bool is_global ) const
virtual

Draw foreground image (everything that is in front of vehicles)

Reimplemented in air_vehicle_t, roadsign_t, vehicle_t, and wolke_t.

Definition at line 255 of file simobj.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finish_rd()

virtual void obj_t::finish_rd ( )
inlinevirtual

Called after the world is completely loaded from savegame

Reimplemented in baum_t, bruecke_t, crossing_t, gebaeude_t, label_t, leitung_t, pumpe_t, road_user_t, roadsign_t, senke_t, tunnel_t, wayobj_t, and weg_t.

Definition at line 262 of file simobj.h.

Here is the caller graph for this function:

◆ get_flag()

bool obj_t::get_flag ( flag_values flag) const
inline

Definition at line 112 of file simobj.h.

Here is the caller graph for this function:

◆ get_front_image()

virtual image_id obj_t::get_front_image ( ) const
inlinevirtual

this image is drawn after all get_image() on this tile Currently only single height is supported for this feature

Reimplemented in bruecke_t, crossing_t, gebaeude_t, leitung_t, pillar_t, roadsign_t, tunnel_t, wayobj_t, weg_t, wolke_t, and zeiger_t.

Definition at line 241 of file simobj.h.

Here is the caller graph for this function:

◆ get_image()

virtual image_id obj_t::get_image ( ) const
pure virtual

Every object needs an image.

Returns
number of current image for that object

Implemented in air_vehicle_t, async_wolke_t, baum_t, bruecke_t, crossing_t, dummy_obj_t, field_t, gebaeude_t, groundobj_t, label_t, leitung_t, oldsignal_t, pedestrian_t, pillar_t, raucher_t, roadsign_t, tunnel_t, vehicle_base_t, wayobj_t, weg_t, wolke_t, and zeiger_t.

Here is the caller graph for this function:

◆ get_name()

virtual const char * obj_t::get_name ( ) const
inlinevirtual
Returns
untranslated name of object

Reimplemented in airdepot_t, bahndepot_t, baum_t, bruecke_t, crossing_t, field_t, gebaeude_t, groundobj_t, leitung_t, maglevdepot_t, monoraildepot_t, movingobj_t, narrowgaugedepot_t, pedestrian_t, pillar_t, private_car_t, pumpe_t, road_user_t, roadsign_t, schiffdepot_t, senke_t, signal_t, strassendepot_t, tramdepot_t, tunnel_t, weg_t, wolke_t, and zeiger_t.

Definition at line 204 of file simobj.h.

Here is the caller graph for this function:

◆ get_outline_colour()

virtual FLAGGED_PIXVAL obj_t::get_outline_colour ( ) const
inlinevirtual

if a function returns a value here with TRANSPARENT_FLAGS set then a transparent outline with the color from the lower 8 bit is drawn

Reimplemented in air_vehicle_t, baum_t, gebaeude_t, schiene_t, and weg_t.

Definition at line 247 of file simobj.h.

Here is the caller graph for this function:

◆ get_outline_image()

virtual image_id obj_t::get_outline_image ( ) const
inlinevirtual

The image, that will be outlined

Reimplemented in air_vehicle_t, baum_t, gebaeude_t, schiene_t, and weg_t.

Definition at line 252 of file simobj.h.

Here is the caller graph for this function:

◆ get_owner()

player_t * obj_t::get_owner ( ) const

returns owner of object

Definition at line 122 of file simobj.cc.

◆ get_owner_nr()

sint8 obj_t::get_owner_nr ( ) const
inline

Definition at line 95 of file simobj.h.

Here is the caller graph for this function:

◆ get_pos()

koord3d obj_t::get_pos ( ) const
inline
Returns
position

Definition at line 267 of file simobj.h.

◆ get_removal_error()

const char * obj_t::get_removal_error ( const player_t * player)
virtual
Returns
NULL if this obj can be removed by player, otherwise an error message

Reimplemented in air_vehicle_t, bruecke_t, crossing_t, depot_t, field_t, leitung_t, road_user_t, tunnel_t, vehicle_t, wayobj_t, and weg_t.

Definition at line 160 of file simobj.cc.

Here is the caller graph for this function:

◆ get_typ()

virtual typ obj_t::get_typ ( ) const
pure virtual

◆ get_waytype()

virtual waytype_t obj_t::get_waytype ( ) const
inlinevirtual

waytype associated with this object

Reimplemented in air_vehicle_t, bruecke_t, crossing_t, gebaeude_t, kanal_t, leitung_t, maglev_t, maglev_vehicle_t, monorail_t, monorail_vehicle_t, movingobj_t, narrowgauge_t, narrowgauge_vehicle_t, rail_vehicle_t, road_user_t, road_vehicle_t, roadsign_t, runway_t, schiene_t, strasse_t, tunnel_t, vehicle_base_t, vehicle_t, water_vehicle_t, wayobj_t, and weg_t.

Definition at line 215 of file simobj.h.

Here is the caller graph for this function:

◆ get_xoff()

sint8 obj_t::get_xoff ( ) const
inline

Definition at line 174 of file simobj.h.

Here is the caller graph for this function:

◆ get_yoff()

sint8 obj_t::get_yoff ( ) const
inline

Definition at line 175 of file simobj.h.

Here is the caller graph for this function:

◆ has_managed_lifecycle()

bool obj_t::has_managed_lifecycle ( ) const
virtual
Returns
True if the object lifecycle is managed by another system so cannot be destroyed. False if the object can be destroyed at any time.

Reimplemented in zeiger_t.

Definition at line 155 of file simobj.cc.

Here is the caller graph for this function:

◆ info()

void obj_t::info ( cbuffer_t & buf) const
virtual

put description of object into the buffer (used for certain windows)

See also
simwin

Reimplemented in baum_t, crossing_t, gebaeude_t, groundobj_t, leitung_t, movingobj_t, pedestrian_t, private_car_t, pumpe_t, roadsign_t, runway_t, schiene_t, senke_t, signal_t, vehicle_t, and weg_t.

Definition at line 132 of file simobj.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

void obj_t::init ( )
private

Used by all constructors to initialize all vars with safe values -> single source principle

Definition at line 40 of file simobj.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_clipping_below_needed()

virtual bool obj_t::is_clipping_below_needed ( ) const
inlinevirtual

true if clipping below is needed

Reimplemented in bruecke_t, and weg_t.

Definition at line 218 of file simobj.h.

◆ is_moving()

bool obj_t::is_moving ( ) const
inline

Definition at line 178 of file simobj.h.

Here is the caller graph for this function:

◆ mark_image_dirty()

void obj_t::mark_image_dirty ( image_id image,
sint16 yoff ) const

When a vehicle moves or a cloud moves, it needs to mark the old spot as dirty (to copy to screen). This routine already takes position, and offsets (x_off, y_off) into account.

Parameters
image
yoffextra y-offset, in most cases 0, in pixels.

Definition at line 293 of file simobj.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

obj_t & obj_t::operator= ( obj_t const & )
private
Here is the call graph for this function:

◆ rdwr()

void obj_t::rdwr ( loadsave_t * file)
virtual

Save and Load of object data in one routine

Reimplemented in baum_t, bruecke_t, crossing_t, depot_t, gebaeude_t, groundobj_t, kanal_t, leitung_t, maglev_t, monorail_t, movingobj_t, narrowgauge_t, oldsignal_t, pedestrian_t, pillar_t, private_car_t, pumpe_t, road_user_t, roadsign_t, runway_t, schiene_t, senke_t, strasse_t, tunnel_t, vehicle_t, wayobj_t, weg_t, and wolke_t.

Definition at line 171 of file simobj.cc.

Here is the caller graph for this function:

◆ rotate90()

void obj_t::rotate90 ( )
virtual

called during map rotation

Reimplemented in baum_t, bruecke_t, crossing_t, gebaeude_t, leitung_t, pedestrian_t, pillar_t, private_car_t, road_vehicle_t, roadsign_t, vehicle_base_t, vehicle_t, wayobj_t, weg_t, and wolke_t.

Definition at line 242 of file simobj.cc.

Here is the caller graph for this function:

◆ set_flag()

void obj_t::set_flag ( flag_values flag)
inline

routines to set, clear, get bit flags

Definition at line 110 of file simobj.h.

Here is the caller graph for this function:

◆ set_owner()

void obj_t::set_owner ( player_t * player)

sets owner of object

Definition at line 114 of file simobj.cc.

Here is the caller graph for this function:

◆ set_owner_nr()

void obj_t::set_owner_nr ( uint8 value)
inlineprotected

Definition at line 84 of file simobj.h.

Here is the caller graph for this function:

◆ set_pos()

void obj_t::set_pos ( koord3d k)
inline

set position - you would not have guessed it :)

Definition at line 272 of file simobj.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_xoff()

void obj_t::set_xoff ( sint8 xoff)
inline

Definition at line 182 of file simobj.h.

Here is the caller graph for this function:

◆ set_yoff()

void obj_t::set_yoff ( sint8 yoff)
inline

Definition at line 183 of file simobj.h.

Here is the caller graph for this function:

◆ show_info()

void obj_t::show_info ( )
virtual

Opens a new info window for the object

Reimplemented in baum_t, depot_t, field_t, gebaeude_t, groundobj_t, label_t, movingobj_t, obj_no_info_t, pillar_t, road_user_t, roadsign_t, signal_t, and vehicle_t.

Definition at line 150 of file simobj.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ flags

uint8 obj_t::flags
private
See also
flag_values

Definition at line 71 of file simobj.h.

◆ owner_n

uint8 obj_t::owner_n
private

Owner of the object (1 - public player, 15 - unowned)

Definition at line 66 of file simobj.h.

◆ pos

koord3d obj_t::pos
private

Coordinate of position

Definition at line 48 of file simobj.h.

◆ show_owner

bool obj_t::show_owner = false
static

Definition at line 39 of file simobj.h.

◆ welt

karte_ptr_t obj_t::welt
staticprotected

Pointer to the world of this thing. Static to conserve space. Change to instance variable once more than one world is available.

Definition at line 90 of file simobj.h.

◆ xoff

sint8 obj_t::xoff
private

x-offset of the object on the tile used for drawing object image if xoff and yoff are between 0 and OBJECT_OFFSET_STEPS-1 then the top-left corner of the image is within tile boundaries

Definition at line 56 of file simobj.h.

◆ yoff

sint8 obj_t::yoff
private

y-offset of the object on the tile

Definition at line 61 of file simobj.h.


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