Skip to content

Commit

Permalink
Translate spieler_t to player_t , sp/spl to player
Browse files Browse the repository at this point in the history
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@7453 8aca7d54-2c30-db11-9de9-000461428c89
  • Loading branch information
Markohs committed Jan 7, 2015
1 parent 07b022c commit d8a7533
Show file tree
Hide file tree
Showing 176 changed files with 2,324 additions and 2,347 deletions.
128 changes: 64 additions & 64 deletions bauer/brueckenbauer.cc

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions bauer/brueckenbauer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class bruecke_besch_t;
class grund_t;
class karte_ptr_t;
class spieler_t; // Hajo: 22-Nov-01: Added forward declaration
class player_t; // Hajo: 22-Nov-01: Added forward declaration
class weg_besch_t;
class tool_selector_t;

Expand All @@ -30,8 +30,8 @@ class brueckenbauer_t {

static karte_ptr_t welt;

static bool is_blocked(koord3d pos, spieler_t *sp, const bruecke_besch_t *besch, const char *&error_msg);
static bool is_monorail_junction(koord3d pos, spieler_t *sp, const bruecke_besch_t *besch, const char *&error_msg);
static bool is_blocked(koord3d pos, player_t *player, const bruecke_besch_t *besch, const char *&error_msg);
static bool is_monorail_junction(koord3d pos, player_t *player, const bruecke_besch_t *besch, const char *&error_msg);
public:
/**
* Finds the position of the end of the bridge. Does all kind of checks.
Expand All @@ -49,7 +49,7 @@ class brueckenbauer_t {
* @param min_length the minimum length of the bridge.
* @return the position of the other end of the bridge or koord3d::invalid if no possible end is found
*/
static koord3d finde_ende(spieler_t *sp, koord3d pos, const koord zv, const bruecke_besch_t *besch, const char *&error_msg, sint8 &bridge_height, bool ai_bridge=false, uint32 min_length=0, bool high_bridge = false );
static koord3d finde_ende(player_t *player, koord3d pos, const koord zv, const bruecke_besch_t *besch, const char *&error_msg, sint8 &bridge_height, bool ai_bridge=false, uint32 min_length=0, bool high_bridge = false );

/**
* Checks whether given tile @p gr is suitable for placing bridge ramp.
Expand All @@ -58,7 +58,7 @@ class brueckenbauer_t {
* @param gr the ground to check.
* @return true, if bridge ramp can be built here.
*/
static bool ist_ende_ok(spieler_t *sp, const grund_t *gr, waytype_t wt, ribi_t::ribi r );
static bool ist_ende_ok(player_t *player, const grund_t *gr, waytype_t wt, ribi_t::ribi r );

/**
* Checks if a bridge starts on @p gr
Expand All @@ -76,7 +76,7 @@ class brueckenbauer_t {
* @param zv direction the bridge will face
* @param besch the bridge description.
*/
static void baue_auffahrt(spieler_t *sp, koord3d end, ribi_t::ribi ribi_neu, hang_t::typ weg_hang, const bruecke_besch_t *besch);
static void baue_auffahrt(player_t *player, koord3d end, ribi_t::ribi ribi_neu, hang_t::typ weg_hang, const bruecke_besch_t *besch);

/**
* Actually builds the bridge without checks.
Expand All @@ -91,7 +91,7 @@ class brueckenbauer_t {
* @param besch bridge description.
* @param weg_besch description of the way to be built on the bridge
*/
static void baue_bruecke(spieler_t *sp, const koord3d start, const koord3d end, koord zv, sint8 bridge_height, const bruecke_besch_t *besch, const weg_besch_t *weg_besch);
static void baue_bruecke(player_t *player, const koord3d start, const koord3d end, koord zv, sint8 bridge_height, const bruecke_besch_t *besch, const weg_besch_t *weg_besch);

/**
* Registers a new bridge type and adds it to the list of build tools.
Expand All @@ -116,7 +116,7 @@ class brueckenbauer_t {
* @param besch Description of the bridge to build
* @return NULL on success or error message otherwise
*/
static const char *baue( spieler_t *sp, const koord3d pos, const bruecke_besch_t *besch);
static const char *baue( player_t *player, const koord3d pos, const bruecke_besch_t *besch);

/**
* Removes a bridge
Expand All @@ -125,7 +125,7 @@ class brueckenbauer_t {
* @param wegtyp way type of the bridge
* @return An error message if the bridge could not be removed, NULL otherwise
*/
static const char *remove(spieler_t *sp, koord3d pos, waytype_t wegtyp);
static const char *remove(player_t *player, koord3d pos, waytype_t wegtyp);

/**
* Find a matching bridge.
Expand Down
22 changes: 11 additions & 11 deletions bauer/fabrikbauer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ void fabrikbauer_t::verteile_tourist(int max_number)
pos = finde_zufallsbauplatz(pos.get_2d(), 20, attraction->get_groesse(rotation),false,attraction,false,0x0FFFFFFF); // so far -> land only
if(welt->lookup(pos)) {
// space found, build attraction
hausbauer_t::baue(welt->get_spieler(1), pos, rotation, attraction);
hausbauer_t::baue(welt->get_player(1), pos, rotation, attraction);
current_number ++;
retrys = max_number*4;
}
Expand Down Expand Up @@ -432,9 +432,9 @@ class RelativeDistanceOrdering
/*
* Builds a single new factory.
*/
fabrik_t* fabrikbauer_t::baue_fabrik(koord3d* parent, const fabrik_besch_t* info, sint32 initial_prod_base, int rotate, koord3d pos, spieler_t* spieler)
fabrik_t* fabrikbauer_t::baue_fabrik(koord3d* parent, const fabrik_besch_t* info, sint32 initial_prod_base, int rotate, koord3d pos, player_t* owner)
{
fabrik_t * fab = new fabrik_t(pos, spieler, info, initial_prod_base);
fabrik_t * fab = new fabrik_t(pos, owner, info, initial_prod_base);

// now build factory
fab->baue(rotate, true /*add fields*/, initial_prod_base != -1 /* force initial prodbase ? */);
Expand All @@ -451,7 +451,7 @@ fabrik_t* fabrikbauer_t::baue_fabrik(koord3d* parent, const fabrik_besch_t* info
koord dim = besch->get_groesse(rotate);

// create water halt
halthandle_t halt = haltestelle_t::create(pos.get_2d(), welt->get_spieler(1));
halthandle_t halt = haltestelle_t::create(pos.get_2d(), welt->get_player(1));
if(halt.is_bound()) {

// add all other tiles of the factory to the halt
Expand Down Expand Up @@ -549,7 +549,7 @@ bool fabrikbauer_t::can_factory_tree_rotate( const fabrik_besch_t *besch )
* is the maximum number of good types for which suppliers chains are built
* (meaning there are no unfinished factory chains).
*/
int fabrikbauer_t::baue_hierarchie(koord3d* parent, const fabrik_besch_t* info, sint32 initial_prod_base, int rotate, koord3d* pos, spieler_t* sp, int number_of_chains )
int fabrikbauer_t::baue_hierarchie(koord3d* parent, const fabrik_besch_t* info, sint32 initial_prod_base, int rotate, koord3d* pos, player_t* player, int number_of_chains )
{
int n = 1;
int org_rotation = -1;
Expand Down Expand Up @@ -643,13 +643,13 @@ int fabrikbauer_t::baue_hierarchie(koord3d* parent, const fabrik_besch_t* info,
DBG_MESSAGE("fabrikbauer_t::baue_hierarchie","Construction of %s at (%i,%i).",info->get_name(),pos->x,pos->y);
INT_CHECK("fabrikbauer 594");

const fabrik_t *our_fab=baue_fabrik(parent, info, initial_prod_base, rotate, *pos, sp);
const fabrik_t *our_fab=baue_fabrik(parent, info, initial_prod_base, rotate, *pos, player);

INT_CHECK("fabrikbauer 596");

// now build supply chains for all products
for(int i=0; i<info->get_lieferanten() && i<number_of_chains; i++) {
n += baue_link_hierarchie( our_fab, info, i, sp);
n += baue_link_hierarchie( our_fab, info, i, player);
}

// everything built -> update map if needed
Expand All @@ -675,7 +675,7 @@ int fabrikbauer_t::baue_hierarchie(koord3d* parent, const fabrik_besch_t* info,
}


int fabrikbauer_t::baue_link_hierarchie(const fabrik_t* our_fab, const fabrik_besch_t* info, int lieferant_nr, spieler_t* sp)
int fabrikbauer_t::baue_link_hierarchie(const fabrik_t* our_fab, const fabrik_besch_t* info, int lieferant_nr, player_t* player)
{
int n = 0; // number of additional factories
/* first we try to connect to existing factories and will do some
Expand Down Expand Up @@ -818,7 +818,7 @@ DBG_MESSAGE("fabrikbauer_t::baue_hierarchie","lieferanten %i, lcount %i (need %i
INT_CHECK("fabrikbauer 697");

DBG_MESSAGE("fabrikbauer_t::baue_hierarchie","Try to built lieferant %s at (%i,%i) r=%i for %s.",hersteller->get_name(),k.x,k.y,rotate,info->get_name());
n += baue_hierarchie(&parent_pos, hersteller, -1 /*random prodbase */, rotate, &k, sp, 10000 );
n += baue_hierarchie(&parent_pos, hersteller, -1 /*random prodbase */, rotate, &k, player, 10000 );
lfound ++;

INT_CHECK( "fabrikbauer 702" );
Expand Down Expand Up @@ -929,7 +929,7 @@ int fabrikbauer_t::increase_industry_density( bool tell_me )

uint32 last_suppliers = last_built_consumer->get_suppliers().get_count();
do {
nr += baue_link_hierarchie( last_built_consumer, last_built_consumer->get_besch(), last_built_consumer_ware, welt->get_spieler(1) );
nr += baue_link_hierarchie( last_built_consumer, last_built_consumer->get_besch(), last_built_consumer_ware, welt->get_player(1) );
last_built_consumer_ware ++;
} while( last_built_consumer_ware < last_built_consumer->get_besch()->get_lieferanten() && last_built_consumer->get_suppliers().get_count()==last_suppliers );

Expand Down Expand Up @@ -1002,7 +1002,7 @@ int fabrikbauer_t::increase_industry_density( bool tell_me )
}
if(welt->lookup(pos)) {
// Space found...
nr += baue_hierarchie(NULL, fab, -1 /* random prodbase */, rotation, &pos, welt->get_spieler(1), 1 );
nr += baue_hierarchie(NULL, fab, -1 /* random prodbase */, rotation, &pos, welt->get_player(1), 1 );
if(nr>0) {
fabrik_t *our_fab = fabrik_t::get_fab( pos.get_2d() );
reliefkarte_t::get_karte()->calc_map_size();
Expand Down
8 changes: 4 additions & 4 deletions bauer/fabrikbauer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ware_besch_t;
class fabrik_besch_t;
class stadt_t;
class karte_ptr_t;
class spieler_t;
class player_t;
class fabrik_t;


Expand Down Expand Up @@ -101,7 +101,7 @@ class fabrikbauer_t
* @param rotate building rotation (0..3)
* @returns The newly constructed factory.
*/
static fabrik_t* baue_fabrik(koord3d* parent, const fabrik_besch_t* info, sint32 initial_prod_base, int rotate, koord3d pos, spieler_t* spieler);
static fabrik_t* baue_fabrik(koord3d* parent, const fabrik_besch_t* info, sint32 initial_prod_base, int rotate, koord3d pos, player_t* owner);

/**
* Builds a new full chain of factories. Precondition before calling this function:
Expand All @@ -110,13 +110,13 @@ class fabrikbauer_t
* (meaning there are no unfinished factory chains).
* @returns number of factories built
*/
static int baue_hierarchie(koord3d* parent, const fabrik_besch_t* info, sint32 initial_prod_base, int rotate, koord3d* pos, spieler_t* sp, int number_of_chains );
static int baue_hierarchie(koord3d* parent, const fabrik_besch_t* info, sint32 initial_prod_base, int rotate, koord3d* pos, player_t* player, int number_of_chains );

/**
* Helper function for baue_hierachie(): builds the connections (chain) for one single product)
* @returns number of factories built
*/
static int baue_link_hierarchie(const fabrik_t* our_fab, const fabrik_besch_t* info, int lieferant_nr, spieler_t* sp);
static int baue_link_hierarchie(const fabrik_t* our_fab, const fabrik_besch_t* info, int lieferant_nr, player_t* player);

/**
* This function is called whenever it is time for industry growth.
Expand Down
38 changes: 19 additions & 19 deletions bauer/hausbauer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ void hausbauer_t::neue_karte()
}


void hausbauer_t::remove( spieler_t *sp, gebaeude_t *gb )
void hausbauer_t::remove( player_t *player, gebaeude_t *gb )
{
const haus_tile_besch_t *tile = gb->get_tile();
const haus_besch_t *hb = tile->get_besch();
Expand Down Expand Up @@ -338,9 +338,9 @@ void hausbauer_t::remove( spieler_t *sp, gebaeude_t *gb )
}
// tell players of the deletion
for(uint8 i=0; i<MAX_PLAYER_COUNT; i++) {
spieler_t *sp = welt->get_spieler(i);
if (sp) {
sp->notify_factory(spieler_t::notify_delete, fab);
player_t *player = welt->get_player(i);
if (player) {
player->notify_factory(player_t::notify_delete, fab);
}
}
// remove all transformers
Expand Down Expand Up @@ -394,11 +394,11 @@ void hausbauer_t::remove( spieler_t *sp, gebaeude_t *gb )
// there may be buildings with holes, so we only remove our building!
if( gb_part && gb_part->get_tile()==hb->get_tile(layout, k.x, k.y) ) {
// ok, now we can go on with deletion
gb_part->entferne( sp );
gb_part->entferne( player );
delete gb_part;
// if this was a station building: delete ground
if(gr->get_halt().is_bound()) {
haltestelle_t::remove(sp, gr->get_pos());
haltestelle_t::remove(player, gr->get_pos());
}
// and maybe restore land below
if(gr->get_typ()==grund_t::fundament) {
Expand Down Expand Up @@ -446,7 +446,7 @@ void hausbauer_t::remove( spieler_t *sp, gebaeude_t *gb )
}


gebaeude_t* hausbauer_t::baue(spieler_t* sp, koord3d pos, int org_layout, const haus_besch_t* besch, void* param)
gebaeude_t* hausbauer_t::baue(player_t* player_, koord3d pos, int org_layout, const haus_besch_t* besch, void* param)
{
gebaeude_t* first_building = NULL;
koord k;
Expand All @@ -471,7 +471,7 @@ gebaeude_t* hausbauer_t::baue(spieler_t* sp, koord3d pos, int org_layout, const
DBG_MESSAGE("hausbauer_t::baue()","get_tile() empty at %i,%i",k.x,k.y);
continue;
}
gebaeude_t *gb = new gebaeude_t(pos + k, sp, tile);
gebaeude_t *gb = new gebaeude_t(pos + k, player_, tile);
if (first_building == NULL) {
first_building = gb;
}
Expand Down Expand Up @@ -501,7 +501,7 @@ gebaeude_t* hausbauer_t::baue(spieler_t* sp, koord3d pos, int org_layout, const
if(lt) {
gr->obj_remove(lt);
}
gr->obj_loesche_alle(sp); // delete everything except vehicles
gr->obj_loesche_alle(player_); // delete everything except vehicles
}

// build new foundation
Expand Down Expand Up @@ -545,7 +545,7 @@ gebaeude_t* hausbauer_t::baue(spieler_t* sp, koord3d pos, int org_layout, const
}


gebaeude_t *hausbauer_t::neues_gebaeude(spieler_t *sp, koord3d pos, int built_layout, const haus_besch_t *besch, void *param)
gebaeude_t *hausbauer_t::neues_gebaeude(player_t *player, koord3d pos, int built_layout, const haus_besch_t *besch, void *param)
{
uint8 corner_layout = 6; // assume single building (for more than 4 layouts)

Expand Down Expand Up @@ -644,36 +644,36 @@ gebaeude_t *hausbauer_t::neues_gebaeude(spieler_t *sp, koord3d pos, int built_la
if( besch->get_utyp() == haus_besch_t::depot ) {
switch( besch->get_extra() ) {
case track_wt:
gb = new bahndepot_t(pos, sp, tile);
gb = new bahndepot_t(pos, player, tile);
break;
case tram_wt:
gb = new tramdepot_t(pos, sp, tile);
gb = new tramdepot_t(pos, player, tile);
break;
case monorail_wt:
gb = new monoraildepot_t(pos, sp, tile);
gb = new monoraildepot_t(pos, player, tile);
break;
case maglev_wt:
gb = new maglevdepot_t(pos, sp, tile);
gb = new maglevdepot_t(pos, player, tile);
break;
case narrowgauge_wt:
gb = new narrowgaugedepot_t(pos, sp, tile);
gb = new narrowgaugedepot_t(pos, player, tile);
break;
case road_wt:
gb = new strassendepot_t(pos, sp, tile);
gb = new strassendepot_t(pos, player, tile);
break;
case water_wt:
gb = new schiffdepot_t(pos, sp, tile);
gb = new schiffdepot_t(pos, player, tile);
break;
case air_wt:
gb = new airdepot_t(pos, sp, tile);
gb = new airdepot_t(pos, player, tile);
break;
default:
dbg->fatal("hausbauer_t::neues_gebaeude()","waytpe %i has no depots!", besch->get_extra() );
break;
}
}
else {
gb = new gebaeude_t(pos, sp, tile);
gb = new gebaeude_t(pos, player, tile);
}
//DBG_MESSAGE("hausbauer_t::neues_gebaeude()","building stop pri=%i",pri);

Expand Down
8 changes: 4 additions & 4 deletions bauer/hausbauer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class gebaeude_t;
class karte_ptr_t;
class spieler_t;
class player_t;
class tool_selector_t;

/**
Expand Down Expand Up @@ -122,7 +122,7 @@ class hausbauer_t
* It will also take care of factories and foundations.
* @param sp the player wanting to remove the building.
*/
static void remove(spieler_t *sp, gebaeude_t *gb);
static void remove(player_t *player, gebaeude_t *gb);

/**
* Main function to build all non-traffic buildings, including factories.
Expand All @@ -134,14 +134,14 @@ class hausbauer_t
* @return The first built part of the building. Usually at @p pos, if this
* building tile is not empty.
*/
static gebaeude_t* baue(spieler_t* sp, koord3d pos, int layout, const haus_besch_t* besch, void* param = NULL);
static gebaeude_t* baue(player_t* player, koord3d pos, int layout, const haus_besch_t* besch, void* param = NULL);

/**
* Build all kind of stops and depots. The building size must be 1x1.
* Stations with layout>4 may change the layout of neighbouring buildings. (->end of rail platforms)
* @param param if building a stop, pointer to the halt handle
*/
static gebaeude_t* neues_gebaeude(spieler_t* sp, koord3d pos, int layout, const haus_besch_t* besch, void* param = NULL);
static gebaeude_t* neues_gebaeude(player_t* player, koord3d pos, int layout, const haus_besch_t* besch, void* param = NULL);

/// @returns house list of type @p typ
static const vector_tpl<const haus_besch_t *> *get_list(haus_besch_t::utyp typ);
Expand Down
Loading

0 comments on commit d8a7533

Please sign in to comment.