diff --git a/bauer/brueckenbauer.cc b/bauer/brueckenbauer.cc index 2ad15425bf9..10e7eb915b5 100644 --- a/bauer/brueckenbauer.cc +++ b/bauer/brueckenbauer.cc @@ -140,7 +140,7 @@ inline bool ribi_check( ribi_t::ribi ribi, ribi_t::ribi check_ribi ) * if check_ribi==0, then any single tile is ok * @returns either (1) error_message (must abort bridge here) (2) "" if it could end here or (3) NULL if it must end here */ -const char *check_tile( const grund_t *gr, const spieler_t *sp, waytype_t wt, ribi_t::ribi check_ribi ) +const char *check_tile( const grund_t *gr, const player_t *player, waytype_t wt, ribi_t::ribi check_ribi ) { // not overbuilt transformers if( gr->find()!=NULL || gr->find()!=NULL ) { @@ -163,7 +163,7 @@ const char *check_tile( const grund_t *gr, const spieler_t *sp, waytype_t wt, ri // we can build a ramp when there is one (or with tram two) way in our direction and no stations/depot etc. if( weg_t *w = gr->get_weg_nr(0) ) { - if( !spieler_t::check_owner(w->get_besitzer(),sp) ) { + if( !player_t::check_owner(w->get_besitzer(),player) ) { // not our way return "Das Feld gehoert\neinem anderen Spieler\n"; } @@ -171,7 +171,7 @@ const char *check_tile( const grund_t *gr, const spieler_t *sp, waytype_t wt, ri // now check for direction ribi_t::ribi ribi = w->get_ribi_unmasked(); if( weg_t *w2 = gr->get_weg_nr(1) ) { - if( !spieler_t::check_owner(w2->get_besitzer(),sp) ) { + if( !player_t::check_owner(w2->get_besitzer(),player) ) { // not our way return "Das Feld gehoert\neinem anderen Spieler\n"; } @@ -193,7 +193,7 @@ const char *check_tile( const grund_t *gr, const spieler_t *sp, waytype_t wt, ri if( w->get_waytype() != wt ) { // now check for perpendicular and crossing - if( (ribi_t::doppelt(ribi) ^ ribi_t::doppelt(check_ribi) ) == ribi_t::alle && crossing_logic_t::get_crossing(wt, w->get_waytype(), 0, 0, sp->get_welt()->get_timeline_year_month() ) ) { + if( (ribi_t::doppelt(ribi) ^ ribi_t::doppelt(check_ribi) ) == ribi_t::alle && crossing_logic_t::get_crossing(wt, w->get_waytype(), 0, 0, player->get_welt()->get_timeline_year_month() ) ) { return NULL; } return "A bridge must start on a way!"; @@ -210,7 +210,7 @@ const char *check_tile( const grund_t *gr, const spieler_t *sp, waytype_t wt, ri } else if( wt == powerline_wt ) { if( leitung_t *lt = gr->get_leitung() ) { - if( spieler_t::check_owner(lt->get_besitzer(),sp) && ribi_check( lt->get_ribi(), check_ribi ) ) { + if( player_t::check_owner(lt->get_besitzer(),player) && ribi_check( lt->get_ribi(), check_ribi ) ) { // matching powerline return NULL; } @@ -219,14 +219,14 @@ const char *check_tile( const grund_t *gr, const spieler_t *sp, waytype_t wt, ri } // somethign here which we cannot remove => fail too if( obj_t *obj=gr->obj_bei(0) ) { - if( const char *err_msg = obj->ist_entfernbar(sp) ) { + if( const char *err_msg = obj->ist_entfernbar(player) ) { return err_msg; } } return ""; // could end here by must not end here } -bool brueckenbauer_t::is_blocked(koord3d pos, spieler_t *sp, const bruecke_besch_t *besch, const char *&error_msg) +bool brueckenbauer_t::is_blocked(koord3d pos, player_t *player, const bruecke_besch_t *besch, const char *&error_msg) { /* can't build directly above or below a way if height clearance == 2 */ for(int dz=-(welt->get_settings().get_way_height_clearance()-1); dz<=(welt->get_settings().get_way_height_clearance()-1); dz++) { @@ -244,7 +244,7 @@ bool brueckenbauer_t::is_blocked(koord3d pos, spieler_t *sp, const bruecke_besch if( gr2->get_typ() == grund_t::monorailboden ) { // now check if our way if( weg_t *w = gr2->get_weg_nr(0) ) { - if( !spieler_t::check_owner(w->get_besitzer(),sp) ) { + if( !player_t::check_owner(w->get_besitzer(),player) ) { // not our way error_msg = "Das Feld gehoert\neinem anderen Spieler\n"; return true; @@ -264,14 +264,14 @@ bool brueckenbauer_t::is_blocked(koord3d pos, spieler_t *sp, const bruecke_besch return false; } -bool brueckenbauer_t::is_monorail_junction(koord3d pos, spieler_t *sp, const bruecke_besch_t *besch, const char *&error_msg) +bool brueckenbauer_t::is_monorail_junction(koord3d pos, player_t *player, const bruecke_besch_t *besch, const char *&error_msg) { // first check for elevated ground exactly in our height if( grund_t *gr2 = welt->lookup( pos ) ) { if( gr2->get_typ() == grund_t::monorailboden ) { // now check if our way if( weg_t *w = gr2->get_weg_nr(0) ) { - if( !spieler_t::check_owner(w->get_besitzer(),sp) ) { + if( !player_t::check_owner(w->get_besitzer(),player) ) { // not our way error_msg = "Das Feld gehoert\neinem anderen Spieler\n"; return false; @@ -289,7 +289,7 @@ bool brueckenbauer_t::is_monorail_junction(koord3d pos, spieler_t *sp, const bru #define height_okay(h) (((h) < min_bridge_height || (h) > max_height) ? false : height_okay_array[h-min_bridge_height]) -koord3d brueckenbauer_t::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, uint32 min_length, bool high_bridge ) +koord3d brueckenbauer_t::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, uint32 min_length, bool high_bridge ) { const grund_t *gr2 = welt->lookup( pos ); if( !gr2 ) { @@ -343,7 +343,7 @@ koord3d brueckenbauer_t::finde_ende(spieler_t *sp, koord3d pos, const koord zv, pos = pos + zv; // test scenario conditions - if( (error_msg = scen->is_work_allowed_here(sp, TOOL_BUILD_BRIDGE|GENERAL_TOOL, wegtyp, pos)) != NULL ) { + if( (error_msg = scen->is_work_allowed_here(player, TOOL_BUILD_BRIDGE|GENERAL_TOOL, wegtyp, pos)) != NULL ) { // fail silent? return koord3d::invalid; } @@ -386,10 +386,10 @@ koord3d brueckenbauer_t::finde_ende(spieler_t *sp, koord3d pos, const koord zv, bool abort = true; for(sint8 z = min_bridge_height; z <= max_height; z++) { if(height_okay(z)) { - if(is_blocked(koord3d(pos.get_2d(), z), sp, besch, error_msg)) { + if(is_blocked(koord3d(pos.get_2d(), z), player, besch, error_msg)) { height_okay_array[z-min_bridge_height] = false; } - else if(is_monorail_junction(koord3d(pos.get_2d(), z), sp, besch, error_msg)) { + else if(is_monorail_junction(koord3d(pos.get_2d(), z), player, besch, error_msg)) { gr = welt->lookup(koord3d(pos.get_2d(), z)); bridge_height = z - start_height; return gr->get_pos(); @@ -420,7 +420,7 @@ koord3d brueckenbauer_t::finde_ende(spieler_t *sp, koord3d pos, const koord zv, if(height_okay(hang_height) && end_slope == hang_t::flach && (hang_height == max_height || ai_bridge || min_length)) { /* now we have a flat tile below */ - error_msg = check_tile( gr, sp, besch->get_waytype(), ribi_typ(zv) ); + error_msg = check_tile( gr, player, besch->get_waytype(), ribi_typ(zv) ); if( !error_msg || (!*error_msg) ) { // success @@ -444,7 +444,7 @@ koord3d brueckenbauer_t::finde_ende(spieler_t *sp, koord3d pos, const koord zv, // first check slope if( ribi_typ(end_slope) == ribi_typ(zv) ) { // slope matches - error_msg = check_tile( gr, sp, besch->get_waytype(), ribi_typ(zv) ); + error_msg = check_tile( gr, player, besch->get_waytype(), ribi_typ(zv) ); if( !error_msg || !*error_msg ) { // success bridge_height = hang_height - start_height; @@ -458,7 +458,7 @@ koord3d brueckenbauer_t::finde_ende(spieler_t *sp, koord3d pos, const koord zv, if ((hang_height+1 >= start_height && height_okay(hang_height+1)) || (hang_height+2 >= start_height && height_okay(hang_height+2))) { /* now we have a flat tile below */ - error_msg = check_tile( gr, sp, besch->get_waytype(), ribi_typ(zv) ); + error_msg = check_tile( gr, player, besch->get_waytype(), ribi_typ(zv) ); if( hang_height < max_height && ( gr->has_two_ways() || ( gr->get_weg_nr(0) && (gr->get_weg_nr(0)->get_waytype() != besch->get_waytype() || gr->get_weg_ribi_unmasked(besch->get_waytype())!=ribi_typ(zv) ) ) ) ) { // no crossing or curve here (since it will a slope ramp) @@ -559,19 +559,19 @@ bool brueckenbauer_t::is_start_of_bridge( const grund_t *gr ) } -bool brueckenbauer_t::ist_ende_ok(spieler_t *sp, const grund_t *gr, waytype_t wt, ribi_t::ribi r ) +bool brueckenbauer_t::ist_ende_ok(player_t *player, const grund_t *gr, waytype_t wt, ribi_t::ribi r ) { // bridges can only start or end above ground if( gr->get_typ()!=grund_t::boden && gr->get_typ()!=grund_t::monorailboden && gr->get_typ()!=grund_t::tunnelboden ) { return false; } - const char *error_msg = check_tile( gr, sp, wt, r ); + const char *error_msg = check_tile( gr, player, wt, r ); return (error_msg == NULL || *error_msg == 0 ); } -const char *brueckenbauer_t::baue( spieler_t *sp, const koord3d pos, const bruecke_besch_t *besch) +const char *brueckenbauer_t::baue( player_t *player, const koord3d pos, const bruecke_besch_t *besch) { const grund_t *gr = welt->lookup(pos); if( !(gr && besch) ) { @@ -602,12 +602,12 @@ const char *brueckenbauer_t::baue( spieler_t *sp, const koord3d pos, const bruec } } - if( (!lt && !weg) || !ist_ende_ok(sp, gr,besch->get_waytype(),ribi) ) { + if( (!lt && !weg) || !ist_ende_ok(player, gr,besch->get_waytype(),ribi) ) { DBG_MESSAGE( "brueckenbauer_t::baue()", "no way %x found", besch->get_waytype() ); return "A bridge must start on a way!"; } - if( gr->kann_alle_obj_entfernen(sp) ) { + if( gr->kann_alle_obj_entfernen(player) ) { return "Tile not empty."; } @@ -631,7 +631,7 @@ const char *brueckenbauer_t::baue( spieler_t *sp, const koord3d pos, const bruec // search for suitable bridge end tile const char *msg; sint8 bridge_height; - koord3d end = finde_ende(sp, gr->get_pos(), zv, besch, msg, bridge_height ); + koord3d end = finde_ende(player, gr->get_pos(), zv, besch, msg, bridge_height ); // found something? if( koord3d::invalid == end ) { @@ -641,15 +641,15 @@ DBG_MESSAGE("brueckenbauer_t::baue()", "end not ok"); // check ownership grund_t * gr_end = welt->lookup(end); - if(gr_end->kann_alle_obj_entfernen(sp)) { + if(gr_end->kann_alle_obj_entfernen(player)) { return "Tile not empty."; } // check way ownership if(gr_end->hat_wege()) { - if(gr_end->get_weg_nr(0)->ist_entfernbar(sp)!=NULL) { + if(gr_end->get_weg_nr(0)->ist_entfernbar(player)!=NULL) { return "Tile not empty."; } - if(gr_end->has_two_ways() && gr_end->get_weg_nr(1)->ist_entfernbar(sp)!=NULL) { + if(gr_end->has_two_ways() && gr_end->get_weg_nr(1)->ist_entfernbar(player)!=NULL) { return "Tile not empty."; } } @@ -657,16 +657,16 @@ DBG_MESSAGE("brueckenbauer_t::baue()", "end not ok"); // Start and end have been checked, we can start to build eventually if(besch->get_waytype()==powerline_wt) { - baue_bruecke(sp, gr->get_pos(), end, zv, bridge_height, besch, lt->get_besch() ); + baue_bruecke(player, gr->get_pos(), end, zv, bridge_height, besch, lt->get_besch() ); } else { - baue_bruecke(sp, gr->get_pos(), end, zv, bridge_height, besch, weg->get_besch() ); + baue_bruecke(player, gr->get_pos(), end, zv, bridge_height, besch, weg->get_besch() ); } return NULL; } -void brueckenbauer_t::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) +void brueckenbauer_t::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) { ribi_t::ribi ribi = ribi_typ(zv); @@ -688,7 +688,7 @@ void brueckenbauer_t::baue_bruecke(spieler_t *sp, const koord3d start, const koo if( slope || bridge_height != 0 ) { // needs a ramp to start on ground add_height = slope ? hang_t::max_diff(slope) : bridge_height; - baue_auffahrt( sp, start, ribi, slope?0:hang_typ(zv)*add_height, besch ); + baue_auffahrt( player, start, ribi, slope?0:hang_typ(zv)*add_height, besch ); if( besch->get_waytype() != powerline_wt ) { ribi = welt->lookup(start)->get_weg_ribi_unmasked(besch->get_waytype()); } @@ -698,7 +698,7 @@ void brueckenbauer_t::baue_bruecke(spieler_t *sp, const koord3d start, const koo if( besch->get_waytype() == powerline_wt ) { leitung_t *lt = start_gr->get_leitung(); if(!lt) { - lt = new leitung_t(start_gr->get_pos(), sp); + lt = new leitung_t(start_gr->get_pos(), player); lt->set_besch( weg_besch ); start_gr->obj_add( lt ); lt->laden_abschliessen(); @@ -708,7 +708,7 @@ void brueckenbauer_t::baue_bruecke(spieler_t *sp, const koord3d start, const koo // builds new way weg_t * const weg = weg_t::alloc( besch->get_waytype() ); weg->set_besch( weg_besch ); - spieler_t::book_construction_costs( sp, -start_gr->neuen_weg_bauen( weg, ribi, sp ) -weg->get_besch()->get_preis(), end.get_2d(), weg->get_waytype()); + player_t::book_construction_costs( player, -start_gr->neuen_weg_bauen( weg, ribi, player ) -weg->get_besch()->get_preis(), end.get_2d(), weg->get_waytype()); } start_gr->calc_bild(); } @@ -720,16 +720,16 @@ void brueckenbauer_t::baue_bruecke(spieler_t *sp, const koord3d start, const koo if( besch->get_waytype() != powerline_wt ) { weg_t * const weg = weg_t::alloc(besch->get_waytype()); weg->set_besch(weg_besch); - bruecke->neuen_weg_bauen(weg, ribi_t::doppelt(ribi), sp); + bruecke->neuen_weg_bauen(weg, ribi_t::doppelt(ribi), player); } else { - leitung_t *lt = new leitung_t(bruecke->get_pos(), sp); + leitung_t *lt = new leitung_t(bruecke->get_pos(), player); bruecke->obj_add( lt ); lt->laden_abschliessen(); } grund_t *gr = welt->lookup_kartenboden(pos.get_2d()); sint16 height = pos.z - gr->get_pos().z; - bruecke_t *br = new bruecke_t(bruecke->get_pos(), sp, besch, besch->get_simple(ribi,height-hang_t::max_diff(gr->get_grund_hang()))); + bruecke_t *br = new bruecke_t(bruecke->get_pos(), player, besch, besch->get_simple(ribi,height-hang_t::max_diff(gr->get_grund_hang()))); bruecke->obj_add(br); bruecke->calc_bild(); br->laden_abschliessen(); @@ -741,7 +741,7 @@ void brueckenbauer_t::baue_bruecke(spieler_t *sp, const koord3d start, const koo while(height-->0) { if( TILE_HEIGHT_STEP*height <= 127) { // eventual more than one part needed, if it is too high ... - gr->obj_add( new pillar_t(gr->get_pos(),sp,besch,besch->get_pillar(ribi), TILE_HEIGHT_STEP*height) ); + gr->obj_add( new pillar_t(gr->get_pos(),player,besch,besch->get_pillar(ribi), TILE_HEIGHT_STEP*height) ); } } } @@ -761,7 +761,7 @@ void brueckenbauer_t::baue_bruecke(spieler_t *sp, const koord3d start, const koo grund_t *gr = welt->lookup(end); if( need_auffahrt ) { // not ending at a bridge - baue_auffahrt(sp, end, ribi_typ(-zv), gr->get_weg_hang()?0:hang_typ(-zv)*(pos.z-end.z), besch); + baue_auffahrt(player, end, ribi_typ(-zv), gr->get_weg_hang()?0:hang_typ(-zv)*(pos.z-end.z), besch); } else { // ending on a slope/elevated way @@ -772,15 +772,15 @@ void brueckenbauer_t::baue_bruecke(spieler_t *sp, const koord3d start, const koo // builds new way weg_t * const weg = weg_t::alloc( besch->get_waytype() ); weg->set_besch( weg_besch ); - spieler_t::book_construction_costs( sp, -gr->neuen_weg_bauen( weg, ribi, sp ) -weg->get_besch()->get_preis(), end.get_2d(), weg->get_waytype()); + player_t::book_construction_costs( player, -gr->neuen_weg_bauen( weg, ribi, player ) -weg->get_besch()->get_preis(), end.get_2d(), weg->get_waytype()); } gr->calc_bild(); } else { leitung_t *lt = gr->get_leitung(); if( lt==NULL ) { - lt = new leitung_t(end, sp ); - spieler_t::book_construction_costs(sp, -weg_besch->get_preis(), gr->get_pos().get_2d(), powerline_wt); + lt = new leitung_t(end, player ); + player_t::book_construction_costs(player, -weg_besch->get_preis(), gr->get_pos().get_2d(), powerline_wt); gr->obj_add(lt); lt->set_besch(weg_besch); lt->laden_abschliessen(); @@ -790,13 +790,13 @@ void brueckenbauer_t::baue_bruecke(spieler_t *sp, const koord3d start, const koo } // if start or end are single way, and next tile is not, try to connect - if( besch->get_waytype() != powerline_wt && sp ) { + if( besch->get_waytype() != powerline_wt && player ) { if( grund_t *start_gr = welt->lookup(start) ) { ribi_t::ribi ribi = start_gr->get_weg_ribi_unmasked(besch->get_waytype()); if( ribi_t::ist_einfach(ribi) ) { // only single tile under start => try to connect to next tile koord3d next_to_start = koord3d( start.get_2d()-koord(ribi), start_gr->get_vmove( ribi_t::rueckwaerts(ribi) ) ); - wegbauer_t bauigel(sp); + wegbauer_t bauigel(player); bauigel.set_keep_existing_ways(true); bauigel.set_keep_city_roads(true); bauigel.set_maximum(20); @@ -812,7 +812,7 @@ void brueckenbauer_t::baue_bruecke(spieler_t *sp, const koord3d start, const koo if( ribi_t::ist_einfach(ribi) ) { // only single tile under start => try to connect to next tile koord3d next_to_end = koord3d( end.get_2d()-koord(ribi), end_gr->get_vmove( ribi_t::rueckwaerts(ribi) ) ); - wegbauer_t bauigel(sp); + wegbauer_t bauigel(player); bauigel.set_keep_existing_ways(true); bauigel.set_keep_city_roads(true); bauigel.set_maximum(20); @@ -827,7 +827,7 @@ void brueckenbauer_t::baue_bruecke(spieler_t *sp, const koord3d start, const koo } -void brueckenbauer_t::baue_auffahrt(spieler_t* sp, koord3d end, ribi_t::ribi ribi_neu, hang_t::typ weg_hang, const bruecke_besch_t* besch) +void brueckenbauer_t::baue_auffahrt(player_t* player, koord3d end, ribi_t::ribi ribi_neu, hang_t::typ weg_hang, const bruecke_besch_t* besch) { assert(weg_hang < 81); @@ -851,31 +851,31 @@ void brueckenbauer_t::baue_auffahrt(spieler_t* sp, koord3d end, ribi_t::ribi rib if( !bruecke->weg_erweitern( besch->get_waytype(), ribi_neu) ) { // needs still one weg = weg_t::alloc( besch->get_waytype() ); - spieler_t::book_construction_costs(sp, -bruecke->neuen_weg_bauen( weg, ribi_neu, sp ), end.get_2d(), besch->get_waytype()); + player_t::book_construction_costs(player, -bruecke->neuen_weg_bauen( weg, ribi_neu, player ), end.get_2d(), besch->get_waytype()); } weg->set_max_speed( besch->get_topspeed() ); } else { leitung_t *lt = bruecke->get_leitung(); if(!lt) { - lt = new leitung_t(bruecke->get_pos(), sp); + lt = new leitung_t(bruecke->get_pos(), player); bruecke->obj_add( lt ); } else { // remove maintenance - it will be added in leitung_t::laden_abschliessen - spieler_t::add_maintenance( sp, -lt->get_besch()->get_wartung(), powerline_wt); + player_t::add_maintenance( player, -lt->get_besch()->get_wartung(), powerline_wt); } // connect to neighbor tiles and networks, add maintenance lt->laden_abschliessen(); } - bruecke_t *br = new bruecke_t(end, sp, besch, img); + bruecke_t *br = new bruecke_t(end, player, besch, img); bruecke->obj_add( br ); br->laden_abschliessen(); bruecke->calc_bild(); } -const char *brueckenbauer_t::remove(spieler_t *sp, koord3d pos_start, waytype_t wegtyp) +const char *brueckenbauer_t::remove(player_t *player, koord3d pos_start, waytype_t wegtyp) { marker_t& marker = marker_t::instance(welt->get_size().x, welt->get_size().y); slist_tpl end_list; @@ -952,9 +952,9 @@ const char *brueckenbauer_t::remove(spieler_t *sp, koord3d pos_start, waytype_t part_list.insert(pos); } // can we delete everything there? - msg = from->kann_alle_obj_entfernen(sp); + msg = from->kann_alle_obj_entfernen(player); - if(msg != NULL || (from->get_halt().is_bound() && from->get_halt()->get_besitzer()!=sp)) { + if(msg != NULL || (from->get_halt().is_bound() && from->get_halt()->get_besitzer()!=player)) { return "Die Bruecke ist nicht frei!\n"; } @@ -990,7 +990,7 @@ const char *brueckenbauer_t::remove(spieler_t *sp, koord3d pos_start, waytype_t w->set_ribi( (~ribi_t::rueckwaerts( ribi_t::nsow[i] )) & w->get_ribi_unmasked() ); if( w->get_ribi_unmasked() == 0 ) { // nowthing left => then remove completel - prev->remove_everything_from_way( sp, wegtyp, bridge_ribi ); // removes stop and signals correctly + prev->remove_everything_from_way( player, wegtyp, bridge_ribi ); // removes stop and signals correctly prev->weg_entfernen( wegtyp, true ); if( prev->get_typ() == grund_t::monorailboden ) { welt->access( prev->get_pos().get_2d() )->boden_entfernen( prev ); @@ -1009,17 +1009,17 @@ const char *brueckenbauer_t::remove(spieler_t *sp, koord3d pos_start, waytype_t // first: remove bridge bruecke_t *br = gr->find(); - br->entferne(sp); + br->entferne(player); delete br; - gr->remove_everything_from_way(sp,wegtyp,ribi_t::keine); // removes stop and signals correctly + gr->remove_everything_from_way(player,wegtyp,ribi_t::keine); // removes stop and signals correctly // remove also the second way on the bridge if(gr->get_weg_nr(0)!=0) { - gr->remove_everything_from_way(sp,gr->get_weg_nr(0)->get_waytype(),ribi_t::keine); + gr->remove_everything_from_way(player,gr->get_weg_nr(0)->get_waytype(),ribi_t::keine); } // we may have a second way/powerline here ... - gr->obj_loesche_alle(sp); + gr->obj_loesche_alle(player); gr->mark_image_dirty(); welt->access(pos.get_2d())->boden_entfernen(gr); @@ -1053,7 +1053,7 @@ const char *brueckenbauer_t::remove(spieler_t *sp, koord3d pos_start, waytype_t w->set_ribi( (~ribi_t::rueckwaerts( ribi_t::nsow[i] )) & w->get_ribi_unmasked() ); if( w->get_ribi_unmasked() == 0 ) { // nowthing left => then remove completel - prev->remove_everything_from_way( sp, wegtyp, bridge_ribi ); // removes stop and signals correctly + prev->remove_everything_from_way( player, wegtyp, bridge_ribi ); // removes stop and signals correctly prev->weg_entfernen( wegtyp, true ); if( prev->get_typ() == grund_t::monorailboden ) { welt->access( prev->get_pos().get_2d() )->boden_entfernen( prev ); @@ -1070,12 +1070,12 @@ const char *brueckenbauer_t::remove(spieler_t *sp, koord3d pos_start, waytype_t if(wegtyp==powerline_wt) { while (obj_t* const br = gr->find()) { - br->entferne(sp); + br->entferne(player); delete br; } leitung_t *lt = gr->get_leitung(); if (lt) { - spieler_t *old_owner = lt->get_besitzer(); + player_t *old_owner = lt->get_besitzer(); // first delete powerline to decouple from the bridge powernet lt->entferne(old_owner); delete lt; @@ -1099,27 +1099,27 @@ const char *brueckenbauer_t::remove(spieler_t *sp, koord3d pos_start, waytype_t ribi &= bridge_ribi; bruecke_t *br = gr->find(); - br->entferne(sp); + br->entferne(player); delete br; // stops on flag bridges ends with road + track on it // are not correctly deleted if ways are kept if (gr->is_halt()) { - haltestelle_t::remove(sp, gr->get_pos()); + haltestelle_t::remove(player, gr->get_pos()); } // depots at bridge ends needs to be deleted as well if (depot_t *dep = gr->get_depot()) { - dep->entferne(sp); + dep->entferne(player); delete dep; } // removes single signals, bridge head, pedestrians, stops, changes catenary etc weg_t *weg=gr->get_weg_nr(1); if(weg) { - gr->remove_everything_from_way(sp,weg->get_waytype(),bridge_ribi); + gr->remove_everything_from_way(player,weg->get_waytype(),bridge_ribi); } - gr->remove_everything_from_way(sp,wegtyp,bridge_ribi); // removes stop and signals correctly + gr->remove_everything_from_way(player,wegtyp,bridge_ribi); // removes stop and signals correctly // corrects the ways weg = gr->get_weg(wegtyp); diff --git a/bauer/brueckenbauer.h b/bauer/brueckenbauer.h index 6ba13a73e94..c32dabe31d2 100644 --- a/bauer/brueckenbauer.h +++ b/bauer/brueckenbauer.h @@ -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; @@ -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. @@ -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. @@ -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 @@ -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. @@ -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. @@ -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 @@ -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. diff --git a/bauer/fabrikbauer.cc b/bauer/fabrikbauer.cc index c821a0a2258..fe40ca267a3 100644 --- a/bauer/fabrikbauer.cc +++ b/bauer/fabrikbauer.cc @@ -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; } @@ -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 ? */); @@ -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 @@ -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; @@ -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; iget_lieferanten() && i update map if needed @@ -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 @@ -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" ); @@ -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 ); @@ -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(); diff --git a/bauer/fabrikbauer.h b/bauer/fabrikbauer.h index ac2f6140366..f971b7fda22 100644 --- a/bauer/fabrikbauer.h +++ b/bauer/fabrikbauer.h @@ -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; @@ -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: @@ -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. diff --git a/bauer/hausbauer.cc b/bauer/hausbauer.cc index 872aef63494..1bdbd78a392 100644 --- a/bauer/hausbauer.cc +++ b/bauer/hausbauer.cc @@ -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(); @@ -338,9 +338,9 @@ void hausbauer_t::remove( spieler_t *sp, gebaeude_t *gb ) } // tell players of the deletion for(uint8 i=0; iget_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 @@ -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) { @@ -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; @@ -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; } @@ -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 @@ -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) @@ -644,28 +644,28 @@ 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() ); @@ -673,7 +673,7 @@ gebaeude_t *hausbauer_t::neues_gebaeude(spieler_t *sp, koord3d pos, int built_la } } 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); diff --git a/bauer/hausbauer.h b/bauer/hausbauer.h index 60ba84b0df8..2fa745f4e58 100644 --- a/bauer/hausbauer.h +++ b/bauer/hausbauer.h @@ -15,7 +15,7 @@ class gebaeude_t; class karte_ptr_t; -class spieler_t; +class player_t; class tool_selector_t; /** @@ -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. @@ -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 *get_list(haus_besch_t::utyp typ); diff --git a/bauer/tunnelbauer.cc b/bauer/tunnelbauer.cc index 49c6b3eb61d..2ea12c4023a 100644 --- a/bauer/tunnelbauer.cc +++ b/bauer/tunnelbauer.cc @@ -137,13 +137,13 @@ void tunnelbauer_t::fill_menu(tool_selector_t* tool_selector, const waytype_t wt /* now construction stuff */ -koord3d tunnelbauer_t::finde_ende(spieler_t *sp, koord3d pos, koord zv, const tunnel_besch_t *besch, bool full_tunnel, const char** msg) +koord3d tunnelbauer_t::finde_ende(player_t *player, koord3d pos, koord zv, const tunnel_besch_t *besch, bool full_tunnel, const char** msg) { const grund_t *gr; leitung_t *lt; waytype_t wegtyp = besch->get_waytype(); // use the is_allowed_step routine of wegbauer_t, needs an instance - wegbauer_t bauigel(sp); + wegbauer_t bauigel(player); bauigel.route_fuer( wegbauer_t::tunnel_flag | (wegbauer_t::bautyp_t)wegtyp, wegbauer_t::weg_search( wegtyp, 1, 0, weg_t::type_flat ), besch); long dummy; @@ -166,7 +166,7 @@ koord3d tunnelbauer_t::finde_ende(spieler_t *sp, koord3d pos, koord zv, const tu karte_t::terraformer_t raise(welt); raise.add_raise_node(pos.x, pos.y, hsw, hse, hne, hnw); raise.iterate(true); - if (raise.can_raise_all(sp)) { + if (raise.can_raise_all(player)) { // returned true therefore error reported return koord3d::invalid; } @@ -177,7 +177,7 @@ koord3d tunnelbauer_t::finde_ende(spieler_t *sp, koord3d pos, koord zv, const tu return koord3d::invalid; } - if (const char* err = welt->get_scenario()->is_work_allowed_here(sp, TOOL_BUILD_TUNNEL|GENERAL_TOOL, wegtyp, pos)) { + if (const char* err = welt->get_scenario()->is_work_allowed_here(player, TOOL_BUILD_TUNNEL|GENERAL_TOOL, wegtyp, pos)) { if (msg) { *msg = err; } @@ -234,7 +234,7 @@ koord3d tunnelbauer_t::finde_ende(spieler_t *sp, koord3d pos, koord zv, const tu raise.iterate(false); lower.add_lower_node(pos.x, pos.y, hsw, hse, hne, hnw); lower.iterate(false); - if (raise.can_lower_all(sp) || lower.can_lower_all(sp)) { + if (raise.can_lower_all(player) || lower.can_lower_all(player)) { // returned true therefore error reported return koord3d::invalid; } @@ -294,7 +294,7 @@ koord3d tunnelbauer_t::finde_ende(spieler_t *sp, koord3d pos, koord zv, const tu } -const char *tunnelbauer_t::baue( spieler_t *sp, koord pos, const tunnel_besch_t *besch, bool full_tunnel ) +const char *tunnelbauer_t::baue( player_t *player, koord pos, const tunnel_besch_t *besch, bool full_tunnel ) { assert( besch ); @@ -345,7 +345,7 @@ const char *tunnelbauer_t::baue( spieler_t *sp, koord pos, const tunnel_besch_t // Search tunnel end and check intermediate tiles const char *err = NULL; - koord3d end = finde_ende(sp, gr->get_pos(), zv, besch, full_tunnel, &err); + koord3d end = finde_ende(player, gr->get_pos(), zv, besch, full_tunnel, &err); if (err) { return err; } @@ -357,7 +357,7 @@ const char *tunnelbauer_t::baue( spieler_t *sp, koord pos, const tunnel_besch_t // check ownership if (const grund_t *gr_end = welt->lookup(end)) { if (weg_t *weg_end = gr_end->get_weg(wegtyp)) { - if (weg_end->ist_entfernbar(sp)!=NULL) { + if (weg_end->ist_entfernbar(player)!=NULL) { return "Das Feld gehoert\neinem anderen Spieler\n"; } } @@ -381,24 +381,24 @@ const char *tunnelbauer_t::baue( spieler_t *sp, koord pos, const tunnel_besch_t lower.add_lower_node(end.x, end.y, hsw, hse, hne, hnw); raise.iterate(true); lower.iterate(false); - err = raise.can_raise_all(sp); - if (!err) err = lower.can_lower_all(sp); + err = raise.can_raise_all(player); + if (!err) err = lower.can_lower_all(player); if (err) return 0; // TODO: this is rather hackish as 4 seems to come from nowhere but works most of the time // feel free to change if you have a better idea! n = (raise.raise_all()+lower.lower_all())/4; - spieler_t::book_construction_costs(sp, welt->get_settings().cst_alter_land * n, end.get_2d(), besch->get_waytype()); + player_t::book_construction_costs(player, welt->get_settings().cst_alter_land * n, end.get_2d(), besch->get_waytype()); } - if(!baue_tunnel(sp, gr->get_pos(), end, zv, besch)) { + if(!baue_tunnel(player, gr->get_pos(), end, zv, besch)) { return "Ways not connected"; } return NULL; } -bool tunnelbauer_t::baue_tunnel(spieler_t *sp, koord3d start, koord3d end, koord zv, const tunnel_besch_t *besch) +bool tunnelbauer_t::baue_tunnel(player_t *player, koord3d start, koord3d end, koord zv, const tunnel_besch_t *besch) { ribi_t::ribi ribi = 0; weg_t *weg = NULL; @@ -417,7 +417,7 @@ DBG_MESSAGE("tunnelbauer_t::baue()","build from (%d,%d,%d) to (%d,%d,%d) ", pos. weg_besch = wegbauer_t::weg_search( wegtyp, besch->get_topspeed(), 0, weg_t::type_flat ); } - baue_einfahrt(sp, pos, zv, besch, weg_besch, cost); + baue_einfahrt(player, pos, zv, besch, weg_besch, cost); ribi = ribi_typ(-zv); // don't move on to next tile if only one tile long @@ -439,21 +439,21 @@ DBG_MESSAGE("tunnelbauer_t::baue()","build from (%d,%d,%d) to (%d,%d,%d) ", pos. weg = weg_t::alloc(besch->get_waytype()); weg->set_besch(weg_besch); weg->set_max_speed(besch->get_topspeed()); - tunnel->neuen_weg_bauen(weg, ribi_t::doppelt(ribi), sp); - spieler_t::add_maintenance( sp, -weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype() ); + tunnel->neuen_weg_bauen(weg, ribi_t::doppelt(ribi), player); + player_t::add_maintenance( player, -weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype() ); } else { - lt = new leitung_t(tunnel->get_pos(), sp); + lt = new leitung_t(tunnel->get_pos(), player); lt->set_besch(weg_besch); tunnel->obj_add( lt ); lt->laden_abschliessen(); - spieler_t::add_maintenance( sp, -weg_besch->get_wartung(), powerline_wt ); + player_t::add_maintenance( player, -weg_besch->get_wartung(), powerline_wt ); } - tunnel->obj_add(new tunnel_t(pos, sp, besch)); + tunnel->obj_add(new tunnel_t(pos, player, besch)); tunnel->calc_bild(); tunnel->set_flag(grund_t::dirty); assert(!tunnel->ist_karten_boden()); - spieler_t::add_maintenance( sp, besch->get_wartung(), besch->get_finance_waytype() ); + player_t::add_maintenance( player, besch->get_wartung(), besch->get_finance_waytype() ); cost += besch->get_preis(); pos = pos + zv; } @@ -466,7 +466,7 @@ DBG_MESSAGE("tunnelbauer_t::baue()","build from (%d,%d,%d) to (%d,%d,%d) ", pos. } else if (gr_end->ist_karten_boden()) { // if end is above ground construct an exit - baue_einfahrt(sp, pos, -zv, besch, weg_besch, cost); + baue_einfahrt(player, pos, -zv, besch, weg_besch, cost); gr_end = NULL; // invalid - replaced by tunnel ground // calc new back image for the ground if (end!=start && grund_t::underground_mode) { @@ -488,30 +488,30 @@ DBG_MESSAGE("tunnelbauer_t::baue()","build from (%d,%d,%d) to (%d,%d,%d) ", pos. weg = weg_t::alloc(besch->get_waytype()); weg->set_besch(weg_besch); weg->set_max_speed(besch->get_topspeed()); - tunnel->neuen_weg_bauen(weg, ribi, sp); - spieler_t::add_maintenance( sp, -weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype() ); + tunnel->neuen_weg_bauen(weg, ribi, player); + player_t::add_maintenance( player, -weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype() ); } else { - lt = new leitung_t(tunnel->get_pos(), sp); + lt = new leitung_t(tunnel->get_pos(), player); lt->set_besch(weg_besch); tunnel->obj_add( lt ); lt->laden_abschliessen(); - spieler_t::add_maintenance( sp, -weg_besch->get_wartung(), powerline_wt ); + player_t::add_maintenance( player, -weg_besch->get_wartung(), powerline_wt ); } - tunnel->obj_add(new tunnel_t(pos, sp, besch)); + tunnel->obj_add(new tunnel_t(pos, player, besch)); tunnel->calc_bild(); tunnel->set_flag(grund_t::dirty); assert(!tunnel->ist_karten_boden()); - spieler_t::add_maintenance( sp, besch->get_wartung(), besch->get_finance_waytype() ); + player_t::add_maintenance( player, besch->get_wartung(), besch->get_finance_waytype() ); cost += besch->get_preis(); } - spieler_t::book_construction_costs(sp, -cost, start.get_2d(), besch->get_waytype()); + player_t::book_construction_costs(player, -cost, start.get_2d(), besch->get_waytype()); return true; } -void tunnelbauer_t::baue_einfahrt(spieler_t *sp, koord3d end, koord zv, const tunnel_besch_t *besch, const weg_besch_t *weg_besch, int &cost) +void tunnelbauer_t::baue_einfahrt(player_t *player, koord3d end, koord zv, const tunnel_besch_t *besch, const weg_besch_t *weg_besch, int &cost) { grund_t *alter_boden = welt->lookup(end); ribi_t::ribi ribi = 0; @@ -520,7 +520,7 @@ void tunnelbauer_t::baue_einfahrt(spieler_t *sp, koord3d end, koord zv, const tu } tunnelboden_t *tunnel = new tunnelboden_t( end, alter_boden->get_grund_hang()); - tunnel->obj_add(new tunnel_t(end, sp, besch)); + tunnel->obj_add(new tunnel_t(end, player, besch)); weg_t *weg = NULL; if(besch->get_waytype()!=powerline_wt) { @@ -540,23 +540,23 @@ void tunnelbauer_t::baue_einfahrt(spieler_t *sp, koord3d end, koord zv, const tu if( weg_besch ) { weg->set_besch( weg_besch ); } - tunnel->neuen_weg_bauen( weg, ribi, sp ); + tunnel->neuen_weg_bauen( weg, ribi, player ); } - spieler_t::add_maintenance( sp, -weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype() ); + player_t::add_maintenance( player, -weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype() ); weg->set_max_speed( besch->get_topspeed() ); } else { leitung_t *lt = tunnel->get_leitung(); if(!lt) { - lt = new leitung_t(tunnel->get_pos(), sp); + lt = new leitung_t(tunnel->get_pos(), player); lt->set_besch(weg_besch); tunnel->obj_add( lt ); - spieler_t::add_maintenance( sp, -weg_besch->get_wartung(), powerline_wt ); + player_t::add_maintenance( player, -weg_besch->get_wartung(), powerline_wt ); } else { // subtract twice maintenance: once for the already existing powerline // once since leitung_t::laden_abschliessen will add it again - spieler_t::add_maintenance( sp, -2*lt->get_besch()->get_wartung(), powerline_wt ); + player_t::add_maintenance( player, -2*lt->get_besch()->get_wartung(), powerline_wt ); } lt->laden_abschliessen(); } @@ -583,7 +583,7 @@ void tunnelbauer_t::baue_einfahrt(spieler_t *sp, koord3d end, koord zv, const tu weg_t *way_outside = ground_outside->get_weg( besch->get_waytype() ); if( way_outside ) { // use the check_owner routine of wegbauer_t (not spieler_t!), needs an instance - wegbauer_t bauigel(sp); + wegbauer_t bauigel(player); bauigel.route_fuer( (wegbauer_t::bautyp_t)besch->get_waytype(), way_outside->get_besch()); long dummy; if(bauigel.is_allowed_step(tunnel, ground_outside, &dummy)) { @@ -599,14 +599,14 @@ void tunnelbauer_t::baue_einfahrt(spieler_t *sp, koord3d end, koord zv, const tu } - if(sp!=NULL) { - spieler_t::add_maintenance( sp, besch->get_wartung(), besch->get_finance_waytype() ); + if(player!=NULL) { + player_t::add_maintenance( player, besch->get_wartung(), besch->get_finance_waytype() ); } cost += besch->get_preis(); } -const char *tunnelbauer_t::remove(spieler_t *sp, koord3d start, waytype_t wegtyp, bool remove_all ) +const char *tunnelbauer_t::remove(player_t *player, koord3d start, waytype_t wegtyp, bool remove_all ) { marker_t& marker = marker_t::instance(welt->get_size().x, welt->get_size().y); slist_tpl end_list; @@ -639,7 +639,7 @@ const char *tunnelbauer_t::remove(spieler_t *sp, koord3d start, waytype_t wegtyp part_list.insert(pos); } // Alle Tunnelteile auf Entfernbarkeit prüfen! - if( from->kann_alle_obj_entfernen(sp) ) { + if( from->kann_alle_obj_entfernen(player) ) { return "Der Tunnel ist nicht frei!\n"; } @@ -675,11 +675,11 @@ const char *tunnelbauer_t::remove(spieler_t *sp, koord3d start, waytype_t wegtyp grund_t *gr = welt->lookup(pos); // remove the second way first in the tunnel if(gr->get_weg_nr(1)) { - gr->remove_everything_from_way(sp,gr->get_weg_nr(1)->get_waytype(),ribi_t::keine); + gr->remove_everything_from_way(player,gr->get_weg_nr(1)->get_waytype(),ribi_t::keine); } - gr->remove_everything_from_way(sp,wegtyp,ribi_t::keine); // removes stop and signals correctly + gr->remove_everything_from_way(player,wegtyp,ribi_t::keine); // removes stop and signals correctly // remove everything else - gr->obj_loesche_alle(sp); + gr->obj_loesche_alle(player); gr->mark_image_dirty(); welt->access(pos.get_2d())->boden_entfernen(gr); delete gr; @@ -696,13 +696,13 @@ const char *tunnelbauer_t::remove(spieler_t *sp, koord3d start, waytype_t wegtyp // remove tunnel portals tunnel_t *t = gr->find(); if(t) { - t->entferne(sp); + t->entferne(player); delete t; } if (leitung_t *lt = gr->get_leitung()) { // remove single powerlines if ( (lt->get_ribi() & ~ribi_typ(gr->get_grund_hang())) == ribi_t::keine ) { - lt->entferne(sp); + lt->entferne(player); delete lt; } } @@ -712,19 +712,19 @@ const char *tunnelbauer_t::remove(spieler_t *sp, koord3d start, waytype_t wegtyp // remove the second way first in the tunnel if(gr->get_weg_nr(1)) { - gr->remove_everything_from_way(sp,gr->get_weg_nr(1)->get_waytype(),gr->get_weg_nr(1)->get_ribi_unmasked() & mask); + gr->remove_everything_from_way(player,gr->get_weg_nr(1)->get_waytype(),gr->get_weg_nr(1)->get_ribi_unmasked() & mask); } // removes single signals, bridge head, pedestrians, stops, changes catenary etc ribi_t::ribi ribi = gr->get_weg_ribi_unmasked(wegtyp) & mask; tunnel_t *t = gr->find(); uint8 broad_type = t->get_broad_type(); - gr->remove_everything_from_way(sp,wegtyp,ribi); // removes stop and signals correctly + gr->remove_everything_from_way(player,wegtyp,ribi); // removes stop and signals correctly // remove tunnel portals t = gr->find(); if(t) { - t->entferne(sp); + t->entferne(player); delete t; } diff --git a/bauer/tunnelbauer.h b/bauer/tunnelbauer.h index 52f8fa0f279..4f0fd35036f 100644 --- a/bauer/tunnelbauer.h +++ b/bauer/tunnelbauer.h @@ -13,7 +13,7 @@ #include "../dataobj/koord3d.h" 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 tunnel_besch_t; class weg_besch_t; class tool_selector_t; @@ -30,13 +30,13 @@ class tunnelbauer_t { private: static karte_ptr_t welt; - static bool baue_tunnel(spieler_t *sp, koord3d pos, koord3d end, koord zv, const tunnel_besch_t *besch); - static void baue_einfahrt(spieler_t *sp, koord3d end, koord zv, const tunnel_besch_t *besch, const weg_besch_t *weg_besch, int &cost); + static bool baue_tunnel(player_t *player, koord3d pos, koord3d end, koord zv, const tunnel_besch_t *besch); + static void baue_einfahrt(player_t *player, koord3d end, koord zv, const tunnel_besch_t *besch, const weg_besch_t *weg_besch, int &cost); tunnelbauer_t() {} // private -> no instance please public: - static koord3d finde_ende(spieler_t *sp, koord3d pos, koord zv, const tunnel_besch_t *besch, bool full_tunnel=true, const char** msg=NULL); + static koord3d finde_ende(player_t *player, koord3d pos, koord zv, const tunnel_besch_t *besch, bool full_tunnel=true, const char** msg=NULL); static void register_besch(tunnel_besch_t *besch); @@ -46,9 +46,9 @@ class tunnelbauer_t { static void fill_menu(tool_selector_t *tool_selector, const waytype_t wtyp, sint16 sound_ok); - static const char *baue( spieler_t *sp, koord pos, const tunnel_besch_t *besch, bool full_tunnel ); + static const char *baue( player_t *player, koord pos, const tunnel_besch_t *besch, bool full_tunnel ); - static const char *remove(spieler_t *sp, koord3d pos, waytype_t wegtyp, bool all); + static const char *remove(player_t *player, koord3d pos, waytype_t wegtyp, bool all); }; #endif diff --git a/bauer/vehikelbauer.cc b/bauer/vehikelbauer.cc index 2a6ce7d0031..bd1feaee17a 100644 --- a/bauer/vehikelbauer.cc +++ b/bauer/vehikelbauer.cc @@ -162,24 +162,24 @@ void vehikelbauer_t::rdwr_speedbonus(loadsave_t *file) } -vehikel_t* vehikelbauer_t::baue(koord3d k, spieler_t* sp, convoi_t* cnv, const vehikel_besch_t* vb ) +vehikel_t* vehikelbauer_t::baue(koord3d k, player_t* player, convoi_t* cnv, const vehikel_besch_t* vb ) { vehikel_t* v; switch (vb->get_waytype()) { - case road_wt: v = new automobil_t( k, vb, sp, cnv); break; - case monorail_wt: v = new monorail_waggon_t(k, vb, sp, cnv); break; + case road_wt: v = new automobil_t( k, vb, player, cnv); break; + case monorail_wt: v = new monorail_waggon_t(k, vb, player, cnv); break; case track_wt: - case tram_wt: v = new waggon_t( k, vb, sp, cnv); break; - case water_wt: v = new schiff_t( k, vb, sp, cnv); break; - case air_wt: v = new aircraft_t( k, vb, sp, cnv); break; - case maglev_wt: v = new maglev_waggon_t( k, vb, sp, cnv); break; - case narrowgauge_wt:v = new narrowgauge_waggon_t(k, vb, sp, cnv); break; + case tram_wt: v = new waggon_t( k, vb, player, cnv); break; + case water_wt: v = new schiff_t( k, vb, player, cnv); break; + case air_wt: v = new aircraft_t( k, vb, player, cnv); break; + case maglev_wt: v = new maglev_waggon_t( k, vb, player, cnv); break; + case narrowgauge_wt:v = new narrowgauge_waggon_t(k, vb, player, cnv); break; default: dbg->fatal("vehikelbauer_t::baue()", "cannot built a vehicle with waytype %i", vb->get_waytype()); } - sp->book_new_vehicle(-(sint64)vb->get_preis(), k.get_2d(), vb->get_waytype() ); + player->book_new_vehicle(-(sint64)vb->get_preis(), k.get_2d(), vb->get_waytype() ); return v; } diff --git a/bauer/vehikelbauer.h b/bauer/vehikelbauer.h index b7e9b40db02..f6ed1156762 100644 --- a/bauer/vehikelbauer.h +++ b/bauer/vehikelbauer.h @@ -14,7 +14,7 @@ #include class vehikel_t; -class spieler_t; +class player_t; class convoi_t; class vehikel_besch_t; class ware_besch_t; @@ -37,7 +37,7 @@ class vehikelbauer_t static bool register_besch(const vehikel_besch_t *besch); static bool alles_geladen(); - static vehikel_t* baue(koord3d k, spieler_t* sp, convoi_t* cnv, const vehikel_besch_t* vb ); + static vehikel_t* baue(koord3d k, player_t* player, convoi_t* cnv, const vehikel_besch_t* vb ); static const vehikel_besch_t * get_info(const char *name); static slist_tpl const& get_info(waytype_t); diff --git a/bauer/wegbauer.cc b/bauer/wegbauer.cc index 699e9141d92..595593aa72f 100644 --- a/bauer/wegbauer.cc +++ b/bauer/wegbauer.cc @@ -322,7 +322,7 @@ void wegbauer_t::fill_menu(tool_selector_t *tool_selector, const waytype_t wtyp, /* allow for railroad crossing * @author prissi */ -bool wegbauer_t::check_crossing(const koord zv, const grund_t *bd, waytype_t wtyp0, const spieler_t *sp) const +bool wegbauer_t::check_crossing(const koord zv, const grund_t *bd, waytype_t wtyp0, const player_t *player_) const { const waytype_t wtyp = wtyp0==tram_wt ? track_wt : wtyp0; // nothing to cross here @@ -350,7 +350,7 @@ bool wegbauer_t::check_crossing(const koord zv, const grund_t *bd, waytype_t wty return true; } // right owner of the other way - if(!check_owner(w->get_besitzer(),sp)) { + if(!check_owner(w->get_besitzer(),player_)) { return false; } // check for existing crossing @@ -445,10 +445,10 @@ bool wegbauer_t::check_slope( const grund_t *from, const grund_t *to ) // allowed owner? -bool wegbauer_t::check_owner( const spieler_t *sp1, const spieler_t *sp2 ) const +bool wegbauer_t::check_owner( const player_t *player1, const player_t *player2 ) const { // unowned, mine or public property or superuser ... ? - return sp1==NULL || sp1==sp2 || sp1==welt->get_spieler(1) || sp2==welt->get_spieler(1); + return player1==NULL || player1==player2 || player1==welt->get_player(1) || player2==welt->get_player(1); } @@ -543,7 +543,7 @@ bool wegbauer_t::is_allowed_step( const grund_t *from, const grund_t *to, long * bool ok = true; // check scenario conditions - if (welt->get_scenario()->is_work_allowed_here(sp, (bautyp&tunnel_flag ? TOOL_BUILD_TUNNEL : TOOL_BUILD_WAY)|GENERAL_TOOL, bautyp&bautyp_mask, to->get_pos()) != NULL) { + if (welt->get_scenario()->is_work_allowed_here(player_builder, (bautyp&tunnel_flag ? TOOL_BUILD_TUNNEL : TOOL_BUILD_WAY)|GENERAL_TOOL, bautyp&bautyp_mask, to->get_pos()) != NULL) { return false; } @@ -561,7 +561,7 @@ bool wegbauer_t::is_allowed_step( const grund_t *from, const grund_t *to, long * if(gb) { // no halt => citybuilding => do not touch // also check for too high buildings ... - if(!check_owner(gb->get_besitzer(),sp) || gb->get_tile()->get_hintergrund(0,1,0)!=IMG_LEER) { + if(!check_owner(gb->get_besitzer(),player_builder) || gb->get_tile()->get_hintergrund(0,1,0)!=IMG_LEER) { return false; } // building above houses is expensive ... avoid it! @@ -578,7 +578,7 @@ bool wegbauer_t::is_allowed_step( const grund_t *from, const grund_t *to, long * if(to2) { if(to2->get_weg_nr(0)) { // already an elevated ground here => it will have always a way object, that indicates ownership - ok = to2->get_typ()==grund_t::monorailboden && check_owner(to2->obj_bei(0)->get_besitzer(),sp); + ok = to2->get_typ()==grund_t::monorailboden && check_owner(to2->obj_bei(0)->get_besitzer(),player_builder); ok &= to2->get_weg_nr(0)->get_besch()->get_wtyp()==besch->get_wtyp(); } else { @@ -653,7 +653,7 @@ bool wegbauer_t::is_allowed_step( const grund_t *from, const grund_t *to, long * // universal check for crossings if (to!=from && (bautyp&bautyp_mask)!=leitung) { waytype_t const wtyp = (bautyp == river) ? water_wt : (waytype_t)(bautyp & bautyp_mask); - if(!check_crossing(zv,to,wtyp,sp) || !check_crossing(-zv,from,wtyp,sp)) { + if(!check_crossing(zv,to,wtyp,player_builder) || !check_crossing(-zv,from,wtyp,player_builder)) { return false; } } @@ -707,7 +707,7 @@ bool wegbauer_t::is_allowed_step( const grund_t *from, const grund_t *to, long * } // ok, regular construction here // if no way there: check for right ground type, otherwise check owner - ok = sch==NULL ? (!fundament && !to->ist_wasser()) : check_owner(sch->get_besitzer(),sp); + ok = sch==NULL ? (!fundament && !to->ist_wasser()) : check_owner(sch->get_besitzer(),player_builder); if(!ok) { return false; } @@ -734,7 +734,7 @@ bool wegbauer_t::is_allowed_step( const grund_t *from, const grund_t *to, long * const weg_t *sch=to->get_weg(track_wt); // roads are checked in check_crossing // if no way there: check for right ground type, otherwise check owner - ok = sch==NULL ? (!fundament && !to->ist_wasser()) : check_owner(sch->get_besitzer(),sp); + ok = sch==NULL ? (!fundament && !to->ist_wasser()) : check_owner(sch->get_besitzer(),player_builder); // tram track allowed in road tunnels, but only along existing roads / tracks if(from!=to) { if(from->ist_tunnel()) { @@ -777,7 +777,7 @@ bool wegbauer_t::is_allowed_step( const grund_t *from, const grund_t *to, long * // do not connect to other powerlines { leitung_t *lt = to->get_leitung(); - ok &= (lt==NULL) || check_owner(sp, lt->get_besitzer()); + ok &= (lt==NULL) || check_owner(player_builder, lt->get_besitzer()); } if(to->get_typ()!=grund_t::tunnelboden) { @@ -993,7 +993,7 @@ void wegbauer_t::do_terraforming() changed = true; if (last_terraformed != i) { // charge player - spieler_t::book_construction_costs(sp, welt->get_settings().cst_set_slope, from->get_pos().get_2d(), ignore_wt); + player_t::book_construction_costs(player_builder, welt->get_settings().cst_set_slope, from->get_pos().get_2d(), ignore_wt); } } // change slope of to @@ -1019,7 +1019,7 @@ void wegbauer_t::do_terraforming() } changed = true; // charge player - spieler_t::book_construction_costs(sp, welt->get_settings().cst_set_slope, to->get_pos().get_2d(), ignore_wt); + player_t::book_construction_costs(player_builder, welt->get_settings().cst_set_slope, to->get_pos().get_2d(), ignore_wt); last_terraformed = i+1; // do not pay twice for terraforming one tile } // recalc slope image of neighbors @@ -1100,7 +1100,7 @@ void wegbauer_t::check_for_bridge(const grund_t* parent_from, const grund_t* fro // ok, so now we do a closer investigation if( bruecke_besch && ( ribi_typ(from->get_grund_hang()) == ribi_t::rueckwaerts(ribi_typ(zv)) || from->get_grund_hang() == 0 ) - && brueckenbauer_t::ist_ende_ok(sp, from, besch->get_wtyp(),ribi_t::rueckwaerts(ribi_typ(zv))) ) { + && brueckenbauer_t::ist_ende_ok(player_builder, from, besch->get_wtyp(),ribi_t::rueckwaerts(ribi_typ(zv))) ) { // Try a bridge. const long cost_difference=besch->get_wartung()>0 ? (bruecke_besch->get_wartung()*4l+3l)/besch->get_wartung() : 16; const char *error; @@ -1110,10 +1110,10 @@ void wegbauer_t::check_for_bridge(const grund_t* parent_from, const grund_t* fro uint32 min_length = 1; for (uint8 i = 0; i < 8 && min_length <= welt->get_settings().way_max_bridge_len; ++i) { sint8 bridge_height; - end = brueckenbauer_t::finde_ende( sp, from->get_pos(), zv, bruecke_besch, error, bridge_height, true, min_length ); + end = brueckenbauer_t::finde_ende( player_builder, from->get_pos(), zv, bruecke_besch, error, bridge_height, true, min_length ); gr_end = welt->lookup(end); uint32 length = koord_distance(from->get_pos(), end); - if( gr_end && !error && !ziel.is_contained(end) && brueckenbauer_t::ist_ende_ok(sp, gr_end, besch->get_wtyp(), ribi_typ(zv)) && length <= welt->get_settings().way_max_bridge_len ) { + if( gr_end && !error && !ziel.is_contained(end) && brueckenbauer_t::ist_ende_ok(player_builder, gr_end, besch->get_wtyp(), ribi_typ(zv)) && length <= welt->get_settings().way_max_bridge_len ) { // If there is a slope on the starting tile, it's taken into account in is_allowed_step, but a bridge will be flat! sint8 num_slopes = (from->get_grund_hang() == hang_t::flach) ? 1 : -1; // On the end tile, we haven't to subtract way_count_slope, since is_allowed_step isn't called with this tile. @@ -1131,7 +1131,7 @@ void wegbauer_t::check_for_bridge(const grund_t* parent_from, const grund_t* fro if( tunnel_besch && ribi_typ(from->get_grund_hang()) == ribi_typ(zv) ) { // uphill hang ... may be tunnel? const long cost_difference=besch->get_wartung()>0 ? (tunnel_besch->get_wartung()*4l+3l)/besch->get_wartung() : 16; - koord3d end = tunnelbauer_t::finde_ende( sp, from->get_pos(), zv, tunnel_besch); + koord3d end = tunnelbauer_t::finde_ende( player_builder, from->get_pos(), zv, tunnel_besch); if( end != koord3d::invalid && !ziel.is_contained(end) ) { uint32 length = koord_distance(from->get_pos(), end); next_gr.append(next_gr_t(welt->lookup(end), length * cost_difference, build_straight | build_tunnel_bridge )); @@ -1141,10 +1141,10 @@ void wegbauer_t::check_for_bridge(const grund_t* parent_from, const grund_t* fro } -wegbauer_t::wegbauer_t(spieler_t* spl) : next_gr(32) +wegbauer_t::wegbauer_t(player_t* player_) : next_gr(32) { n = 0; - sp = spl; + player_builder = player_; bautyp = strasse; // kann mit route_fuer() gesetzt werden maximum = 2000;// CA $ PER TILE @@ -1186,7 +1186,7 @@ void wegbauer_t::route_fuer(bautyp_t wt, const weg_besch_t *b, const tunnel_besc if((wt&bautyp_mask)==luft) { wt &= bautyp_mask | bot_flag; } - if(sp==NULL) { + if(player_builder==NULL) { bruecke_besch = NULL; tunnel_besch = NULL; } @@ -1693,7 +1693,7 @@ bool wegbauer_t::intern_calc_route_runways(koord3d start3d, const koord3d ziel3d // not too close to the border? if( !(welt->is_within_limits(start-koord(5,5)) && welt->is_within_limits(start+koord(5,5))) || !(welt->is_within_limits(ziel-koord(5,5)) && welt->is_within_limits(ziel+koord(5,5))) ) { - if(sp==welt->get_active_player()) { + if(player_builder==welt->get_active_player()) { create_win( new news_img("Zu nah am Kartenrand"), w_time_delete, magic_none); return false; } @@ -1872,11 +1872,11 @@ void wegbauer_t::baue_tunnel_und_bruecken() if(start->get_grund_hang()==0 || start->get_grund_hang()==hang_typ(zv*(-1))) { // bridge here, since the route is saved backwards, we have to build it at the posterior end - brueckenbauer_t::baue( sp, route[i+1], bruecke_besch); + brueckenbauer_t::baue( player_builder, route[i+1], bruecke_besch); } else { // tunnel - tunnelbauer_t::baue( sp, route[i].get_2d(), tunnel_besch, true ); + tunnelbauer_t::baue( player_builder, route[i].get_2d(), tunnel_besch, true ); } INT_CHECK( "wegbauer 1584" ); } @@ -1895,21 +1895,21 @@ void wegbauer_t::baue_tunnel_und_bruecken() // now: check ownership weg_t *wi = gr_i->get_weg(wt); weg_t *wi1 = gr_i1->get_weg(wt); - if(wi->get_besitzer()==sp && wi1->get_besitzer()==sp) { + if(wi->get_besitzer()==player_builder && wi1->get_besitzer()==player_builder) { // we are the owner if( h != hang_typ(zv) ) { // its a bridge if( bruecke_besch ) { wi->set_ribi(ribi_typ(h)); wi1->set_ribi(ribi_typ(hang_t::gegenueber(h))); - brueckenbauer_t::baue( sp, route[i], bruecke_besch); + brueckenbauer_t::baue( player_builder, route[i], bruecke_besch); } } else if( tunnel_besch ) { // make a short tunnel wi->set_ribi(ribi_typ(hang_t::gegenueber(h))); wi1->set_ribi(ribi_typ(h)); - tunnelbauer_t::baue( sp, route[i].get_2d(), tunnel_besch, true ); + tunnelbauer_t::baue( player_builder, route[i].get_2d(), tunnel_besch, true ); } INT_CHECK( "wegbauer 1584" ); } @@ -2076,22 +2076,22 @@ bool wegbauer_t::baue_tunnelboden() if( tunnel_besch->get_waytype() != powerline_wt ) { weg_t *weg = weg_t::alloc(tunnel_besch->get_waytype()); weg->set_besch( wb ); - tunnel->neuen_weg_bauen(weg, route.get_ribi(i), sp); - tunnel->obj_add(new tunnel_t(route[i], sp, tunnel_besch)); + tunnel->neuen_weg_bauen(weg, route.get_ribi(i), player_builder); + tunnel->obj_add(new tunnel_t(route[i], player_builder, tunnel_besch)); weg->set_max_speed(tunnel_besch->get_topspeed()); - spieler_t::add_maintenance( sp, -weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype()); + player_t::add_maintenance( player_builder, -weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype()); } else { - tunnel->obj_add(new tunnel_t(route[i], sp, tunnel_besch)); - leitung_t *lt = new leitung_t(tunnel->get_pos(), sp); + tunnel->obj_add(new tunnel_t(route[i], player_builder, tunnel_besch)); + leitung_t *lt = new leitung_t(tunnel->get_pos(), player_builder); lt->set_besch( wb ); tunnel->obj_add( lt ); lt->laden_abschliessen(); - spieler_t::add_maintenance( sp, -lt->get_besch()->get_wartung(), powerline_wt); + player_t::add_maintenance( player_builder, -lt->get_besch()->get_wartung(), powerline_wt); } tunnel->calc_bild(); cost -= tunnel_besch->get_preis(); - spieler_t::add_maintenance( sp, tunnel_besch->get_wartung(), tunnel_besch->get_finance_waytype() ); + player_t::add_maintenance( player_builder, tunnel_besch->get_wartung(), tunnel_besch->get_finance_waytype() ); } else if( gr->get_typ() == grund_t::tunnelboden ) { // check for extension only ... @@ -2102,8 +2102,8 @@ bool wegbauer_t::baue_tunnelboden() assert( tunnel ); // take the faster way if( !keep_existing_faster_ways || (tunnel->get_besch()->get_topspeed() < tunnel_besch->get_topspeed()) ) { - spieler_t::add_maintenance(sp, -tunnel->get_besch()->get_wartung(), tunnel->get_besch()->get_finance_waytype()); - spieler_t::add_maintenance(sp, tunnel_besch->get_wartung(), tunnel->get_besch()->get_finance_waytype() ); + player_t::add_maintenance(player_builder, -tunnel->get_besch()->get_wartung(), tunnel->get_besch()->get_finance_waytype()); + player_t::add_maintenance(player_builder, tunnel_besch->get_wartung(), tunnel->get_besch()->get_finance_waytype() ); tunnel->set_besch(tunnel_besch); weg_t *weg = gr->get_weg(tunnel_besch->get_waytype()); @@ -2122,18 +2122,18 @@ bool wegbauer_t::baue_tunnelboden() else { leitung_t *lt = gr->get_leitung(); if(!lt) { - lt = new leitung_t(gr->get_pos(), sp); + lt = new leitung_t(gr->get_pos(), player_builder); lt->set_besch( wb ); gr->obj_add( lt ); } else { lt->leitung_t::laden_abschliessen(); // only change powerline aspect - spieler_t::add_maintenance( sp, -lt->get_besch()->get_wartung(), powerline_wt); + player_t::add_maintenance( player_builder, -lt->get_besch()->get_wartung(), powerline_wt); } } } } - spieler_t::book_construction_costs(sp, cost, route[0].get_2d(), tunnel_besch->get_waytype()); + player_t::book_construction_costs(player_builder, cost, route[0].get_2d(), tunnel_besch->get_waytype()); return true; } @@ -2163,16 +2163,16 @@ void wegbauer_t::baue_elevated() void wegbauer_t::baue_strasse() { // only public player or cities (sp==NULL) can build cityroads with sidewalk - bool add_sidewalk = build_sidewalk && (sp==NULL || sp->get_player_nr()==1); + bool add_sidewalk = build_sidewalk && (player_builder==NULL || player_builder->get_player_nr()==1); if(add_sidewalk) { - sp = NULL; + player_builder = NULL; } // init undo - if(sp!=NULL) { + if(player_builder!=NULL) { // intercity roads have no owner, so we must check for an owner - sp->init_undo(road_wt,get_count()); + player_builder->init_undo(road_wt,get_count()); } for( uint32 i=0; iget_weg(road_wt); // keep faster ways or if it is the same way ... (@author prissi) - if(weg->get_besch()==besch || keep_existing_ways || (keep_existing_city_roads && weg->hat_gehweg()) || (keep_existing_faster_ways && weg->get_besch()->get_topspeed()>besch->get_topspeed()) || (sp!=NULL && weg->ist_entfernbar(sp)!=NULL) || (gr->get_typ()==grund_t::monorailboden && (bautyp&elevated_flag)==0)) { + if(weg->get_besch()==besch || keep_existing_ways || (keep_existing_city_roads && weg->hat_gehweg()) || (keep_existing_faster_ways && weg->get_besch()->get_topspeed()>besch->get_topspeed()) || (player_builder!=NULL && weg->ist_entfernbar(player_builder)!=NULL) || (gr->get_typ()==grund_t::monorailboden && (bautyp&elevated_flag)==0)) { //nothing to be done //DBG_MESSAGE("wegbauer_t::baue_strasse()","nothing to do at (%i,%i)",k.x,k.y); } else { // we take ownership => we take care to maintain the roads completely ... - spieler_t *s = weg->get_besitzer(); - spieler_t::add_maintenance(s, -weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype()); + player_t *s = weg->get_besitzer(); + player_t::add_maintenance(s, -weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype()); // cost is the more expensive one, so downgrading is between removing and new building cost -= max( weg->get_besch()->get_preis(), besch->get_preis() ); weg->set_besch(besch); @@ -2212,8 +2212,8 @@ void wegbauer_t::baue_strasse() weg->set_max_speed( wo->get_besch()->get_topspeed() ); } weg->set_gehweg(add_sidewalk); - spieler_t::add_maintenance( sp, weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype()); - weg->set_besitzer(sp); + player_t::add_maintenance( player_builder, weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype()); + weg->set_besitzer(player_builder); } } else { @@ -2222,17 +2222,17 @@ void wegbauer_t::baue_strasse() str->set_besch(besch); str->set_gehweg(add_sidewalk); - cost = -gr->neuen_weg_bauen(str, route.get_short_ribi(i), sp)-besch->get_preis(); + cost = -gr->neuen_weg_bauen(str, route.get_short_ribi(i), player_builder)-besch->get_preis(); // prissi: into UNDO-list, so we can remove it later - if(sp!=NULL) { + if(player_builder!=NULL) { // intercity roads have no owner, so we must check for an owner - sp->add_undo( route[i] ); + player_builder->add_undo( route[i] ); } } gr->calc_bild(); // because it may be a crossing ... reliefkarte_t::get_karte()->calc_map_pixel(k); - spieler_t::book_construction_costs(sp, cost, k, road_wt); + player_t::book_construction_costs(player_builder, cost, k, road_wt); } // for } @@ -2241,7 +2241,7 @@ void wegbauer_t::baue_schiene() { if(get_count() > 1) { // init undo - sp->init_undo(besch->get_wtyp(), get_count()); + player_builder->init_undo(besch->get_wtyp(), get_count()); // built tracks for( uint32 i=0; ifind(2) ) { // change to tram track cr->mark_image_dirty( cr->get_bild(), 0); - cr->entferne(sp); + cr->entferne(player_builder); delete cr; change_besch = true; // tell way we have no crossing any more, restore speed limit @@ -2293,8 +2293,8 @@ void wegbauer_t::baue_schiene() if( change_besch ) { // we take ownership => we take care to maintain the roads completely ... - spieler_t *s = weg->get_besitzer(); - spieler_t::add_maintenance( s, -weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype()); + player_t *s = weg->get_besitzer(); + player_t::add_maintenance( s, -weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype()); // cost is the more expensive one, so downgrading is between removing and new buidling cost -= max( weg->get_besch()->get_preis(), besch->get_preis() ); weg->set_besch(besch); @@ -2303,15 +2303,15 @@ void wegbauer_t::baue_schiene() if (wo && wo->get_besch()->get_topspeed() < weg->get_max_speed()) { weg->set_max_speed( wo->get_besch()->get_topspeed() ); } - spieler_t::add_maintenance( sp, weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype()); - weg->set_besitzer(sp); + player_t::add_maintenance( player_builder, weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype()); + weg->set_besitzer(player_builder); } } else { weg_t* const sch = weg_t::alloc(besch->get_wtyp()); sch->set_besch(besch); - cost = -gr->neuen_weg_bauen(sch, ribi, sp)-besch->get_preis(); + cost = -gr->neuen_weg_bauen(sch, ribi, player_builder)-besch->get_preis(); // connect canals to sea if( besch->get_wtyp() == water_wt ) { @@ -2325,12 +2325,12 @@ void wegbauer_t::baue_schiene() } // prissi: into UNDO-list, so we can remove it later - sp->add_undo( route[i] ); + player_builder->add_undo( route[i] ); } gr->calc_bild(); reliefkarte_t::get_karte()->calc_map_pixel( gr->get_pos().get_2d() ); - spieler_t::book_construction_costs(sp, cost, gr->get_pos().get_2d(), besch->get_finance_waytype()); + player_t::book_construction_costs(player_builder, cost, gr->get_pos().get_2d(), besch->get_finance_waytype()); if((i&3)==0) { INT_CHECK( "wegbauer 1584" ); @@ -2348,7 +2348,7 @@ void wegbauer_t::baue_leitung() } // no undo - sp->init_undo(powerline_wt,get_count()); + player_builder->init_undo(powerline_wt,get_count()); for( uint32 i=0; ilookup(route[i]); @@ -2360,25 +2360,25 @@ void wegbauer_t::baue_leitung() if(gr->ist_natur()) { // remove trees etc. sint64 cost = gr->remove_trees(); - spieler_t::book_construction_costs(sp, -cost, gr->get_pos().get_2d(), powerline_wt); + player_t::book_construction_costs(player_builder, -cost, gr->get_pos().get_2d(), powerline_wt); } - lt = new leitung_t(route[i], sp ); + lt = new leitung_t(route[i], player_builder ); gr->obj_add(lt); // prissi: into UNDO-list, so we can remove it later - sp->add_undo( route[i] ); + player_builder->add_undo( route[i] ); build_powerline = true; } else { // modernize the network if( !keep_existing_faster_ways || lt->get_besch()->get_topspeed() < besch->get_topspeed() ) { build_powerline = true; - spieler_t::add_maintenance( lt->get_besitzer(), -lt->get_besch()->get_wartung(), powerline_wt ); + player_t::add_maintenance( lt->get_besitzer(), -lt->get_besch()->get_wartung(), powerline_wt ); } } if (build_powerline) { lt->set_besch(besch); - spieler_t::book_construction_costs(sp, -besch->get_preis(), gr->get_pos().get_2d(), powerline_wt); + player_t::book_construction_costs(player_builder, -besch->get_preis(), gr->get_pos().get_2d(), powerline_wt); // this adds maintenance lt->leitung_t::laden_abschliessen(); reliefkarte_t::get_karte()->calc_map_pixel( gr->get_pos().get_2d() ); diff --git a/bauer/wegbauer.h b/bauer/wegbauer.h index c42ad6ef743..10110a2a55c 100644 --- a/bauer/wegbauer.h +++ b/bauer/wegbauer.h @@ -17,7 +17,7 @@ class weg_besch_t; class bruecke_besch_t; class tunnel_besch_t; class karte_ptr_t; -class spieler_t; +class player_t; class grund_t; class tool_selector_t; @@ -95,7 +95,7 @@ class wegbauer_t }; vector_tpl next_gr; - spieler_t *sp; + player_t *player_builder; /** * Type of building operation @@ -204,7 +204,7 @@ class wegbauer_t void set_maximum(uint32 n) { maximum = n; } - wegbauer_t(spieler_t *spl); + wegbauer_t(player_t *player_); void calc_straight_route(const koord3d start, const koord3d ziel); void calc_route(const koord3d &start3d, const koord3d &ziel); @@ -215,10 +215,10 @@ class wegbauer_t */ sint64 calc_costs(); - bool check_crossing(const koord zv, const grund_t *bd,waytype_t wtyp, const spieler_t *sp) const; + bool check_crossing(const koord zv, const grund_t *bd,waytype_t wtyp, const player_t *player_) const; bool check_for_leitung(const koord zv, const grund_t *bd) const; // allowed owner? - bool check_owner( const spieler_t *sp1, const spieler_t *sp2 ) const; + bool check_owner( const player_t *player1, const player_t *player2 ) const; // checks whether buildings on the tile allow to leave in direction dir bool check_building( const grund_t *to, const koord dir ) const; // allowed slope? diff --git a/boden/brueckenboden.cc b/boden/brueckenboden.cc index 5eea7d9e8f5..0088eab717f 100644 --- a/boden/brueckenboden.cc +++ b/boden/brueckenboden.cc @@ -92,7 +92,7 @@ void brueckenboden_t::rdwr(loadsave_t *file) if( kb && get_pos().z - kb->get_pos().z > 1 ) { height = 2; } - bruecke_t *br = new bruecke_t( get_pos(), welt->get_spieler(1), br_besch, ist_karten_boden() ? br_besch->get_end( slope, get_grund_hang(), get_weg_hang() ) : br_besch->get_simple( w->get_ribi_unmasked(), height ) ); + bruecke_t *br = new bruecke_t( get_pos(), welt->get_player(1), br_besch, ist_karten_boden() ? br_besch->get_end( slope, get_grund_hang(), get_weg_hang() ) : br_besch->get_simple( w->get_ribi_unmasked(), height ) ); obj_add( br ); } } diff --git a/boden/grund.cc b/boden/grund.cc index 12e6cfd5db8..0d6fb2e7ea9 100644 --- a/boden/grund.cc +++ b/boden/grund.cc @@ -136,20 +136,20 @@ PLAYER_COLOR_VAL grund_t::text_farbe() const if(is_halt() && find()==NULL) { // only halt label const halthandle_t halt = get_halt(); - const spieler_t *sp=halt->get_besitzer(); - if(sp) { - return PLAYER_FLAG|(sp->get_player_color1()+4); + const player_t *player=halt->get_besitzer(); + if(player) { + return PLAYER_FLAG|(player->get_player_color1()+4); } } // else color according to current owner else if(obj_bei(0)) { - const spieler_t *sp = obj_bei(0)->get_besitzer(); // for cityhall + const player_t *player = obj_bei(0)->get_besitzer(); // for cityhall const label_t* l = find(); if(l) { - sp = l->get_besitzer(); + player = l->get_besitzer(); } - if(sp) { - return PLAYER_FLAG|(sp->get_player_color1()+4); + if(player) { + return PLAYER_FLAG|(player->get_player_color1()+4); } } @@ -243,7 +243,7 @@ void grund_t::rdwr(loadsave_t *file) bool label; file->rdwr_bool(label); if(label) { - objlist.add( new label_t(pos, welt->get_spieler(0), get_text() ) ); + objlist.add( new label_t(pos, welt->get_player(0), get_text() ) ); } } @@ -417,7 +417,7 @@ void grund_t::rdwr(loadsave_t *file) assert((flags&has_way2)==0); // maximum two ways on one tile ... weg->set_pos(pos); if(besitzer_n!=-1) { - weg->set_besitzer(welt->get_spieler(besitzer_n)); + weg->set_besitzer(welt->get_player(besitzer_n)); } objlist.add(weg); if(flags&has_way1) { @@ -1728,7 +1728,7 @@ sint64 grund_t::remove_trees() } -sint64 grund_t::neuen_weg_bauen(weg_t *weg, ribi_t::ribi ribi, spieler_t *sp) +sint64 grund_t::neuen_weg_bauen(weg_t *weg, ribi_t::ribi ribi, player_t *player) { sint64 cost=0; @@ -1773,9 +1773,9 @@ sint64 grund_t::neuen_weg_bauen(weg_t *weg, ribi_t::ribi ribi, spieler_t *sp) } // just add the maintenance - if(sp && !ist_wasser()) { - spieler_t::add_maintenance( sp, weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype() ); - weg->set_besitzer( sp ); + if(player && !ist_wasser()) { + player_t::add_maintenance( player, weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype() ); + weg->set_besitzer( player ); } // may result in a crossing, but the wegebauer will recalc all images anyway @@ -1899,7 +1899,7 @@ int grund_t::get_max_speed() const } -bool grund_t::remove_everything_from_way(spieler_t* sp, waytype_t wt, ribi_t::ribi rem) +bool grund_t::remove_everything_from_way(player_t* player_, waytype_t wt, ribi_t::ribi rem) { // check, if the way must be totally removed? weg_t *weg = get_weg(wt); @@ -1909,7 +1909,7 @@ bool grund_t::remove_everything_from_way(spieler_t* sp, waytype_t wt, ribi_t::ri const koord here = pos.get_2d(); // stops - if(flags&is_halt_flag && (get_halt()->get_besitzer()==sp || sp==welt->get_spieler(1))) { + if(flags&is_halt_flag && (get_halt()->get_besitzer()==player_ || player_==welt->get_player(1))) { bool remove_halt = get_typ()!=boden; // remove only if there is no other way if(get_weg_nr(1)==NULL) { @@ -1930,7 +1930,7 @@ bool grund_t::remove_everything_from_way(spieler_t* sp, waytype_t wt, ribi_t::ri #endif } if (remove_halt) { - if (!haltestelle_t::remove(sp, pos)) { + if (!haltestelle_t::remove(player_, pos)) { return false; } } @@ -1998,7 +1998,7 @@ bool grund_t::remove_everything_from_way(spieler_t* sp, waytype_t wt, ribi_t::ri if((flags&has_way2)==0) { if (add==ribi_t::keine) { // last way was belonging to this tunnel - tunnel->entferne(sp); + tunnel->entferne(player_); delete tunnel; } } @@ -2026,7 +2026,7 @@ bool grund_t::remove_everything_from_way(spieler_t* sp, waytype_t wt, ribi_t::ri // make tunnel portals to normal ground if (get_typ()==tunnelboden && (flags&has_way1)==0) { // remove remaining objs - obj_loesche_alle( sp ); + obj_loesche_alle( player_ ); // set to normal ground welt->access(here)->kartenboden_setzen( new boden_t( pos, slope ) ); // now this is already deleted ! @@ -2041,7 +2041,7 @@ DBG_MESSAGE("tool_wayremover()","change remaining way to ribi %d",add); } // we have to pay? if(costs) { - spieler_t::book_construction_costs(sp, costs, here, finance_wt); + player_t::book_construction_costs(player_, costs, here, finance_wt); } } return true; diff --git a/boden/grund.h b/boden/grund.h index a39ec74ffd4..ce93782f28d 100644 --- a/boden/grund.h +++ b/boden/grund.h @@ -18,7 +18,7 @@ #include "wege/weg.h" -class spieler_t; +class player_t; class depot_t; class karte_ptr_t; class cbuffer_t; @@ -586,7 +586,7 @@ class grund_t uint8 obj_add(obj_t *obj) { return objlist.add(obj); } uint8 obj_remove(const obj_t* obj) { return objlist.remove(obj); } - bool obj_loesche_alle(spieler_t *sp) { return objlist.loesche_alle(sp,offsets[flags/has_way1]); } + bool obj_loesche_alle(player_t *player) { return objlist.loesche_alle(player,offsets[flags/has_way1]); } bool obj_ist_da(const obj_t* obj) const { return objlist.ist_da(obj); } obj_t * obj_bei(uint8 n) const { return objlist.bei(n); } uint8 obj_count() const { return objlist.get_top()-offsets[flags/has_way1]; } @@ -599,7 +599,7 @@ class grund_t * @return NULL wenn OK, oder Meldung, warum nicht * @author Hj. Malthaner */ - const char * kann_alle_obj_entfernen(const spieler_t *sp) const { return objlist.kann_alle_entfernen(sp,offsets[flags/has_way1]); } + const char * kann_alle_obj_entfernen(const player_t *player) const { return objlist.kann_alle_entfernen(player,offsets[flags/has_way1]); } /** * Interface zur Bauen und abfragen von Gebaeuden @@ -738,16 +738,14 @@ class grund_t sint64 remove_trees(); /** - * Bauhilfsfunktion - ein neuer weg wird mit den vorgegebenen ribis - * eingetragen und der Grund dem Erbauer zugeordnet. - * + * A new way is built with the given ribis. Registered and assigned to the builder. * @param weg der neue Weg * @param ribi die neuen ribis - * @param sp Spieler, dem der Boden zugeordnet wird + * @param sp Player building the way * * @author V. Meyer */ - sint64 neuen_weg_bauen(weg_t *weg, ribi_t::ribi ribi, spieler_t *sp); + sint64 neuen_weg_bauen(weg_t *weg, ribi_t::ribi ribi, player_t *player); /** * Bauhilfsfunktion - die ribis eines vorhandenen weges werden erweitert @@ -844,7 +842,7 @@ class grund_t * powerline ond other stuff * @author prissi */ - bool remove_everything_from_way(spieler_t *sp,waytype_t wt,ribi_t::ribi ribi_rem); + bool remove_everything_from_way(player_t *player,waytype_t wt,ribi_t::ribi ribi_rem); void* operator new(size_t s); void operator delete(void* p, size_t s); diff --git a/boden/wege/schiene.cc b/boden/wege/schiene.cc index 8c5320ee861..2a21a494ed8 100644 --- a/boden/wege/schiene.cc +++ b/boden/wege/schiene.cc @@ -39,7 +39,7 @@ schiene_t::schiene_t(loadsave_t *file) : weg_t() } -void schiene_t::entferne(spieler_t *) +void schiene_t::entferne(player_t *) { // removes reservation if(reserved.is_bound()) { diff --git a/boden/wege/schiene.h b/boden/wege/schiene.h index 6bb4545a1e5..88823245440 100644 --- a/boden/wege/schiene.h +++ b/boden/wege/schiene.h @@ -84,7 +84,7 @@ class schiene_t : public weg_t /* called before deletion; * last chance to unreserve tiles ... */ - virtual void entferne(spieler_t *sp); + virtual void entferne(player_t *player); /** * gets the related convoi diff --git a/boden/wege/weg.cc b/boden/wege/weg.cc index 3df6a883163..942a34f67c3 100644 --- a/boden/wege/weg.cc +++ b/boden/wege/weg.cc @@ -173,9 +173,9 @@ void weg_t::init() weg_t::~weg_t() { alle_wege.remove(this); - spieler_t *sp=get_besitzer(); - if(sp) { - spieler_t::add_maintenance( sp, -besch->get_wartung(), besch->get_finance_waytype() ); + player_t *player=get_besitzer(); + if(player) { + player_t::add_maintenance( player, -besch->get_wartung(), besch->get_finance_waytype() ); } } @@ -566,19 +566,19 @@ void weg_t::neuer_monat() // correct speed and maintenance void weg_t::laden_abschliessen() { - spieler_t *sp = get_besitzer(); - if( sp && besch ) { - spieler_t::add_maintenance( sp, besch->get_wartung(), besch->get_finance_waytype() ); + player_t *player = get_besitzer(); + if( player && besch ) { + player_t::add_maintenance( player, besch->get_wartung(), besch->get_finance_waytype() ); } } // returns NULL, if removal is allowed // players can remove public owned ways -const char *weg_t::ist_entfernbar(const spieler_t *sp) +const char *weg_t::ist_entfernbar(const player_t *player) { if( get_player_nr()==1 ) { return NULL; } - return obj_t::ist_entfernbar(sp); + return obj_t::ist_entfernbar(player); } diff --git a/boden/wege/weg.h b/boden/wege/weg.h index 1ea68038a65..47b88737f3e 100644 --- a/boden/wege/weg.h +++ b/boden/wege/weg.h @@ -200,7 +200,7 @@ class weg_t : public obj_no_info_t * @return NULL if OK, otherwise an error message * @author Hj. Malthaner */ - virtual const char *ist_entfernbar(const spieler_t *sp); + virtual const char *ist_entfernbar(const player_t *player); /** * Wegtyp zurückliefern diff --git a/dataobj/fahrplan.cc b/dataobj/fahrplan.cc index b4542969e8d..3cec233c318 100644 --- a/dataobj/fahrplan.cc +++ b/dataobj/fahrplan.cc @@ -88,11 +88,11 @@ bool schedule_t::ist_halt_erlaubt(const grund_t *gr) const /* returns a valid halthandle if there is a next halt in the schedule; * it may however not be allowed to load there, if the owner mismatches! */ -halthandle_t schedule_t::get_next_halt( spieler_t *sp, halthandle_t halt ) const +halthandle_t schedule_t::get_next_halt( player_t *player, halthandle_t halt ) const { if( eintrag.get_count()>1 ) { for( uint i=1; i < eintrag.get_count(); i++ ) { - halthandle_t h = haltestelle_t::get_halt( eintrag[ (aktuell+i) % eintrag.get_count() ].pos, sp ); + halthandle_t h = haltestelle_t::get_halt( eintrag[ (aktuell+i) % eintrag.get_count() ].pos, player ); if( h.is_bound() && h != halt ) { return h; } @@ -105,11 +105,11 @@ halthandle_t schedule_t::get_next_halt( spieler_t *sp, halthandle_t halt ) const /* returns a valid halthandle if there is a previous halt in the schedule; * it may however not be allowed to load there, if the owner mismatches! */ -halthandle_t schedule_t::get_prev_halt( spieler_t *sp ) const +halthandle_t schedule_t::get_prev_halt( player_t *player ) const { if( eintrag.get_count()>1 ) { for( uint i=1; i < eintrag.get_count()-1u; i++ ) { - halthandle_t h = haltestelle_t::get_halt( eintrag[ (aktuell+eintrag.get_count()-i) % eintrag.get_count() ].pos, sp ); + halthandle_t h = haltestelle_t::get_halt( eintrag[ (aktuell+eintrag.get_count()-i) % eintrag.get_count() ].pos, player ); if( h.is_bound() ) { return h; } @@ -348,7 +348,7 @@ class HaltIdOrdering * compare this schedule (fahrplan) with another, ignoring order and exact positions and waypoints * @author prissi */ -bool schedule_t::similar( const schedule_t *fpl, const spieler_t *sp ) +bool schedule_t::similar( const schedule_t *fpl, const player_t *player ) { if( fpl == NULL ) { return false; @@ -366,7 +366,7 @@ bool schedule_t::similar( const schedule_t *fpl, const spieler_t *sp ) vector_tpl halts; for( uint8 idx = 0; idx < this->eintrag.get_count(); idx++ ) { koord3d p = this->eintrag[idx].pos; - halthandle_t halt = haltestelle_t::get_halt( p, sp ); + halthandle_t halt = haltestelle_t::get_halt( p, player ); if( halt.is_bound() ) { halts.insert_unique_ordered( halt, HaltIdOrdering() ); } @@ -374,7 +374,7 @@ bool schedule_t::similar( const schedule_t *fpl, const spieler_t *sp ) vector_tpl other_halts; for( uint8 idx = 0; idx < fpl->eintrag.get_count(); idx++ ) { koord3d p = fpl->eintrag[idx].pos; - halthandle_t halt = haltestelle_t::get_halt( p, sp ); + halthandle_t halt = haltestelle_t::get_halt( p, player ); if( halt.is_bound() ) { other_halts.insert_unique_ordered( halt, HaltIdOrdering() ); } diff --git a/dataobj/fahrplan.h b/dataobj/fahrplan.h index 5f1554b2f6e..44c6ff39594 100644 --- a/dataobj/fahrplan.h +++ b/dataobj/fahrplan.h @@ -10,7 +10,7 @@ class cbuffer_t; class grund_t; -class spieler_t; +class player_t; class karte_t; @@ -106,12 +106,12 @@ class schedule_t /** * returns a halthandle for the next halt in the schedule (or unbound) */ - halthandle_t get_next_halt( spieler_t *sp, halthandle_t halt ) const; + halthandle_t get_next_halt( player_t *player, halthandle_t halt ) const; /** * returns a halthandle for the previous halt in the schedule (or unbound) */ - halthandle_t get_prev_halt( spieler_t *sp ) const; + halthandle_t get_prev_halt( player_t *player ) const; /** * fügt eine koordinate an stelle aktuell in den Fahrplan ein @@ -147,7 +147,7 @@ class schedule_t * compare this fahrplan with another, ignoring order and exact positions and waypoints * @author prissi */ - bool similar( const schedule_t *fpl, const spieler_t *sp ); + bool similar( const schedule_t *fpl, const player_t *player ); /** * calculates a return way for this schedule diff --git a/dataobj/gameinfo.cc b/dataobj/gameinfo.cc index 728ec567f08..f90ddcea942 100644 --- a/dataobj/gameinfo.cc +++ b/dataobj/gameinfo.cc @@ -65,11 +65,11 @@ gameinfo_t::gameinfo_t(karte_t *welt) : convoi_count = welt->convoys().get_count(); for( int i=0; iget_spieler(i) ) { - spieler_type[i] = sp->get_ai_id(); - if( !sp->access_password_hash().empty() ) { - spieler_type[i] |= spieler_t::PASSWORD_PROTECTED; + player_type[i] = player_t::EMPTY; + if( player_t *player = welt->get_player(i) ) { + player_type[i] = player->get_ai_id(); + if( !player->access_password_hash().empty() ) { + player_type[i] |= player_t::PASSWORD_PROTECTED; } } } @@ -176,7 +176,7 @@ void gameinfo_t::rdwr(loadsave_t *file) file->rdwr_long( game_engine_revision ); for( int i=0; i<16; i++ ) { - file->rdwr_byte( spieler_type[i] ); + file->rdwr_byte( player_type[i] ); } file->rdwr_byte( clients ); diff --git a/dataobj/gameinfo.h b/dataobj/gameinfo.h index 759a82c4f9f..dd6d6adee3d 100644 --- a/dataobj/gameinfo.h +++ b/dataobj/gameinfo.h @@ -47,7 +47,7 @@ class gameinfo_t checksum_t pakset_checksum; // 0 = empty, otherwise some value from simplay - uint8 spieler_type[MAX_PLAYER_COUNT]; + uint8 player_type[MAX_PLAYER_COUNT]; uint8 clients; // currently connected players public: @@ -79,7 +79,7 @@ class gameinfo_t uint32 get_game_engine_revision() const { return game_engine_revision; } const char *get_name_language_iso() const { return language_code_names; } const char *get_pak_name() const { return pak_name.c_str(); } - uint8 get_player_type(uint8 i) const { return spieler_type[i]; } + uint8 get_player_type(uint8 i) const { return player_type[i]; } uint8 get_clients() const { return clients; } const checksum_t & get_pakset_checksum() const { return pakset_checksum; } }; diff --git a/dataobj/objlist.cc b/dataobj/objlist.cc index 497071b9c3d..540a1ddeabb 100644 --- a/dataobj/objlist.cc +++ b/dataobj/objlist.cc @@ -574,14 +574,14 @@ bool objlist_t::remove(const obj_t* remove_obj) * removes object from map * deletes object if it is not a zeiger_t */ -void local_delete_object(obj_t *remove_obj, spieler_t *sp) +void local_delete_object(obj_t *remove_obj, player_t *player) { vehikel_basis_t* const v = obj_cast(remove_obj); if (v && remove_obj->get_typ() != obj_t::fussgaenger && remove_obj->get_typ() != obj_t::verkehr && remove_obj->get_typ() != obj_t::movingobj) { v->verlasse_feld(); } else { - remove_obj->entferne(sp); + remove_obj->entferne(player); remove_obj->set_flag(obj_t::not_on_map); // all objects except zeiger (pointer) are destroyed here // zeiger's will be deleted if their associated tool terminates @@ -592,7 +592,7 @@ void local_delete_object(obj_t *remove_obj, spieler_t *sp) } -bool objlist_t::loesche_alle(spieler_t *sp, uint8 offset) +bool objlist_t::loesche_alle(player_t *player, uint8 offset) { if(top<=offset) { return false; @@ -604,14 +604,14 @@ bool objlist_t::loesche_alle(spieler_t *sp, uint8 offset) if(capacity>1) { while( top>offset ) { top --; - local_delete_object(obj.some[top], sp); + local_delete_object(obj.some[top], player); obj.some[top] = NULL; ok = true; } } else { if(capacity==1) { - local_delete_object(obj.one, sp); + local_delete_object(obj.one, player); ok = true; obj.one = NULL; capacity = top = 0; @@ -625,20 +625,20 @@ bool objlist_t::loesche_alle(spieler_t *sp, uint8 offset) /* returns the text of an error message, if obj could not be removed */ -const char *objlist_t::kann_alle_entfernen(const spieler_t *sp, uint8 offset) const +const char *objlist_t::kann_alle_entfernen(const player_t *player, uint8 offset) const { if(top<=offset) { return NULL; } if(capacity==1) { - return obj.one->ist_entfernbar(sp); + return obj.one->ist_entfernbar(player); } else { const char * msg = NULL; for(uint8 i=offset; iist_entfernbar(sp); + msg = obj.some[i]->ist_entfernbar(player); if(msg != NULL) { return msg; } diff --git a/dataobj/objlist.h b/dataobj/objlist.h index 3417e115cef..957cf2b9e0f 100644 --- a/dataobj/objlist.h +++ b/dataobj/objlist.h @@ -76,7 +76,7 @@ class objlist_t { bool add(obj_t* obj); bool remove(const obj_t* obj); - bool loesche_alle(spieler_t *sp,uint8 offset); + bool loesche_alle(player_t *player,uint8 offset); bool ist_da(const obj_t* obj) const; inline uint8 get_top() const {return top;} @@ -90,7 +90,7 @@ class objlist_t { * @return NULL when OK, or message, why not? * @author Hj. Malthaner */ - const char * kann_alle_entfernen(const spieler_t *, uint8 ) const; + const char * kann_alle_entfernen(const player_t *, uint8 ) const; /* recalcs all objects on this tile * @author prissi diff --git a/dataobj/records.h b/dataobj/records.h index 9f6c4928ee2..32e2c1de72c 100644 --- a/dataobj/records.h +++ b/dataobj/records.h @@ -10,7 +10,7 @@ #include "../simconvoi.h" class message_t; -class spieler_t; +class player_t; /** * World record speed management. @@ -43,7 +43,7 @@ class records_t { convoihandle_t cnv; sint32 speed; koord pos; - spieler_t *besitzer; // Owner + player_t *besitzer; // Owner uint32 year_month; speed_record_t() : cnv(), speed(0), pos(koord::invalid), besitzer(NULL), year_month(0) {} diff --git a/dataobj/scenario.cc b/dataobj/scenario.cc index 75cf864f33e..687d0c52a06 100644 --- a/dataobj/scenario.cc +++ b/dataobj/scenario.cc @@ -464,7 +464,7 @@ void scenario_t::clear_rules() } -bool scenario_t::is_tool_allowed(const spieler_t* sp, uint16 tool_id, sint16 wt) +bool scenario_t::is_tool_allowed(const player_t* player, uint16 tool_id, sint16 wt) { if (what_scenario != SCRIPTED && what_scenario != SCRIPTED_NETWORK) { return true; @@ -472,7 +472,7 @@ bool scenario_t::is_tool_allowed(const spieler_t* sp, uint16 tool_id, sint16 wt) // first test the list if (!forbidden_tools.empty()) { forbidden_t test(forbidden_t::forbid_tool, PLAYER_UNOWNED, tool_id, invalid_wt); - uint8 player_nr = sp ? sp->get_player_nr() : PLAYER_UNOWNED; + uint8 player_nr = player ? player->get_player_nr() : PLAYER_UNOWNED; // first test waytype invalid_wt, then wt // .. and all players then specific player @@ -494,14 +494,14 @@ bool scenario_t::is_tool_allowed(const spieler_t* sp, uint16 tool_id, sint16 wt) // then call script if available if (what_scenario == SCRIPTED) { bool ok = true; - const char* err = script->call_function("is_tool_allowed", ok, (uint8)(sp ? sp->get_player_nr() : PLAYER_UNOWNED), tool_id, wt); + const char* err = script->call_function("is_tool_allowed", ok, (uint8)(player ? player->get_player_nr() : PLAYER_UNOWNED), tool_id, wt); return err != NULL || ok; } return true; } -const char* scenario_t::is_work_allowed_here(const spieler_t* sp, uint16 tool_id, sint16 wt, koord3d pos) +const char* scenario_t::is_work_allowed_here(const player_t* player, uint16 tool_id, sint16 wt, koord3d pos) { if (what_scenario != SCRIPTED && what_scenario != SCRIPTED_NETWORK) { return NULL; @@ -510,7 +510,7 @@ const char* scenario_t::is_work_allowed_here(const spieler_t* sp, uint16 tool_id // first test the list if (!forbidden_tools.empty()) { forbidden_t test(forbidden_t::forbid_tool_rect, PLAYER_UNOWNED, tool_id, invalid_wt); - uint8 player_nr = sp ? sp->get_player_nr() : PLAYER_UNOWNED; + uint8 player_nr = player ? player->get_player_nr() : PLAYER_UNOWNED; // first test waytype invalid_wt, then wt // .. and all players then specific player @@ -545,7 +545,7 @@ const char* scenario_t::is_work_allowed_here(const spieler_t* sp, uint16 tool_id // which is done per client if (what_scenario == SCRIPTED) { static plainstring msg; - const char *err = script->call_function("is_work_allowed_here", msg, (uint8)(sp ? sp->get_player_nr() : PLAYER_UNOWNED), tool_id, pos); + const char *err = script->call_function("is_work_allowed_here", msg, (uint8)(player ? player->get_player_nr() : PLAYER_UNOWNED), tool_id, pos); return err == NULL ? msg.c_str() : NULL; } @@ -553,7 +553,7 @@ const char* scenario_t::is_work_allowed_here(const spieler_t* sp, uint16 tool_id } -const char* scenario_t::is_schedule_allowed(const spieler_t* sp, const schedule_t* schedule) +const char* scenario_t::is_schedule_allowed(const player_t* player, const schedule_t* schedule) { // sanity checks if (schedule == NULL) { @@ -566,7 +566,7 @@ const char* scenario_t::is_schedule_allowed(const spieler_t* sp, const schedule_ // call script if (what_scenario == SCRIPTED) { static plainstring msg; - const char *err = script->call_function("is_schedule_allowed", msg, (uint8)(sp ? sp->get_player_nr() : PLAYER_UNOWNED), schedule); + const char *err = script->call_function("is_schedule_allowed", msg, (uint8)(player ? player->get_player_nr() : PLAYER_UNOWNED), schedule); return err == NULL ? msg.c_str() : NULL; } @@ -598,20 +598,20 @@ void scenario_t::step() // first check, whether win/loss state of any player changed for(uint32 i=0; iget_spieler(i); + player_t *player = welt->get_player(i); uint16 mask = 1 << i; // player exists and has not won/lost yet - if (sp && (((won | lost) & mask)==0)) { + if (player && (((won | lost) & mask)==0)) { sint32 percentage = 0; - script->call_function("is_scenario_completed", percentage, (uint8)(sp ? sp->get_player_nr() : PLAYER_UNOWNED)); + script->call_function("is_scenario_completed", percentage, (uint8)(player ? player->get_player_nr() : PLAYER_UNOWNED)); // script might have deleted the player - sp = welt->get_spieler(i); - if (sp == NULL) { + player = welt->get_player(i); + if (player == NULL) { continue; } - sp->set_scenario_completion(percentage); + player->set_scenario_completion(percentage); // won ? if (percentage >= 100) { new_won |= mask; @@ -686,14 +686,14 @@ void scenario_t::update_won_lost(uint16 new_won, uint16 new_lost) void scenario_t::update_scenario_texts() { - spieler_t *sp = welt->get_active_player(); - info_text.update(script, sp); - goal_text.update(script, sp); - rule_text.update(script, sp); - result_text.update(script, sp); - about_text.update(script, sp); - debug_text.update(script, sp); - description_text.update(script, sp); + player_t *player = welt->get_active_player(); + info_text.update(script, player); + goal_text.update(script, player); + rule_text.update(script, player); + result_text.update(script, player); + about_text.update(script, player); + debug_text.update(script, player); + description_text.update(script, player); } @@ -883,12 +883,12 @@ int scenario_t::get_completion(int player_nr) } sint32 percentage = 0; - spieler_t *sp = welt->get_spieler(player_nr); + player_t *player = welt->get_player(player_nr); if ( what_scenario == SCRIPTED ) { // take cached value - if (sp) { - percentage = sp->get_scenario_completion(); + if (player) { + percentage = player->get_scenario_completion(); } } else if ( what_scenario == SCRIPTED_NETWORK ) { @@ -897,8 +897,8 @@ int scenario_t::get_completion(int player_nr) const char *ret = dynamic_string::fetch_result((const char*)buf, NULL, NULL); percentage = ret ? atoi(ret) : 0; // cache value - if (sp) { - sp->set_scenario_completion(percentage); + if (player) { + player->set_scenario_completion(percentage); } } return min( 100, percentage); diff --git a/dataobj/scenario.h b/dataobj/scenario.h index 88a539eae45..716ba51c1cf 100644 --- a/dataobj/scenario.h +++ b/dataobj/scenario.h @@ -306,7 +306,7 @@ class scenario_t /** - * Calls scripted is_scenario_completed. Caches this value in statistics of spieler_t. + * Calls scripted is_scenario_completed. Caches this value in statistics of player_t. * Server sends update of won/lost if necessary. */ void step(); @@ -407,13 +407,13 @@ class scenario_t * Called for instance in karte_t::local_set_tool to change active tool or when filling toolbars. * @return true if player can use this tool. */ - bool is_tool_allowed(const spieler_t* sp, uint16 tool_id, sint16 wt = invalid_wt); + bool is_tool_allowed(const player_t* player, uint16 tool_id, sint16 wt = invalid_wt); /** * Checks if player can use the tool at this position. * @return NULL if allowed otherwise error message */ - const char* is_work_allowed_here(const spieler_t* sp, uint16 tool_id, sint16 wt, koord3d pos); + const char* is_work_allowed_here(const player_t* player, uint16 tool_id, sint16 wt, koord3d pos); /** * Checks if player can use this schedule. @@ -423,7 +423,7 @@ class scenario_t * * @return null if allowed, an error message otherwise */ - const char* is_schedule_allowed(const spieler_t* sp, const schedule_t* schedule); + const char* is_schedule_allowed(const player_t* player, const schedule_t* schedule); /// @return debug dump of forbidden tools diff --git a/dataobj/settings.cc b/dataobj/settings.cc index 78016d02012..08a23512924 100644 --- a/dataobj/settings.cc +++ b/dataobj/settings.cc @@ -185,20 +185,20 @@ settings_t::settings_t() : // default AIs active for( int i=0; irdwr_bool(automaten[i] ); - file->rdwr_byte(spieler_type[i] ); + file->rdwr_bool(player_active[i] ); + file->rdwr_byte(player_type[i] ); if( file->get_version()<=102002 ) { char dummy[2] = { 0, 0 }; file->rdwr_str(dummy, lengthof(dummy) ); @@ -632,18 +632,18 @@ void settings_t::rdwr(loadsave_t *file) // default AIs active for( int i=0; iget_player_nr()][0]; + COLOR_VAL color1 = default_player_color[player->get_player_nr()][0]; if( color1 == 255 ) { if( default_player_color_random ) { // build a vector with all colors @@ -1537,9 +1537,9 @@ void settings_t::set_default_player_color(spieler_t* const sp) const } // remove all used colors for( uint8 i=0; iget_welt()->get_spieler(i); - if( test_sp && sp!=test_sp ) { - uint8 rem = 1<<(sp->get_player_color1()/8); + player_t *test_sp = player->get_welt()->get_player(i); + if( test_sp && player!=test_sp ) { + uint8 rem = 1<<(player->get_player_color1()/8); if( all_colors1.is_contained(rem) ) { all_colors1.remove( rem ); } @@ -1555,11 +1555,11 @@ void settings_t::set_default_player_color(spieler_t* const sp) const color1 = pick_any(all_colors1); } else { - color1 = sp->get_player_nr(); + color1 = player->get_player_nr(); } } - COLOR_VAL color2 = default_player_color[sp->get_player_nr()][1]; + COLOR_VAL color2 = default_player_color[player->get_player_nr()][1]; if( color2 == 255 ) { if( default_player_color_random ) { // build a vector with all colors @@ -1571,9 +1571,9 @@ void settings_t::set_default_player_color(spieler_t* const sp) const all_colors2.remove( color1/8 ); // remove all used colors for( uint8 i=0; iget_welt()->get_spieler(i); - if( test_sp && sp!=test_sp ) { - uint8 rem = 1<<(sp->get_player_color2()/8); + player_t *test_sp = player->get_welt()->get_player(i); + if( test_sp && player!=test_sp ) { + uint8 rem = 1<<(player->get_player_color2()/8); if( all_colors2.is_contained(rem) ) { all_colors2.remove( rem ); } @@ -1589,9 +1589,9 @@ void settings_t::set_default_player_color(spieler_t* const sp) const color2 = pick_any(all_colors2); } else { - color2 = sp->get_player_nr() + 3; + color2 = player->get_player_nr() + 3; } } - sp->set_player_color( color1*8, color2*8 ); + player->set_player_color( color1*8, color2*8 ); } diff --git a/dataobj/settings.h b/dataobj/settings.h index e105b8f4a8b..81794f27c7c 100644 --- a/dataobj/settings.h +++ b/dataobj/settings.h @@ -14,7 +14,7 @@ * April 2000 */ -class spieler_t; +class player_t; class loadsave_t; class tabfile_t; class weg_besch_t; @@ -309,9 +309,9 @@ class settings_t sint32 way_count_leaving_road; // true if active - bool automaten[MAX_PLAYER_COUNT]; + bool player_active[MAX_PLAYER_COUNT]; // 0 = empty, otherwise some value from simplay - uint8 spieler_type[MAX_PLAYER_COUNT]; + uint8 player_type[MAX_PLAYER_COUNT]; // how fast new AI will built something uint32 default_ai_construction_speed; @@ -454,9 +454,9 @@ class settings_t language_code_names[2] = 0; } - void set_player_active(uint8 i, bool b) { automaten[i] = b; } - void set_player_type(uint8 i, uint8 t) { spieler_type[i] = t; } - uint8 get_player_type(uint8 i) const { return spieler_type[i]; } + void set_player_active(uint8 i, bool b) { player_active[i] = b; } + void set_player_type(uint8 i, uint8 t) { player_type[i] = t; } + uint8 get_player_type(uint8 i) const { return player_type[i]; } bool is_separate_halt_capacities() const { return separate_halt_capacities ; } @@ -539,7 +539,7 @@ class settings_t sint16 get_used_vehicle_reduction() const { return used_vehicle_reduction; } - void set_default_player_color( spieler_t *sp ) const; + void set_default_player_color( player_t *player ) const; // usually only used in network mode => no need to set them! uint32 get_random_counter() const { return random_counter; } diff --git a/display/simview.cc b/display/simview.cc index 1b9b1f5d64b..4405724ba69 100644 --- a/display/simview.cc +++ b/display/simview.cc @@ -296,8 +296,8 @@ void karte_ansicht_t::display(bool force_dirty) if(welt) { // show players income/cost messages for(int x=0; xget_spieler(x) ) { - welt->get_spieler(x)->display_messages(); + if( welt->get_player(x) ) { + welt->get_player(x)->display_messages(); } } } diff --git a/gui/ai_option_t.cc b/gui/ai_option_t.cc index ddb46b6ca2b..a0b0cdf4bd6 100644 --- a/gui/ai_option_t.cc +++ b/gui/ai_option_t.cc @@ -21,11 +21,11 @@ #define L_DIALOG_WIDTH (200) -ai_option_t::ai_option_t( spieler_t *sp ) : - gui_frame_t( translator::translate("Configure AI"), sp ), +ai_option_t::ai_option_t( player_t *player ) : + gui_frame_t( translator::translate("Configure AI"), player ), label_cs( "construction speed" ) { - this->ai = dynamic_cast(sp); + this->ai = dynamic_cast(player); scr_coord cursor(D_MARGIN_LEFT,D_MARGIN_TOP); diff --git a/gui/ai_option_t.h b/gui/ai_option_t.h index cd1adc9686f..76073c9d809 100644 --- a/gui/ai_option_t.h +++ b/gui/ai_option_t.h @@ -15,7 +15,7 @@ #include "components/gui_numberinput.h" #include "../utils/cbuffer_t.h" -class spieler_t; +class player_t; class ai_t; class ai_option_t : public gui_frame_t, private action_listener_t @@ -27,7 +27,7 @@ class ai_option_t : public gui_frame_t, private action_listener_t ai_t *ai; public: - ai_option_t(spieler_t *sp); + ai_option_t(player_t *player); /** * Set the window associated helptext diff --git a/gui/base_info.cc b/gui/base_info.cc index aa0cc933895..535e87ab92c 100644 --- a/gui/base_info.cc +++ b/gui/base_info.cc @@ -3,8 +3,8 @@ static scr_coord default_margin(LINESPACE, LINESPACE); -base_infowin_t::base_infowin_t(const char *name, const spieler_t *sp) : - gui_frame_t(name, sp), +base_infowin_t::base_infowin_t(const char *name, const player_t *player) : + gui_frame_t(name, player), textarea(&buf, 16*LINESPACE), embedded(NULL) { diff --git a/gui/base_info.h b/gui/base_info.h index 16d1b8e227e..9d70cc399ab 100644 --- a/gui/base_info.h +++ b/gui/base_info.h @@ -27,7 +27,7 @@ class base_infowin_t : public gui_frame_t void set_embedded(gui_component_t *other); public: - base_infowin_t(const char *name, const spieler_t *sp=NULL); + base_infowin_t(const char *name, const player_t *player=NULL); }; diff --git a/gui/baum_edit.cc b/gui/baum_edit.cc index 12656b2fc80..9c236264ede 100644 --- a/gui/baum_edit.cc +++ b/gui/baum_edit.cc @@ -44,8 +44,8 @@ static bool compare_baum_besch(const baum_besch_t* a, const baum_besch_t* b) } -baum_edit_frame_t::baum_edit_frame_t(spieler_t* sp_) : - extend_edit_gui_t(translator::translate("baum builder"), sp_), +baum_edit_frame_t::baum_edit_frame_t(player_t* player_) : + extend_edit_gui_t(translator::translate("baum builder"), player_), baumlist(16) { bt_timeline.set_text( "Random age" ); @@ -135,10 +135,10 @@ void baum_edit_frame_t::change_item_info(sint32 entry) sprintf( param_str, "%i%i,%s", bt_climates.pressed, bt_timeline.pressed, besch->get_name() ); baum_tool.set_default_param(param_str); baum_tool.cursor = tool_t::general_tool[TOOL_PLANT_TREE]->cursor; - welt->set_tool( &baum_tool, sp ); + welt->set_tool( &baum_tool, player ); } - else if(welt->get_tool(sp->get_player_nr())==&baum_tool) { + else if(welt->get_tool(player->get_player_nr())==&baum_tool) { besch = NULL; - welt->set_tool( tool_t::general_tool[TOOL_QUERY], sp ); + welt->set_tool( tool_t::general_tool[TOOL_QUERY], player ); } } diff --git a/gui/baum_edit.h b/gui/baum_edit.h index 4ec2c7724c9..293bee93f8b 100644 --- a/gui/baum_edit.h +++ b/gui/baum_edit.h @@ -28,7 +28,7 @@ class baum_edit_frame_t : public extend_edit_gui_t virtual void change_item_info( sint32 i ); public: - baum_edit_frame_t(spieler_t* sp); + baum_edit_frame_t(player_t* player_); /** * in top-level windows the name is displayed in titlebar diff --git a/gui/citybuilding_edit.cc b/gui/citybuilding_edit.cc index 64d233cb95c..4e8e313fe7a 100644 --- a/gui/citybuilding_edit.cc +++ b/gui/citybuilding_edit.cc @@ -49,8 +49,8 @@ static bool compare_haus_besch(const haus_besch_t* a, const haus_besch_t* b) -citybuilding_edit_frame_t::citybuilding_edit_frame_t(spieler_t* sp_) : - extend_edit_gui_t(translator::translate("citybuilding builder"), sp_), +citybuilding_edit_frame_t::citybuilding_edit_frame_t(player_t* player_) : + extend_edit_gui_t(translator::translate("citybuilding builder"), player_), hauslist(16), lb_rotation( rot_str, SYSCOL_TEXT_HIGHLIGHT, gui_label_t::right ), lb_rotation_info( translator::translate("Rotation"), SYSCOL_TEXT, gui_label_t::left ) @@ -267,10 +267,10 @@ void citybuilding_edit_frame_t::change_item_info(sint32 entry) // the tools will be always updated, even though the data up there might be still current sprintf( param_str, "%i%c%s", bt_climates.pressed, rotation>253 ? (rotation==254 ? 'A' : '#') : '0'+rotation, besch->get_name() ); haus_tool.set_default_param(param_str); - welt->set_tool( &haus_tool, sp ); + welt->set_tool( &haus_tool, player ); } - else if(welt->get_tool(sp->get_player_nr())==&haus_tool) { + else if(welt->get_tool(player->get_player_nr())==&haus_tool) { besch = NULL; - welt->set_tool( tool_t::general_tool[TOOL_QUERY], sp ); + welt->set_tool( tool_t::general_tool[TOOL_QUERY], player ); } } diff --git a/gui/citybuilding_edit.h b/gui/citybuilding_edit.h index af31932d704..29c26877b73 100644 --- a/gui/citybuilding_edit.h +++ b/gui/citybuilding_edit.h @@ -38,7 +38,7 @@ class citybuilding_edit_frame_t : public extend_edit_gui_t virtual void change_item_info( sint32 i ); public: - citybuilding_edit_frame_t(spieler_t* sp); + citybuilding_edit_frame_t(player_t* player); /** * in top-level windows the name is displayed in titlebar diff --git a/gui/components/gui_button.cc b/gui/components/gui_button.cc index 79f88341f72..b4c2046ee92 100644 --- a/gui/components/gui_button.cc +++ b/gui/components/gui_button.cc @@ -319,7 +319,7 @@ void button_t::draw(scr_coord offset) { uint8 offset = get_state_offset(); if( offset == 0 ) { - karte_t *welt = spieler_t::get_welt(); + karte_t *welt = player_t::get_welt(); if( grund_t *gr = welt->lookup_kartenboden(targetpos.x,targetpos.y) ) { offset = welt->get_viewport()->is_on_center( gr->get_pos() ); } diff --git a/gui/convoi_filter_frame.cc b/gui/convoi_filter_frame.cc index 01bf684429e..5eae12cf466 100644 --- a/gui/convoi_filter_frame.cc +++ b/gui/convoi_filter_frame.cc @@ -74,8 +74,8 @@ slist_tplconvoi_filter_frame_t::active_ware; char convoi_filter_frame_t::name_filter_text[] = ""; -convoi_filter_frame_t::convoi_filter_frame_t(spieler_t *sp, convoi_frame_t *m, uint32 f ) : - gui_frame_t( translator::translate("clf_title"), sp), +convoi_filter_frame_t::convoi_filter_frame_t(player_t *player, convoi_frame_t *m, uint32 f ) : + gui_frame_t( translator::translate("clf_title"), player), filter_flags(f), main_frame(m), ware_scrolly(&ware_cont) diff --git a/gui/convoi_filter_frame.h b/gui/convoi_filter_frame.h index b01798d9809..541f8c97316 100644 --- a/gui/convoi_filter_frame.h +++ b/gui/convoi_filter_frame.h @@ -22,7 +22,7 @@ #include "components/gui_textinput.h" class convoi_frame_t; -class spieler_t; +class player_t; class ware_besch_t; class convoi_filter_frame_t : public gui_frame_t , private action_listener_t @@ -125,7 +125,7 @@ class convoi_filter_frame_t : public gui_frame_t , private action_listener_t * Constructor. Generates all necessary Subcomponents. * @author V. Meyer */ - convoi_filter_frame_t(spieler_t *sp, convoi_frame_t *parent, uint32 initial_filters ); + convoi_filter_frame_t(player_t *player, convoi_frame_t *parent, uint32 initial_filters ); /** * Does this window need a min size button in the title bar? diff --git a/gui/convoi_frame.cc b/gui/convoi_frame.cc index 4fbbc70427f..ab0f4da640e 100644 --- a/gui/convoi_frame.cc +++ b/gui/convoi_frame.cc @@ -207,9 +207,9 @@ void convoi_frame_t::sort_list( char *name, uint32 filter, const slist_tpl *wares ); - convoi_frame_t(spieler_t *sp); + convoi_frame_t(player_t *player); ~convoi_frame_t(); diff --git a/gui/curiosity_edit.cc b/gui/curiosity_edit.cc index 90be3e9e44d..79ac6409fbb 100644 --- a/gui/curiosity_edit.cc +++ b/gui/curiosity_edit.cc @@ -43,8 +43,8 @@ static bool compare_haus_besch(const haus_besch_t* a, const haus_besch_t* b) -curiosity_edit_frame_t::curiosity_edit_frame_t(spieler_t* sp_) : - extend_edit_gui_t(translator::translate("curiosity builder"), sp_), +curiosity_edit_frame_t::curiosity_edit_frame_t(player_t* player_) : + extend_edit_gui_t(translator::translate("curiosity builder"), player_), hauslist(16), lb_rotation( rot_str, SYSCOL_TEXT_HIGHLIGHT, gui_label_t::right ), lb_rotation_info( translator::translate("Rotation"), SYSCOL_TEXT, gui_label_t::left ) @@ -285,9 +285,9 @@ void curiosity_edit_frame_t::change_item_info(sint32 entry) // the tools will be always updated, even though the data up there might be still current sprintf( param_str, "%i%c%s", bt_climates.pressed, rotation==255 ? '#' : '0'+rotation, besch->get_name() ); haus_tool.set_default_param(param_str); - welt->set_tool( &haus_tool, sp ); + welt->set_tool( &haus_tool, player ); } - else if(welt->get_tool(sp->get_player_nr())==&haus_tool) { + else if(welt->get_tool(player->get_player_nr())==&haus_tool) { for(int i=0; i<4; i++ ) { img[i].set_image( IMG_LEER ); } @@ -298,7 +298,7 @@ void curiosity_edit_frame_t::change_item_info(sint32 entry) } besch = NULL; - welt->set_tool( tool_t::general_tool[TOOL_QUERY], sp ); + welt->set_tool( tool_t::general_tool[TOOL_QUERY], player ); } } diff --git a/gui/curiosity_edit.h b/gui/curiosity_edit.h index d0d671b1b8a..2746cb2e82d 100644 --- a/gui/curiosity_edit.h +++ b/gui/curiosity_edit.h @@ -38,7 +38,7 @@ class curiosity_edit_frame_t : public extend_edit_gui_t virtual void change_item_info( sint32 i ); public: - curiosity_edit_frame_t(spieler_t* sp); + curiosity_edit_frame_t(player_t* player); /** * in top-level windows the name is displayed in titlebar diff --git a/gui/enlarge_map_frame_t.cc b/gui/enlarge_map_frame_t.cc index 4dbc47673c7..79ee88dfda0 100644 --- a/gui/enlarge_map_frame_t.cc +++ b/gui/enlarge_map_frame_t.cc @@ -261,7 +261,7 @@ void enlarge_map_frame_t::update_preview() const uint sy = sets->get_groesse_y(); const long memory = ( sizeof(karte_t) + - sizeof(spieler_t) * 8 + + sizeof(player_t) * 8 + sizeof(convoi_t) * 1000 + (sizeof(schiene_t) + sizeof(vehikel_t)) * 10 * (sx + sy) + sizeof(stadt_t) * sets->get_anzahl_staedte() + diff --git a/gui/extend_edit.cc b/gui/extend_edit.cc index 65eea95bfa5..83462fd1f97 100644 --- a/gui/extend_edit.cc +++ b/gui/extend_edit.cc @@ -24,9 +24,9 @@ -extend_edit_gui_t::extend_edit_gui_t(const char *name, spieler_t* sp_) : - gui_frame_t( name, sp_ ), - sp(sp_), +extend_edit_gui_t::extend_edit_gui_t(const char *name, player_t* player_) : + gui_frame_t( name, player_ ), + player(player_), info_text(&buf, COLUMN_WIDTH), scrolly(&cont), scl(gui_scrolled_list_t::listskin) @@ -40,7 +40,7 @@ extend_edit_gui_t::extend_edit_gui_t(const char *name, spieler_t* sp_) : // init scrolled list scl.set_size(scr_size(tab_panel_width, SCL_HEIGHT-14)); scl.set_pos(scr_coord(0,1)); - scl.set_highlight_color(sp->get_player_color1()+1); + scl.set_highlight_color(player->get_player_color1()+1); scl.set_selection(-1); scl.add_listener(this); diff --git a/gui/extend_edit.h b/gui/extend_edit.h index d909c819d42..45032dc1ae1 100644 --- a/gui/extend_edit.h +++ b/gui/extend_edit.h @@ -16,7 +16,7 @@ #include "../utils/cbuffer_t.h" #include "../simtypes.h" -class spieler_t; +class player_t; #define COLUMN_WIDTH (int)(D_BUTTON_WIDTH*2.25) #define SCL_HEIGHT (15*LINESPACE-1) @@ -43,7 +43,7 @@ class extend_edit_gui_t : sint16 tab_panel_width; protected: - spieler_t *sp; + player_t *player; cbuffer_t buf; gui_fixedwidth_textarea_t info_text; @@ -72,7 +72,7 @@ class extend_edit_gui_t : virtual void change_item_info( sint32 /*entry, -1= none */ ) {} public: - extend_edit_gui_t(const char *name, spieler_t* sp); + extend_edit_gui_t(const char *name, player_t* player_); /** * Does this window need a min size button in the title bar? diff --git a/gui/fabrik_info.cc b/gui/fabrik_info.cc index 919224d50eb..a0379294930 100644 --- a/gui/fabrik_info.cc +++ b/gui/fabrik_info.cc @@ -117,7 +117,7 @@ void fabrik_info_t::rename_factory() buf.printf( "f%s,%s", fab->get_pos().get_str(), fabname ); tool_t *tool = create_tool( TOOL_RENAME | SIMPLE_TOOL ); tool->set_default_param( buf ); - welt->set_tool( tool, welt->get_spieler(1)); + welt->set_tool( tool, welt->get_player(1)); // since init always returns false, it is safe to delete immediately delete tool; } @@ -369,7 +369,7 @@ void gui_fabrik_info_t::draw(scr_coord offset) fabrik_info_t::fabrik_info_t() : - gui_frame_t("", welt->get_spieler(1)), + gui_frame_t("", welt->get_player(1)), fab(NULL), chart(NULL), view(scr_size( max(64, get_base_tile_raster_width()), max(56, (get_base_tile_raster_width() * 7) / 8))), diff --git a/gui/factory_edit.cc b/gui/factory_edit.cc index 4fa220f9478..604322fc5a7 100644 --- a/gui/factory_edit.cc +++ b/gui/factory_edit.cc @@ -41,8 +41,8 @@ static bool compare_fabrik_besch(const fabrik_besch_t* a, const fabrik_besch_t* return diff < 0; } -factory_edit_frame_t::factory_edit_frame_t(spieler_t* sp_) : - extend_edit_gui_t(translator::translate("factorybuilder"), sp_), +factory_edit_frame_t::factory_edit_frame_t(player_t* player_) : + extend_edit_gui_t(translator::translate("factorybuilder"), player_), fablist(16), lb_rotation( rot_str, SYSCOL_TEXT_HIGHLIGHT, gui_label_t::right ), lb_rotation_info( translator::translate("Rotation"), SYSCOL_TEXT, gui_label_t::left ), @@ -344,13 +344,13 @@ void factory_edit_frame_t::change_item_info(sint32 entry) // the tools will be always updated, even though the data up there might be still current sprintf( param_str, "%i%c%i,%s", bt_climates.pressed, rotation==255 ? '#' : '0'+rotation, production, fab_besch->get_name() ); if(bt_land_chain.pressed) { - welt->set_tool( &land_chain_tool, sp ); + welt->set_tool( &land_chain_tool, player ); } else if(bt_city_chain.pressed) { - welt->set_tool( &city_chain_tool, sp ); + welt->set_tool( &city_chain_tool, player ); } else { - welt->set_tool( &fab_tool, sp ); + welt->set_tool( &fab_tool, player ); } } else if(fab_besch!=NULL) { @@ -361,6 +361,6 @@ void factory_edit_frame_t::change_item_info(sint32 entry) prod_str[0] = 0; tstrncpy(rot_str, translator::translate("random"), lengthof(rot_str)); fab_besch = NULL; - welt->set_tool( tool_t::general_tool[TOOL_QUERY], sp ); + welt->set_tool( tool_t::general_tool[TOOL_QUERY], player ); } } diff --git a/gui/factory_edit.h b/gui/factory_edit.h index 0462bb75403..eec3e73847a 100644 --- a/gui/factory_edit.h +++ b/gui/factory_edit.h @@ -46,7 +46,7 @@ class factory_edit_frame_t : public extend_edit_gui_t virtual void change_item_info( sint32 i ); public: - factory_edit_frame_t(spieler_t* sp); + factory_edit_frame_t(player_t* player); /** * in top-level windows the name is displayed in titlebar diff --git a/gui/fahrplan_gui.cc b/gui/fahrplan_gui.cc index a471f5e3a60..8ea8ffbe820 100644 --- a/gui/fahrplan_gui.cc +++ b/gui/fahrplan_gui.cc @@ -94,10 +94,10 @@ void fahrplan_gui_stats_t::highlight_schedule( schedule_t *markfpl, bool marking /** * Append description of entry to buf. */ -static void gimme_stop_name(cbuffer_t& buf, karte_t* welt, spieler_t const* const sp, linieneintrag_t const& entry) +static void gimme_stop_name(cbuffer_t& buf, karte_t* welt, player_t const* const player_, linieneintrag_t const& entry) { char const* what; - halthandle_t const halt = haltestelle_t::get_halt(entry.pos, sp); + halthandle_t const halt = haltestelle_t::get_halt(entry.pos, player_); if (halt.is_bound()) { if (entry.ladegrad != 0) { buf.printf("%d%% ", entry.ladegrad); @@ -124,10 +124,10 @@ static void gimme_stop_name(cbuffer_t& buf, karte_t* welt, spieler_t const* cons } -void fahrplan_gui_t::gimme_short_stop_name(cbuffer_t& buf, karte_t* welt, spieler_t const* const sp, linieneintrag_t const& entry, int const max_chars) +void fahrplan_gui_t::gimme_short_stop_name(cbuffer_t& buf, karte_t* welt, player_t const* const player_, linieneintrag_t const& entry, int const max_chars) { const char *p; - halthandle_t halt = haltestelle_t::get_halt(entry.pos, sp); + halthandle_t halt = haltestelle_t::get_halt(entry.pos, player_); if(halt.is_bound()) { p = halt->get_name(); } @@ -176,12 +176,12 @@ void fahrplan_gui_stats_t::draw(scr_coord offset) FORX(minivec_tpl, const& e, fpl->eintrag, (--sel, offset.y += LINESPACE + 1)) { if (sel == 0) { // highlight current entry (width is just wide enough, scrolly will do clipping) - display_fillbox_wh_clip(offset.x, offset.y - 1, 2048, LINESPACE + 1, sp->get_player_color1() + 1, false); + display_fillbox_wh_clip(offset.x, offset.y - 1, 2048, LINESPACE + 1, player->get_player_color1() + 1, false); } buf.clear(); buf.printf("%i) ", ++i); - gimme_stop_name(buf, welt, sp, e); + gimme_stop_name(buf, welt, player, e); PLAYER_COLOR_VAL const c = sel == 0 ? SYSCOL_TEXT_HIGHLIGHT : SYSCOL_TEXT; sint16 const w = display_proportional_clip(offset.x + 4 + 10, offset.y, buf, ALIGN_LEFT, c, true); if (width < w) { @@ -198,10 +198,10 @@ void fahrplan_gui_stats_t::draw(scr_coord offset) -fahrplan_gui_stats_t::fahrplan_gui_stats_t(spieler_t *s) +fahrplan_gui_stats_t::fahrplan_gui_stats_t(player_t *player_) { fpl = NULL; - sp = s; + player = player_; if( aktuell_mark==NULL ) { aktuell_mark = new zeiger_t(koord3d::invalid, NULL ); aktuell_mark->set_bild( tool_t::general_tool[TOOL_SCHEDULE_ADD]->cursor ); @@ -223,7 +223,7 @@ fahrplan_gui_stats_t::~fahrplan_gui_stats_t() fahrplan_gui_t::~fahrplan_gui_t() { - if( sp ) { + if( player ) { update_tool( false ); // hide schedule on minimap (may not current, but for safe) reliefkarte_t::get_karte()->set_current_cnv( convoihandle_t() ); @@ -234,16 +234,16 @@ fahrplan_gui_t::~fahrplan_gui_t() -fahrplan_gui_t::fahrplan_gui_t(schedule_t* fpl_, spieler_t* sp_, convoihandle_t cnv_) : - gui_frame_t( translator::translate("Fahrplan"), sp_), +fahrplan_gui_t::fahrplan_gui_t(schedule_t* fpl_, player_t* player_, convoihandle_t cnv_) : + gui_frame_t( translator::translate("Fahrplan"), player_), lb_line("Serves Line:"), lb_wait("month wait time"), lb_waitlevel(NULL, SYSCOL_TEXT_HIGHLIGHT, gui_label_t::right), lb_load("Full load"), - stats(sp_), + stats(player_), scrolly(&stats), old_fpl(fpl_), - sp(sp_), + player(player_), cnv(cnv_) { old_fpl->eingabe_beginnen(); @@ -276,7 +276,7 @@ fahrplan_gui_t::fahrplan_gui_t(schedule_t* fpl_, spieler_t* sp_, convoihandle_t line_selector.set_pos(scr_coord(2, ypos)); line_selector.set_size(scr_size(BUTTON4_X-2, D_BUTTON_HEIGHT)); line_selector.set_max_size(scr_size(BUTTON4_X-2, 13*LINESPACE+D_TITLEBAR_HEIGHT-1)); - line_selector.set_highlight_color(sp->get_player_color1() + 1); + line_selector.set_highlight_color(player->get_player_color1() + 1); line_selector.clear_elements(); init_line_selector(); @@ -380,14 +380,14 @@ void fahrplan_gui_t::update_tool(bool set) { if(!set || mode==removing || mode==undefined_mode) { // reset tools, if still selected ... - if(welt->get_tool(sp->get_player_nr())==tool_t::general_tool[TOOL_SCHEDULE_ADD]) { + if(welt->get_tool(player->get_player_nr())==tool_t::general_tool[TOOL_SCHEDULE_ADD]) { if(tool_t::general_tool[TOOL_SCHEDULE_ADD]->get_default_param()==(const char *)fpl) { - welt->set_tool( tool_t::general_tool[TOOL_QUERY], sp ); + welt->set_tool( tool_t::general_tool[TOOL_QUERY], player ); } } - else if(welt->get_tool(sp->get_player_nr())==tool_t::general_tool[TOOL_SCHEDULE_INS]) { + else if(welt->get_tool(player->get_player_nr())==tool_t::general_tool[TOOL_SCHEDULE_INS]) { if(tool_t::general_tool[TOOL_SCHEDULE_INS]->get_default_param()==(const char *)fpl) { - welt->set_tool( tool_t::general_tool[TOOL_QUERY], sp ); + welt->set_tool( tool_t::general_tool[TOOL_QUERY], player ); } } } @@ -395,11 +395,11 @@ void fahrplan_gui_t::update_tool(bool set) // .. or set them again if(mode==adding) { tool_t::general_tool[TOOL_SCHEDULE_ADD]->set_default_param((const char *)fpl); - welt->set_tool( tool_t::general_tool[TOOL_SCHEDULE_ADD], sp ); + welt->set_tool( tool_t::general_tool[TOOL_SCHEDULE_ADD], player ); } else if(mode==inserting) { tool_t::general_tool[TOOL_SCHEDULE_INS]->set_default_param((const char *)fpl); - welt->set_tool( tool_t::general_tool[TOOL_SCHEDULE_INS], sp ); + welt->set_tool( tool_t::general_tool[TOOL_SCHEDULE_INS], player ); } } } @@ -416,7 +416,7 @@ void fahrplan_gui_t::update_selection() if( !fpl->empty() ) { fpl->set_aktuell( min(fpl->get_count()-1,fpl->get_aktuell()) ); const uint8 aktuell = fpl->get_aktuell(); - if( haltestelle_t::get_halt(fpl->eintrag[aktuell].pos, sp).is_bound() ) { + if( haltestelle_t::get_halt(fpl->eintrag[aktuell].pos, player).is_bound() ) { lb_load.set_color( SYSCOL_TEXT ); numimp_load.enable(); numimp_load.set_value( fpl->eintrag[aktuell].ladegrad ); @@ -613,7 +613,7 @@ DBG_MESSAGE("fahrplan_gui_t::action_triggered()","komp=%p combo=%p",komp,&line_s buf.printf( "c,0,%i,%ld,", (int)fpl->get_type(), (long)old_fpl ); fpl->sprintf_schedule( buf ); tool->set_default_param(buf); - welt->set_tool( tool, sp ); + welt->set_tool( tool, player ); // since init always returns false, it is safe to delete immediately delete tool; } @@ -640,7 +640,7 @@ void fahrplan_gui_t::init_line_selector() int selection = 0; vector_tpl lines; - sp->simlinemgmt.get_lines(fpl->get_type(), &lines); + player->simlinemgmt.get_lines(fpl->get_type(), &lines); // keep assignment with identical schedules if( new_line.is_bound() && !fpl->matches( welt, new_line->get_schedule() ) ) { @@ -672,7 +672,7 @@ void fahrplan_gui_t::init_line_selector() line_selector.set_selection( selection ); line_scrollitem_t::sort_mode = line_scrollitem_t::SORT_BY_NAME; line_selector.sort( 1, NULL ); - old_line_count = sp->simlinemgmt.get_line_count(); + old_line_count = player->simlinemgmt.get_line_count(); last_schedule_count = fpl->get_count(); } @@ -680,7 +680,7 @@ void fahrplan_gui_t::init_line_selector() void fahrplan_gui_t::draw(scr_coord pos, scr_size size) { - if( sp->simlinemgmt.get_line_count()!=old_line_count || last_schedule_count!=fpl->get_count() ) { + if( player->simlinemgmt.get_line_count()!=old_line_count || last_schedule_count!=fpl->get_count() ) { // lines added or deleted init_line_selector(); last_schedule_count = fpl->get_count(); @@ -732,7 +732,7 @@ gui_frame_t( translator::translate("Fahrplan"), NULL), scrolly(&stats), fpl(NULL), old_fpl(NULL), - sp(NULL), + player(NULL), cnv() { // just a dummy @@ -787,7 +787,7 @@ void fahrplan_gui_t::rdwr(loadsave_t *file) else { dbg->error( "fahrplan_gui_t::rdwr", "Could not restore schedule window for (%d)", cnv.get_id() ); } - sp = NULL; + player = NULL; delete old_fpl; delete fpl; fpl = old_fpl = NULL; diff --git a/gui/fahrplan_gui.h b/gui/fahrplan_gui.h index 59a95901459..448e471a535 100644 --- a/gui/fahrplan_gui.h +++ b/gui/fahrplan_gui.h @@ -29,7 +29,7 @@ class zeiger_t; class schedule_t; struct linieneintrag_t; -class spieler_t; +class player_t; class cbuffer_t; class loadsave_t; @@ -42,10 +42,10 @@ class fahrplan_gui_stats_t : public gui_world_component_t schedule_t* fpl; - spieler_t* sp; + player_t* player; public: - fahrplan_gui_stats_t(spieler_t *s); + fahrplan_gui_stats_t(player_t *player_); ~fahrplan_gui_stats_t(); void set_fahrplan( schedule_t* f ) { fpl = f; } @@ -71,7 +71,7 @@ class fahrplan_gui_t : public gui_frame_t, * Append description of entry to buf. * short version, without loading level and position */ - static void gimme_short_stop_name(cbuffer_t& buf, karte_t* welt, spieler_t const* sp, linieneintrag_t const& entry, int max_chars); + static void gimme_short_stop_name(cbuffer_t& buf, karte_t* welt, player_t const* player_, linieneintrag_t const& entry, int max_chars); private: enum mode_t {adding, inserting, removing, undefined_mode}; @@ -111,13 +111,13 @@ class fahrplan_gui_t : public gui_frame_t, protected: schedule_t *fpl; schedule_t* old_fpl; - spieler_t *sp; + player_t *player; convoihandle_t cnv; linehandle_t new_line, old_line; public: - fahrplan_gui_t(schedule_t* fpl, spieler_t* sp, convoihandle_t cnv); + fahrplan_gui_t(schedule_t* fpl, player_t* player, convoihandle_t cnv); virtual ~fahrplan_gui_t(); diff --git a/gui/gui_frame.cc b/gui/gui_frame.cc index 551fc4aeabf..0bafa4a1f93 100644 --- a/gui/gui_frame.cc +++ b/gui/gui_frame.cc @@ -26,12 +26,12 @@ karte_ptr_t gui_frame_t::welt; // Insert the container -gui_frame_t::gui_frame_t(char const* const name, spieler_t const* const sp) +gui_frame_t::gui_frame_t(char const* const name, player_t const* const player) { this->name = name; size = scr_size(200, 100); min_windowsize = scr_size(0,0); - owner = sp; + owner = player; container.set_pos(scr_coord(0,D_TITLEBAR_HEIGHT)); set_resizemode(no_resize); //25-may-02 markus weber added opaque = true; diff --git a/gui/gui_frame.h b/gui/gui_frame.h index e22ebf946c5..12072be94dc 100644 --- a/gui/gui_frame.h +++ b/gui/gui_frame.h @@ -24,7 +24,7 @@ class loadsave_t; class karte_ptr_t; -class spieler_t; +class player_t; /** * A Class for window with Component. @@ -60,7 +60,7 @@ class gui_frame_t scr_size min_windowsize; resize_modes resize_mode; // 25-may-02 markus weber added - const spieler_t *owner; + const player_t *owner; // set true for total redraw bool dirty:1; @@ -81,7 +81,7 @@ class gui_frame_t */ virtual void resize(const scr_coord delta); - void set_owner( const spieler_t *sp ) { owner = sp; } + void set_owner( const player_t *player ) { owner = player; } void set_transparent( uint8 percent, COLOR_VAL col ) { opaque = percent==0; percent_transparent = percent; color_transparent = col; } @@ -89,10 +89,10 @@ class gui_frame_t public: /** * @param name, Window title - * @param sp, owner for color + * @param player owner for color * @author Hj. Malthaner */ - gui_frame_t(const char *name, const spieler_t *sp=NULL); + gui_frame_t(const char *name, const player_t *player=NULL); virtual ~gui_frame_t() {} diff --git a/gui/halt_detail.cc b/gui/halt_detail.cc index 4836f4f0852..439d08250bc 100644 --- a/gui/halt_detail.cc +++ b/gui/halt_detail.cc @@ -335,11 +335,11 @@ bool halt_detail_t::action_triggered( gui_action_creator_t *, value_t extra) uint16 j=k.y; if( j < halt->registered_lines.get_count() ) { linehandle_t line=halt->registered_lines[j]; - spieler_t *sp=welt->get_active_player(); - if( sp==line->get_besitzer() ) { + player_t *player=welt->get_active_player(); + if( player==line->get_besitzer() ) { //TODO: // Change player => change marked lines - sp->simlinemgmt.show_lineinfo(sp,line); + player->simlinemgmt.show_lineinfo(player,line); welt->set_dirty(); } } diff --git a/gui/halt_detail.h b/gui/halt_detail.h index e55df3a6216..7c8aec44fcb 100644 --- a/gui/halt_detail.h +++ b/gui/halt_detail.h @@ -18,7 +18,7 @@ #include "../utils/cbuffer_t.h" #include "../gui/simwin.h" -class spieler_t; +class player_t; /** @@ -31,7 +31,7 @@ class halt_detail_t : public gui_frame_t, action_listener_t private: halthandle_t halt; uint8 destination_counter; // last destination counter of the halt; if mismatch to current, then redraw destinations - spieler_t *cached_active_player; // So that, if different from current, change line links + player_t *cached_active_player; // So that, if different from current, change line links uint32 cached_line_count; uint32 cached_convoy_count; diff --git a/gui/halt_list_filter_frame.cc b/gui/halt_list_filter_frame.cc index ee7176875dc..cd7402d1c06 100644 --- a/gui/halt_list_filter_frame.cc +++ b/gui/halt_list_filter_frame.cc @@ -60,8 +60,8 @@ halt_list_frame_t::filter_flag_t halt_list_filter_frame_t::filter_buttons_types[ }; -halt_list_filter_frame_t::halt_list_filter_frame_t(spieler_t *sp, halt_list_frame_t *main_frame) : - gui_frame_t( translator::translate("hlf_title"), sp), +halt_list_filter_frame_t::halt_list_filter_frame_t(player_t *player, halt_list_frame_t *main_frame) : + gui_frame_t( translator::translate("hlf_title"), player), ware_scrolly_ab(&ware_cont_ab), ware_scrolly_an(&ware_cont_an) { diff --git a/gui/halt_list_filter_frame.h b/gui/halt_list_filter_frame.h index 3522189e19d..e3333296339 100644 --- a/gui/halt_list_filter_frame.h +++ b/gui/halt_list_filter_frame.h @@ -19,7 +19,7 @@ #include "halt_list_frame.h" #include "components/gui_textinput.h" -class spieler_t; +class player_t; class halt_list_filter_frame_t : public gui_frame_t , private action_listener_t { @@ -97,7 +97,7 @@ class halt_list_filter_frame_t : public gui_frame_t , private action_listener_t gui_container_t ware_cont_an; public: - halt_list_filter_frame_t(spieler_t *sp, halt_list_frame_t *main_frame); + halt_list_filter_frame_t(player_t *player, halt_list_frame_t *main_frame); ~halt_list_filter_frame_t(); /** diff --git a/gui/halt_list_frame.cc b/gui/halt_list_frame.cc index 0441b3e0a53..752980f12c8 100644 --- a/gui/halt_list_frame.cc +++ b/gui/halt_list_frame.cc @@ -243,13 +243,13 @@ static bool passes_filter(haltestelle_t const& s) } -halt_list_frame_t::halt_list_frame_t(spieler_t *sp) : - gui_frame_t( translator::translate("hl_title"), sp), +halt_list_frame_t::halt_list_frame_t(player_t *player) : + gui_frame_t( translator::translate("hl_title"), player), vscroll( scrollbar_t::vertical ), sort_label(translator::translate("hl_txt_sort")), filter_label(translator::translate("hl_txt_filter")) { - m_sp = sp; + m_player = player; filter_frame = NULL; sort_label.set_pos(scr_coord(BUTTON1_X, 2)); @@ -310,7 +310,7 @@ void halt_list_frame_t::display_list() // create a unsorted station list num_filtered_stops = 0; FOR(vector_tpl, const halt, haltestelle_t::get_alle_haltestellen()) { - if( halt->get_besitzer() == m_sp ) { + if( halt->get_besitzer() == m_player ) { a[n++] = halt; if (passes_filter(*halt)) { num_filtered_stops++; @@ -396,7 +396,7 @@ bool halt_list_frame_t::action_triggered( gui_action_creator_t *comp,value_t /* destroy_win(filter_frame); } else { - filter_frame = new halt_list_filter_frame_t(m_sp, this); + filter_frame = new halt_list_filter_frame_t(m_player, this); create_win(filter_frame, w_info, (ptrdiff_t)this); } } diff --git a/gui/halt_list_frame.h b/gui/halt_list_frame.h index 53ddfd54025..de9bff885ec 100644 --- a/gui/halt_list_frame.h +++ b/gui/halt_list_frame.h @@ -25,7 +25,7 @@ #include "components/action_listener.h" #include "../tpl/vector_tpl.h" -class spieler_t; +class player_t; class ware_besch_t; class halt_list_frame_t : public gui_frame_t , private action_listener_t @@ -49,7 +49,7 @@ class halt_list_frame_t : public gui_frame_t , private action_listener_t }; private: - spieler_t *m_sp; //13-Feb-02 Added + player_t *m_player; //13-Feb-02 Added static const char *sort_text[SORT_MODES]; @@ -92,7 +92,7 @@ class halt_list_frame_t : public gui_frame_t , private action_listener_t static bool compare_halts(halthandle_t, halthandle_t); public: - halt_list_frame_t(spieler_t *sp); + halt_list_frame_t(player_t *player); ~halt_list_frame_t(); diff --git a/gui/help_frame.cc b/gui/help_frame.cc index 75173ffd2ca..86ccac7b9c2 100644 --- a/gui/help_frame.cc +++ b/gui/help_frame.cc @@ -294,7 +294,7 @@ void help_frame_t::set_helpfile(const char *filename, bool resize_frame ) if (strcmp(filename, "keys.txt") == 0) { cbuffer_t buf; buf.append( translator::translate( "Keyboard Help\n

Keyboard Help

\n" ) ); - spieler_t *sp = welt->get_active_player(); + player_t *player = welt->get_active_player(); const char *trad_str = translator::translate( "%s - %s
\n" ); FOR(vector_tpl, const i, tool_t::char_to_tool) { char const* c = NULL; @@ -322,7 +322,7 @@ void help_frame_t::set_helpfile(const char *filename, bool resize_frame ) c = str; break; } - buf.printf(trad_str, c, i->get_tooltip(sp)); + buf.printf(trad_str, c, i->get_tooltip(player)); } set_text( buf, resize_frame ); } diff --git a/gui/karte.cc b/gui/karte.cc index fe8b81ad505..367f20af752 100644 --- a/gui/karte.cc +++ b/gui/karte.cc @@ -85,7 +85,7 @@ const uint8 reliefkarte_t::severity_color[MAX_SEVERITY_COLORS] = // helper function for line segment_t bool reliefkarte_t::line_segment_t::operator == (const line_segment_t & k) const { - return start == k.start && end == k.end && sp == k.sp && fpl->similar( k.fpl, sp ); + return start == k.start && end == k.end && player == k.player && fpl->similar( k.fpl, player ); } // Ordering based on first start then end coordinate @@ -1223,9 +1223,9 @@ void reliefkarte_t::draw(scr_coord pos) continue; } //cycle on players - if( welt->get_spieler( np ) && welt->get_spieler( np )->simlinemgmt.get_line_count() > 0 ) { + if( welt->get_player( np ) && welt->get_player( np )->simlinemgmt.get_line_count() > 0 ) { - welt->get_spieler( np )->simlinemgmt.get_lines( simline_t::line, &linee ); + welt->get_player( np )->simlinemgmt.get_lines( simline_t::line, &linee ); for( uint32 j = 0; j < linee.get_count(); j++ ) { //cycle on lines @@ -1261,9 +1261,9 @@ void reliefkarte_t::draw(scr_coord pos) } // now add all unbound convois - spieler_t * required_vehicle_owner = NULL; + player_t * required_vehicle_owner = NULL; if (player_showed_on_map != -1) { - required_vehicle_owner = welt->get_spieler(player_showed_on_map); + required_vehicle_owner = welt->get_player(player_showed_on_map); } FOR( vector_tpl, cnv, welt->convoys() ) { if( !cnv.is_bound() || cnv->get_line().is_bound() ) { @@ -1347,7 +1347,7 @@ void reliefkarte_t::draw(scr_coord pos) if( event_get_last_control_shift()==2 || current_cnv.is_bound() ) { // on control / single convoi use only player colors static COLOR_VAL last_color = color; - color = seg.sp->get_player_color1()+1; + color = seg.player->get_player_color1()+1; // all lines same thickness if same color if( color == last_color ) { offset = 0; diff --git a/gui/karte.h b/gui/karte.h index 67871580a67..122ff82fd7a 100644 --- a/gui/karte.h +++ b/gui/karte.h @@ -14,7 +14,7 @@ class karte_ptr_t; class fabrik_t; class grund_t; class stadt_t; -class spieler_t; +class player_t; class schedule_t; class loadsave_t; class ware_besch_t; @@ -83,17 +83,17 @@ class reliefkarte_t : public gui_component_t public: koord start, end; schedule_t *fpl; - spieler_t *sp; + player_t *player; waytype_t waytype; uint8 colorcount; uint8 start_offset; uint8 end_offset; bool start_diagonal; line_segment_t() {} - line_segment_t( koord s, uint8 so, koord e, uint8 eo, schedule_t *f, spieler_t *p, uint8 cc, bool diagonal ) { + line_segment_t( koord s, uint8 so, koord e, uint8 eo, schedule_t *f, player_t *player_, uint8 cc, bool diagonal ) { fpl = f; waytype = f->get_waytype(); - sp = p; + player = player_; colorcount = cc; start_diagonal = diagonal; if( s.xget_bild_nr(0), sp->get_player_nr() ) + bild( skinverwaltung_t::color_options->get_bild_nr(0), player_->get_player_nr() ) { scr_coord cursor = scr_coord (D_MARGIN_TOP, D_MARGIN_LEFT); - this->sp = sp; + this->player = player_; buf.clear(); buf.append(translator::translate("COLOR_CHOOSE\n")); @@ -51,9 +51,9 @@ farbengui_t::farbengui_t(spieler_t *sp) : uint32 used_colors1 = 0; uint32 used_colors2 = 0; for( int i=0; iget_player_nr() && welt->get_spieler(i) ) { - used_colors1 |= 1 << (welt->get_spieler(i)->get_player_color1() / 8); - used_colors2 |= 1 << (welt->get_spieler(i)->get_player_color2() / 8); + if( i!=player_->get_player_nr() && welt->get_player(i) ) { + used_colors1 |= 1 << (welt->get_player(i)->get_player_color1() / 8); + used_colors2 |= 1 << (welt->get_player(i)->get_player_color2() / 8); } } @@ -64,7 +64,7 @@ farbengui_t::farbengui_t(spieler_t *sp) : player_color_1[i].add_listener(this); add_component( player_color_1+i ); } - player_color_1[sp->get_player_color1()/8].pressed = true; + player_color_1[player_->get_player_color1()/8].pressed = true; cursor.y += 2*(D_BUTTON_HEIGHT+D_H_SPACE)+LINESPACE; // Player's secondary color label @@ -79,7 +79,7 @@ farbengui_t::farbengui_t(spieler_t *sp) : player_color_2[i].add_listener(this); add_component( player_color_2+i ); } - player_color_2[sp->get_player_color2()/8].pressed = true; + player_color_2[player_->get_player_color2()/8].pressed = true; cursor.y += 2*D_BUTTON_HEIGHT+D_H_SPACE; // Put picture in place @@ -103,7 +103,7 @@ bool farbengui_t::action_triggered( gui_action_creator_t *komp,value_t /* */) player_color_1[j].pressed = false; } player_color_1[i].pressed = true; - sp->set_player_color( i*8, sp->get_player_color2() ); + player->set_player_color( i*8, player->get_player_color2() ); return true; } @@ -113,7 +113,7 @@ bool farbengui_t::action_triggered( gui_action_creator_t *komp,value_t /* */) player_color_2[j].pressed = false; } player_color_2[i].pressed = true; - sp->set_player_color( sp->get_player_color1(), i*8 ); + player->set_player_color( player->get_player_color1(), i*8 ); return true; } diff --git a/gui/kennfarbe.h b/gui/kennfarbe.h index 3946c0fa43f..b9afb8699b5 100644 --- a/gui/kennfarbe.h +++ b/gui/kennfarbe.h @@ -30,7 +30,7 @@ class farbengui_t : public gui_frame_t, action_listener_t { private: - spieler_t *sp; + player_t *player; cbuffer_t buf; gui_textarea_t txt; gui_label_t c1, c2; @@ -40,7 +40,7 @@ class farbengui_t : public gui_frame_t, action_listener_t button_t player_color_2[28]; public: - farbengui_t(spieler_t *sp); + farbengui_t(player_t *player); /** * Set the window associated helptext diff --git a/gui/label_info.cc b/gui/label_info.cc index 5f350e4b66b..ca4051bb577 100644 --- a/gui/label_info.cc +++ b/gui/label_info.cc @@ -28,7 +28,7 @@ label_info_t::label_info_t(label_t* l) : view(l->get_pos(), scr_size( max(64, get_base_tile_raster_width()), max(56, (get_base_tile_raster_width()*7)/8) )) { - this->sp = sp; + this->player = player; label = l; const char *const p_name = label->get_besitzer()->get_name(); diff --git a/gui/label_info.h b/gui/label_info.h index 52d95743289..6d455a5b5d4 100644 --- a/gui/label_info.h +++ b/gui/label_info.h @@ -26,7 +26,7 @@ class label_t; class label_info_t : public gui_frame_t, private action_listener_t { private: - spieler_t *sp; + player_t *player; label_t *label; gui_label_t player_name; diff --git a/gui/line_management_gui.cc b/gui/line_management_gui.cc index f7b9dd9e31d..0a3f7822611 100644 --- a/gui/line_management_gui.cc +++ b/gui/line_management_gui.cc @@ -16,8 +16,8 @@ #include "line_management_gui.h" -line_management_gui_t::line_management_gui_t(linehandle_t line, spieler_t* sp) : - fahrplan_gui_t(line->get_schedule()->copy(), sp, convoihandle_t() ) +line_management_gui_t::line_management_gui_t(linehandle_t line, player_t* player_) : + fahrplan_gui_t(line->get_schedule()->copy(), player_, convoihandle_t() ) { this->line = line; // has this line a single running convoi? @@ -44,7 +44,7 @@ const char *line_management_gui_t::get_name() const bool line_management_gui_t::infowin_event(const event_t *ev) { - if( sp!=NULL ) { + if( player!=NULL ) { // not "magic_line_schedule_rdwr_dummy" during loading of UI ... if( !line.is_bound() ) { destroy_win( this ); @@ -97,13 +97,13 @@ void line_management_gui_t::rdwr(loadsave_t *file) old_fpl->rdwr(file); fpl->rdwr(file); if( file->is_loading() ) { - spieler_t *sp = welt->get_spieler(player_nr); - assert(sp); // since it was alive during saving, this should never happen + player_t *player = welt->get_player(player_nr); + assert(player); // since it was alive during saving, this should never happen if( line.is_bound() && old_fpl->matches( welt, line->get_schedule() ) ) { // now we can open the window ... scr_coord const& pos = win_get_pos(this); - line_management_gui_t *w = new line_management_gui_t( line, sp ); + line_management_gui_t *w = new line_management_gui_t( line, player ); create_win(pos.x, pos.y, w, w_info, (ptrdiff_t)line.get_rep()); w->set_windowsize( size ); w->fpl->copy_from( fpl ); @@ -111,7 +111,7 @@ void line_management_gui_t::rdwr(loadsave_t *file) else { dbg->error( "line_management_gui_t::rdwr", "Could not restore schedule window for line id %i", line.get_id() ); } - sp = NULL; + player = NULL; delete old_fpl; delete fpl; fpl = old_fpl = NULL; diff --git a/gui/line_management_gui.h b/gui/line_management_gui.h index cf17ac18a7d..56759e3bd5e 100644 --- a/gui/line_management_gui.h +++ b/gui/line_management_gui.h @@ -11,13 +11,13 @@ #include "../linehandle_t.h" -class spieler_t; +class player_t; class loadsave_t; class line_management_gui_t : public fahrplan_gui_t { public: - line_management_gui_t(linehandle_t line, spieler_t* sp); + line_management_gui_t(linehandle_t line, player_t* player); virtual ~line_management_gui_t(); const char * get_name() const; diff --git a/gui/map_frame.cc b/gui/map_frame.cc index 6d00b01ce11..bac786637e2 100644 --- a/gui/map_frame.cc +++ b/gui/map_frame.cc @@ -232,8 +232,8 @@ map_frame_t::map_frame_t() : viewed_player_c.append_element( new gui_scrolled_list_t::const_text_scrollitem_t(translator::translate("All"), COL_BLACK)); viewable_players[ 0 ] = -1; for( int np = 0, count = 1; np < MAX_PLAYER_COUNT; np++ ) { - if( welt->get_spieler( np ) && welt->get_spieler( np )->has_money_or_assets()) { - viewed_player_c.append_element( new gui_scrolled_list_t::const_text_scrollitem_t(welt->get_spieler( np )->get_name(), welt->get_spieler( np )->get_player_color1()+4)); + if( welt->get_player( np ) && welt->get_player( np )->has_money_or_assets()) { + viewed_player_c.append_element( new gui_scrolled_list_t::const_text_scrollitem_t(welt->get_player( np )->get_name(), welt->get_player( np )->get_player_color1()+4)); viewable_players[ count++ ] = np; } } diff --git a/gui/money_frame.cc b/gui/money_frame.cc index 680c235f4b8..2092f12a3a4 100644 --- a/gui/money_frame.cc +++ b/gui/money_frame.cc @@ -106,7 +106,7 @@ const char * money_frame_t::transport_type_values[TT_MAX] = { /// Helper method to query data from players statistics sint64 money_frame_t::get_statistics_value(int tt, uint8 type, int yearmonth, bool monthly) { - const finance_t* finance = sp->get_finance(); + const finance_t* finance = player->get_finance(); if (tt == TT_MAX) { return monthly ? finance->get_history_com_month(yearmonth, type) : finance->get_history_com_year( yearmonth, type); @@ -166,7 +166,7 @@ void money_frame_t::fill_chart_tables() bool money_frame_t::is_chart_table_zero(int ttoption) { - if (sp->get_finance()->get_maintenance_with_bits((transport_type)ttoption) != 0) { + if (player->get_finance()->get_maintenance_with_bits((transport_type)ttoption) != 0) { return false; } // search for any non-zero values @@ -193,8 +193,8 @@ bool money_frame_t::is_chart_table_zero(int ttoption) } -money_frame_t::money_frame_t(spieler_t *sp) - : gui_frame_t( translator::translate("Finanzen"), sp), +money_frame_t::money_frame_t(player_t *player) + : gui_frame_t( translator::translate("Finanzen"), player), tylabel("This Year", SYSCOL_TEXT_HIGHLIGHT, gui_label_t::right), lylabel("Last Year", SYSCOL_TEXT_HIGHLIGHT, gui_label_t::right), conmoney(NULL, SYSCOL_TEXT_HIGHLIGHT, gui_label_t::money), @@ -227,12 +227,12 @@ money_frame_t::money_frame_t(spieler_t *sp) transport_type_option(0), headquarter_view(koord3d::invalid, scr_size(120, 64)) { - if(welt->get_spieler(0)!=sp) { - sprintf(money_frame_title,translator::translate("Finances of %s"),translator::translate(sp->get_name()) ); + if(welt->get_player(0)!=player) { + sprintf(money_frame_title,translator::translate("Finances of %s"),translator::translate(player->get_name()) ); set_name(money_frame_title); } - this->sp = sp; + this->player = player; const scr_coord_val top = 30; const scr_coord_val left = 12; @@ -283,7 +283,7 @@ money_frame_t::money_frame_t(spieler_t *sp) // return money or else stuff ... warn.set_pos(scr_coord(left+335, top+9*BUTTONSPACE)); - if(sp->get_player_nr()!=1 && welt->get_scenario()->active()) { + if(player->get_player_nr()!=1 && welt->get_scenario()->active()) { scenario.set_pos( scr_coord( 10,1 ) ); welt->get_scenario()->update_scenario_texts(); scenario.set_text( welt->get_scenario()->description_text ); @@ -359,11 +359,11 @@ money_frame_t::money_frame_t(spieler_t *sp) add_component(&mchart); // easier headquarter access - old_level = sp->get_headquarter_level(); - old_pos = sp->get_headquarter_pos(); + old_level = player->get_headquarter_level(); + old_pos = player->get_headquarter_pos(); headquarter_tooltip[0] = 0; - if( sp->get_ai_id()!=spieler_t::HUMAN ) { + if( player->get_ai_id()!=player_t::HUMAN ) { // misuse headquarter button for AI configure headquarter.init(button_t::roundbox, "Configure AI", scr_coord(582-12-120, 0), scr_size(120, BUTTONSPACE)); headquarter.add_listener(this); @@ -379,7 +379,7 @@ money_frame_t::money_frame_t(spieler_t *sp) headquarter.disable(); // reuse tooltip from tool_headquarter_t - const char * c = tool_t::general_tool[TOOL_HEADQUARTER]->get_tooltip(sp); + const char * c = tool_t::general_tool[TOOL_HEADQUARTER]->get_tooltip(player); if(c) { // only true, if the headquarter can be built/updated tstrncpy(headquarter_tooltip, c, lengthof(headquarter_tooltip)); @@ -389,7 +389,7 @@ money_frame_t::money_frame_t(spieler_t *sp) } if(old_pos!=koord::invalid) { - headquarter_view.set_location( welt->lookup_kartenboden( sp->get_headquarter_pos() )->get_pos() ); + headquarter_view.set_location( welt->lookup_kartenboden( player->get_headquarter_pos() )->get_pos() ); } headquarter_view.set_pos( scr_coord(582-12-120, BUTTONSPACE) ); add_component(&headquarter_view); @@ -410,7 +410,7 @@ money_frame_t::money_frame_t(spieler_t *sp) // states ... for ( int i = 0; iget_player_nr()] & (1<get_player_nr()] & (1<get_finance()->calc_finance_history(); + player->get_finance()->calc_finance_history(); fill_chart_tables(); chart.set_visible( year_month_tabs.get_active_tab_index()==0 ); @@ -485,9 +485,9 @@ void money_frame_t::draw(scr_coord pos, scr_size size) str_buf[19][strlen(str_buf[19])-1] = '%'; // remove cent sign // warning/success messages - if(sp->get_player_nr()!=1 && welt->get_scenario()->active()) { + if(player->get_player_nr()!=1 && welt->get_scenario()->active()) { warn.set_color( COL_BLACK ); - sint32 percent = welt->get_scenario()->get_completion(sp->get_player_nr()); + sint32 percent = welt->get_scenario()->get_completion(player->get_player_nr()); if (percent >= 0) { sprintf( str_buf[15], translator::translate("Scenario complete: %i%%"), percent ); } @@ -495,17 +495,17 @@ void money_frame_t::draw(scr_coord pos, scr_size size) tstrncpy(str_buf[15], translator::translate("Scenario lost!"), lengthof(str_buf[15]) ); } } - else if(sp->get_finance()->get_history_com_year(0, ATC_NETWEALTH)<0) { + else if(player->get_finance()->get_history_com_year(0, ATC_NETWEALTH)<0) { warn.set_color( MONEY_MINUS ); tstrncpy(str_buf[15], translator::translate("Company bankrupt"), lengthof(str_buf[15]) ); } - else if( sp->get_finance()->get_history_com_year(0, ATC_NETWEALTH)*10 < welt->get_settings().get_starting_money(welt->get_current_month()/12) ){ + else if( player->get_finance()->get_history_com_year(0, ATC_NETWEALTH)*10 < welt->get_settings().get_starting_money(welt->get_current_month()/12) ){ warn.set_color( MONEY_MINUS ); tstrncpy(str_buf[15], translator::translate("Net wealth near zero"), lengthof(str_buf[15]) ); } - else if( sp->get_account_overdrawn() ) { + else if( player->get_account_overdrawn() ) { warn.set_color( COL_YELLOW ); - sprintf( str_buf[15], translator::translate("On loan since %i month(s)"), sp->get_account_overdrawn() ); + sprintf( str_buf[15], translator::translate("On loan since %i month(s)"), player->get_account_overdrawn() ); } else { str_buf[15][0] = '\0'; @@ -513,7 +513,7 @@ void money_frame_t::draw(scr_coord pos, scr_size size) warn.set_text(str_buf[15]); // scenario description - if(sp->get_player_nr()!=1 && welt->get_scenario()->active()) { + if(player->get_player_nr()!=1 && welt->get_scenario()->active()) { dynamic_string& desc = welt->get_scenario()->description_text; if (desc.has_changed()) { scenario.set_text( desc ); @@ -522,20 +522,20 @@ void money_frame_t::draw(scr_coord pos, scr_size size) } headquarter.disable(); - if( sp->get_ai_id()!=spieler_t::HUMAN ) { + if( player->get_ai_id()!=player_t::HUMAN ) { headquarter.set_tooltip( "Configure AI setttings" ); headquarter.set_text( "Configure AI" ); headquarter.enable(); } - else if(sp!=welt->get_active_player()) { + else if(player!=welt->get_active_player()) { headquarter.set_tooltip( NULL ); } else { // I am on my own => allow upgrading - if(old_level!=sp->get_headquarter_level()) { + if(old_level!=player->get_headquarter_level()) { // reuse tooltip from tool_headquarter_t - const char * c = tool_t::general_tool[TOOL_HEADQUARTER]->get_tooltip(sp); + const char * c = tool_t::general_tool[TOOL_HEADQUARTER]->get_tooltip(player); if(c) { // only true, if the headquarter can be built/updated tstrncpy(headquarter_tooltip, c, lengthof(headquarter_tooltip)); @@ -552,13 +552,13 @@ void money_frame_t::draw(scr_coord pos, scr_size size) } } - if(old_level!=sp->get_headquarter_level() || old_pos!=sp->get_headquarter_pos()) { - if( sp->get_ai_id() == spieler_t::HUMAN ) { - headquarter.set_text( sp->get_headquarter_pos()!=koord::invalid ? "upgrade HQ" : "build HQ" ); + if(old_level!=player->get_headquarter_level() || old_pos!=player->get_headquarter_pos()) { + if( player->get_ai_id() == player_t::HUMAN ) { + headquarter.set_text( player->get_headquarter_pos()!=koord::invalid ? "upgrade HQ" : "build HQ" ); } remove_component(&headquarter_view); - old_level = sp->get_headquarter_level(); - old_pos = sp->get_headquarter_pos(); + old_level = player->get_headquarter_level(); + old_pos = player->get_headquarter_pos(); if( old_pos!=koord::invalid ) { headquarter_view.set_location( welt->lookup_kartenboden(old_pos)->get_pos() ); add_component(&headquarter_view); @@ -567,13 +567,13 @@ void money_frame_t::draw(scr_coord pos, scr_size size) // Hajo: Money is counted in credit cents (100 cents = 1 Cr) money_to_string(str_buf[16], - (double)((sint64)sp->get_finance()->get_maintenance_with_bits((transport_type)transport_type_option))/100.0 + (double)((sint64)player->get_finance()->get_maintenance_with_bits((transport_type)transport_type_option))/100.0 ); maintenance_money.set_text(str_buf[16]); - maintenance_money.set_color(sp->get_finance()->get_maintenance((transport_type)transport_type_option)>=0?MONEY_PLUS:MONEY_MINUS); + maintenance_money.set_color(player->get_finance()->get_maintenance((transport_type)transport_type_option)>=0?MONEY_PLUS:MONEY_MINUS); for (int i = 0; iget_player_nr()]&(1<get_player_nr()]&(1<get_ai_id()!=spieler_t::HUMAN ) { - create_win( new ai_option_t(sp), w_info, magic_ai_options_t+sp->get_player_nr() ); + if( player->get_ai_id()!=player_t::HUMAN ) { + create_win( new ai_option_t(player), w_info, magic_ai_options_t+player->get_player_nr() ); } else { - welt->set_tool( tool_t::general_tool[TOOL_HEADQUARTER], sp ); + welt->set_tool( tool_t::general_tool[TOOL_HEADQUARTER], player ); } return true; } for ( int i = 0; iget_player_nr()] ^= (1<get_player_nr()] & (1<get_player_nr()] ^= (1<get_player_nr()] & (1<get_player_nr(); + return magic_finances_t+player->get_player_nr(); } @@ -633,12 +633,12 @@ void money_frame_t::rdwr( loadsave_t *file ) file->rdwr_bool( monthly ); // button state already collected - file->rdwr_long( bFilterStates[sp->get_player_nr()] ); + file->rdwr_long( bFilterStates[player->get_player_nr()] ); if( file->is_loading() ) { // states ... for( uint32 i = 0; iget_player_nr()] & (1<get_player_nr()] & (1<sp = sp; + this->player = player; - if( !sp->is_locked() || (welt->get_active_player_nr()==1 && !welt->get_spieler(1)->is_locked()) ) { + if( !player->is_locked() || (welt->get_active_player_nr()==1 && !welt->get_player(1)->is_locked()) ) { // allow to change name name - tstrncpy( player_name_str, sp->get_name(), lengthof(player_name_str) ); + tstrncpy( player_name_str, player->get_name(), lengthof(player_name_str) ); player_name.set_text(player_name_str, lengthof(player_name_str)); player_name.add_listener(this); player_name.set_pos(cursor); @@ -43,7 +43,7 @@ password_frame_t::password_frame_t( spieler_t *sp ) : cursor.y += max(D_EDIT_HEIGHT, LINESPACE); } else { - const_player_name.set_text( sp->get_name() ); + const_player_name.set_text( player->get_name() ); const_player_name.set_pos(scr_coord(D_MARGIN_LEFT, D_MARGIN_TOP)); add_component(&const_player_name); cursor.y += LINESPACE; @@ -79,7 +79,7 @@ password_frame_t::password_frame_t( spieler_t *sp ) : bool password_frame_t::action_triggered( gui_action_creator_t *komp, value_t p ) { if(komp == &password && (ibuf[0]!=0 || p.i == 1)) { - if (sp->is_unlock_pending()) { + if (player->is_unlock_pending()) { // unlock already pending, do not do everything twice return true; } @@ -94,25 +94,25 @@ bool password_frame_t::action_triggered( gui_action_creator_t *komp, value_t p ) hash.set(sha1); } // store the hash - welt->store_player_password_hash( sp->get_player_nr(), hash ); + welt->store_player_password_hash( player->get_player_nr(), hash ); if( env_t::networkmode) { - sp->unlock(!sp->is_locked(), true); + player->unlock(!player->is_locked(), true); // send hash to server: it will unlock player or change password - nwc_auth_player_t *nwc = new nwc_auth_player_t(sp->get_player_nr(), hash); + nwc_auth_player_t *nwc = new nwc_auth_player_t(player->get_player_nr(), hash); network_send_server(nwc); } else { /* if current active player is player 1 and this is unlocked, he may reset passwords * otherwise you need the valid previous password */ - if( !sp->is_locked() || (welt->get_active_player_nr()==1 && !welt->get_spieler(1)->is_locked()) ) { + if( !player->is_locked() || (welt->get_active_player_nr()==1 && !welt->get_player(1)->is_locked()) ) { // set password - sp->access_password_hash() = hash; - sp->unlock(true, false); + player->access_password_hash() = hash; + player->unlock(true, false); } else { - sp->check_unlock(hash); + player->check_unlock(hash); } } } @@ -120,10 +120,10 @@ bool password_frame_t::action_triggered( gui_action_creator_t *komp, value_t p ) if( komp == &player_name ) { // rename a player cbuffer_t buf; - buf.printf( "p%u,%s", sp->get_player_nr(), player_name.get_text() ); + buf.printf( "p%u,%s", player->get_player_nr(), player_name.get_text() ); tool_t *tmp_tool = create_tool( TOOL_RENAME | SIMPLE_TOOL ); tmp_tool->set_default_param( buf ); - welt->set_tool( tmp_tool, sp ); + welt->set_tool( tmp_tool, player ); // since init always returns false, it is safe to delete immediately delete tmp_tool; } diff --git a/gui/password_frame.h b/gui/password_frame.h index 990a8932cb0..2d70b7dc1ab 100644 --- a/gui/password_frame.h +++ b/gui/password_frame.h @@ -22,14 +22,14 @@ class password_frame_t : public gui_frame_t, action_listener_t char ibuf[256], player_name_str[256]; protected: - spieler_t *sp; + player_t *player; gui_textinput_t player_name; gui_hidden_textinput_t password; gui_label_t fnlabel, const_player_name; public: - password_frame_t( spieler_t *sp ); + password_frame_t( player_t *player ); const char * get_help_filename() const {return "password.txt";} diff --git a/gui/player_frame_t.cc b/gui/player_frame_t.cc index 33d514e77dd..e65b119d10a 100644 --- a/gui/player_frame_t.cc +++ b/gui/player_frame_t.cc @@ -46,7 +46,7 @@ ki_kontroll_t::ki_kontroll_t() : scr_coord cursor = scr_coord ( D_MARGIN_LEFT, D_MARGIN_TOP ); // switching active player allowed? - bool player_change_allowed = welt->get_settings().get_allow_player_change() || !welt->get_spieler(1)->is_locked(); + bool player_change_allowed = welt->get_settings().get_allow_player_change() || !welt->get_player(1)->is_locked(); // activate player etc allowed? bool player_tools_allowed = true; @@ -59,7 +59,7 @@ ki_kontroll_t::ki_kontroll_t() : for(int i=0; iget_spieler(i); + const player_t *const player_ = welt->get_player(i); // AI buttons not available for the two first players (first human and second public) if( i >= 2 ) { @@ -67,7 +67,7 @@ ki_kontroll_t::ki_kontroll_t() : player_active[i-2].init(button_t::square_state, "", cursor); player_active[i-2].align_to( &player_get_finances[i], ALIGN_CENTER_V ); player_active[i-2].add_listener(this); - if(sp && sp->get_ai_id()!=spieler_t::HUMAN && player_tools_allowed) { + if(player_ && player_->get_ai_id()!=player_t::HUMAN && player_tools_allowed) { add_component( player_active+i-2 ); } } @@ -78,14 +78,14 @@ ki_kontroll_t::ki_kontroll_t() : player_change_to[i].add_listener(this); // Allow player change to human and public only (no AI) - if (sp && player_change_allowed) { + if (player_ && player_change_allowed) { add_component(player_change_to+i); } cursor.x += D_ARROW_RIGHT_WIDTH + D_H_SPACE; // Prepare finances button player_get_finances[i].init( button_t::box, "", cursor, scr_size( L_FINANCE_WIDTH, D_EDIT_HEIGHT ) ); - player_get_finances[i].background_color = PLAYER_FLAG | ((sp ? sp->get_player_color1():i*8)+4); + player_get_finances[i].background_color = PLAYER_FLAG | ((player_ ? player_->get_player_color1():i*8)+4); player_get_finances[i].add_listener(this); // Player type selector, Combobox @@ -96,17 +96,17 @@ ki_kontroll_t::ki_kontroll_t() : // Create combobox list data player_select[i].append_element( new gui_scrolled_list_t::const_text_scrollitem_t( translator::translate("slot empty"), COL_BLACK ) ); player_select[i].append_element( new gui_scrolled_list_t::const_text_scrollitem_t( translator::translate("Manual (Human)"), COL_BLACK ) ); - if( !welt->get_spieler(1)->is_locked() || !env_t::networkmode ) { + if( !welt->get_player(1)->is_locked() || !env_t::networkmode ) { player_select[i].append_element( new gui_scrolled_list_t::const_text_scrollitem_t( translator::translate("Goods AI"), COL_BLACK ) ); player_select[i].append_element( new gui_scrolled_list_t::const_text_scrollitem_t( translator::translate("Passenger AI"), COL_BLACK ) ); } - assert( spieler_t::MAX_AI==4 ); + assert( player_t::MAX_AI==4 ); // When adding new players, activate the interface player_select[i].set_selection(welt->get_settings().get_player_type(i)); player_select[i].add_listener(this); - if( sp != NULL ) { - player_get_finances[i].set_text( sp->get_name() ); + if( player_ != NULL ) { + player_get_finances[i].set_text( player_->get_name() ); add_component( player_get_finances+i ); player_select[i].set_visible(false); } @@ -121,8 +121,8 @@ ki_kontroll_t::ki_kontroll_t() : // password/locked button player_lock[i].init(button_t::box, "", cursor, scr_size(D_EDIT_HEIGHT,D_EDIT_HEIGHT)); - player_lock[i].background_color = (sp && sp->is_locked()) ? (sp->is_unlock_pending() ? COL_YELLOW : COL_RED) : COL_GREEN; - player_lock[i].enable( welt->get_spieler(i) ); + player_lock[i].background_color = (player_ && player_->is_locked()) ? (player_->is_unlock_pending() ? COL_YELLOW : COL_RED) : COL_GREEN; + player_lock[i].enable( welt->get_player(i) ); player_lock[i].add_listener(this); if (player_tools_allowed) { add_component( player_lock+i ); @@ -147,7 +147,7 @@ ki_kontroll_t::ki_kontroll_t() : // freeplay mode freeplay.init( button_t::square_state, "freeplay mode", cursor); freeplay.add_listener(this); - if (welt->get_spieler(1)->is_locked() || !welt->get_settings().get_allow_player_change() || !player_tools_allowed) { + if (welt->get_player(1)->is_locked() || !welt->get_settings().get_allow_player_change() || !player_tools_allowed) { freeplay.disable(); } freeplay.pressed = welt->get_settings().is_freeplay(); @@ -185,14 +185,14 @@ bool ki_kontroll_t::action_triggered( gui_action_creator_t *comp,value_t p ) for(int i=0; i=2 && comp == (player_active+i-2) ) { // switch AI on/off - if( welt->get_spieler(i)==NULL ) { + if( welt->get_player(i)==NULL ) { // create new AI welt->call_change_player_tool(karte_t::new_player, i, player_select[i].get_selection()); - player_lock[i].enable( welt->get_spieler(i) ); + player_lock[i].enable( welt->get_player(i) ); } else { // Current AI on/off - sprintf( param, "a,%i,%i", i, !welt->get_spieler(i)->is_active() ); + sprintf( param, "a,%i,%i", i, !welt->get_player(i)->is_active() ); tool_t::simple_tool[TOOL_CHANGE_PLAYER]->set_default_param( param ); welt->set_tool( tool_t::simple_tool[TOOL_CHANGE_PLAYER], welt->get_active_player() ); } @@ -203,7 +203,7 @@ bool ki_kontroll_t::action_triggered( gui_action_creator_t *comp,value_t p ) if( comp == (player_get_finances+i) ) { // get finances player_get_finances[i].pressed = false; - create_win( new money_frame_t(welt->get_spieler(i)), w_info, magic_finances_t+welt->get_spieler(i)->get_player_nr() ); + create_win( new money_frame_t(welt->get_player(i)), w_info, magic_finances_t+welt->get_player(i)->get_player_nr() ); break; } @@ -215,10 +215,10 @@ bool ki_kontroll_t::action_triggered( gui_action_creator_t *comp,value_t p ) } // Change player name and/or password - if( comp == (player_lock+i) && welt->get_spieler(i) ) { - if (!welt->get_spieler(i)->is_unlock_pending()) { + if( comp == (player_lock+i) && welt->get_player(i) ) { + if (!welt->get_player(i)->is_unlock_pending()) { // set password - create_win( -1, -1, new password_frame_t(welt->get_spieler(i)), w_info, magic_pwd_t + i ); + create_win( -1, -1, new password_frame_t(welt->get_player(i)), w_info, magic_pwd_t + i ); player_lock[i].pressed = false; } } @@ -228,7 +228,7 @@ bool ki_kontroll_t::action_triggered( gui_action_creator_t *comp,value_t p ) // make active player remove_component( player_active+i-2 ); - if( p.i0 ) { + if( p.i0 ) { add_component( player_active+i-2 ); welt->get_settings().set_player_type(i, (uint8)p.i); } @@ -248,27 +248,27 @@ void ki_kontroll_t::update_data() { for(int i=0; iget_spieler(i) ) { + if( player_t *player = welt->get_player(i) ) { // active player -> remove selection if (player_select[i].is_visible()) { player_select[i].set_visible(false); player_get_finances[i].set_visible(true); add_component(player_get_finances+i); - if (welt->get_settings().get_allow_player_change() || !welt->get_spieler(1)->is_locked()) { + if (welt->get_settings().get_allow_player_change() || !welt->get_player(1)->is_locked()) { add_component(player_change_to+i); } - player_get_finances[i].set_text(sp->get_name()); + player_get_finances[i].set_text(player->get_name()); } // always update locking status - player_get_finances[i].background_color = PLAYER_FLAG | (sp->get_player_color1()+4); - player_lock[i].background_color = sp->is_locked() ? (sp->is_unlock_pending() ? COL_YELLOW : COL_RED) : COL_GREEN; + player_get_finances[i].background_color = PLAYER_FLAG | (player->get_player_color1()+4); + player_lock[i].background_color = player->is_locked() ? (player->is_unlock_pending() ? COL_YELLOW : COL_RED) : COL_GREEN; // human players cannot be deactivated if (i>1) { remove_component( player_active+i-2 ); - if( sp->get_ai_id()!=spieler_t::HUMAN ) { + if( player->get_ai_id()!=player_t::HUMAN ) { add_component( player_active+i-2 ); } } @@ -286,7 +286,7 @@ void ki_kontroll_t::update_data() if (i>1) { remove_component( player_active+i-2 ); - if( 0get_spieler(1)->is_locked() ) { + if( !welt->get_player(1)->is_locked() ) { if( player_select[i].count_elements()==2 ) { player_select[i].append_element( new gui_scrolled_list_t::const_text_scrollitem_t( translator::translate("Goods AI"), COL_BLACK ) ); player_select[i].append_element( new gui_scrolled_list_t::const_text_scrollitem_t( translator::translate("Passenger AI"), COL_BLACK ) ); @@ -322,7 +322,7 @@ void ki_kontroll_t::draw(scr_coord pos, scr_size size) { // Update free play freeplay.pressed = welt->get_settings().is_freeplay(); - if (welt->get_spieler(1)->is_locked() || !welt->get_settings().get_allow_player_change()) { + if (welt->get_player(1)->is_locked() || !welt->get_settings().get_allow_player_change()) { freeplay.disable(); } else { @@ -334,19 +334,19 @@ void ki_kontroll_t::draw(scr_coord pos, scr_size size) player_change_to[i].pressed = false; if(i>=2) { - player_active[i-2].pressed = welt->get_spieler(i) !=NULL && welt->get_spieler(i)->is_active(); + player_active[i-2].pressed = welt->get_player(i) !=NULL && welt->get_player(i)->is_active(); } - spieler_t *sp = welt->get_spieler(i); - player_lock[i].background_color = sp && sp->is_locked() ? (sp->is_unlock_pending() ? COL_YELLOW : COL_RED) : COL_GREEN; + player_t *player = welt->get_player(i); + player_lock[i].background_color = player && player->is_locked() ? (player->is_unlock_pending() ? COL_YELLOW : COL_RED) : COL_GREEN; - if( sp != NULL ) { - if (i != 1 && !welt->get_settings().is_freeplay() && sp->get_finance()->get_history_com_year(0, ATC_NETWEALTH) < 0) { + if( player != NULL ) { + if (i != 1 && !welt->get_settings().is_freeplay() && player->get_finance()->get_history_com_year(0, ATC_NETWEALTH) < 0) { ai_income[i]->set_color( MONEY_MINUS ); tstrncpy(account_str[i], translator::translate("Company bankrupt"), lengthof(account_str[i])); } else { - double account=sp->get_konto_als_double(); + double account=player->get_account_balance_as_double(); money_to_string(account_str[i], account ); ai_income[i]->set_color( account>=0.0 ? MONEY_PLUS : MONEY_MINUS ); } diff --git a/gui/player_frame_t.h b/gui/player_frame_t.h index 849308e1afc..b69fabb699b 100644 --- a/gui/player_frame_t.h +++ b/gui/player_frame_t.h @@ -3,8 +3,8 @@ * Hj. Malthaner, 2000 */ -#ifndef gui_spieler_h -#define gui_spieler_h +#ifndef gui_player_h +#define gui_player_h #include "../simconst.h" diff --git a/gui/privatesign_info.cc b/gui/privatesign_info.cc index 398cf83892e..0dab075298b 100644 --- a/gui/privatesign_info.cc +++ b/gui/privatesign_info.cc @@ -17,8 +17,8 @@ privatesign_info_t::privatesign_info_t(roadsign_t* s) : sign(s) { for( int i=0; iget_spieler(i) ) { - players[i].init( button_t::square_state, welt->get_spieler(i)->get_name(), scr_coord(4,get_windowsize().h-25-LINESPACE*(PLAYER_UNOWNED-i)), scr_size(get_windowsize().w-18,D_BUTTON_HEIGHT) ); + if( welt->get_player(i) ) { + players[i].init( button_t::square_state, welt->get_player(i)->get_name(), scr_coord(4,get_windowsize().h-25-LINESPACE*(PLAYER_UNOWNED-i)), scr_size(get_windowsize().w-18,D_BUTTON_HEIGHT) ); players[i].add_listener( this ); } else { diff --git a/gui/schedule_list.cc b/gui/schedule_list.cc index 38f47e5a9e7..ec989d425aa 100644 --- a/gui/schedule_list.cc +++ b/gui/schedule_list.cc @@ -98,9 +98,9 @@ static uint8 selected_tab[MAX_PLAYER_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /// selected line per tab (static) linehandle_t schedule_list_gui_t::selected_line[MAX_PLAYER_COUNT][simline_t::MAX_LINE_TYPE]; -schedule_list_gui_t::schedule_list_gui_t(spieler_t *sp_) : - gui_frame_t( translator::translate("Line Management"), sp_), - sp(sp_), +schedule_list_gui_t::schedule_list_gui_t(player_t *player_) : + gui_frame_t( translator::translate("Line Management"), player_), + player(player_), scrolly_convois(&cont), scrolly_haltestellen(&cont_haltestellen), scl(gui_scrolled_list_t::listskin), @@ -116,7 +116,7 @@ schedule_list_gui_t::schedule_list_gui_t(spieler_t *sp_) : // init scrolled list scl.set_pos(scr_coord(0,1)); scl.set_size(scr_size(LINE_NAME_COLUMN_WIDTH-11-4, SCL_HEIGHT-18)); - scl.set_highlight_color(sp->get_player_color1()+1); + scl.set_highlight_color(player->get_player_color1()+1); scl.add_listener(this); // tab panel @@ -242,13 +242,13 @@ schedule_list_gui_t::schedule_list_gui_t(spieler_t *sp_) : // recover last selected line int index = 0; for( uint i=0; iget_player_nr()] ) { - line = selected_line[sp->get_player_nr()][selected_tab[sp->get_player_nr()]]; + if( tabs_to_lineindex[i] == selected_tab[player->get_player_nr()] ) { + line = selected_line[player->get_player_nr()][selected_tab[player->get_player_nr()]]; index = i; break; } } - selected_tab[sp->get_player_nr()] = tabs_to_lineindex[index]; // reset if previous selected tab is not there anymore + selected_tab[player->get_player_nr()] = tabs_to_lineindex[index]; // reset if previous selected tab is not there anymore tabs.set_active_tab_index(index); if(index>0) { bt_new_line.enable(); @@ -305,7 +305,7 @@ bool schedule_list_gui_t::action_triggered( gui_action_creator_t *komp, value_t { if(komp == &bt_change_line) { if(line.is_bound()) { - create_win( new line_management_gui_t(line, sp), w_info, (ptrdiff_t)line.get_rep() ); + create_win( new line_management_gui_t(line, player), w_info, (ptrdiff_t)line.get_rep() ); } } else if(komp == &bt_new_line) { @@ -317,7 +317,7 @@ bool schedule_list_gui_t::action_triggered( gui_action_creator_t *komp, value_t int type = tabs_to_lineindex[tabs.get_active_tab_index()]; buf.printf( "c,0,%i,0,0|%i|", type, type ); tmp_tool->set_default_param(buf); - welt->set_tool( tmp_tool, sp ); + welt->set_tool( tmp_tool, player ); // since init always returns false, it is safe to delete immediately delete tmp_tool; depot_t::update_all_win(); @@ -328,7 +328,7 @@ bool schedule_list_gui_t::action_triggered( gui_action_creator_t *komp, value_t cbuffer_t buf; buf.printf( "d,%i", line.get_id() ); tmp_tool->set_default_param(buf); - welt->set_tool( tmp_tool, sp ); + welt->set_tool( tmp_tool, player ); // since init always returns false, it is safe to delete immediately delete tmp_tool; depot_t::update_all_win(); @@ -341,20 +341,20 @@ bool schedule_list_gui_t::action_triggered( gui_action_creator_t *komp, value_t cbuffer_t buf; buf.printf( "w,%i,%i", line.get_id(), bt_withdraw_line.pressed ); tmp_tool->set_default_param(buf); - welt->set_tool( tmp_tool, sp ); + welt->set_tool( tmp_tool, player ); // since init always returns false, it is safe to delete immediately delete tmp_tool; } } else if (komp == &tabs) { int const tab = tabs.get_active_tab_index(); - uint8 old_selected_tab = selected_tab[sp->get_player_nr()]; - selected_tab[sp->get_player_nr()] = tabs_to_lineindex[tab]; - if( old_selected_tab == simline_t::line && selected_line[sp->get_player_nr()][0].is_bound() && selected_line[sp->get_player_nr()][0]->get_linetype() == selected_tab[sp->get_player_nr()] ) { + uint8 old_selected_tab = selected_tab[player->get_player_nr()]; + selected_tab[player->get_player_nr()] = tabs_to_lineindex[tab]; + if( old_selected_tab == simline_t::line && selected_line[player->get_player_nr()][0].is_bound() && selected_line[player->get_player_nr()][0]->get_linetype() == selected_tab[player->get_player_nr()] ) { // switching from general to same waytype tab while line is seletced => use current line instead - selected_line[sp->get_player_nr()][selected_tab[sp->get_player_nr()]] = selected_line[sp->get_player_nr()][0]; + selected_line[player->get_player_nr()][selected_tab[player->get_player_nr()]] = selected_line[player->get_player_nr()][0]; } - update_lineinfo( selected_line[sp->get_player_nr()][selected_tab[sp->get_player_nr()]] ); + update_lineinfo( selected_line[player->get_player_nr()][selected_tab[player->get_player_nr()]] ); build_line_list(tab); if (tab>0) { bt_new_line.enable(); @@ -371,8 +371,8 @@ bool schedule_list_gui_t::action_triggered( gui_action_creator_t *komp, value_t // no valid line update_lineinfo(linehandle_t()); } - selected_line[sp->get_player_nr()][selected_tab[sp->get_player_nr()]] = line; - selected_line[sp->get_player_nr()][0] = line; // keep these the same in overview + selected_line[player->get_player_nr()][selected_tab[player->get_player_nr()]] = line; + selected_line[player->get_player_nr()][0] = line; // keep these the same in overview } else if (komp == &inp_filter) { if( strcmp(old_schedule_filter,schedule_filter) ) { @@ -439,7 +439,7 @@ void schedule_list_gui_t::rename_line() void schedule_list_gui_t::draw(scr_coord pos, scr_size size) { - if( old_line_count != sp->simlinemgmt.get_line_count() ) { + if( old_line_count != player->simlinemgmt.get_line_count() ) { show_lineinfo( line ); } // if search string changed, update line selection @@ -546,7 +546,7 @@ void schedule_list_gui_t::build_line_list(int filter) { sint32 sel = -1; scl.clear_elements(); - sp->simlinemgmt.get_lines(tabs_to_lineindex[filter], &lines); + player->simlinemgmt.get_lines(tabs_to_lineindex[filter], &lines); vector_tplselected_lines; FOR(vector_tpl, const l, lines) { @@ -567,7 +567,7 @@ void schedule_list_gui_t::build_line_list(int filter) line_scrollitem_t::sort_mode = (line_scrollitem_t::sort_modes_t)current_sort_mode; scl.sort( 0, NULL ); - old_line_count = sp->simlinemgmt.get_line_count(); + old_line_count = player->simlinemgmt.get_line_count(); } @@ -619,7 +619,7 @@ void schedule_list_gui_t::update_lineinfo(linehandle_t new_line) cont_haltestellen.remove_all(); ypos = 0; FOR(minivec_tpl, const& i, new_line->get_schedule()->eintrag) { - halthandle_t const halt = haltestelle_t::get_halt(i.pos, sp); + halthandle_t const halt = haltestelle_t::get_halt(i.pos, player); if (halt.is_bound()) { halt_list_stats_t* cinfo = new halt_list_stats_t(halt); cinfo->set_pos(scr_coord(0, ypos)); @@ -721,7 +721,7 @@ void schedule_list_gui_t::update_data(linehandle_t changed_line) uint32 schedule_list_gui_t::get_rdwr_id() { - return magic_line_management_t+sp->get_player_nr(); + return magic_line_management_t+player->get_player_nr(); } diff --git a/gui/schedule_list.h b/gui/schedule_list.h index 0acb3777887..23320eb17e2 100644 --- a/gui/schedule_list.h +++ b/gui/schedule_list.h @@ -21,11 +21,11 @@ #include "components/gui_convoiinfo.h" #include "../simline.h" -class spieler_t; +class player_t; class schedule_list_gui_t : public gui_frame_t, public action_listener_t { private: - spieler_t *sp; + player_t *player; button_t bt_new_line, bt_change_line, bt_delete_line, bt_withdraw_line;; gui_container_t cont, cont_haltestellen; @@ -73,7 +73,7 @@ class schedule_list_gui_t : public gui_frame_t, public action_listener_t static linehandle_t selected_line[MAX_PLAYER_COUNT][simline_t::MAX_LINE_TYPE]; - schedule_list_gui_t(spieler_t* sp); + schedule_list_gui_t(player_t* player_); ~schedule_list_gui_t(); /** * in top-level windows the name is displayed in titlebar diff --git a/gui/server_frame.cc b/gui/server_frame.cc index a16c8c127dd..75e1f30803e 100644 --- a/gui/server_frame.cc +++ b/gui/server_frame.cc @@ -230,9 +230,9 @@ void server_frame_t::update_info () if ( gi.get_clients() != 255 ) { uint8 player = 0, locked = 0; for ( uint8 i = 0; i < MAX_PLAYER_COUNT; i++ ) { - if ( gi.get_player_type(i)&~spieler_t::PASSWORD_PROTECTED ) { + if ( gi.get_player_type(i)&~player_t::PASSWORD_PROTECTED ) { player ++; - if ( gi.get_player_type(i)&spieler_t::PASSWORD_PROTECTED ) { + if ( gi.get_player_type(i)&player_t::PASSWORD_PROTECTED ) { locked ++; } } diff --git a/gui/signal_spacing.cc b/gui/signal_spacing.cc index ae9b59916e9..0d4c7f97b9a 100644 --- a/gui/signal_spacing.cc +++ b/gui/signal_spacing.cc @@ -18,13 +18,13 @@ uint8 signal_spacing_frame_t::signal_spacing = 2; bool signal_spacing_frame_t::remove = true; bool signal_spacing_frame_t::replace = true; -signal_spacing_frame_t::signal_spacing_frame_t(spieler_t *sp_, tool_build_roadsign_t* tool_) : +signal_spacing_frame_t::signal_spacing_frame_t(player_t *player_, tool_build_roadsign_t* tool_) : gui_frame_t( translator::translate("set signal spacing") ), signal_label("signal spacing") { - sp = sp_; + player = player_; tool = tool_; - tool->get_values(sp, signal_spacing, remove, replace); + tool->get_values(player, signal_spacing, remove, replace); scr_coord cursor(D_MARGIN_LEFT, D_MARGIN_TOP); @@ -72,6 +72,6 @@ bool signal_spacing_frame_t::action_triggered( gui_action_creator_t *komp, value replace = !replace; replace_button.pressed = replace; } - tool->set_values(sp, signal_spacing, remove, replace); + tool->set_values(player, signal_spacing, remove, replace); return true; } diff --git a/gui/signal_spacing.h b/gui/signal_spacing.h index 00c466f4256..2002c0a851c 100644 --- a/gui/signal_spacing.h +++ b/gui/signal_spacing.h @@ -13,21 +13,21 @@ class gui_numberinput_t; class button_t; class gui_label_t; class tool_build_roadsign_t; -class spieler_t; +class player_t; class signal_spacing_frame_t : public gui_frame_t, private action_listener_t { private: static uint8 signal_spacing; static bool remove, replace; - spieler_t *sp; + player_t *player; tool_build_roadsign_t* tool; gui_numberinput_t signal_spacing_inp; gui_label_t signal_label; button_t remove_button, replace_button; public: - signal_spacing_frame_t( spieler_t *, tool_build_roadsign_t * ); + signal_spacing_frame_t( player_t *, tool_build_roadsign_t * ); bool action_triggered(gui_action_creator_t*, value_t) OVERRIDE; const char * get_help_filename() const { return "signal_spacing.txt"; } }; diff --git a/gui/simwin.cc b/gui/simwin.cc index 2898d987637..e5266168d29 100644 --- a/gui/simwin.cc +++ b/gui/simwin.cc @@ -501,10 +501,10 @@ void rdwr_all_win(loadsave_t *file) default: if( id>=magic_finances_t && idget_spieler(id-magic_finances_t) ); + w = new money_frame_t( wl->get_player(id-magic_finances_t) ); } else if( id>=magic_line_management_t && idget_spieler(id-magic_line_management_t) ); + w = new schedule_list_gui_t( wl->get_player(id-magic_line_management_t) ); } else if( id>=magic_toolbar && idupdate(wl->get_active_player()); @@ -1354,7 +1354,7 @@ bool check_pos_win(event_t *ev) { // change position on map (or follow) koord3d k = wins[i].gui->get_weltpos(true); if( k!=koord3d::invalid ) { - spieler_t::get_welt()->get_viewport()->change_world_position( k ); + player_t::get_welt()->get_viewport()->change_world_position( k ); } } break; diff --git a/gui/stadt_info.cc b/gui/stadt_info.cc index 925078351fe..3ae8d59ce38 100644 --- a/gui/stadt_info.cc +++ b/gui/stadt_info.cc @@ -202,7 +202,7 @@ void stadt_info_t::rename_city() buf.printf( "t%u,%s", welt->get_staedte().index_of(stadt), name ); tool_t *tmp_tool = create_tool( TOOL_RENAME | SIMPLE_TOOL ); tmp_tool->set_default_param( buf ); - welt->set_tool( tmp_tool, welt->get_spieler(1)); + welt->set_tool( tmp_tool, welt->get_player(1)); // since init always returns false, it is safe to delete immediately delete tmp_tool; // do not trigger this command again @@ -319,7 +319,7 @@ bool stadt_info_t::action_triggered( gui_action_creator_t *komp,value_t /* */) if( komp==&allow_growth ) { sprintf(param,"g%hi,%hi,%hi", stadt->get_pos().x, stadt->get_pos().y, (short)(!stadt->get_citygrowth()) ); tool_t::simple_tool[TOOL_CHANGE_CITY]->set_default_param( param ); - welt->set_tool( tool_t::simple_tool[TOOL_CHANGE_CITY], welt->get_spieler(1)); + welt->set_tool( tool_t::simple_tool[TOOL_CHANGE_CITY], welt->get_player(1)); return true; } if( komp==&name_input ) { diff --git a/gui/tool_selector.cc b/gui/tool_selector.cc index ce4451e003b..0962af953be 100644 --- a/gui/tool_selector.cc +++ b/gui/tool_selector.cc @@ -170,10 +170,10 @@ bool tool_selector_t::infowin_event(const event_t *ev) void tool_selector_t::draw(scr_coord pos, scr_size) { - spieler_t *sp = welt->get_active_player(); + player_t *player = welt->get_active_player(); for( uint i = tool_icon_disp_start; i < tool_icon_disp_end; i++ ) { - const image_id icon_img = tools[i].tool->get_icon(sp); + const image_id icon_img = tools[i].tool->get_icon(player); const scr_coord draw_pos = pos + scr_coord(( (i-tool_icon_disp_start)%tool_icon_width )*env_t::iconsize.w, D_TITLEBAR_HEIGHT+( (i-tool_icon_disp_start)/tool_icon_width )*env_t::iconsize.h); const char *param = tools[i].tool->get_default_param(); @@ -194,7 +194,7 @@ void tool_selector_t::draw(scr_coord pos, scr_size) if( icon_img != IMG_LEER ) { bool tool_dirty = dirty || tools[i].tool->is_selected() ^ tools[i].selected; display_fit_img_to_width( icon_img, env_t::iconsize.w ); - display_color_img(icon_img, draw_pos.x, draw_pos.y, sp->get_player_nr(), false, tool_dirty); + display_color_img(icon_img, draw_pos.x, draw_pos.y, player->get_player_nr(), false, tool_dirty); tools[i].tool->draw_after( draw_pos, tool_dirty); // store whether tool was selected tools[i].selected = tools[i].tool->is_selected(); @@ -224,10 +224,10 @@ void tool_selector_t::draw(scr_coord pos, scr_size) -bool tool_selector_t::empty(spieler_t *sp) const +bool tool_selector_t::empty(player_t *player) const { FOR(vector_tpl, w, tools) { - if (w.tool->get_icon(sp) != IMG_LEER) { + if (w.tool->get_icon(player) != IMG_LEER) { return false; } } diff --git a/gui/tool_selector.h b/gui/tool_selector.h index 1f3c5445dd0..3a44ae8bef3 100644 --- a/gui/tool_selector.h +++ b/gui/tool_selector.h @@ -105,7 +105,7 @@ class tool_selector_t : public gui_frame_t virtual uint32 get_rdwr_id() { return magic_toolbar+toolbar_id; } - bool empty(spieler_t *sp) const; + bool empty(player_t *player) const; }; #endif diff --git a/gui/welt.cc b/gui/welt.cc index 2ef425e7726..12fd74e00f1 100644 --- a/gui/welt.cc +++ b/gui/welt.cc @@ -640,7 +640,7 @@ void welt_gui_t::draw(scr_coord pos, scr_size size) const uint sy = sets->get_groesse_y(); const uint64 memory = ( (uint64)sizeof(karte_t) + - sizeof(spieler_t) * 8 + + sizeof(player_t) * 8 + sizeof(convoi_t) * 1000 + (sizeof(schiene_t) + sizeof(vehikel_t)) * 10 * (sx + sy) + sizeof(stadt_t) * sets->get_anzahl_staedte() + diff --git a/network/network_cmd_ingame.cc b/network/network_cmd_ingame.cc index 46ce20c891f..9d73f9d9eae 100644 --- a/network/network_cmd_ingame.cc +++ b/network/network_cmd_ingame.cc @@ -275,12 +275,12 @@ void nwc_chat_t::add_message (karte_t* welt) const dbg->warning("nwc_chat_t::add_message", ""); cbuffer_t buf; // Output which will be printed to chat window - PLAYER_COLOR_VAL color = player_nr < PLAYER_UNOWNED ? welt->get_spieler( player_nr )->get_player_color1() : COL_WHITE; + PLAYER_COLOR_VAL color = player_nr < PLAYER_UNOWNED ? welt->get_player( player_nr )->get_player_color1() : COL_WHITE; uint16 flag = message_t::chat; if ( destination == NULL ) { if ( player_nr < PLAYER_UNOWNED ) { - buf.printf( "%s <%s>: %s", clientname.c_str(), welt->get_spieler( player_nr )->get_name(), message.c_str() ); + buf.printf( "%s <%s>: %s", clientname.c_str(), welt->get_player( player_nr )->get_name(), message.c_str() ); } else { buf.printf( "%s: %s", clientname.c_str(), message.c_str() ); @@ -290,7 +290,7 @@ void nwc_chat_t::add_message (karte_t* welt) const // Whisper, do not store message in savegame flag |= message_t::local_flag; if ( player_nr < PLAYER_UNOWNED ) { - buf.printf( "%s <%s> --> %s: %s", clientname.c_str(), welt->get_spieler( player_nr )->get_name(), destination.c_str(), message.c_str() ); + buf.printf( "%s <%s> --> %s: %s", clientname.c_str(), welt->get_player( player_nr )->get_name(), destination.c_str(), message.c_str() ); } else { buf.printf( "%s --> %s: %s", clientname.c_str(), destination.c_str(), message.c_str() ); @@ -338,7 +338,7 @@ bool nwc_chat_t::execute (karte_t* welt) csv.add_field( info.address.get_str() ); csv.add_field( info.nickname.c_str() ); csv.add_field( player_nr ); - csv.add_field( player_nr < PLAYER_UNOWNED ? welt->get_spieler( player_nr )->get_name() : "" ); + csv.add_field( player_nr < PLAYER_UNOWNED ? welt->get_player( player_nr )->get_name() : "" ); csv.add_field( message.c_str() ); dbg->warning( "__ChatLog__", "%s", csv.get_str() ); } @@ -369,7 +369,7 @@ bool nwc_chat_t::execute (karte_t* welt) csv.add_field( info.address.get_str() ); csv.add_field( info.nickname.c_str() ); csv.add_field( player_nr ); - csv.add_field( player_nr < PLAYER_UNOWNED ? welt->get_spieler( player_nr )->get_name() : "" ); + csv.add_field( player_nr < PLAYER_UNOWNED ? welt->get_player( player_nr )->get_name() : "" ); csv.add_field( destination.c_str() ); csv.add_field( message.c_str() ); dbg->warning( "__ChatLog__", "%s", csv.get_str() ); @@ -539,8 +539,8 @@ bool nwc_auth_player_t::execute(karte_t *welt) dbg->message("nwc_auth_player_t::execute","set pwd for plnr = %d", player_nr); // change password - if (welt->get_spieler(player_nr)->access_password_hash() != hash) { - welt->get_spieler(player_nr)->access_password_hash() = hash; + if (welt->get_player(player_nr)->access_password_hash() != hash) { + welt->get_player(player_nr)->access_password_hash() = hash; // unlock all clients if new password is empty // otherwise lock all socket_list_t::unlock_player_all(player_nr, hash.empty(), our_client_id); @@ -548,7 +548,7 @@ bool nwc_auth_player_t::execute(karte_t *welt) } else if (player_nr < PLAYER_UNOWNED) { // check password - if (welt->get_spieler(player_nr)->access_password_hash() == hash) { + if (welt->get_player(player_nr)->access_password_hash() == hash) { dbg->message("nwc_auth_player_t::execute","unlock plnr = %d at our_client_id = %d", player_nr, our_client_id); @@ -559,7 +559,7 @@ bool nwc_auth_player_t::execute(karte_t *welt) // report back to client who sent the command if (our_client_id == 0) { // unlock player on the server and clear unlock_pending flag - welt->get_spieler(player_nr)->unlock(info.is_player_unlocked(player_nr), false); + welt->get_player(player_nr)->unlock(info.is_player_unlocked(player_nr), false); } else { // send unlock-info to player on the client (to clear unlock_pending flag) @@ -571,8 +571,8 @@ bool nwc_auth_player_t::execute(karte_t *welt) } else { for(uint8 i=0; iget_spieler(i)) { - sp->unlock( player_unlocked & (1<get_player(i)) { + player->unlock( player_unlocked & (1<get_spieler(i); - if (sp == NULL || sp->access_password_hash() == welt->get_player_password_hash(i) ) { + player_t *player = welt->get_player(i); + if (player == NULL || player->access_password_hash() == welt->get_player_password_hash(i) ) { player_unlocked |= 1<unlock( player_unlocked & (1<unlock( player_unlocked & (1<get_spieler(i)) { - if (!sp->is_locked()) { + if (player_t *player = welt->get_player(i)) { + if (!player->is_locked()) { player_unlocked |= 1<get_spieler(i); - if( sp==NULL || sp->access_password_hash().empty() ) { + player_t *player = welt->get_player(i); + if( player==NULL || player->access_password_hash().empty() ) { unlocked_players |= (1<access_password_hash().clear(); + player->access_password_hash().clear(); } } @@ -773,8 +773,8 @@ void nwc_sync_t::do_command(karte_t *welt) welt->switch_active_player(active_player,true); // restore lock state for(uint8 i=0; iget_spieler(i)) { - sp->unlock(player_unlocked & (1<get_player(i)) { + player->unlock(player_unlocked & (1<get_player_nr() : -1; + player_nr = player ? player->get_player_nr() : -1; tool_id = tool_->get_id(); wt = tool_->get_waytype(); - default_param = tool_->get_default_param(sp); + default_param = tool_->get_default_param(player); init = init_; tool_client_id = 0; flags = tool_->flags; - last_sync_step = spieler_t::get_welt()->get_last_checklist_sync_step(); - last_checklist = spieler_t::get_welt()->get_last_checklist(); + last_sync_step = player_t::get_welt()->get_last_checklist_sync_step(); + last_checklist = player_t::get_welt()->get_last_checklist(); // write custom data of tool_ to our internal buffer - if (sp) { + if (player) { tool_->rdwr_custom_data(&custom_data); } tool = NULL; @@ -1087,17 +1087,17 @@ network_broadcast_world_command_t* nwc_tool_t::clone(karte_t *welt) // do scenario checks here, send error message back if ( scen->is_scripted() ) { - if (!scen->is_tool_allowed(welt->get_spieler(player_nr), tool_id, wt)) { + if (!scen->is_tool_allowed(welt->get_player(player_nr), tool_id, wt)) { dbg->warning("nwc_tool_t::clone", "tool_id=%d wt=%d tool not allowed", tool_id, wt); // TODO return error message ? return NULL; } if (!init) { - const char *err = scen->is_work_allowed_here(welt->get_spieler(player_nr), tool_id, wt, pos); + const char *err = scen->is_work_allowed_here(welt->get_player(player_nr), tool_id, wt, pos); if (err == NULL) { if (two_click_tool_t *two_ctool = dynamic_cast(tool)) { if (!two_ctool->is_first_click()) { - err = scen->is_work_allowed_here(welt->get_spieler(player_nr), tool_id, wt, two_ctool->get_start_pos()); + err = scen->is_work_allowed_here(welt->get_player(player_nr), tool_id, wt, two_ctool->get_start_pos()); } } } @@ -1140,7 +1140,7 @@ void nwc_tool_t::do_command(karte_t *welt) // commands are treated differently if they come from this client or not bool local = tool_client_id == network_get_client_id(); - spieler_t *sp = player_nr < PLAYER_UNOWNED ? welt->get_spieler(player_nr) : NULL; + player_t *player = player_nr < PLAYER_UNOWNED ? welt->get_player(player_nr) : NULL; // before calling work initialize new tool assert(tool); @@ -1148,7 +1148,7 @@ void nwc_tool_t::do_command(karte_t *welt) // init command was not sent if tool->is_init_network_safe() returned true tool->flags = 0; // init tool - tool->init(sp); + tool->init(player); } // read custom data (again, necessary for two_click_tool_t) @@ -1168,7 +1168,7 @@ void nwc_tool_t::do_command(karte_t *welt) if( init ) { // we should be here only if tool->init() returns false // no need to change active tool of world - tool->init(sp); + tool->init(player); } // call WORK else { @@ -1177,15 +1177,15 @@ void nwc_tool_t::do_command(karte_t *welt) if(active_tool && active_tool->remove_preview_necessary()) { active_tool->cleanup(true); } - const char *err = tool->work( sp, pos ); + const char *err = tool->work( player, pos ); // only local players or AIs get the callback - if (local || sp->get_ai_id()!=spieler_t::HUMAN) { - sp->tell_tool_result(tool, pos, err, local); + if (local || player->get_ai_id()!=player_t::HUMAN) { + player->tell_tool_result(tool, pos, err, local); } if (err) { dbg->warning("nwc_tool_t::do_command","failed with '%s'",err); } - tool->exit(sp); + tool->exit(player); } } @@ -1329,9 +1329,9 @@ bool nwc_service_t::execute(karte_t *welt) cbuffer_t buf; for (uint8 i=min_index; iget_spieler(i)) { - buf.printf("Company #%d: %s\n", i, sp->get_name()); - buf.printf(" Password: %sset\n", sp->access_password_hash().empty() ? "NOT " :""); + if (player_t *player = welt->get_player(i)) { + buf.printf("Company #%d: %s\n", i, player->get_name()); + buf.printf(" Password: %sset\n", player->access_password_hash().empty() ? "NOT " :""); // print creator information if (i < lengthof(nwc_chg_player_t::company_creator)) { if (connection_info_t const* creator = nwc_chg_player_t::company_creator[i]) { @@ -1374,13 +1374,13 @@ bool nwc_service_t::execute(karte_t *welt) } uint8 player_nr = number; // empty password - spieler_t *sp = welt->get_spieler(player_nr); - if (sp) { - sp->access_password_hash().clear(); + player_t *player = welt->get_player(player_nr); + if (player) { + player->access_password_hash().clear(); // unlock all clients socket_list_t::unlock_player_all(player_nr, true, packet->get_sender()); // unlock player on the server - sp->unlock(true, false); + player->unlock(true, false); } break; } diff --git a/network/network_cmd_ingame.h b/network/network_cmd_ingame.h index b2ea494bec2..d83846a985d 100644 --- a/network/network_cmd_ingame.h +++ b/network/network_cmd_ingame.h @@ -10,7 +10,7 @@ class connection_info_t; class packet_t; -class spieler_t; +class player_t; class tool_t; /** @@ -316,7 +316,7 @@ class nwc_tool_t : public network_broadcast_world_command_t { uint32 last_sync_step; nwc_tool_t(); - nwc_tool_t(spieler_t *sp, tool_t *tool, koord3d pos, uint32 sync_steps, uint32 map_counter, bool init); + nwc_tool_t(player_t *player, tool_t *tool, koord3d pos, uint32 sync_steps, uint32 map_counter, bool init); nwc_tool_t(const nwc_tool_t&); // messages are allowed to arrive at any time diff --git a/obj/baum.cc b/obj/baum.cc index 7421930c5d1..39e159c0975 100644 --- a/obj/baum.cc +++ b/obj/baum.cc @@ -602,9 +602,9 @@ void baum_t::info(cbuffer_t & buf) const } -void baum_t::entferne(spieler_t *sp) +void baum_t::entferne(player_t *player) { - spieler_t::book_construction_costs(sp, welt->get_settings().cst_remove_tree, get_pos().get_2d(), ignore_wt); + player_t::book_construction_costs(player, welt->get_settings().cst_remove_tree, get_pos().get_2d(), ignore_wt); mark_image_dirty( get_bild(), 0 ); } diff --git a/obj/baum.h b/obj/baum.h index 250e6da0ba3..2d0eb7e2d5a 100644 --- a/obj/baum.h +++ b/obj/baum.h @@ -105,7 +105,7 @@ class baum_t : public obj_t void info(cbuffer_t & buf) const; - void entferne(spieler_t *sp); + void entferne(player_t *player); void * operator new(size_t s); void operator delete(void *p); diff --git a/obj/bruecke.cc b/obj/bruecke.cc index b924c083b35..cf8765591a7 100644 --- a/obj/bruecke.cc +++ b/obj/bruecke.cc @@ -26,13 +26,13 @@ bruecke_t::bruecke_t(loadsave_t* const file) : obj_no_info_t() } -bruecke_t::bruecke_t(koord3d pos, spieler_t *sp, const bruecke_besch_t *besch, bruecke_besch_t::img_t img) : +bruecke_t::bruecke_t(koord3d pos, player_t *player, const bruecke_besch_t *besch, bruecke_besch_t::img_t img) : obj_no_info_t(pos) { this->besch = besch; this->img = img; - set_besitzer( sp ); - spieler_t::book_construction_costs( get_besitzer(), -besch->get_preis(), get_pos().get_2d(), besch->get_waytype()); + set_besitzer( player ); + player_t::book_construction_costs( get_besitzer(), -besch->get_preis(), get_pos().get_2d(), besch->get_waytype()); } @@ -166,21 +166,21 @@ void bruecke_t::laden_abschliessen() } } - spieler_t *sp=get_besitzer(); + player_t *player=get_besitzer(); // change maintenance if(besch->get_waytype()!=powerline_wt) { weg_t *weg = gr->get_weg(besch->get_waytype()); if(weg==NULL) { dbg->error("bruecke_t::laden_abschliessen()","Bridge without way at(%s)!", gr->get_pos().get_str() ); weg = weg_t::alloc( besch->get_waytype() ); - gr->neuen_weg_bauen( weg, 0, welt->get_spieler(1) ); + gr->neuen_weg_bauen( weg, 0, welt->get_player(1) ); } weg->set_max_speed(besch->get_topspeed()); // take ownership of way - spieler_t::add_maintenance( weg->get_besitzer(), -weg->get_besch()->get_wartung(), besch->get_finance_waytype()); - weg->set_besitzer(sp); + player_t::add_maintenance( weg->get_besitzer(), -weg->get_besch()->get_wartung(), besch->get_finance_waytype()); + weg->set_besitzer(player); } - spieler_t::add_maintenance( sp, besch->get_wartung(), besch->get_finance_waytype()); + player_t::add_maintenance( player, besch->get_wartung(), besch->get_finance_waytype()); // with double heights may need to correct image on load (not all besch have double images) // at present only start images have 2 height variants, others to follow... @@ -201,16 +201,16 @@ void bruecke_t::laden_abschliessen() // correct speed and maintenance -void bruecke_t::entferne( spieler_t *sp2 ) +void bruecke_t::entferne( player_t *player2 ) { - spieler_t *sp = get_besitzer(); + player_t *player = get_besitzer(); // change maintenance, reset max-speed and y-offset const grund_t *gr = welt->lookup(get_pos()); if(gr) { weg_t *weg = gr->get_weg( besch->get_waytype() ); if(weg) { weg->set_max_speed( weg->get_besch()->get_topspeed() ); - spieler_t::add_maintenance( sp, weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype()); + player_t::add_maintenance( player, weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype()); // reset offsets weg->set_yoff(0); if (gr->get_weg_nr(1)) { @@ -218,8 +218,8 @@ void bruecke_t::entferne( spieler_t *sp2 ) } } } - spieler_t::add_maintenance( sp, -besch->get_wartung(), besch->get_finance_waytype() ); - spieler_t::book_construction_costs( sp2, -besch->get_preis(), get_pos().get_2d(), besch->get_waytype() ); + player_t::add_maintenance( player, -besch->get_wartung(), besch->get_finance_waytype() ); + player_t::book_construction_costs( player2, -besch->get_preis(), get_pos().get_2d(), besch->get_waytype() ); } @@ -247,12 +247,12 @@ void bruecke_t::rotate90() // returns NULL, if removal is allowed // players can remove public owned ways -const char *bruecke_t::ist_entfernbar(const spieler_t *sp) +const char *bruecke_t::ist_entfernbar(const player_t *player) { if (get_player_nr()==1) { return NULL; } else { - return obj_t::ist_entfernbar(sp); + return obj_t::ist_entfernbar(player); } } diff --git a/obj/bruecke.h b/obj/bruecke.h index 23ae444917b..58424b1bbfb 100644 --- a/obj/bruecke.h +++ b/obj/bruecke.h @@ -23,7 +23,7 @@ class bruecke_t : public obj_no_info_t public: bruecke_t(loadsave_t *file); - bruecke_t(koord3d pos, spieler_t *sp, const bruecke_besch_t *besch, bruecke_besch_t::img_t img); + bruecke_t(koord3d pos, player_t *player, const bruecke_besch_t *besch, bruecke_besch_t::img_t img); const char *get_name() const {return "Bruecke";} typ get_typ() const { return bruecke; } @@ -50,14 +50,14 @@ class bruecke_t : public obj_no_info_t void laden_abschliessen(); - void entferne(spieler_t *sp); + void entferne(player_t *player); void rotate90(); /** * @return NULL wenn OK, ansonsten eine Fehlermeldung * @author Hj. Malthaner */ - virtual const char *ist_entfernbar(const spieler_t *sp); + virtual const char *ist_entfernbar(const player_t *player); }; #endif diff --git a/obj/crossing.cc b/obj/crossing.cc index 044278aa3da..8024cd6e37f 100644 --- a/obj/crossing.cc +++ b/obj/crossing.cc @@ -38,14 +38,14 @@ crossing_t::crossing_t(loadsave_t* const file) : obj_no_info_t() } -crossing_t::crossing_t(spieler_t* const sp, koord3d const pos, kreuzung_besch_t const* const besch, uint8 const ns) : obj_no_info_t(pos) +crossing_t::crossing_t(player_t* const player_, koord3d const pos, kreuzung_besch_t const* const besch, uint8 const ns) : obj_no_info_t(pos) { this->ns = ns; this->besch = besch; logic = NULL; zustand = crossing_logic_t::CROSSING_INVALID; bild = after_bild = IMG_LEER; - set_besitzer( sp ); + set_besitzer( player_ ); } @@ -55,7 +55,7 @@ crossing_t::~crossing_t() } -void crossing_t::entferne(spieler_t *) +void crossing_t::entferne(player_t *) { if(logic) { crossing_logic_t *old_logic = logic; @@ -202,12 +202,12 @@ void crossing_t::laden_abschliessen() // returns NULL, if removal is allowed // players can remove public owned ways -const char *crossing_t::ist_entfernbar(const spieler_t *sp) +const char *crossing_t::ist_entfernbar(const player_t *player) { if (get_player_nr()==1) { return NULL; } else { - return obj_t::ist_entfernbar(sp); + return obj_t::ist_entfernbar(player); } } diff --git a/obj/crossing.h b/obj/crossing.h index d64a4ab6fc6..729176115cf 100644 --- a/obj/crossing.h +++ b/obj/crossing.h @@ -40,7 +40,7 @@ class crossing_t : public obj_no_info_t waytype_t get_waytype() const { return invalid_wt; } crossing_t(loadsave_t *file); - crossing_t(spieler_t *sp, koord3d pos, const kreuzung_besch_t *besch, uint8 ns = 0); + crossing_t(player_t *player, koord3d pos, const kreuzung_besch_t *besch, uint8 ns = 0); virtual ~crossing_t(); @@ -58,13 +58,13 @@ class crossing_t : public obj_no_info_t * @return NULL wenn OK, ansonsten eine Fehlermeldung * @author Hj. Malthaner */ - virtual const char *ist_entfernbar(const spieler_t *sp); + virtual const char *ist_entfernbar(const player_t *player); /** * crossing logic is removed here * @author prissi */ - virtual void entferne(spieler_t *); + virtual void entferne(player_t *); // returns true, if the crossing can be passed by this vehicle bool request_crossing( const vehikel_basis_t *v ) { return logic->request_crossing( v ); } diff --git a/obj/field.cc b/obj/field.cc index 6d5127e57b6..45894ba28b2 100644 --- a/obj/field.cc +++ b/obj/field.cc @@ -20,11 +20,11 @@ #include "field.h" -field_t::field_t(koord3d p, spieler_t *sp, const field_class_besch_t *besch, fabrik_t *fab) : obj_t() +field_t::field_t(koord3d p, player_t *player, const field_class_besch_t *besch, fabrik_t *fab) : obj_t() { this->besch = besch; this->fab = fab; - set_besitzer( sp ); + set_besitzer( player ); p.z = welt->max_hgt(p.get_2d()); set_pos( p ); } @@ -38,7 +38,7 @@ field_t::~field_t() -const char *field_t::ist_entfernbar(const spieler_t *) +const char *field_t::ist_entfernbar(const player_t *) { // we allow removal, if there is less than return (fab->get_field_count() > fab->get_besch()->get_field_group()->get_min_fields()) ? NULL : "Not enough fields would remain."; @@ -47,9 +47,9 @@ const char *field_t::ist_entfernbar(const spieler_t *) // remove costs -void field_t::entferne(spieler_t *sp) +void field_t::entferne(player_t *player) { - spieler_t::book_construction_costs(sp, welt->get_settings().cst_multiply_remove_field, get_pos().get_2d(), ignore_wt); + player_t::book_construction_costs(player, welt->get_settings().cst_multiply_remove_field, get_pos().get_2d(), ignore_wt); mark_image_dirty( get_bild(), 0 ); } diff --git a/obj/field.h b/obj/field.h index 34bef13fe36..d5bd3ff7c0e 100644 --- a/obj/field.h +++ b/obj/field.h @@ -14,7 +14,7 @@ class field_t : public obj_t const field_class_besch_t *besch; public: - field_t(const koord3d pos, spieler_t *sp, const field_class_besch_t *besch, fabrik_t *fab); + field_t(const koord3d pos, player_t *player, const field_class_besch_t *besch, fabrik_t *fab); virtual ~field_t(); const char* get_name() const { return "Field"; } @@ -33,9 +33,9 @@ class field_t : public obj_t * @return NULL wenn OK, ansonsten eine Fehlermeldung * @author Hj. Malthaner */ - const char * ist_entfernbar(const spieler_t *); + const char * ist_entfernbar(const player_t *); - void entferne(spieler_t *sp); + void entferne(player_t *player); }; #endif diff --git a/obj/gebaeude.cc b/obj/gebaeude.cc index fabf2d11d97..32fa170a39a 100644 --- a/obj/gebaeude.cc +++ b/obj/gebaeude.cc @@ -92,15 +92,15 @@ gebaeude_t::gebaeude_t(loadsave_t *file) : obj_t() -gebaeude_t::gebaeude_t(koord3d pos, spieler_t *sp, const haus_tile_besch_t *t) : +gebaeude_t::gebaeude_t(koord3d pos, player_t *player, const haus_tile_besch_t *t) : obj_t(pos) { - set_besitzer( sp ); + set_besitzer( player ); init(); if(t) { set_tile(t,true); // this will set init time etc. - spieler_t::add_maintenance(get_besitzer(), tile->get_besch()->get_maintenance(welt), tile->get_besch()->get_finance_waytype() ); + player_t::add_maintenance(get_besitzer(), tile->get_besch()->get_maintenance(welt), tile->get_besch()->get_finance_waytype() ); } // get correct y offset for bridges @@ -136,7 +136,7 @@ gebaeude_t::~gebaeude_t() count = 0; anim_time = 0; if(tile) { - spieler_t::add_maintenance(get_besitzer(), -tile->get_besch()->get_maintenance(welt), tile->get_besch()->get_finance_waytype()); + player_t::add_maintenance(get_besitzer(), -tile->get_besch()->get_maintenance(welt), tile->get_besch()->get_finance_waytype()); } } @@ -869,7 +869,7 @@ void gebaeude_t::rdwr(loadsave_t *file) */ void gebaeude_t::laden_abschliessen() { - spieler_t::add_maintenance(get_besitzer(), tile->get_besch()->get_maintenance(welt), tile->get_besch()->get_finance_waytype()); + player_t::add_maintenance(get_besitzer(), tile->get_besch()->get_maintenance(welt), tile->get_besch()->get_finance_waytype()); // citybuilding, but no town? if( tile->get_offset()==koord(0,0) ) { @@ -892,7 +892,7 @@ void gebaeude_t::laden_abschliessen() } -void gebaeude_t::entferne(spieler_t *sp) +void gebaeude_t::entferne(player_t *player) { // DBG_MESSAGE("gebaeude_t::entferne()","gb %i"); // remove costs @@ -903,7 +903,7 @@ void gebaeude_t::entferne(spieler_t *sp) cost *= tile->get_besch()->get_level() + 1; } - spieler_t::book_construction_costs(sp, cost, get_pos().get_2d(), tile->get_besch()->get_finance_waytype()); + player_t::book_construction_costs(player, cost, get_pos().get_2d(), tile->get_besch()->get_finance_waytype()); // may need to update next buildings, in the case of start, middle, end buildings if(tile->get_besch()->get_all_layouts()>1 && get_haustyp()==unbekannt) { diff --git a/obj/gebaeude.h b/obj/gebaeude.h index bdb12340298..07566b8cd48 100644 --- a/obj/gebaeude.h +++ b/obj/gebaeude.h @@ -97,7 +97,7 @@ class gebaeude_t : public obj_t, sync_steppable public: gebaeude_t(loadsave_t *file); - gebaeude_t(koord3d pos,spieler_t *sp, const haus_tile_besch_t *t); + gebaeude_t(koord3d pos,player_t *player, const haus_tile_besch_t *t); virtual ~gebaeude_t(); void rotate90(); @@ -184,7 +184,7 @@ class gebaeude_t : public obj_t, sync_steppable virtual void zeige_info(); - void entferne(spieler_t *sp); + void entferne(player_t *player); void laden_abschliessen(); diff --git a/obj/groundobj.cc b/obj/groundobj.cc index e04024a4747..2e672aef595 100644 --- a/obj/groundobj.cc +++ b/obj/groundobj.cc @@ -232,9 +232,9 @@ void groundobj_t::info(cbuffer_t & buf) const } -void groundobj_t::entferne(spieler_t *sp) +void groundobj_t::entferne(player_t *player) { - spieler_t::book_construction_costs(sp, -get_besch()->get_preis(), get_pos().get_2d(), ignore_wt); + player_t::book_construction_costs(player, -get_besch()->get_preis(), get_pos().get_2d(), ignore_wt); mark_image_dirty( get_bild(), 0 ); } diff --git a/obj/groundobj.h b/obj/groundobj.h index cd172c8f1b6..b6675080956 100644 --- a/obj/groundobj.h +++ b/obj/groundobj.h @@ -60,7 +60,7 @@ class groundobj_t : public obj_t void info(cbuffer_t & buf) const; - void entferne(spieler_t *sp); + void entferne(player_t *player); const groundobj_besch_t* get_besch() const { return groundobj_typen[groundobjtype]; } diff --git a/obj/label.cc b/obj/label.cc index 58f1f519cef..29d8a24b884 100644 --- a/obj/label.cc +++ b/obj/label.cc @@ -38,17 +38,17 @@ label_t::label_t(loadsave_t *file) : } -label_t::label_t(koord3d pos, spieler_t *sp, const char *text) : +label_t::label_t(koord3d pos, player_t *player, const char *text) : obj_t(pos) { - set_besitzer( sp ); + set_besitzer( player ); welt->add_label(pos.get_2d()); grund_t *gr=welt->lookup_kartenboden(pos.get_2d()); if(gr) { if (text) { gr->set_text(text); } - spieler_t::book_construction_costs(sp, welt->get_settings().cst_buy_land, pos.get_2d(), ignore_wt); + player_t::book_construction_costs(player, welt->get_settings().cst_buy_land, pos.get_2d(), ignore_wt); } } diff --git a/obj/label.h b/obj/label.h index b5a152f14fa..f2911cda05e 100644 --- a/obj/label.h +++ b/obj/label.h @@ -8,7 +8,7 @@ class label_t : public obj_t { public: label_t(loadsave_t *file); - label_t(koord3d pos, spieler_t *sp, const char *text); + label_t(koord3d pos, player_t *player, const char *text); ~label_t(); void laden_abschliessen(); diff --git a/obj/leitung2.cc b/obj/leitung2.cc index fa2e0cf837c..076b385b4a6 100644 --- a/obj/leitung2.cc +++ b/obj/leitung2.cc @@ -70,9 +70,9 @@ int leitung_t::gimme_neighbours(leitung_t **conn) // both ground or both tunnel or both not tunnel bool const ok = (gr->ist_karten_boden() && gr_base->ist_karten_boden()) || (gr->ist_tunnel()==gr_base->ist_tunnel()); if( lt && (ribi_t::rueckwaerts(ribi_t::nsow[i]) & get_powerline_ribi(gr)) && ok ) { - const spieler_t *owner = get_besitzer(); - const spieler_t *other = lt->get_besitzer(); - const spieler_t *super = welt->get_spieler(1); + const player_t *owner = get_besitzer(); + const player_t *other = lt->get_besitzer(); + const player_t *super = welt->get_player(1); if (owner==other || owner==super || other==super) { conn[i] = lt; count++; @@ -105,11 +105,11 @@ leitung_t::leitung_t(loadsave_t *file) : obj_t() } -leitung_t::leitung_t(koord3d pos, spieler_t *sp) : obj_t(pos) +leitung_t::leitung_t(koord3d pos, player_t *player) : obj_t(pos) { bild = IMG_LEER; set_net(NULL); - set_besitzer( sp ); + set_besitzer( player ); set_besch(wegbauer_t::leitung_besch); } @@ -149,15 +149,15 @@ leitung_t::~leitung_t() delete net; } if(!gr->ist_tunnel()) { - spieler_t::add_maintenance(get_besitzer(), -besch->get_wartung(), powerline_wt); + player_t::add_maintenance(get_besitzer(), -besch->get_wartung(), powerline_wt); } } } -void leitung_t::entferne(spieler_t *sp) +void leitung_t::entferne(player_t *player) { - spieler_t::book_construction_costs(sp, -besch->get_preis()/2, get_pos().get_2d(), powerline_wt); + player_t::book_construction_costs(player, -besch->get_preis()/2, get_pos().get_2d(), powerline_wt); mark_image_dirty( bild, 0 ); } @@ -369,7 +369,7 @@ void leitung_t::laden_abschliessen() grund_t *gr = welt->lookup(get_pos()); assert(gr); - spieler_t::add_maintenance(get_besitzer(), besch->get_wartung(), powerline_wt); + player_t::add_maintenance(get_besitzer(), besch->get_wartung(), powerline_wt); } @@ -432,12 +432,12 @@ void leitung_t::rdwr(loadsave_t *file) // returns NULL, if removal is allowed // players can remove public owned powerlines -const char *leitung_t::ist_entfernbar(const spieler_t *sp) +const char *leitung_t::ist_entfernbar(const player_t *player) { - if( get_player_nr()==1 && sp ) { + if( get_player_nr()==1 && player ) { return NULL; } - return obj_t::ist_entfernbar(sp); + return obj_t::ist_entfernbar(player); } @@ -468,11 +468,11 @@ pumpe_t::pumpe_t(loadsave_t *file ) : leitung_t( koord3d::invalid, NULL ) } -pumpe_t::pumpe_t(koord3d pos, spieler_t *sp) : leitung_t(pos, sp) +pumpe_t::pumpe_t(koord3d pos, player_t *player) : leitung_t(pos, player) { fab = NULL; supply = 0; - spieler_t::book_construction_costs(sp, welt->get_settings().cst_transformer, get_pos().get_2d(), powerline_wt); + player_t::book_construction_costs(player, welt->get_settings().cst_transformer, get_pos().get_2d(), powerline_wt); } @@ -483,7 +483,7 @@ pumpe_t::~pumpe_t() fab = NULL; } pumpe_list.remove( this ); - spieler_t::add_maintenance(get_besitzer(), (sint32)welt->get_settings().cst_maintain_transformer, powerline_wt); + player_t::add_maintenance(get_besitzer(), (sint32)welt->get_settings().cst_maintain_transformer, powerline_wt); } @@ -521,7 +521,7 @@ void pumpe_t::step(uint32 delta_t) void pumpe_t::laden_abschliessen() { leitung_t::laden_abschliessen(); - spieler_t::add_maintenance(get_besitzer(), -(sint32)welt->get_settings().cst_maintain_transformer, powerline_wt); + player_t::add_maintenance(get_besitzer(), -(sint32)welt->get_settings().cst_maintain_transformer, powerline_wt); assert(get_net()); @@ -600,7 +600,7 @@ senke_t::senke_t(loadsave_t *file) : leitung_t( koord3d::invalid, NULL ) } -senke_t::senke_t(koord3d pos, spieler_t *sp) : leitung_t(pos, sp) +senke_t::senke_t(koord3d pos, player_t *player) : leitung_t(pos, player) { fab = NULL; einkommen = 0; @@ -609,7 +609,7 @@ senke_t::senke_t(koord3d pos, spieler_t *sp) : leitung_t(pos, sp) delta_sum = 0; last_power_demand = 0; power_load = 0; - spieler_t::book_construction_costs(sp, welt->get_settings().cst_transformer, get_pos().get_2d(), powerline_wt); + player_t::book_construction_costs(player, welt->get_settings().cst_transformer, get_pos().get_2d(), powerline_wt); welt->sync_add(this); } @@ -622,7 +622,7 @@ senke_t::~senke_t() fab = NULL; } senke_list.remove( this ); - spieler_t::add_maintenance(get_besitzer(), (sint32)welt->get_settings().cst_maintain_transformer, powerline_wt); + player_t::add_maintenance(get_besitzer(), (sint32)welt->get_settings().cst_maintain_transformer, powerline_wt); } @@ -736,7 +736,7 @@ bool senke_t::sync_step(uint32 delta_t) void senke_t::laden_abschliessen() { leitung_t::laden_abschliessen(); - spieler_t::add_maintenance(get_besitzer(), -(sint32)welt->get_settings().cst_maintain_transformer, powerline_wt); + player_t::add_maintenance(get_besitzer(), -(sint32)welt->get_settings().cst_maintain_transformer, powerline_wt); assert(get_net()); diff --git a/obj/leitung2.h b/obj/leitung2.h index abd2d538280..a64e5a9175a 100644 --- a/obj/leitung2.h +++ b/obj/leitung2.h @@ -18,7 +18,7 @@ #define POWER_TO_MW (12) // bitshift for converting internal power values to MW for display class powernet_t; -class spieler_t; +class player_t; class fabrik_t; class weg_besch_t; @@ -69,11 +69,11 @@ class leitung_t : public obj_t static fabrik_t * suche_fab_4(koord pos); leitung_t(loadsave_t *file); - leitung_t(koord3d pos, spieler_t *sp); + leitung_t(koord3d pos, player_t *player); virtual ~leitung_t(); // just book the costs for destruction - void entferne(spieler_t *); + void entferne(player_t *); // for map rotation void rotate90(); @@ -129,7 +129,7 @@ class leitung_t : public obj_t * @return NULL if OK, otherwise an error message * @author Hj. Malthaner */ - virtual const char *ist_entfernbar(const spieler_t *sp); + virtual const char *ist_entfernbar(const player_t *player); }; @@ -150,7 +150,7 @@ class pumpe_t : public leitung_t public: pumpe_t(loadsave_t *file); - pumpe_t(koord3d pos, spieler_t *sp); + pumpe_t(koord3d pos, player_t *player); ~pumpe_t(); typ get_typ() const { return pumpe; } @@ -189,7 +189,7 @@ class senke_t : public leitung_t, public sync_steppable public: senke_t(loadsave_t *file); - senke_t(koord3d pos, spieler_t *sp); + senke_t(koord3d pos, player_t *player); ~senke_t(); typ get_typ() const { return senke; } diff --git a/obj/pillar.cc b/obj/pillar.cc index ff80839822c..225fca2e7eb 100644 --- a/obj/pillar.cc +++ b/obj/pillar.cc @@ -32,12 +32,12 @@ pillar_t::pillar_t(loadsave_t *file) : obj_t() } -pillar_t::pillar_t(koord3d pos, spieler_t *sp, const bruecke_besch_t *besch, bruecke_besch_t::img_t img, int hoehe) : obj_t(pos) +pillar_t::pillar_t(koord3d pos, player_t *player, const bruecke_besch_t *besch, bruecke_besch_t::img_t img, int hoehe) : obj_t(pos) { this->besch = besch; this->dir = (uint8)img; set_yoff(-hoehe); - set_besitzer( sp ); + set_besitzer( player ); asymmetric = besch->has_pillar_asymmetric(); calc_bild(); } diff --git a/obj/pillar.h b/obj/pillar.h index 08acd8749b4..3d5bfe0de15 100644 --- a/obj/pillar.h +++ b/obj/pillar.h @@ -24,7 +24,7 @@ class pillar_t : public obj_t public: pillar_t(loadsave_t *file); - pillar_t(koord3d pos, spieler_t *sp, const bruecke_besch_t *besch, bruecke_besch_t::img_t img, int hoehe); + pillar_t(koord3d pos, player_t *player, const bruecke_besch_t *besch, bruecke_besch_t::img_t img, int hoehe); const char* get_name() const { return "Pillar"; } typ get_typ() const { return obj_t::pillar; } diff --git a/obj/roadsign.cc b/obj/roadsign.cc index 82fb5c30809..f4f00021901 100644 --- a/obj/roadsign.cc +++ b/obj/roadsign.cc @@ -71,7 +71,7 @@ roadsign_t::roadsign_t(loadsave_t *file) : obj_t () } -roadsign_t::roadsign_t(spieler_t *sp, koord3d pos, ribi_t::ribi dir, const roadsign_besch_t *besch) : obj_t(pos) +roadsign_t::roadsign_t(player_t *player, koord3d pos, ribi_t::ribi dir, const roadsign_besch_t *besch) : obj_t(pos) { this->besch = besch; this->dir = dir; @@ -79,15 +79,15 @@ roadsign_t::roadsign_t(spieler_t *sp, koord3d pos, ribi_t::ribi dir, const roads zustand = 0; ticks_ns = ticks_ow = 16; ticks_offset = 0; - set_besitzer( sp ); + set_besitzer( player ); if( besch->is_private_way() ) { // init ownership of private ways ticks_ns = ticks_ow = 0; - if( sp->get_player_nr() >= 8 ) { - ticks_ow = 1 << (sp->get_player_nr()-8); + if( player->get_player_nr() >= 8 ) { + ticks_ow = 1 << (player->get_player_nr()-8); } else { - ticks_ns = 1 << sp->get_player_nr(); + ticks_ns = 1 << player->get_player_nr(); } } /* if more than one state, we will switch direction and phase for traffic lights @@ -589,9 +589,9 @@ void roadsign_t::rdwr(loadsave_t *file) } -void roadsign_t::entferne(spieler_t *sp) +void roadsign_t::entferne(player_t *player) { - spieler_t::book_construction_costs(sp, -besch->get_preis(), get_pos().get_2d(), get_waytype()); + player_t::book_construction_costs(player, -besch->get_preis(), get_pos().get_2d(), get_waytype()); } diff --git a/obj/roadsign.h b/obj/roadsign.h index 6893be3d1c6..b35407dfb08 100644 --- a/obj/roadsign.h +++ b/obj/roadsign.h @@ -71,7 +71,7 @@ class roadsign_t : public obj_t, public sync_steppable waytype_t get_waytype() const { return besch ? besch->get_wtyp() : invalid_wt; } roadsign_t(loadsave_t *file); - roadsign_t(spieler_t *sp, koord3d pos, ribi_t::ribi dir, const roadsign_besch_t* besch); + roadsign_t(player_t *player, koord3d pos, ribi_t::ribi dir, const roadsign_besch_t* besch); const roadsign_besch_t *get_besch() const {return besch;} @@ -136,7 +136,7 @@ class roadsign_t : public obj_t, public sync_steppable void rotate90(); // substracts cost - void entferne(spieler_t *sp); + void entferne(player_t *player); void laden_abschliessen(); diff --git a/obj/signal.h b/obj/signal.h index 76205af2f93..81642c9f98a 100644 --- a/obj/signal.h +++ b/obj/signal.h @@ -24,7 +24,7 @@ class signal_t : public roadsign_t { public: signal_t(loadsave_t *file); - signal_t(spieler_t *sp, koord3d pos, ribi_t::ribi dir,const roadsign_besch_t *besch) : roadsign_t(sp,pos,dir,besch) { zustand = rot;} + signal_t(player_t *player, koord3d pos, ribi_t::ribi dir,const roadsign_besch_t *besch) : roadsign_t(player,pos,dir,besch) { zustand = rot;} /** * @return Einen Beschreibungsstring für das Objekt, der z.B. in einem diff --git a/obj/tunnel.cc b/obj/tunnel.cc index a2c4f22be1a..c92b333238e 100644 --- a/obj/tunnel.cc +++ b/obj/tunnel.cc @@ -39,12 +39,12 @@ tunnel_t::tunnel_t(loadsave_t* const file) : obj_no_info_t() } -tunnel_t::tunnel_t(koord3d pos, spieler_t *sp, const tunnel_besch_t *besch) : +tunnel_t::tunnel_t(koord3d pos, player_t *player, const tunnel_besch_t *besch) : obj_no_info_t(pos) { assert(besch); this->besch = besch; - set_besitzer( sp ); + set_besitzer( player ); bild = after_bild = IMG_LEER; broad_type = 0; } @@ -132,7 +132,7 @@ void tunnel_t::rdwr(loadsave_t *file) void tunnel_t::laden_abschliessen() { const grund_t *gr = welt->lookup(get_pos()); - spieler_t *sp=get_besitzer(); + player_t *player=get_besitzer(); if(besch==NULL) { // find a matching besch @@ -155,39 +155,39 @@ void tunnel_t::laden_abschliessen() } } - if(sp) { + if(player) { // change maintenance weg_t *weg = gr->get_weg(besch->get_waytype()); if(weg) { weg->set_max_speed(besch->get_topspeed()); - spieler_t::add_maintenance( sp, -weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype()); + player_t::add_maintenance( player, -weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype()); } leitung_t *lt = gr->get_leitung(); if(lt) { - spieler_t::add_maintenance( sp, -lt->get_besch()->get_wartung(), powerline_wt ); + player_t::add_maintenance( player, -lt->get_besch()->get_wartung(), powerline_wt ); } - spieler_t::add_maintenance( sp, besch->get_wartung(), besch->get_finance_waytype() ); + player_t::add_maintenance( player, besch->get_wartung(), besch->get_finance_waytype() ); } } // correct speed and maintenance -void tunnel_t::entferne( spieler_t *sp2 ) +void tunnel_t::entferne( player_t *player2 ) { - spieler_t *sp = get_besitzer(); - if(sp) { + player_t *player = get_besitzer(); + if(player) { // inside tunnel => do nothing but change maintenance const grund_t *gr = welt->lookup(get_pos()); if(gr) { weg_t *weg = gr->get_weg( besch->get_waytype() ); if(weg) { weg->set_max_speed( weg->get_besch()->get_topspeed() ); - spieler_t::add_maintenance( sp, weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype()); + player_t::add_maintenance( player, weg->get_besch()->get_wartung(), weg->get_besch()->get_finance_waytype()); } - spieler_t::add_maintenance( sp, -besch->get_wartung(), besch->get_finance_waytype() ); + player_t::add_maintenance( player, -besch->get_wartung(), besch->get_finance_waytype() ); } } - spieler_t::book_construction_costs(sp2, -besch->get_preis(), get_pos().get_2d(), besch->get_finance_waytype() ); + player_t::book_construction_costs(player2, -besch->get_preis(), get_pos().get_2d(), besch->get_finance_waytype() ); } @@ -209,12 +209,12 @@ void tunnel_t::set_after_bild( image_id b ) // returns NULL, if removal is allowed // players can remove public owned ways -const char *tunnel_t::ist_entfernbar(const spieler_t *sp) +const char *tunnel_t::ist_entfernbar(const player_t *player) { if (get_player_nr()==1) { return NULL; } else { - return obj_t::ist_entfernbar(sp); + return obj_t::ist_entfernbar(player); } } diff --git a/obj/tunnel.h b/obj/tunnel.h index 75f15e4d821..950cf11742f 100644 --- a/obj/tunnel.h +++ b/obj/tunnel.h @@ -16,7 +16,7 @@ class tunnel_t : public obj_no_info_t public: tunnel_t(loadsave_t *file); - tunnel_t(koord3d pos, spieler_t *sp, const tunnel_besch_t *besch); + tunnel_t(koord3d pos, player_t *player, const tunnel_besch_t *besch); const char *get_name() const {return "Tunnelmuendung";} typ get_typ() const { return tunnel; } @@ -47,7 +47,7 @@ class tunnel_t : public obj_no_info_t void laden_abschliessen(); - void entferne(spieler_t *sp); + void entferne(player_t *player); uint8 get_broad_type() const { return broad_type; }; @@ -55,7 +55,7 @@ class tunnel_t : public obj_no_info_t * @return NULL wenn OK, ansonsten eine Fehlermeldung * @author Hj. Malthaner */ - virtual const char *ist_entfernbar(const spieler_t *sp); + virtual const char *ist_entfernbar(const player_t *player); }; #endif diff --git a/obj/wayobj.cc b/obj/wayobj.cc index fe6925c8706..84633096520 100644 --- a/obj/wayobj.cc +++ b/obj/wayobj.cc @@ -57,7 +57,7 @@ wayobj_t::wayobj_t(loadsave_t* const file) : obj_no_info_t() } -wayobj_t::wayobj_t(koord3d const pos, spieler_t* const besitzer, ribi_t::ribi const d, way_obj_besch_t const* const b) : obj_no_info_t(pos) +wayobj_t::wayobj_t(koord3d const pos, player_t* const besitzer, ribi_t::ribi const d, way_obj_besch_t const* const b) : obj_no_info_t(pos) { besch = b; dir = d; @@ -71,7 +71,7 @@ wayobj_t::~wayobj_t() return; } if(get_besitzer()) { - spieler_t::add_maintenance(get_besitzer(), -besch->get_wartung(), get_waytype()); + player_t::add_maintenance(get_besitzer(), -besch->get_wartung(), get_waytype()); } if(besch->get_own_wtyp()==overheadlines_wt) { grund_t *gr=welt->lookup(get_pos()); @@ -168,22 +168,22 @@ void wayobj_t::rdwr(loadsave_t *file) } -void wayobj_t::entferne(spieler_t *sp) +void wayobj_t::entferne(player_t *player) { if(besch) { - spieler_t::book_construction_costs(sp, -besch->get_preis(), get_pos().get_2d(), besch->get_wtyp()); + player_t::book_construction_costs(player, -besch->get_preis(), get_pos().get_2d(), besch->get_wtyp()); } } // returns NULL, if removal is allowed // players can remove public owned wayobjs -const char *wayobj_t::ist_entfernbar(const spieler_t *sp) +const char *wayobj_t::ist_entfernbar(const player_t *player) { if( get_player_nr()==1 ) { return NULL; } - return obj_t::ist_entfernbar(sp); + return obj_t::ist_entfernbar(player); } @@ -218,7 +218,7 @@ void wayobj_t::laden_abschliessen() } if(get_besitzer()) { - spieler_t::add_maintenance(get_besitzer(), besch->get_wartung(), besch->get_wtyp()); + player_t::add_maintenance(get_besitzer(), besch->get_wartung(), besch->get_wtyp()); } } @@ -332,13 +332,13 @@ void wayobj_t::calc_bild() /* better use this constrcutor for new wayobj; it will extend a matching obj or make an new one */ -void wayobj_t::extend_wayobj_t(koord3d pos, spieler_t *besitzer, ribi_t::ribi dir, const way_obj_besch_t *besch) +void wayobj_t::extend_wayobj_t(koord3d pos, player_t *besitzer, ribi_t::ribi dir, const way_obj_besch_t *besch) { grund_t *gr=welt->lookup(pos); if(gr) { wayobj_t *existing_wayobj = gr->get_wayobj( besch->get_wtyp() ); if( existing_wayobj ) { - if( existing_wayobj->get_besch()->get_topspeed() < besch->get_topspeed() && spieler_t::check_owner(besitzer, existing_wayobj->get_besitzer()) ) { + if( existing_wayobj->get_besch()->get_topspeed() < besch->get_topspeed() && player_t::check_owner(besitzer, existing_wayobj->get_besitzer()) ) { // replace slower by faster dir = dir | existing_wayobj->get_dir(); gr->set_flag(grund_t::dirty); @@ -361,7 +361,7 @@ void wayobj_t::extend_wayobj_t(koord3d pos, spieler_t *besitzer, ribi_t::ribi di wo->calc_bild(); wo->mark_image_dirty( wo->get_after_bild(), 0 ); wo->set_flag(obj_t::dirty); - spieler_t::book_construction_costs( besitzer, -besch->get_preis(), pos.get_2d(), besch->get_wtyp()); + player_t::book_construction_costs( besitzer, -besch->get_preis(), pos.get_2d(), besch->get_wtyp()); for( uint8 i = 0; i < 4; i++ ) { // Extend wayobjects around the new one, that aren't already connected. diff --git a/obj/wayobj.h b/obj/wayobj.h index 3151196e265..946ce33ed09 100644 --- a/obj/wayobj.h +++ b/obj/wayobj.h @@ -16,7 +16,7 @@ #include "../tpl/vector_tpl.h" #include "../tpl/stringhashtable_tpl.h" -class spieler_t; +class player_t; class karte_t; class koord; class grund_t; @@ -42,7 +42,7 @@ class wayobj_t : public obj_no_info_t public: - wayobj_t(koord3d pos, spieler_t *besitzer, ribi_t::ribi dir, const way_obj_besch_t *besch); + wayobj_t(koord3d pos, player_t *besitzer, ribi_t::ribi dir, const way_obj_besch_t *besch); wayobj_t(loadsave_t *file); @@ -94,9 +94,9 @@ class wayobj_t : public obj_no_info_t void rdwr(loadsave_t *file); // substracts cost - void entferne(spieler_t *sp); + void entferne(player_t *player); - const char* ist_entfernbar(const spieler_t *sp) OVERRIDE; + const char* ist_entfernbar(const player_t *player) OVERRIDE; /** * calculate image after loading @@ -117,7 +117,7 @@ class wayobj_t : public obj_no_info_t static const way_obj_besch_t *default_oberleitung; // use this constructor; it will extend a matching existing wayobj - static void extend_wayobj_t(koord3d pos, spieler_t *besitzer, ribi_t::ribi dir, const way_obj_besch_t *besch); + static void extend_wayobj_t(koord3d pos, player_t *besitzer, ribi_t::ribi dir, const way_obj_besch_t *besch); static bool register_besch(way_obj_besch_t *besch); static bool alles_geladen(); diff --git a/obj/zeiger.cc b/obj/zeiger.cc index e14f3468dfb..47d223b07f9 100644 --- a/obj/zeiger.cc +++ b/obj/zeiger.cc @@ -26,10 +26,10 @@ zeiger_t::zeiger_t(loadsave_t *file) : obj_no_info_t() } -zeiger_t::zeiger_t(koord3d pos, spieler_t *sp) : +zeiger_t::zeiger_t(koord3d pos, player_t *player) : obj_no_info_t(pos) { - set_besitzer( sp ); + set_besitzer( player ); bild = IMG_LEER; after_bild = IMG_LEER; area = koord(0,0); diff --git a/obj/zeiger.h b/obj/zeiger.h index ac554a20fe3..1fe399dc470 100644 --- a/obj/zeiger.h +++ b/obj/zeiger.h @@ -21,7 +21,7 @@ class zeiger_t : public obj_no_info_t public: zeiger_t(loadsave_t *file); - zeiger_t(koord3d pos, spieler_t *sp); + zeiger_t(koord3d pos, player_t *player); void change_pos(koord3d k); diff --git a/player/ai.cc b/player/ai.cc index eacca0b976e..b45fa815a3f 100644 --- a/player/ai.cc +++ b/player/ai.cc @@ -555,14 +555,14 @@ DBG_MESSAGE("ai_passenger_t::create_simple_road_transport()","Already connection void ai_t::tell_tool_result(tool_t *tool, koord3d pos, const char *err, bool local) { // necessary to show error message if a human helps us poor AI - spieler_t::tell_tool_result(tool, pos, err, local); + player_t::tell_tool_result(tool, pos, err, local); // TODO: process the result... } /* create new AI */ -ai_t::ai_t(karte_t *wl, uint8 nr) : spieler_t( wl, nr ) +ai_t::ai_t(karte_t *wl, uint8 nr) : player_t( wl, nr ) { road_transport = rail_transport = air_transport = ship_transport = false; construction_speed = env_t::default_ai_construction_speed; @@ -571,7 +571,7 @@ ai_t::ai_t(karte_t *wl, uint8 nr) : spieler_t( wl, nr ) void ai_t::rdwr(loadsave_t *file) { - spieler_t::rdwr(file); + player_t::rdwr(file); if( file->get_version()<111001 ) { // do not know about ai_t diff --git a/player/ai.h b/player/ai.h index 97dc237f726..de9fd952357 100644 --- a/player/ai.h +++ b/player/ai.h @@ -34,7 +34,7 @@ class ai_bauplatz_mit_strasse_sucher_t : public bauplatz_sucher_t { // AI helper functions -class ai_t : public spieler_t +class ai_t : public player_t { protected: // set the allowed modes of transport diff --git a/player/ai_goods.cc b/player/ai_goods.cc index 55265a506de..6804c465ad4 100644 --- a/player/ai_goods.cc +++ b/player/ai_goods.cc @@ -70,9 +70,9 @@ ai_goods_t::ai_goods_t(karte_t *wl, uint8 nr) : ai_t(wl,nr) * Methode fuer jaehrliche Aktionen * @author Hj. Malthaner, Owen Rudge, hsiegeln */ -void ai_goods_t::neues_jahr() +void ai_goods_t::new_year() { - spieler_t::neues_jahr(); + player_t::new_year(); // AI will reconsider the oldest unbuiltable lines again uint remove = (uint)max(0,(int)forbidden_connections.get_count()-3); @@ -85,7 +85,7 @@ void ai_goods_t::neues_jahr() void ai_goods_t::rotate90( const sint16 y_size ) { - spieler_t::rotate90( y_size ); + player_t::rotate90( y_size ); // rotate places platz1.rotate90( y_size ); @@ -103,20 +103,20 @@ void ai_goods_t::rotate90( const sint16 y_size ) bool ai_goods_t::set_active(bool new_state) { // something to change? - if(automat!=new_state) { + if(active!=new_state) { if(!new_state) { // deactivate AI - automat = false; + active = false; state = NR_INIT; start = ziel = NULL; } else { // aktivate AI - automat = true; + active = true; } } - return automat; + return active; } @@ -775,9 +775,9 @@ DBG_MESSAGE("ai_goods_t::create_simple_rail_transport()","building simple track void ai_goods_t::step() { // needed for schedule of stops ... - spieler_t::step(); + player_t::step(); - if(!automat) { + if(!active) { // I am off ... return; } @@ -1339,7 +1339,7 @@ void ai_goods_t::rdwr(loadsave_t *file) { if( file->get_version()<102002 ) { // due to an error the player was never saved correctly - spieler_t::rdwr(file); + player_t::rdwr(file); return; } @@ -1508,14 +1508,14 @@ void ai_goods_t::fabconnection_t::rdwr(loadsave_t *file) * @author prissi * @date 30-Dec-2008 */ -void ai_goods_t::bescheid_vehikel_problem(convoihandle_t cnv,const koord3d ziel) +void ai_goods_t::report_vehicle_problem(convoihandle_t cnv,const koord3d ziel) { if( cnv->get_state() == convoi_t::NO_ROUTE && this!=welt->get_active_player() ) { DBG_MESSAGE("ai_passenger_t::bescheid_vehikel_problem","Vehicle %s can't find a route to (%i,%i)!", cnv->get_name(),ziel.x,ziel.y); cnv->self_destruct(); return; } - spieler_t::bescheid_vehikel_problem( cnv, ziel ); + player_t::report_vehicle_problem( cnv, ziel ); } diff --git a/player/ai_goods.h b/player/ai_goods.h index 337f7fe63e3..189e460cb5c 100644 --- a/player/ai_goods.h +++ b/player/ai_goods.h @@ -118,13 +118,13 @@ class ai_goods_t : public ai_t virtual void rdwr(loadsave_t *file); - virtual void bescheid_vehikel_problem(convoihandle_t cnv,const koord3d ziel); + virtual void report_vehicle_problem(convoihandle_t cnv,const koord3d ziel); bool set_active( bool b ); void step(); - void neues_jahr(); + void new_year(); virtual void rotate90( const sint16 y_size ); diff --git a/player/ai_passenger.cc b/player/ai_passenger.cc index f78877a24e5..36995c07c0f 100644 --- a/player/ai_passenger.cc +++ b/player/ai_passenger.cc @@ -64,7 +64,7 @@ bool ai_passenger_t::set_active(bool new_state) if( new_state ) { new_state = NULL!=vehikel_search( road_wt, 50, 80, warenbauer_t::passagiere, false); } - return spieler_t::set_active( new_state ); + return player_t::set_active( new_state ); } @@ -74,7 +74,7 @@ bool ai_passenger_t::set_active(bool new_state) halthandle_t ai_passenger_t::get_our_hub( const stadt_t *s ) const { FOR(vector_tpl, const halt, haltestelle_t::get_alle_haltestellen()) { - if (halt->get_besitzer() == sim::up_cast(this)) { + if (halt->get_besitzer() == sim::up_cast(this)) { if( halt->get_pax_enabled() && (halt->get_station_type()&haltestelle_t::busstop)!=0 ) { koord h=halt->get_basis_pos(); if(h.x>=s->get_linksoben().x && h.y>=s->get_linksoben().y && h.x<=s->get_rechtsunten().x && h.y<=s->get_rechtsunten().y ) { @@ -103,7 +103,7 @@ koord ai_passenger_t::find_area_for_hub( const koord lo, const koord ru, const k if( gr->get_typ()==grund_t::boden && gr->get_grund_hang()==hang_t::flach ) { const obj_t* obj = gr->obj_bei(0); int test_dist = koord_distance( trypos, basis ); - if (!obj || !obj->get_besitzer() || obj->get_besitzer() == sim::up_cast(this)) { + if (!obj || !obj->get_besitzer() || obj->get_besitzer() == sim::up_cast(this)) { if( gr->is_halt() && check_owner( gr->get_halt()->get_besitzer(), this ) && gr->hat_weg(road_wt) ) { // ok, one halt belongs already to us ... (should not really happen!) but might be a public stop return trypos; @@ -850,7 +850,7 @@ void ai_passenger_t::walk_city(linehandle_t const line, grund_t* const start, in // our stop => nothing to do #if AUTOJOIN_PUBLIC // we leave also public stops alone - if( hl[own]->get_besitzer()==this || hl[own]->get_besitzer()==welt->get_spieler(1) ) { + if( hl[own]->get_besitzer()==this || hl[own]->get_besitzer()==welt->get_player(1) ) { #else if( hl[own]->get_besitzer()==this ) { #endif @@ -933,9 +933,9 @@ void ai_passenger_t::cover_city_with_bus_route(koord start_pos, int number_of_st void ai_passenger_t::step() { // needed for schedule of stops ... - spieler_t::step(); + player_t::step(); - if(!automat) { + if(!active) { // I am off ... return; } @@ -1383,7 +1383,7 @@ void ai_passenger_t::rdwr(loadsave_t *file) { if( file->get_version()<102002 ) { // due to an error the player was never saved correctly - spieler_t::rdwr(file); + player_t::rdwr(file); return; } @@ -1452,18 +1452,18 @@ void ai_passenger_t::rdwr(loadsave_t *file) * @author prissi * @date 30-Dec-2008 */ -void ai_passenger_t::bescheid_vehikel_problem(convoihandle_t cnv,const koord3d ziel) +void ai_passenger_t::report_vehicle_problem(convoihandle_t cnv,const koord3d ziel) { if( cnv->get_state() == convoi_t::NO_ROUTE && this!=welt->get_active_player() ) { DBG_MESSAGE("ai_passenger_t::bescheid_vehikel_problem","Vehicle %s can't find a route to (%i,%i)!", cnv->get_name(),ziel.x,ziel.y); cnv->self_destruct(); return; } - spieler_t::bescheid_vehikel_problem( cnv, ziel ); + player_t::report_vehicle_problem( cnv, ziel ); } -void ai_passenger_t::laden_abschliessen() +void ai_passenger_t::load_finished() { road_vehicle = vehikel_search( road_wt, 50, 80, warenbauer_t::passagiere, false); if (road_vehicle == NULL) { diff --git a/player/ai_passenger.h b/player/ai_passenger.h index d3f758a5f5b..ddc089052ec 100644 --- a/player/ai_passenger.h +++ b/player/ai_passenger.h @@ -86,11 +86,11 @@ class ai_passenger_t : public ai_t // cannot do rail virtual void set_rail_transport( bool ) { rail_transport = false; } - virtual void bescheid_vehikel_problem(convoihandle_t cnv,const koord3d ziel); + virtual void report_vehicle_problem(convoihandle_t cnv,const koord3d ziel); virtual void rdwr(loadsave_t *file); - virtual void laden_abschliessen(); + virtual void load_finished(); bool set_active( bool b ); diff --git a/player/finance.cc b/player/finance.cc index 84b352d001a..96dbba6bfd8 100644 --- a/player/finance.cc +++ b/player/finance.cc @@ -19,7 +19,7 @@ * initialize finance history arrays * @author Jan Korbel */ -finance_t::finance_t(spieler_t * _player, karte_t * _world) : +finance_t::finance_t(player_t * _player, karte_t * _world) : player(_player), world(_world) { diff --git a/player/finance.h b/player/finance.h index 3379d1f351d..b09d26ac804 100644 --- a/player/finance.h +++ b/player/finance.h @@ -101,7 +101,7 @@ enum accounting_type_vehicles { class loadsave_t; class karte_t; -class spieler_t; +class player_t; class scenario_t; @@ -129,7 +129,7 @@ inline sint64 convert_money(sint64 value) { return (value + 50) / 100; } */ class finance_t { /** transport company */ - spieler_t * player; + player_t * player; karte_t * world; @@ -182,7 +182,7 @@ class finance_t { sint32 vehicle_maintenance[TT_MAX]; public: - finance_t(spieler_t * _player, karte_t * _world); + finance_t(player_t * _player, karte_t * _world); /** * Adds construction cost to finance stats. diff --git a/player/simplay.cc b/player/simplay.cc index 269a901f429..dbd9eb5bf17 100644 --- a/player/simplay.cc +++ b/player/simplay.cc @@ -56,21 +56,21 @@ #include "simplay.h" #include "finance.h" -karte_t *spieler_t::welt = NULL; +karte_t *player_t::welt = NULL; #ifdef MULTI_THREAD #include "../utils/simthread.h" -static pthread_mutex_t laden_abschl_mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t load_mutex = PTHREAD_MUTEX_INITIALIZER; #endif -spieler_t::spieler_t(karte_t *wl, uint8 nr) : +player_t::player_t(karte_t *wl, uint8 nr) : simlinemgmt() { finance = new finance_t(this, wl); welt = wl; player_nr = nr; player_age = 0; - automat = false; // Don't start as an AI player + active = false; // Don't start as an AI player locked = false; // allowed to change anything unlock_pending = false; @@ -81,11 +81,11 @@ spieler_t::spieler_t(karte_t *wl, uint8 nr) : welt->get_settings().set_default_player_color(this); // we have different AI, try to find out our type: - sprintf(spieler_name_buf,"player %i",player_nr-1); + sprintf(player_name_buf,"player %i",player_nr-1); } -spieler_t::~spieler_t() +player_t::~player_t() { while( !messages.empty() ) { delete messages.remove_first(); @@ -96,38 +96,32 @@ spieler_t::~spieler_t() } -void spieler_t::book_construction_costs(spieler_t * const sp, const sint64 amount, const koord k, const waytype_t wt) +void player_t::book_construction_costs(player_t * const player, const sint64 amount, const koord k, const waytype_t wt) { - if(sp!=NULL) { - sp->finance->book_construction_costs(amount, wt); + if(player!=NULL) { + player->finance->book_construction_costs(amount, wt); if(k != koord::invalid) { - sp->add_money_message(amount, k); + player->add_money_message(amount, k); } } } -/** - * Adds some amount to the maintenance costs. - * @param change the change - * @return the new maintenance costs - * @author Hj. Malthaner - */ -sint32 spieler_t::add_maintenance(sint32 change, waytype_t const wt) +sint32 player_t::add_maintenance(sint32 change, waytype_t const wt) { int tmp = 0; #ifdef MULTI_THREAD - pthread_mutex_lock( &laden_abschl_mutex ); + pthread_mutex_lock( &load_mutex ); #endif tmp = finance->book_maintenance(change, wt); #ifdef MULTI_THREAD - pthread_mutex_unlock( &laden_abschl_mutex ); + pthread_mutex_unlock( &load_mutex ); #endif return tmp; } -void spieler_t::add_money_message(const sint64 amount, const koord pos) +void player_t::add_money_message(const sint64 amount, const koord pos) { if(amount != 0 && player_nr != 1) { if( koord_distance(welt->get_viewport()->get_world_position(),pos)<2*(uint32)(display_get_width()/get_tile_raster_width())+3 ) { @@ -143,71 +137,62 @@ void spieler_t::add_money_message(const sint64 amount, const koord pos) } -/** - * amount has negative value = buy vehicle, positive value = vehicle sold - */ -void spieler_t::book_new_vehicle(const sint64 amount, const koord k, const waytype_t wt) +void player_t::book_new_vehicle(const sint64 amount, const koord k, const waytype_t wt) { finance->book_new_vehicle(amount, wt); add_money_message(amount, k); } -void spieler_t::book_revenue(const sint64 amount, const koord k, const waytype_t wt, sint32 index) +void player_t::book_revenue(const sint64 amount, const koord k, const waytype_t wt, sint32 index) { finance->book_revenue(amount, wt, index); add_money_message(amount, k); } -void spieler_t::book_running_costs(const sint64 amount, const waytype_t wt) +void player_t::book_running_costs(const sint64 amount, const waytype_t wt) { finance->book_running_costs(amount, wt); } -void spieler_t::book_toll_paid(const sint64 amount, const waytype_t wt) +void player_t::book_toll_paid(const sint64 amount, const waytype_t wt) { finance->book_toll_paid(amount, wt); } -void spieler_t::book_toll_received(const sint64 amount, const waytype_t wt) +void player_t::book_toll_received(const sint64 amount, const waytype_t wt) { finance->book_toll_received(amount, wt); } -void spieler_t::book_transported(const sint64 amount, const waytype_t wt, int index) +void player_t::book_transported(const sint64 amount, const waytype_t wt, int index) { finance->book_transported(amount, wt, index); } -void spieler_t::book_delivered(const sint64 amount, const waytype_t wt, int index) +void player_t::book_delivered(const sint64 amount, const waytype_t wt, int index) { finance->book_delivered(amount, wt, index); } -/* returns the name of the player; "player -1" sits in front of the screen - * @author prissi - */ -const char* spieler_t::get_name() const +const char* player_t::get_name() const { - return translator::translate(spieler_name_buf); + return translator::translate(player_name_buf); } -void spieler_t::set_name(const char *new_name) +void player_t::set_name(const char *new_name) { - tstrncpy( spieler_name_buf, new_name, lengthof(spieler_name_buf) ); + tstrncpy( player_name_buf, new_name, lengthof(player_name_buf) ); } -/** - * floating massages for all players here - */ -spieler_t::income_message_t::income_message_t( sint64 betrag, koord p ) +player_t::income_message_t::income_message_t( sint64 betrag, koord p ) { money_to_string(str, betrag/100.0); alter = 127; @@ -216,23 +201,19 @@ spieler_t::income_message_t::income_message_t( sint64 betrag, koord p ) } -void *spieler_t::income_message_t::operator new(size_t /*s*/) +void *player_t::income_message_t::operator new(size_t /*s*/) { - return freelist_t::gimme_node(sizeof(spieler_t::income_message_t)); + return freelist_t::gimme_node(sizeof(player_t::income_message_t)); } -void spieler_t::income_message_t::operator delete(void *p) +void player_t::income_message_t::operator delete(void *p) { - freelist_t::putback_node(sizeof(spieler_t::income_message_t),p); + freelist_t::putback_node(sizeof(player_t::income_message_t),p); } -/** - * Show income messages - * @author prissi - */ -void spieler_t::display_messages() +void player_t::display_messages() { const viewport_t *vp = welt->get_viewport(); @@ -240,7 +221,7 @@ void spieler_t::display_messages() const scr_coord scr_pos = vp->get_screen_coord(koord3d(m->pos,welt->lookup_hgt(m->pos)),koord(0,m->alter >> 4)); - display_shadow_proportional( scr_pos.x, scr_pos.y, PLAYER_FLAG|(kennfarbe1+3), COL_BLACK, m->str, true); + display_shadow_proportional( scr_pos.x, scr_pos.y, PLAYER_FLAG|(player_color_1+3), COL_BLACK, m->str, true); if( m->pos.x < 3 || m->pos.y < 3 ) { // very close to border => renew background welt->set_background_dirty(); @@ -249,11 +230,7 @@ void spieler_t::display_messages() } -/** - * Age messages (move them upwards), delete too old ones - * @author prissi - */ -void spieler_t::age_messages(uint32 /*delta_t*/) +void player_t::age_messages(uint32 /*delta_t*/) { for(slist_tpl::iterator iter = messages.begin(); iter != messages.end(); ) { income_message_t *m = *iter; @@ -270,7 +247,7 @@ void spieler_t::age_messages(uint32 /*delta_t*/) } -void spieler_t::add_message(sint64 betrag, koord k) +void player_t::add_message(sint64 betrag, koord k) { if( !messages.empty() && messages.back()->pos==k && messages.back()->alter==127 ) { // last message exactly at same place, not aged @@ -285,28 +262,20 @@ void spieler_t::add_message(sint64 betrag, koord k) } -void spieler_t::set_player_color(uint8 col1, uint8 col2) +void player_t::set_player_color(uint8 col1, uint8 col2) { - kennfarbe1 = col1; - kennfarbe2 = col2; + player_color_1 = col1; + player_color_2 = col2; display_set_player_color_scheme( player_nr, col1, col2 ); } -/** - * Any action goes here (only need for AI at the moment) - * @author Hj. Malthaner - */ -void spieler_t::step() +void player_t::step() { } -/** - * wird von welt nach jedem monat aufgerufen - * @author Hj. Malthaner - */ -bool spieler_t::neuer_monat() +bool player_t::new_month() { // since the messages must remain on the screen longer ... static cbuffer_t buf; @@ -328,7 +297,7 @@ bool spieler_t::neuer_monat() if( finance->get_netwealth() < 0 ) { destroy_all_win(true); create_win( display_get_width()/2-128, 40, new news_img("Bankrott:\n\nDu bist bankrott.\n"), w_info, magic_none); - ticker::add_msg( translator::translate("Bankrott:\n\nDu bist bankrott.\n"), koord::invalid, PLAYER_FLAG + kennfarbe1 + 1 ); + ticker::add_msg( translator::translate("Bankrott:\n\nDu bist bankrott.\n"), koord::invalid, PLAYER_FLAG + player_color_1 + 1 ); welt->stop(false); } else if( finance->get_netwealth()*10 < welt->get_settings().get_starting_money(welt->get_current_month()/12) ){ @@ -369,7 +338,7 @@ bool spieler_t::neuer_monat() finance->set_account_overdrawn( 0 ); } - if( env_t::networkmode && player_nr>1 && !automat ) { + if( env_t::networkmode && player_nr>1 && !active ) { // find out dummy companies (i.e. no vehicle running within x months) if( welt->get_settings().get_remove_dummy_player_months() && player_age >= welt->get_settings().get_remove_dummy_player_months() ) { bool no_cnv = true; @@ -416,7 +385,7 @@ bool spieler_t::neuer_monat() } -void spieler_t::calc_assets() +void player_t::calc_assets() { sint64 assets[TT_MAX]; for(int i=0; i < TT_MAX; ++i){ @@ -446,33 +415,33 @@ void spieler_t::calc_assets() } -void spieler_t::update_assets(sint64 const delta, const waytype_t wt) +void player_t::update_assets(sint64 const delta, const waytype_t wt) { finance->update_assets(delta, wt); } -sint32 spieler_t::get_scenario_completion() const +sint32 player_t::get_scenario_completion() const { return finance->get_scenario_completed(); } -void spieler_t::set_scenario_completion(sint32 percent) +void player_t::set_scenario_completion(sint32 percent) { finance->set_scenario_completed(percent); } -bool spieler_t::check_owner( const spieler_t *owner, const spieler_t *test ) +bool player_t::check_owner( const player_t *owner, const player_t *test ) { - return owner == test || owner == NULL || test == welt->get_spieler(1); + return owner == test || owner == NULL || test == welt->get_player(1); } -void spieler_t::ai_bankrupt() +void player_t::ai_bankrupt() { - DBG_MESSAGE("spieler_t::ai_bankrupt()","Removing convois"); + DBG_MESSAGE("player_t::ai_bankrupt()","Removing convois"); for (size_t i = welt->convoys().get_count(); i-- != 0;) { convoihandle_t const cnv = welt->convoys()[i]; @@ -516,7 +485,7 @@ void spieler_t::ai_bankrupt() // transfer all ways in public stops belonging to me to no one FOR(vector_tpl, const halt, haltestelle_t::get_alle_haltestellen()) { - if( halt->get_besitzer()==welt->get_spieler(1) ) { + if( halt->get_besitzer()==welt->get_player(1) ) { // only concerns public stops tiles FOR(slist_tpl, const& i, halt->get_tiles()) { grund_t const* const gr = i.grund; @@ -525,7 +494,7 @@ void spieler_t::ai_bankrupt() if( w && w->get_besitzer()==this ) { // take ownership if (wnr>1 || (!gr->ist_bruecke() && !gr->ist_tunnel())) { - spieler_t::add_maintenance( this, -w->get_besch()->get_wartung(), w->get_besch()->get_finance_waytype() ); + player_t::add_maintenance( this, -w->get_besch()->get_wartung(), w->get_besch()->get_finance_waytype() ); } w->set_besitzer(NULL); // make public } @@ -584,7 +553,7 @@ void spieler_t::ai_bankrupt() if(gr->ist_bruecke()) { add_maintenance( -((leitung_t*)obj)->get_besch()->get_wartung(), powerline_wt ); // do not remove powerline from bridges - obj->set_besitzer( welt->get_spieler(1) ); + obj->set_besitzer( welt->get_player(1) ); } else { obj->entferne(this); @@ -619,7 +588,7 @@ void spieler_t::ai_bankrupt() break; default: - obj->set_besitzer( welt->get_spieler(1) ); + obj->set_besitzer( welt->get_player(1) ); } } } @@ -631,7 +600,7 @@ void spieler_t::ai_bankrupt() } } - automat = false; + active = false; // make account negative if (finance->get_account_balance() > 0) { finance->book_account( -finance->get_account_balance() -1 ); @@ -643,12 +612,7 @@ void spieler_t::ai_bankrupt() } -/** - * Stores/save the player state - * @param file, where the data will be saved - * @author Hj. Malthaner - */ -void spieler_t::rdwr(loadsave_t *file) +void player_t::rdwr(loadsave_t *file) { xml_tag_t sss( file, "spieler_t" ); @@ -671,12 +635,12 @@ void spieler_t::rdwr(loadsave_t *file) if(file->get_version()<99009) { sint32 farbe; file->rdwr_long(farbe); - kennfarbe1 = (uint8)farbe*2; - kennfarbe2 = kennfarbe1+24; + player_color_1 = (uint8)farbe*2; + player_color_2 = player_color_1+24; } else { - file->rdwr_byte(kennfarbe1); - file->rdwr_byte(kennfarbe2); + file->rdwr_byte(player_color_1); + file->rdwr_byte(player_color_2); } sint32 halt_count=0; @@ -691,7 +655,7 @@ void spieler_t::rdwr(loadsave_t *file) // save all the financial statistics finance->rdwr( file ); - file->rdwr_bool(automat); + file->rdwr_bool(active); // state is not saved anymore if(file->get_version()<99014) { @@ -715,7 +679,7 @@ void spieler_t::rdwr(loadsave_t *file) if(file->is_loading()) { // halt_count will be zero for newer savegames -DBG_DEBUG("spieler_t::rdwr()","player %i: loading %i halts.",welt->sp2num( this ),halt_count); +DBG_DEBUG("player_t::rdwr()","player %i: loading %i halts.",welt->sp2num( this ),halt_count); for(int i=0; isp2num( this // save the name too if( file->get_version() > 102003 ) { - file->rdwr_str( spieler_name_buf, lengthof(spieler_name_buf) ); + file->rdwr_str( player_name_buf, lengthof(player_name_buf) ); } // save age @@ -768,13 +732,10 @@ DBG_DEBUG("spieler_t::rdwr()","player %i: loading %i halts.",welt->sp2num( this } -/** - * called after game is fully loaded; - */ -void spieler_t::laden_abschliessen() +void player_t::load_finished() { simlinemgmt.laden_abschliessen(); - display_set_player_color_scheme( player_nr, kennfarbe1, kennfarbe2 ); + display_set_player_color_scheme( player_nr, player_color_1, player_color_2 ); // recalculate vehicle value calc_assets(); @@ -782,24 +743,19 @@ void spieler_t::laden_abschliessen() } -void spieler_t::rotate90( const sint16 y_size ) +void player_t::rotate90( const sint16 y_size ) { simlinemgmt.rotate90( y_size ); headquarter_pos.rotate90( y_size ); } -/** - * Rückruf, um uns zu informieren, dass ein Vehikel ein Problem hat - * @author Hansjörg Malthaner - * @date 26-Nov-2001 - */ -void spieler_t::bescheid_vehikel_problem(convoihandle_t cnv,const koord3d ziel) +void player_t::report_vehicle_problem(convoihandle_t cnv,const koord3d position) { switch(cnv->get_state()) { case convoi_t::NO_ROUTE: -DBG_MESSAGE("spieler_t::bescheid_vehikel_problem","Vehicle %s can't find a route to (%i,%i)!", cnv->get_name(),ziel.x,ziel.y); +DBG_MESSAGE("player_t::report_vehicle_problem","Vehicle %s can't find a route to (%i,%i)!", cnv->get_name(),position.x,position.y); { cbuffer_t buf; buf.printf( translator::translate("Vehicle %s can't find a route!"), cnv->get_name()); @@ -810,7 +766,7 @@ DBG_MESSAGE("spieler_t::bescheid_vehikel_problem","Vehicle %s can't find a route case convoi_t::WAITING_FOR_CLEARANCE_ONE_MONTH: case convoi_t::CAN_START_ONE_MONTH: case convoi_t::CAN_START_TWO_MONTHS: -DBG_MESSAGE("spieler_t::bescheid_vehikel_problem","Vehicle %s stuck!", cnv->get_name(),ziel.x,ziel.y); +DBG_MESSAGE("player_t::report_vehicle_problem","Vehicle %s stuck!", cnv->get_name(),position.x,position.y); { cbuffer_t buf; buf.printf( translator::translate("Vehicle %s is stucked!"), cnv->get_name()); @@ -819,21 +775,17 @@ DBG_MESSAGE("spieler_t::bescheid_vehikel_problem","Vehicle %s stuck!", cnv->get_ break; default: -DBG_MESSAGE("spieler_t::bescheid_vehikel_problem","Vehicle %s, state %i!", cnv->get_name(), cnv->get_state()); +DBG_MESSAGE("player_t::report_vehicle_problem","Vehicle %s, state %i!", cnv->get_name(), cnv->get_state()); } - (void)ziel; + (void)position; } -/* Here functions for UNDO - * @date 7-Feb-2005 - * @author prissi - */ -void spieler_t::init_undo( waytype_t wtype, unsigned short max ) +void player_t::init_undo( waytype_t wtype, unsigned short max ) { // only human player // prissi: allow for UNDO for real player -DBG_MESSAGE("spieler_t::int_undo()","undo tiles %i",max); +DBG_MESSAGE("player_t::int_undo()","undo tiles %i",max); last_built.clear(); last_built.resize(max+1); if(max>0) { @@ -843,16 +795,16 @@ DBG_MESSAGE("spieler_t::int_undo()","undo tiles %i",max); } -void spieler_t::add_undo(koord3d k) +void player_t::add_undo(koord3d k) { if(last_built.get_size()>0) { -//DBG_DEBUG("spieler_t::add_undo()","tile at (%i,%i)",k.x,k.y); +//DBG_DEBUG("player_t::add_undo()","tile at (%i,%i)",k.x,k.y); last_built.append(k); } } -sint64 spieler_t::undo() +sint64 player_t::undo() { if (last_built.empty()) { // nothing to UNDO @@ -924,7 +876,7 @@ sint64 spieler_t::undo() } -void spieler_t::tell_tool_result(tool_t *tool, koord3d, const char *err, bool local) +void player_t::tell_tool_result(tool_t *tool, koord3d, const char *err, bool local) { /* tools can return three kinds of messages * NULL = success @@ -946,25 +898,25 @@ void spieler_t::tell_tool_result(tool_t *tool, koord3d, const char *err, bool lo } -void spieler_t::book_convoi_number(int count) +void player_t::book_convoi_number(int count) { finance->book_convoi_number(count); } -double spieler_t::get_konto_als_double() const +double player_t::get_account_balance_as_double() const { return finance->get_account_balance() / 100.0; } -int spieler_t::get_account_overdrawn() const +int player_t::get_account_overdrawn() const { return finance->get_account_overdrawn(); } -bool spieler_t::has_money_or_assets() const +bool player_t::has_money_or_assets() const { return finance->has_money_or_assets(); } diff --git a/player/simplay.h b/player/simplay.h index c0d4a8de53e..c865dd13394 100644 --- a/player/simplay.h +++ b/player/simplay.h @@ -29,13 +29,13 @@ class finance_t; /** * Class to hold informations about one player/company. AI players are derived from this class. */ -class spieler_t +class player_t { public: enum { EMPTY=0, HUMAN=1, AI_GOODS=2, AI_PASSENGER=3, MAX_AI, PASSWORD_PROTECTED=128 }; protected: - char spieler_name_buf[256]; + char player_name_buf[256]; /* "new" finance history */ finance_t *finance; @@ -50,6 +50,10 @@ class spieler_t // when was the company founded uint16 player_age; + + /** + * Floating massages for all players here + */ class income_message_t { public: char str[33]; @@ -65,21 +69,21 @@ class spieler_t slist_tplmessages; /** - * creates new income message entry or merges with existing one if the + * Creates new income message entry or merges with existing one if the * most recent one is at the same coordinate */ void add_message(sint64 amount, koord k); /** - * displays amount of money when koordinates are on screen + * Displays amount of money when koordinates are on screen */ void add_money_message(sint64 amount, koord k); /** - * Kennfarbe (Fahrzeuge, Gebäude) des Speielers + * Colors of the player * @author Hj. Malthaner */ - uint8 kennfarbe1, kennfarbe2; + uint8 player_color_1, player_color_2; /** * Player number; only player 0 can do interaction @@ -99,7 +103,7 @@ class spieler_t * Ist dieser Spieler ein automatischer Spieler? * @author Hj. Malthaner */ - bool automat; + bool active; /** * Are this player allowed to do any changes? @@ -126,7 +130,7 @@ class spieler_t * @param tt type of transport * @author jk271 */ - static void book_construction_costs(spieler_t * const sp, const sint64 amount, const koord k, const waytype_t wt=ignore_wt); + static void book_construction_costs(player_t * const player, const sint64 amount, const koord k, const waytype_t wt=ignore_wt); /** * Accounts bought/sold vehicles. @@ -195,9 +199,9 @@ class spieler_t finance_t * get_finance() { return finance; } - virtual bool set_active( bool b ) { return automat = b; } + virtual bool set_active( bool b ) { return active = b; } - bool is_active() const { return automat; } + bool is_active() const { return active; } bool is_locked() const { return locked; } @@ -225,13 +229,13 @@ class spieler_t /* Handles player colors ... * @author prissi */ - uint8 get_player_color1() const { return kennfarbe1; } - uint8 get_player_color2() const { return kennfarbe2; } + uint8 get_player_color1() const { return player_color_1; } + uint8 get_player_color2() const { return player_color_2; } void set_player_color(uint8 col1, uint8 col2); /** - * Name of the player - * @author player + * @return the name of the player; "player -1" sits in front of the screen + * @author prissi */ const char* get_name() const; void set_name(const char *); @@ -242,21 +246,21 @@ class spieler_t * return true, if the owner is none, myself or player(1), i.e. the ownership can be taken by player test * @author prissi */ - static bool check_owner( const spieler_t *owner, const spieler_t *test ); + static bool check_owner( const player_t *owner, const player_t *test ); /** - * @param welt Die Welt (Karte) des Spiels - * @param color Kennfarbe des Spielers + * @param welt World this players belong to. + * @param player_nr Number assigned to this player, it's a ID. * @author Hj. Malthaner */ - spieler_t(karte_t *welt, uint8 player_nr ); + player_t(karte_t *welt, uint8 player_nr ); - virtual ~spieler_t(); + virtual ~player_t(); - static sint32 add_maintenance(spieler_t *sp, sint32 const change, waytype_t const wt=ignore_wt) + static sint32 add_maintenance(player_t *player, sint32 const change, waytype_t const wt=ignore_wt) { - if(sp) { - return sp->add_maintenance(change, wt); + if(player) { + return player->add_maintenance(change, wt); } return 0; } @@ -270,53 +274,56 @@ class spieler_t void set_scenario_completion(sint32 percent); /** - * @return Kontostand als double (Gleitkomma) Wert + * @return Account balance as a double (floating point) value * @author Hj. Malthaner */ - double get_konto_als_double() const; + double get_account_balance_as_double() const; /** - * @return true wenn Konto Überzogen ist + * @return true when account balance is overdrawn * @author Hj. Malthaner */ int get_account_overdrawn() const; /** - * Zeigt Meldungen aus der Queue des Spielers auf dem Bildschirm an + * Displays messages from the queue of the player on the screen + * Show income messages * @author Hj. Malthaner - */ + * @author prissi + */ void display_messages(); /** - * Wird von welt in kurzen abständen aufgerufen + * Called often by simworld.cc during simulation + * @note Any action goes here (only need for AI at the moment) * @author Hj. Malthaner */ virtual void step(); /** - * Wird von welt nach jedem monat aufgerufen + * Called monthly by simworld.cc during simulation * @author Hj. Malthaner * @returns false if player has to be removed (bankrupt/inactive) */ - virtual bool neuer_monat(); + virtual bool new_month(); /** - * Methode fuer jaehrliche Aktionen + * Called yearly by simworld.cc during simulation * @author Hj. Malthaner */ - virtual void neues_jahr() {} + virtual void new_year() {} /** - * Lädt oder speichert Zustand des Spielers - * @param file die offene Save-Datei - * @author Hj. Malthaner - */ + * Stores/loads the player state + * @param file, where the data will be saved/loaded + * @author Hj. Malthaner + */ virtual void rdwr(loadsave_t *file); /* - * called after game is fully loaded; + * Called after game is fully loaded; */ - virtual void laden_abschliessen(); + virtual void load_finished(); virtual void rotate90( const sint16 y_size ); @@ -337,11 +344,11 @@ class spieler_t void update_assets(sint64 const delta, const waytype_t wt = ignore_wt); /** - * Rückruf, um uns zu informieren, dass ein Vehikel ein Problem hat + * Report the player one of his vehicles has a problem * @author Hansjörg Malthaner * @date 26-Nov-2001 */ - virtual void bescheid_vehikel_problem(convoihandle_t cnv,const koord3d ziel); + virtual void report_vehicle_problem(convoihandle_t cnv,const koord3d position); /** * Tells the player the result of tool-work commands @@ -370,12 +377,29 @@ class spieler_t waytype_t undo_type; public: + /** + * Function for UNDO + * @date 7-Feb-2005 + * @author prissi + */ void init_undo(waytype_t t, unsigned short max ); + + /** + * Function for UNDO + * @date 7-Feb-2005 + * @author prissi + */ void add_undo(koord3d k); + + /** + * Function for UNDO + * @date 7-Feb-2005 + * @author prissi + */ sint64 undo(); - // headquarter stuff private: + // headquarter stuff sint32 headquarter_level; koord headquarter_pos; diff --git a/script/api/api_city.cc b/script/api/api_city.cc index 0468db52f82..9df8824d1c2 100644 --- a/script/api/api_city.cc +++ b/script/api/api_city.cc @@ -55,7 +55,7 @@ static void_t set_citygrowth(stadt_t *city, bool allow) tool_t *tool = tool_t::simple_tool[TOOL_CHANGE_CITY]; tool->set_default_param( param ); tool->flags |= tool_t::WFL_SCRIPT; - welt->set_tool( tool, welt->get_spieler(1) ); + welt->set_tool( tool, welt->get_player(1) ); tool->flags &= ~tool_t::WFL_SCRIPT; return void_t(); } diff --git a/script/api/api_line.cc b/script/api/api_line.cc index 3cf0dd98596..d8929f78de5 100644 --- a/script/api/api_line.cc +++ b/script/api/api_line.cc @@ -50,8 +50,8 @@ vector_tpl const* generic_get_line_list(HSQUIRRELVM vm, SQInteger } } if (SQ_SUCCEEDED(get_slot(vm, "player_id", id, index)) && id < PLAYER_UNOWNED) { - if (spieler_t *sp = welt->get_spieler(id)) { - return &sp->simlinemgmt.get_line_list(); + if (player_t *player = welt->get_player(id)) { + return &player->simlinemgmt.get_line_list(); } } sq_raise_error(vm, "Invalid line list."); diff --git a/script/api/api_map_objects.cc b/script/api/api_map_objects.cc index b903bdf01ff..45c93d8b611 100644 --- a/script/api/api_map_objects.cc +++ b/script/api/api_map_objects.cc @@ -183,14 +183,14 @@ void begin_obj_class(HSQUIRRELVM vm, const char* name, const char* base = NULL) } // markers / labels -label_t* create_marker(koord pos, spieler_t* sp, const char* text) +label_t* create_marker(koord pos, player_t* player, const char* text) { - if (sp == NULL || text == NULL) { + if (player == NULL || text == NULL) { return NULL; } tool_marker_t w; w.flags = 0; - const char* err = w.work(sp, koord3d(pos,0)); + const char* err = w.work(player, koord3d(pos, 0)); if (err) { return NULL; } diff --git a/script/api/api_player.cc b/script/api/api_player.cc index 32439cc5abd..8885847cf77 100644 --- a/script/api/api_player.cc +++ b/script/api/api_player.cc @@ -10,7 +10,7 @@ using namespace script_api; -vector_tpl const& get_player_stat(spieler_t *sp, sint32 INDEX, sint32 TTYPE, bool monthly) +vector_tpl const& get_player_stat(player_t *player, sint32 INDEX, sint32 TTYPE, bool monthly) { static vector_tpl v; v.clear(); @@ -26,8 +26,8 @@ vector_tpl const& get_player_stat(spieler_t *sp, sint32 INDEX, sint32 TT } atv = true; } - if (sp) { - finance_t *finance = sp->get_finance(); + if (player) { + finance_t *finance = player->get_finance(); uint16 maxi = monthly ? MAX_PLAYER_HISTORY_MONTHS : MAX_PLAYER_HISTORY_YEARS; for(uint16 i = 0; i < maxi; i++) { sint64 m = atv ? ( monthly ? finance->get_history_veh_month((transport_type)TTYPE, i, INDEX) : finance->get_history_veh_year((transport_type)TTYPE, i, INDEX) ) @@ -48,26 +48,26 @@ vector_tpl const& get_player_stat(spieler_t *sp, sint32 INDEX, sint32 TT return v; } -void_t change_player_account(spieler_t *sp, sint64 delta) +void_t change_player_account(player_t *player, sint64 delta) { - if (sp) { - sp->get_finance()->book_account(delta); + if (player) { + player->get_finance()->book_account(delta); } return void_t(); } -bool player_active(spieler_t *sp) +bool player_active(player_t *player) { - return sp != NULL; + return player != NULL; } SQInteger player_export_line_list(HSQUIRRELVM vm) { - if (spieler_t* sp = param::get(vm, 1)) { + if (player_t* player = param::get(vm, 1)) { push_instance(vm, "line_list_x"); - set_slot(vm, "player_id", sp->get_player_nr()); + set_slot(vm, "player_id", player->get_player_nr()); return 1; } return SQ_ERROR; @@ -93,17 +93,17 @@ void export_player(HSQUIRRELVM vm) * Return headquarter level. * @returns level, level is zero if no headquarter was built */ - register_method(vm, &spieler_t::get_headquarter_level, "get_headquarter_level"); + register_method(vm, &player_t::get_headquarter_level, "get_headquarter_level"); /** * Return headquarter position. * @returns coordinate, (-1,-1) if no headquarter was built */ - register_method(vm, &spieler_t::get_headquarter_pos, "get_headquarter_pos"); + register_method(vm, &player_t::get_headquarter_pos, "get_headquarter_pos"); /** * Return name of company. * @returns name */ - register_method(vm, &spieler_t::get_name, "get_name"); + register_method(vm, &player_t::get_name, "get_name"); /** * Get monthly statistics of construction costs. * @returns array, index [0] corresponds to current month @@ -210,7 +210,7 @@ void export_player(HSQUIRRELVM vm) * Exports list of lines of this player. * @typemask line_list_x() */ - register_function(vm, &player_export_line_list, "get_line_list", 1, param::typemask()); + register_function(vm, &player_export_line_list, "get_line_list", 1, param::typemask()); end_class(vm); } diff --git a/script/api/api_schedule.cc b/script/api/api_schedule.cc index d7a08ff15f9..3a333c05af0 100644 --- a/script/api/api_schedule.cc +++ b/script/api/api_schedule.cc @@ -11,12 +11,12 @@ using namespace script_api; -halthandle_t get_halt_from_koord3d(koord3d pos, const spieler_t *sp ) +halthandle_t get_halt_from_koord3d(koord3d pos, const player_t *player ) { - if( sp == NULL ) { + if( player == NULL ) { return halthandle_t(); } - return haltestelle_t::get_halt(pos, sp); + return haltestelle_t::get_halt(pos, player); } diff --git a/script/api/api_settings.cc b/script/api/api_settings.cc index f02e44cc863..682d232df46 100644 --- a/script/api/api_settings.cc +++ b/script/api/api_settings.cc @@ -26,7 +26,7 @@ void_t set_traffic_level(settings_t*, sint16 rate) tool_t *tool = tool_t::simple_tool[TOOL_TRAFFIC_LEVEL]; tool->set_default_param( level ); tool->flags |= tool_t::WFL_SCRIPT; - welt->set_tool( tool, welt->get_spieler(1) ); + welt->set_tool( tool, welt->get_player(1) ); tool->flags &= ~tool_t::WFL_SCRIPT; return void_t(); } diff --git a/script/api/api_tiles.cc b/script/api/api_tiles.cc index 6bffcd58884..5da19692a75 100644 --- a/script/api/api_tiles.cc +++ b/script/api/api_tiles.cc @@ -31,9 +31,9 @@ SQInteger get_object_index(HSQUIRRELVM vm) } -const char* tile_remove_object(grund_t* gr, spieler_t* sp, obj_t::typ type) +const char* tile_remove_object(grund_t* gr, player_t* player, obj_t::typ type) { - if (gr == NULL || sp == NULL) { + if (gr == NULL || player == NULL) { return ""; } tool_remover_t w; @@ -42,7 +42,7 @@ const char* tile_remove_object(grund_t* gr, spieler_t* sp, obj_t::typ type) sprintf(buf, "%d", (int)type); w.set_default_param(buf); - return w.work(sp, gr->get_pos()); + return w.work(player, gr->get_pos()); } // return way ribis, have to implement a wrapper, to correctly rotate ribi diff --git a/script/api/api_world.cc b/script/api/api_world.cc index d2c3dbebae2..3076402b9c0 100644 --- a/script/api/api_world.cc +++ b/script/api/api_world.cc @@ -38,18 +38,18 @@ vector_tpl const& get_world_stat(karte_t* welt, bool monthly, sint32 IND } -bool world_remove_player(karte_t *welt, spieler_t *sp) +bool world_remove_player(karte_t *welt, player_t *player) { - if (sp == NULL) { + if (player == NULL) { return false; } // first test - bool ok = welt->change_player_tool(karte_t::delete_player, sp->get_player_nr(), 0, true /*unlocked*/, false /*exec*/); + bool ok = welt->change_player_tool(karte_t::delete_player, player->get_player_nr(), 0, true /*unlocked*/, false /*exec*/); if (!ok) { return false; } // now call - will not have immediate effect in network games - welt->call_change_player_tool(karte_t::delete_player, sp->get_player_nr(), 0, true /*scripted*/); + welt->call_change_player_tool(karte_t::delete_player, player->get_player_nr(), 0, true /*scripted*/); return true; } diff --git a/script/api_param.cc b/script/api_param.cc index 5dee77ae0cd..d08ebe2e1c1 100644 --- a/script/api_param.cc +++ b/script/api_param.cc @@ -329,12 +329,12 @@ namespace script_api { return NULL; } - spieler_t* param::get(HSQUIRRELVM vm, SQInteger index) + player_t* param::get(HSQUIRRELVM vm, SQInteger index) { uint8 plnr = 0; get_slot(vm, "nr", plnr, index); if(plnr < 15) { - return welt->get_spieler(plnr); + return welt->get_player(plnr); } else { sq_raise_error(vm, "Invalid player index %d", plnr); @@ -343,9 +343,9 @@ namespace script_api { } - SQInteger param::push(HSQUIRRELVM vm, spieler_t* const& sp) + SQInteger param::push(HSQUIRRELVM vm, player_t* const& player) { - return push_instance(vm, "player_x", sp ? sp->get_player_nr() : 16); + return push_instance(vm, "player_x", player ? player->get_player_nr() : 16); } diff --git a/script/api_param.h b/script/api_param.h index 7b0de05ab7b..8cfa8e69803 100644 --- a/script/api_param.h +++ b/script/api_param.h @@ -338,7 +338,7 @@ namespace script_api { declare_specialized_param(scenario_t*, "t|x|y", ""); declare_specialized_param(linehandle_t, "t|x|y", "line_x"); declare_specialized_param(simline_t*, "t|x|y", "line_x"); - declare_specialized_param(spieler_t*, "t|x|y", "player_x"); + declare_specialized_param(player_t*, "t|x|y", "player_x"); declare_specialized_param(stadt_t*, "t|x|y", "city_x"); declare_specialized_param(const ware_production_t*, "t|x|y", "factory_production_x"); declare_param_mask(ware_production_t*, "t|x|y", "factory_production_x"); diff --git a/script/dynamic_string.cc b/script/dynamic_string.cc index b16cc22426f..b93594cf4ca 100644 --- a/script/dynamic_string.cc +++ b/script/dynamic_string.cc @@ -54,10 +54,10 @@ void dynamic_string::init() } -void dynamic_string::update(script_vm_t *script, spieler_t *sp, bool force_update) +void dynamic_string::update(script_vm_t *script, player_t *player, bool force_update) { cbuffer_t buf; - buf.printf("%s(%d)", method, sp ? sp->get_player_nr() : PLAYER_UNOWNED); + buf.printf("%s(%d)", method, player ? player->get_player_nr() : PLAYER_UNOWNED); const char* function = (const char*)buf; plainstring s; @@ -72,7 +72,7 @@ void dynamic_string::update(script_vm_t *script, spieler_t *sp, bool force_updat } else { // call script - script->call_function(method, s, (uint8)(sp ? sp->get_player_nr() : PLAYER_UNOWNED)); + script->call_function(method, s, (uint8)(player ? player->get_player_nr() : PLAYER_UNOWNED)); // .. and store result record_result(function, s); } diff --git a/script/dynamic_string.h b/script/dynamic_string.h index ea06816a52d..329ce9731e6 100644 --- a/script/dynamic_string.h +++ b/script/dynamic_string.h @@ -6,7 +6,7 @@ #include "../utils/plainstring.h" class script_vm_t; -class spieler_t; +class player_t; /** * Class of strings to hold result of text-returning script functions. @@ -37,7 +37,7 @@ class dynamic_string * @param script the scripting engine, if script == NULL then this needs server communication * @param force_update will force to update even if cache is still valid */ - void update(script_vm_t *script, spieler_t *sp, bool force_update=false); + void update(script_vm_t *script, player_t *player, bool force_update=false); operator const plainstring& () const { return str; } operator const char* () const { return (const char*)str; } diff --git a/simcity.cc b/simcity.cc index 2c81c3b1dc2..10d90d3018f 100644 --- a/simcity.cc +++ b/simcity.cc @@ -965,7 +965,7 @@ stadt_t::~stadt_t() } else { gb->set_stadt( NULL ); - hausbauer_t::remove(welt->get_spieler(1),gb); + hausbauer_t::remove(welt->get_player(1),gb); } } } @@ -983,7 +983,7 @@ static bool name_used(weighted_vector_tpl const& cities, char const* c } -stadt_t::stadt_t(spieler_t* sp, koord pos, sint32 citizens) : +stadt_t::stadt_t(player_t* player, koord pos, sint32 citizens) : buildings(16), pax_destinations_old(koord(PAX_DESTINATIONS_SIZE, PAX_DESTINATIONS_SIZE)), pax_destinations_new(koord(PAX_DESTINATIONS_SIZE, PAX_DESTINATIONS_SIZE)) @@ -999,7 +999,7 @@ stadt_t::stadt_t(spieler_t* sp, koord pos, sint32 citizens) : stadtinfo_options = 3; // citizen and growth - besitzer_p = sp; + owner = player; this->pos = pos; last_center = koord::invalid; @@ -1102,10 +1102,10 @@ stadt_t::stadt_t(loadsave_t* file) : void stadt_t::rdwr(loadsave_t* file) { - sint32 besitzer_n; + sint32 owner_n; if (file->is_saving()) { - besitzer_n = welt->sp2num(besitzer_p); + owner_n = welt->sp2num(owner); } file->rdwr_str(name); pos.rdwr(file); @@ -1121,7 +1121,7 @@ void stadt_t::rdwr(loadsave_t* file) lo.y = lob; ur.x = lre; ur.y = lun; - file->rdwr_long(besitzer_n); + file->rdwr_long(owner_n); file->rdwr_long(bev); file->rdwr_long(arb); file->rdwr_long(won); @@ -1143,7 +1143,7 @@ void stadt_t::rdwr(loadsave_t* file) } if (file->is_loading()) { - besitzer_p = welt->get_spieler(besitzer_n); + owner = welt->get_player(owner_n); } if(file->is_loading()) { @@ -2069,7 +2069,7 @@ void stadt_t::check_bau_spezial(bool new_town) if (besch->get_all_layouts() > 1) { rotate = (simrand(20) & 2) + is_rotate; } - hausbauer_t::baue( besitzer_p, welt->lookup_kartenboden(best_pos)->get_pos(), rotate, besch ); + hausbauer_t::baue( owner, welt->lookup_kartenboden(best_pos)->get_pos(), rotate, besch ); // tell the player, if not during initialization if (!new_town) { cbuffer_t buf; @@ -2135,7 +2135,7 @@ void stadt_t::check_bau_spezial(bool new_town) } } // and then build it - const gebaeude_t* gb = hausbauer_t::baue(besitzer_p, welt->lookup_kartenboden(best_pos + koord(1, 1))->get_pos(), 0, besch); + const gebaeude_t* gb = hausbauer_t::baue(owner, welt->lookup_kartenboden(best_pos + koord(1, 1))->get_pos(), 0, besch); hausbauer_t::denkmal_gebaut(besch); add_gebaeude_to_stadt(gb); // tell the player, if not during initialization @@ -2310,7 +2310,7 @@ void stadt_t::check_bau_rathaus(bool new_town) dbg->error( "stadt_t::check_bau_rathaus", "no better position found!" ); return; } - gebaeude_t const* const new_gb = hausbauer_t::baue(besitzer_p, welt->lookup_kartenboden(best_pos + offset)->get_pos(), layout, besch); + gebaeude_t const* const new_gb = hausbauer_t::baue(owner, welt->lookup_kartenboden(best_pos + offset)->get_pos(), layout, besch); DBG_MESSAGE("new townhall", "use layout=%i", layout); add_gebaeude_to_stadt(new_gb); DBG_MESSAGE("stadt_t::check_bau_rathaus()", "add townhall (bev=%i, ptr=%p)", buildings.get_sum_weight(),welt->lookup_kartenboden(best_pos)->first_obj()); @@ -2557,9 +2557,9 @@ void stadt_t::build_city_building(const koord k) weg->set_gehweg(true); // if not current city road standard, then replace it if( weg->get_besch() != welt->get_city_road() ) { - spieler_t *sp = weg->get_besitzer(); - if( sp == NULL || !gr->get_depot() ) { - spieler_t::add_maintenance( sp, -weg->get_besch()->get_wartung(), road_wt); + player_t *player = weg->get_besitzer(); + if( player == NULL || !gr->get_depot() ) { + player_t::add_maintenance( player, -weg->get_besch()->get_wartung(), road_wt); weg->set_besitzer(NULL); // make public weg->set_besch(welt->get_city_road()); } @@ -2688,9 +2688,9 @@ void stadt_t::renovate_city_building(gebaeude_t *gb) weg->set_gehweg(true); // if not current city road standard, then replace it if( weg->get_besch() != welt->get_city_road() ) { - spieler_t *sp = weg->get_besitzer(); - if( sp == NULL || !gr->get_depot() ) { - spieler_t::add_maintenance( sp, -weg->get_besch()->get_wartung(), road_wt); + player_t *player = weg->get_besitzer(); + if( player == NULL || !gr->get_depot() ) { + player_t::add_maintenance( player, -weg->get_besch()->get_wartung(), road_wt); weg->set_besitzer(NULL); // make public weg->set_besch(welt->get_city_road()); @@ -2775,7 +2775,7 @@ void stadt_t::erzeuge_verkehrsteilnehmer(koord pos, sint32 level, koord target) * * @author Hj. Malthaner, V. Meyer */ -bool stadt_t::baue_strasse(const koord k, spieler_t* sp, bool forced) +bool stadt_t::baue_strasse(const koord k, player_t* player_, bool forced) { grund_t* bd = welt->lookup_kartenboden(k); @@ -2933,7 +2933,7 @@ bool stadt_t::baue_strasse(const koord k, spieler_t* sp, bool forced) // Hajo: city roads should not belong to any player => so we can ignore any construction costs ... weg->set_besch(welt->get_city_road()); weg->set_gehweg(true); - bd->neuen_weg_bauen(weg, connection_roads, sp); + bd->neuen_weg_bauen(weg, connection_roads, player_); bd->calc_bild(); // otherwise the } // check to bridge a river @@ -3030,7 +3030,7 @@ void stadt_t::baue() // try to find a public owned building for( uint8 i=0; i<4; i++ ) { gebaeude_t* const gb = pick_any(buildings); - if( spieler_t::check_owner(gb->get_besitzer(),NULL) ) { + if( player_t::check_owner(gb->get_besitzer(),NULL) ) { renovate_city_building(gb); break; } diff --git a/simcity.h b/simcity.h index 3ce25182586..e8bbd3cb60d 100644 --- a/simcity.h +++ b/simcity.h @@ -19,7 +19,7 @@ #include class karte_ptr_t; -class spieler_t; +class player_t; class rule_t; @@ -99,7 +99,7 @@ class stadt_t private: static karte_ptr_t welt; - spieler_t *besitzer_p; + player_t *owner; plainstring name; weighted_vector_tpl buildings; @@ -324,7 +324,7 @@ class stadt_t * * @author Hj. Malthaner, V. Meyer */ - bool baue_strasse(const koord k, spieler_t *sp, bool forced); + bool baue_strasse(const koord k, player_t *player, bool forced); void baue(); @@ -440,13 +440,13 @@ class stadt_t /** * Erzeugt eine neue Stadt auf Planquadrat (x,y) die dem Spieler sp * gehoert. - * @param sp Der Besitzer der Stadt. + * @param player The owner of the city * @param x x-Planquadratkoordinate * @param y y-Planquadratkoordinate * @param number of citizens * @author Hj. Malthaner */ - stadt_t(spieler_t* sp, koord pos, sint32 citizens); + stadt_t(player_t* player, koord pos, sint32 citizens); /** * Erzeugt eine neue Stadt nach Angaben aus der Datei file. diff --git a/simconvoi.cc b/simconvoi.cc index 86b8d8b75b1..82db18115ae 100644 --- a/simconvoi.cc +++ b/simconvoi.cc @@ -104,9 +104,9 @@ static int calc_min_top_speed(const array_tpl& fahr, uint8 anz_vehik } -void convoi_t::init(spieler_t *sp) +void convoi_t::init(player_t *player) { - besitzer_p = sp; + besitzer_p = player; is_electric = false; sum_gesamtgewicht = sum_gewicht = 0; @@ -174,11 +174,11 @@ convoi_t::convoi_t(loadsave_t* file) : fahr(max_vehicle, NULL) } -convoi_t::convoi_t(spieler_t* sp) : fahr(max_vehicle, NULL) +convoi_t::convoi_t(player_t* player_) : fahr(max_vehicle, NULL) { self = convoihandle_t(this); - sp->book_convoi_number(1); - init(sp); + player_->book_convoi_number(1); + init(player_); set_name( "Unnamed" ); welt->add_convoi( self ); init_financial_history(); @@ -460,7 +460,7 @@ DBG_MESSAGE("convoi_t::laden_abschliessen()","next_stop_index=%d", next_stop_ind if (route.empty()) { // realigning needs a route state = NO_ROUTE; - besitzer_p->bescheid_vehikel_problem( self, koord3d::invalid ); + besitzer_p->report_vehicle_problem( self, koord3d::invalid ); dbg->error( "convoi_t::laden_abschliessen()", "No valid route, but needs realignment at (%s)!", fahr[0]->get_pos().get_str() ); } else { @@ -1009,7 +1009,7 @@ bool convoi_t::drive_to() if( !fahr[0]->calc_route( start, ziel, speed_to_kmh(min_top_speed), &route ) ) { if( state != NO_ROUTE ) { state = NO_ROUTE; - get_besitzer()->bescheid_vehikel_problem( self, ziel ); + get_besitzer()->report_vehicle_problem( self, ziel ); } // wait 25s before next attempt wait_lock = 25000; @@ -1051,7 +1051,7 @@ bool convoi_t::drive_to() // we are stuck on our first routing attempt => give up if( state != NO_ROUTE ) { state = NO_ROUTE; - get_besitzer()->bescheid_vehikel_problem( self, ziel ); + get_besitzer()->report_vehicle_problem( self, ziel ); } // wait 25s before next attempt wait_lock = 25000; @@ -1166,7 +1166,7 @@ void convoi_t::step() if( fpl->empty() ) { // no entry => no route ... state = NO_ROUTE; - besitzer_p->bescheid_vehikel_problem( self, koord3d::invalid ); + besitzer_p->report_vehicle_problem( self, koord3d::invalid ); } else { // Schedule changed at station @@ -1212,7 +1212,7 @@ void convoi_t::step() if( fpl->empty() ) { state = NO_ROUTE; - besitzer_p->bescheid_vehikel_problem( self, koord3d::invalid ); + besitzer_p->report_vehicle_problem( self, koord3d::invalid ); } else { // check first, if we are already there: @@ -1369,7 +1369,7 @@ void convoi_t::new_month() } // remind every new month again if( state==NO_ROUTE ) { - get_besitzer()->bescheid_vehikel_problem( self, get_pos() ); + get_besitzer()->report_vehicle_problem( self, get_pos() ); } // check for traffic jam if(state==WAITING_FOR_CLEARANCE) { @@ -1399,7 +1399,7 @@ void convoi_t::new_month() } } if( notify ) { - get_besitzer()->bescheid_vehikel_problem( self, koord3d::invalid ); + get_besitzer()->report_vehicle_problem( self, koord3d::invalid ); } state = WAITING_FOR_CLEARANCE_TWO_MONTHS; } @@ -1408,7 +1408,7 @@ void convoi_t::new_month() state = CAN_START_ONE_MONTH; } else if(state==CAN_START_ONE_MONTH || state==CAN_START_TWO_MONTHS ) { - get_besitzer()->bescheid_vehikel_problem( self, koord3d::invalid ); + get_besitzer()->report_vehicle_problem( self, koord3d::invalid ); state = CAN_START_TWO_MONTHS; } // check for obsolete vehicles in the convoi @@ -1633,7 +1633,7 @@ DBG_MESSAGE("convoi_t::add_vehikel()","extend array_tpl to %i totals.",max_rail_ if(!has_obsolete && welt->use_timeline()) { has_obsolete = info->is_retired( welt->get_timeline_year_month() ); } - spieler_t::add_maintenance( get_besitzer(), info->get_maintenance(), info->get_waytype() ); + player_t::add_maintenance( get_besitzer(), info->get_maintenance(), info->get_waytype() ); } else { return false; @@ -1667,7 +1667,7 @@ vehikel_t *convoi_t::remove_vehikel_bei(uint16 i) sum_gear_und_leistung -= info->get_leistung()*info->get_gear(); sum_gewicht -= info->get_gewicht(); sum_running_costs += info->get_betriebskosten(); - spieler_t::add_maintenance( get_besitzer(), -info->get_maintenance(), info->get_waytype() ); + player_t::add_maintenance( get_besitzer(), -info->get_maintenance(), info->get_waytype() ); } sum_gesamtgewicht = sum_gewicht; calc_loading(); @@ -2191,7 +2191,7 @@ void convoi_t::rdwr(loadsave_t *file) if(anz_vehikel > max_vehicle) { fahr.resize(max_rail_vehicle, NULL); } - besitzer_p = welt->get_spieler( besitzer_n ); + besitzer_p = welt->get_player( besitzer_n ); // Hajo: sanity check for values ... plus correction if(sp_soll < 0) { @@ -2279,7 +2279,7 @@ void convoi_t::rdwr(loadsave_t *file) sum_gewicht += info->get_gewicht(); sum_running_costs -= info->get_betriebskosten(); is_electric |= info->get_engine_type()==vehikel_besch_t::electric; - spieler_t::add_maintenance( get_besitzer(), info->get_maintenance(), info->get_waytype() ); + player_t::add_maintenance( get_besitzer(), info->get_maintenance(), info->get_waytype() ); } // some versions save vehicles after leaving depot with koord3d::invalid @@ -2739,8 +2739,8 @@ void convoi_t::laden() halthandle_t halt = haltestelle_t::get_halt(fpl->get_current_eintrag().pos,besitzer_p); // eigene haltestelle ? if( halt.is_bound() ) { - const spieler_t* owner = halt->get_besitzer(); - if( owner == get_besitzer() || owner == welt->get_spieler(1) ) { + const player_t* owner = halt->get_besitzer(); + if( owner == get_besitzer() || owner == welt->get_player(1) ) { // loading/unloading ... halt->request_loading( self ); } diff --git a/simconvoi.h b/simconvoi.h index 055406bb814..4f2f10b0934 100644 --- a/simconvoi.h +++ b/simconvoi.h @@ -26,7 +26,7 @@ class weg_t; class depot_t; class karte_ptr_t; -class spieler_t; +class player_t; class vehikel_t; class vehikel_besch_t; class schedule_t; @@ -146,7 +146,7 @@ class convoi_t : public sync_steppable, public overtaker_t * Convoi owner * @author Hj. Malthaner */ - spieler_t *besitzer_p; + player_t *besitzer_p; /** * Current map @@ -312,7 +312,7 @@ class convoi_t : public sync_steppable, public overtaker_t * Each constructor must call this method first! * @author Hj. Malthaner */ - void init(spieler_t *sp); + void init(player_t *player); /** * Calculate route from Start to Target Coordinate @@ -505,7 +505,7 @@ class convoi_t : public sync_steppable, public overtaker_t */ convoi_t(loadsave_t *file); - convoi_t(spieler_t* sp); + convoi_t(player_t* player_); virtual ~convoi_t(); @@ -695,7 +695,7 @@ class convoi_t : public sync_steppable, public overtaker_t * @return Owner of this convoi * @author Hj. Malthaner */ - spieler_t * get_besitzer() const { return besitzer_p; } + player_t * get_besitzer() const { return besitzer_p; } /** * Opens an information window diff --git a/simdepot.cc b/simdepot.cc index 3e4490e601f..99417756f21 100644 --- a/simdepot.cc +++ b/simdepot.cc @@ -51,8 +51,8 @@ depot_t::depot_t(loadsave_t *file) : gebaeude_t() } -depot_t::depot_t(koord3d pos, spieler_t *sp, const haus_tile_besch_t *t) : - gebaeude_t(pos, sp, t) +depot_t::depot_t(koord3d pos, player_t *player, const haus_tile_besch_t *t) : + gebaeude_t(pos, player, t) { all_depots.append(this); selected_filter = VEHICLE_FILTER_RELEVANT; @@ -69,14 +69,14 @@ depot_t::~depot_t() // finds the next/previous depot relative to the current position -depot_t *depot_t::find_depot( koord3d start, const obj_t::typ depot_type, const spieler_t *sp, bool forward) +depot_t *depot_t::find_depot( koord3d start, const obj_t::typ depot_type, const player_t *player, bool forward) { depot_t *found = NULL; koord3d found_pos = forward ? koord3d(welt->get_size().x+1,welt->get_size().y+1,welt->get_grundwasser()) : koord3d(-1,-1,-1); long found_hash = forward ? 0x7FFFFFF : -1; long start_hash = start.x + (8192*start.y); FOR(slist_tpl, const d, all_depots) { - if(d->get_typ()==depot_type && d->get_besitzer()==sp) { + if(d->get_typ()==depot_type && d->get_besitzer()==player) { // ok, the right type of depot const koord3d pos = d->get_pos(); if(pos==start) { @@ -547,9 +547,9 @@ void depot_t::rdwr_vehikel(slist_tpl &list, loadsave_t *file) * @return NULL wenn OK, ansonsten eine Fehlermeldung * @author Hj. Malthaner */ -const char * depot_t::ist_entfernbar(const spieler_t *sp) +const char * depot_t::ist_entfernbar(const player_t *player) { - if(sp!=get_besitzer() && sp!=welt->get_spieler(1)) { + if(player!=get_besitzer() && player!=welt->get_player(1)) { return "Das Feld gehoert\neinem anderen Spieler\n"; } if (!vehicles.empty()) { diff --git a/simdepot.h b/simdepot.h index 4050532c938..5b429855324 100644 --- a/simdepot.h +++ b/simdepot.h @@ -55,12 +55,12 @@ class depot_t : public gebaeude_t int selected_filter; // finds the next/previous depot relative to the current position - static depot_t *find_depot( koord3d start, const obj_t::typ depot_type, const spieler_t *sp, bool next); + static depot_t *find_depot( koord3d start, const obj_t::typ depot_type, const player_t *player, bool next); static const slist_tpl& get_depot_list() { return all_depots; } depot_t(loadsave_t *file); - depot_t(koord3d pos, spieler_t *sp, const haus_tile_besch_t *t); + depot_t(koord3d pos, player_t *player, const haus_tile_besch_t *t); virtual ~depot_t(); void call_depot_tool( char tool, convoihandle_t cnv, const char *extra ); @@ -201,7 +201,7 @@ class depot_t : public gebaeude_t * @return NULL wenn OK, ansonsten eine Fehlermeldung * @author Hj. Malthaner */ - virtual const char * ist_entfernbar(const spieler_t *sp); + virtual const char * ist_entfernbar(const player_t *player); /** * identifies the oldest vehicle of a certain type @@ -255,7 +255,7 @@ class bahndepot_t : public depot_t { public: bahndepot_t(loadsave_t *file) : depot_t(file) {} - bahndepot_t(koord3d pos,spieler_t *sp, const haus_tile_besch_t *t) : depot_t(pos,sp,t) {} + bahndepot_t(koord3d pos,player_t *player, const haus_tile_besch_t *t) : depot_t(pos,player,t) {} virtual simline_t::linetype get_line_type() const { return simline_t::trainline; } @@ -281,7 +281,7 @@ class tramdepot_t : public bahndepot_t { public: tramdepot_t(loadsave_t *file):bahndepot_t(file) {} - tramdepot_t(koord3d pos,spieler_t *sp, const haus_tile_besch_t *t): bahndepot_t(pos,sp,t) {} + tramdepot_t(koord3d pos,player_t *player_, const haus_tile_besch_t *t): bahndepot_t(pos,player_,t) {} virtual simline_t::linetype get_line_type() const { return simline_t::tramline; } @@ -293,7 +293,7 @@ class monoraildepot_t : public bahndepot_t { public: monoraildepot_t(loadsave_t *file):bahndepot_t(file) {} - monoraildepot_t(koord3d pos,spieler_t *sp, const haus_tile_besch_t *t): bahndepot_t(pos,sp,t) {} + monoraildepot_t(koord3d pos,player_t *player, const haus_tile_besch_t *t): bahndepot_t(pos,player,t) {} virtual simline_t::linetype get_line_type() const { return simline_t::monorailline; } @@ -305,7 +305,7 @@ class maglevdepot_t : public bahndepot_t { public: maglevdepot_t(loadsave_t *file):bahndepot_t(file) {} - maglevdepot_t(koord3d pos,spieler_t *sp, const haus_tile_besch_t *t): bahndepot_t(pos,sp,t) {} + maglevdepot_t(koord3d pos,player_t *player, const haus_tile_besch_t *t): bahndepot_t(pos,player,t) {} virtual simline_t::linetype get_line_type() const { return simline_t::maglevline; } @@ -317,7 +317,7 @@ class narrowgaugedepot_t : public bahndepot_t { public: narrowgaugedepot_t(loadsave_t *file):bahndepot_t(file) {} - narrowgaugedepot_t(koord3d pos,spieler_t *sp, const haus_tile_besch_t *t): bahndepot_t(pos,sp,t) {} + narrowgaugedepot_t(koord3d pos,player_t *player, const haus_tile_besch_t *t): bahndepot_t(pos,player,t) {} virtual simline_t::linetype get_line_type() const { return simline_t::narrowgaugeline; } @@ -342,7 +342,7 @@ class strassendepot_t : public depot_t public: strassendepot_t(loadsave_t *file) : depot_t(file) {} - strassendepot_t(koord3d pos,spieler_t *sp, const haus_tile_besch_t *t) : depot_t(pos,sp,t) {} + strassendepot_t(koord3d pos,player_t *player, const haus_tile_besch_t *t) : depot_t(pos,player,t) {} virtual simline_t::linetype get_line_type() const { return simline_t::truckline; } @@ -378,7 +378,7 @@ class schiffdepot_t : public depot_t public: schiffdepot_t(loadsave_t *file) : depot_t(file) {} - schiffdepot_t(koord3d pos, spieler_t *sp, const haus_tile_besch_t *t) : depot_t(pos,sp,t) {} + schiffdepot_t(koord3d pos, player_t *player, const haus_tile_besch_t *t) : depot_t(pos,player,t) {} virtual simline_t::linetype get_line_type() const { return simline_t::shipline; } @@ -409,7 +409,7 @@ class airdepot_t : public depot_t public: airdepot_t(loadsave_t *file) : depot_t(file) {} - airdepot_t(koord3d pos,spieler_t *sp, const haus_tile_besch_t *t) : depot_t(pos,sp,t) {} + airdepot_t(koord3d pos,player_t *player, const haus_tile_besch_t *t) : depot_t(pos,player,t) {} virtual simline_t::linetype get_line_type() const { return simline_t::airline; } diff --git a/simfab.cc b/simfab.cc index d074ba7e590..dd413fdb5a3 100644 --- a/simfab.cc +++ b/simfab.cc @@ -721,7 +721,7 @@ void fabrik_t::rem_lieferziel(koord ziel) fabrik_t::fabrik_t(loadsave_t* file) { - besitzer_p = NULL; + owner = NULL; power = 0; power_demand = 0; prodfactor_electric = 0; @@ -761,14 +761,14 @@ fabrik_t::fabrik_t(loadsave_t* file) } -fabrik_t::fabrik_t(koord3d pos_, spieler_t* spieler, const fabrik_besch_t* fabesch, sint32 initial_prod_base) : +fabrik_t::fabrik_t(koord3d pos_, player_t* owner, const fabrik_besch_t* fabesch, sint32 initial_prod_base) : besch(fabesch), pos(pos_) { this->pos.z = welt->max_hgt(pos.get_2d()); pos_origin = pos; - besitzer_p = spieler; + this->owner = owner; prodfactor_electric = 0; prodfactor_pax = 0; prodfactor_mail = 0; @@ -877,7 +877,7 @@ void fabrik_t::baue(sint32 rotate, bool build_fields, bool force_initial_prodbas { this->rotate = rotate; pos_origin = welt->lookup_kartenboden(pos_origin.get_2d())->get_pos(); - gebaeude_t *gb = hausbauer_t::baue(besitzer_p, pos_origin, rotate, besch->get_haus(), this); + gebaeude_t *gb = hausbauer_t::baue(owner, pos_origin, rotate, besch->get_haus(), this); pos = gb->get_pos(); pos_origin.z = pos.z; @@ -891,7 +891,7 @@ void fabrik_t::baue(sint32 rotate, bool build_fields, bool force_initial_prodbas // first make foundation below grund_t *gr2 = new fundament_t(gr->get_pos(), gr->get_grund_hang()); welt->access(k)->boden_ersetzen(gr, gr2); - gr2->obj_add( new field_t(gr2->get_pos(), besitzer_p, besch->get_field_group()->get_field_class( fields[i].field_class_index ), this ) ); + gr2->obj_add( new field_t(gr2->get_pos(), owner, besch->get_field_group()->get_field_class( fields[i].field_class_index ), this ) ); } else { // there was already a building at this position => do not restore! @@ -1051,7 +1051,7 @@ bool fabrik_t::add_random_field(uint16 probability) fields.append(new_field); grund_t *gr2 = new fundament_t(gr->get_pos(), gr->get_grund_hang()); welt->access(k)->boden_ersetzen(gr, gr2); - gr2->obj_add( new field_t(gr2->get_pos(), besitzer_p, field_class, this ) ); + gr2->obj_add( new field_t(gr2->get_pos(), owner, field_class, this ) ); // Knightly : adjust production base and storage capacities set_base_production( prodbase + field_class->get_field_production() ); if(lt) { @@ -1125,7 +1125,7 @@ void fabrik_t::rdwr(loadsave_t *file) { xml_tag_t f( file, "fabrik_t" ); sint32 i; - sint32 spieler_n; + sint32 owner_n; sint32 eingang_count; sint32 ausgang_count; sint32 anz_lieferziele; @@ -1263,8 +1263,8 @@ DBG_DEBUG("fabrik_t::rdwr()","loading factory '%s'",s); } // restore other information - spieler_n = welt->sp2num(besitzer_p); - file->rdwr_long(spieler_n); + owner_n = welt->sp2num(owner); + file->rdwr_long(owner_n); file->rdwr_long(prodbase); if( file->get_version() < 110005 ) { // TurfIt : prodfaktor saving no longer required @@ -1294,13 +1294,13 @@ DBG_DEBUG("fabrik_t::rdwr()","loading factory '%s'",s); // Due to a omission in Volkers changes, there might be savegames // in which factories were saved without an owner. In this case // set the owner to the default of player 1 - if(spieler_n == -1) { + if(owner_n == -1) { // Use default - besitzer_p = welt->get_spieler(1); + owner = welt->get_player(1); } else { // Restore owner pointer - besitzer_p = welt->get_spieler(spieler_n); + owner = welt->get_player(owner_n); } } diff --git a/simfab.h b/simfab.h index 511ebc69263..9ec2d98548a 100644 --- a/simfab.h +++ b/simfab.h @@ -20,7 +20,7 @@ #include "utils/plainstring.h" -class spieler_t; +class player_t; class stadt_t; class ware_t; @@ -288,7 +288,7 @@ class fabrik_t // List of target cities vector_tpl target_cities; - spieler_t *besitzer_p; + player_t *owner; static karte_ptr_t welt; const fabrik_besch_t *besch; @@ -464,7 +464,7 @@ class fabrik_t public: fabrik_t(loadsave_t *file); - fabrik_t(koord3d pos, spieler_t* sp, const fabrik_besch_t* fabesch, sint32 initial_prod_base); + fabrik_t(koord3d pos, player_t* owner, const fabrik_besch_t* fabesch, sint32 initial_prod_base); ~fabrik_t(); /** @@ -592,7 +592,7 @@ class fabrik_t sint32 get_kennfarbe() const { return besch->get_kennfarbe(); } - spieler_t *get_besitzer() const + player_t *get_besitzer() const { grund_t const* const p = welt->lookup(pos); return p ? p->first_obj()->get_besitzer() : 0; diff --git a/simhalt.cc b/simhalt.cc index 7b8d3332389..ded5fcd489d 100644 --- a/simhalt.cc +++ b/simhalt.cc @@ -178,11 +178,11 @@ halthandle_t haltestelle_t::get_halt_koord_index(koord k) /* we allow only for a single stop per grund * this will only return something if this stop belongs to same player or is public, or is a dock (when on water) */ -halthandle_t haltestelle_t::get_halt(const koord3d pos, const spieler_t *sp ) +halthandle_t haltestelle_t::get_halt(const koord3d pos, const player_t *player ) { const grund_t *gr = welt->lookup(pos); if(gr) { - if(gr->get_halt().is_bound() && spieler_t::check_owner(sp,gr->get_halt()->get_besitzer()) ) { + if(gr->get_halt().is_bound() && player_t::check_owner(player,gr->get_halt()->get_besitzer()) ) { return gr->get_halt(); } // no halt? => we do the water check @@ -193,14 +193,14 @@ halthandle_t haltestelle_t::get_halt(const koord3d pos, const spieler_t *sp ) // first check for own stop for( uint8 i=0; iget_haltlist()[i]; - if( halt->get_besitzer()==sp && halt->get_station_type()&dock ) { + if( halt->get_besitzer()==player && halt->get_station_type()&dock ) { return halt; } } // then for public stop for( uint8 i=0; iget_haltlist()[i]; - if( halt->get_besitzer()==welt->get_spieler(1) && halt->get_station_type()&dock ) { + if( halt->get_besitzer()==welt->get_player(1) && halt->get_station_type()&dock ) { return halt; } } @@ -231,9 +231,9 @@ koord3d haltestelle_t::get_basis_pos3d() const * Station factory method. Returns handles instead of pointers. * @author Hj. Malthaner */ -halthandle_t haltestelle_t::create(koord pos, spieler_t *sp) +halthandle_t haltestelle_t::create(koord pos, player_t *player) { - haltestelle_t * p = new haltestelle_t(pos, sp); + haltestelle_t * p = new haltestelle_t(pos, player); return p->self; } @@ -242,7 +242,7 @@ halthandle_t haltestelle_t::create(koord pos, spieler_t *sp) * removes a ground tile from a station * @author prissi */ -bool haltestelle_t::remove(spieler_t *sp, koord3d pos) +bool haltestelle_t::remove(player_t *player, koord3d pos) { grund_t *bd = welt->lookup(pos); @@ -268,7 +268,7 @@ DBG_MESSAGE("haltestelle_t::remove()","removing segment from %d,%d,%d", pos.x, p gebaeude_t* gb = bd->find(); if(gb) { DBG_MESSAGE("haltestelle_t::remove()", "removing building" ); - hausbauer_t::remove( sp, gb ); + hausbauer_t::remove( player, gb ); bd = NULL; // no need to recalc image // removing the building could have destroyed this halt already if (!halt.is_bound()){ @@ -360,7 +360,7 @@ haltestelle_t::haltestelle_t(loadsave_t* file) } -haltestelle_t::haltestelle_t(koord k, spieler_t* sp) +haltestelle_t::haltestelle_t(koord k, player_t* player_) { self = halthandle_t(this); assert( !alle_haltestellen.is_contained(self) ); @@ -371,7 +371,7 @@ haltestelle_t::haltestelle_t(koord k, spieler_t* sp) last_loading_step = welt->get_steps(); this->init_pos = k; - besitzer_p = sp; + owner_p = player_; enables = NOT_ENABLED; // force total re-routing @@ -901,10 +901,10 @@ bool haltestelle_t::step(uint8 what, sint16 &units_remaining) */ void haltestelle_t::neuer_monat() { - if( welt->get_active_player()==besitzer_p && status_color==COL_RED ) { + if( welt->get_active_player()==owner_p && status_color==COL_RED ) { cbuffer_t buf; buf.printf( translator::translate("%s\nis crowded."), get_name() ); - welt->get_message()->add_message(buf, get_basis_pos(),message_t::full, PLAYER_FLAG|besitzer_p->get_player_nr(), IMG_LEER ); + welt->get_message()->add_message(buf, get_basis_pos(),message_t::full, PLAYER_FLAG|owner_p->get_player_nr(), IMG_LEER ); enables &= (PAX|POST|WARE); } @@ -1081,7 +1081,7 @@ sint32 haltestelle_t::rebuild_connections() // DBG_MESSAGE("haltestelle_t::rebuild_destinations()", "Adding new table entries"); - const spieler_t *owner; + const player_t *owner; schedule_t *fpl; const minivec_tpl *goods_catg_index; @@ -1873,7 +1873,7 @@ bool haltestelle_t::recall_ware( ware_t& w, uint32 menge ) -void haltestelle_t::fetch_goods( slist_tpl &load, const ware_besch_t *good_category, uint32 requested_amount, const schedule_t *schedule, const spieler_t *sp ) +void haltestelle_t::fetch_goods( slist_tpl &load, const ware_besch_t *good_category, uint32 requested_amount, const schedule_t *schedule, const player_t *player ) { // prissi: first iterate over the next stop, then over the ware // might be a little slower, but ensures that passengers to nearest stop are served first @@ -1887,7 +1887,7 @@ void haltestelle_t::fetch_goods( slist_tpl &load, const ware_besch_t *go for( uint8 i=1; iget_aktuell()) % count; - const halthandle_t plan_halt = haltestelle_t::get_halt(schedule->eintrag[wrap_i].pos, sp); + const halthandle_t plan_halt = haltestelle_t::get_halt(schedule->eintrag[wrap_i].pos, player); if(plan_halt == self) { // we will come later here again ... break; @@ -2241,27 +2241,27 @@ sint64 haltestelle_t::calc_maintenance() const // changes this to a public transfer exchange stop -void haltestelle_t::make_public_and_join( spieler_t *sp ) +void haltestelle_t::make_public_and_join( player_t *player ) { - spieler_t *public_owner=welt->get_spieler(1); + player_t *public_owner=welt->get_player(1); slist_tpl joining; // only something to do if not yet owner ... - if(besitzer_p!=public_owner) { + if(owner_p!=public_owner) { // now recalculate maintenance FOR(slist_tpl, const& i, tiles) { grund_t* const gr = i.grund; gebaeude_t* gb = gr->find(); if(gb) { - spieler_t *gb_sp=gb->get_besitzer(); + player_t *gb_player=gb->get_besitzer(); sint64 const monthly_costs = welt->get_settings().maint_building * gb->get_tile()->get_besch()->get_level(); - spieler_t::add_maintenance( gb_sp, -monthly_costs, gb->get_waytype() ); + player_t::add_maintenance( gb_player, -monthly_costs, gb->get_waytype() ); gb->set_besitzer( public_owner ); gb->set_flag( obj_t::dirty ); - spieler_t::add_maintenance(public_owner, monthly_costs, gb->get_waytype() ); + player_t::add_maintenance(public_owner, monthly_costs, gb->get_waytype() ); // it is not real construction cost, it is fee paid for public authority for future maintenance. So money are transferred to public authority - spieler_t::book_construction_costs( sp, -monthly_costs*60, get_basis_pos(), gb->get_waytype()); - spieler_t::book_construction_costs( public_owner, monthly_costs*60, koord::invalid, gb->get_waytype()); + player_t::book_construction_costs( player, -monthly_costs*60, get_basis_pos(), gb->get_waytype()); + player_t::book_construction_costs( public_owner, monthly_costs*60, koord::invalid, gb->get_waytype()); } // ok, valid start, now we can join them // First search the same square @@ -2286,7 +2286,7 @@ void haltestelle_t::make_public_and_join( spieler_t *sp ) } } // transfer ownership - besitzer_p = public_owner; + owner_p = public_owner; } // set name to name of first public stop @@ -2314,16 +2314,16 @@ void haltestelle_t::make_public_and_join( spieler_t *sp ) gebaeude_t* gb = gr->find(); if(gb) { // there are also water tiles, which may not have a building - spieler_t *gb_sp=gb->get_besitzer(); - if(public_owner!=gb_sp) { - spieler_t *gb_sp=gb->get_besitzer(); + player_t *gb_player=gb->get_besitzer(); + if(public_owner!=gb_player) { + player_t *gb_sp=gb->get_besitzer(); sint64 const monthly_costs = welt->get_settings().maint_building * gb->get_tile()->get_besch()->get_level(); - spieler_t::add_maintenance( gb_sp, -monthly_costs, gb->get_waytype() ); - spieler_t::book_construction_costs(gb_sp, monthly_costs*60, gr->get_pos().get_2d(), gb->get_waytype()); - spieler_t::book_construction_costs(public_owner, -monthly_costs*60, koord::invalid, gb->get_waytype()); + player_t::add_maintenance( gb_player, -monthly_costs, gb->get_waytype() ); + player_t::book_construction_costs(gb_player, monthly_costs*60, gr->get_pos().get_2d(), gb->get_waytype()); + player_t::book_construction_costs(public_owner, -monthly_costs*60, koord::invalid, gb->get_waytype()); gb->set_besitzer(public_owner); gb->set_flag(obj_t::dirty); - spieler_t::add_maintenance(public_owner, monthly_costs, gb->get_waytype() ); + player_t::add_maintenance(public_owner, monthly_costs, gb->get_waytype() ); } } // transfer tiles to us @@ -2345,10 +2345,10 @@ void haltestelle_t::make_public_and_join( spieler_t *sp ) } // tell the world of it ... - if( sp->get_player_nr()!=1 && env_t::networkmode ) { + if( player->get_player_nr()!=1 && env_t::networkmode ) { cbuffer_t buf; buf.printf( translator::translate("%s at (%i,%i) now public stop."), get_name(), get_basis_pos().x, get_basis_pos().y ); - welt->get_message()->add_message( buf, get_basis_pos(), message_t::ai, PLAYER_FLAG|sp->get_player_nr(), IMG_LEER ); + welt->get_message()->add_message( buf, get_basis_pos(), message_t::ai, PLAYER_FLAG|player->get_player_nr(), IMG_LEER ); } recalc_station_type(); @@ -2531,7 +2531,7 @@ void haltestelle_t::rdwr(loadsave_t *file) { xml_tag_t h( file, "haltestelle_t" ); - sint32 spieler_n; + sint32 owner_n; koord3d k; // will restore halthandle_t after loading @@ -2554,13 +2554,13 @@ void haltestelle_t::rdwr(loadsave_t *file) } if(file->is_saving()) { - spieler_n = welt->sp2num( besitzer_p ); + owner_n = welt->sp2num( owner_p ); } if(file->get_version()<99008) { init_pos.rdwr( file ); } - file->rdwr_long(spieler_n); + file->rdwr_long(owner_n); if(file->get_version()<=88005) { bool dummy; @@ -2570,7 +2570,7 @@ void haltestelle_t::rdwr(loadsave_t *file) } if(file->is_loading()) { - besitzer_p = welt->get_spieler(spieler_n); + owner_p = welt->get_player(owner_n); k.rdwr( file ); while(k!=koord3d::invalid) { grund_t *gr = welt->lookup(k); @@ -3003,19 +3003,19 @@ bool haltestelle_t::add_grund(grund_t *gr) vector_tpl check_line(0); // public halt: must iterate over all players lines / convoys - bool public_halt = get_besitzer() == welt->get_spieler(1); + bool public_halt = get_besitzer() == welt->get_player(1); uint8 const pl_min = public_halt ? 0 : get_besitzer()->get_player_nr(); uint8 const pl_max = public_halt ? MAX_PLAYER_COUNT : get_besitzer()->get_player_nr()+1; // iterate over all lines (public halt: all lines, other: only player's lines) for( uint8 i=pl_min; iget_spieler(i) ) { - sp->simlinemgmt.get_lines(simline_t::line, &check_line); + if( player_t *player = welt->get_player(i) ) { + player->simlinemgmt.get_lines(simline_t::line, &check_line); FOR( vector_tpl, const j, check_line ) { // only add unknown lines if( !registered_lines.is_contained(j) && j->count_convoys() > 0 ) { FOR( minivec_tpl, const& k, j->get_schedule()->eintrag ) { - if( get_halt(k.pos, sp) == self ) { + if( get_halt(k.pos, player) == self ) { registered_lines.append(j); break; } diff --git a/simhalt.h b/simhalt.h index 456a64bb6e5..a2701fac28f 100644 --- a/simhalt.h +++ b/simhalt.h @@ -52,7 +52,7 @@ class karte_ptr_t; class koord3d; class loadsave_t; class schedule_t; -class spieler_t; +class player_t; class ware_t; // -------------------------- Haltestelle ---------------------------- @@ -171,7 +171,7 @@ class haltestelle_t /* * this will only return something if this stop belongs to same player or is public, or is a dock (when on water) */ - static halthandle_t get_halt(const koord3d pos, const spieler_t *sp ); + static halthandle_t get_halt(const koord3d pos, const player_t *player ); static const vector_tpl& get_alle_haltestellen() { return alle_haltestellen; } @@ -179,7 +179,7 @@ class haltestelle_t * Station factory method. Returns handles instead of pointers. * @author Hj. Malthaner */ - static halthandle_t create(koord pos, spieler_t *sp); + static halthandle_t create(koord pos, player_t *player); /** * Station factory method. Returns handles instead of pointers. @@ -191,7 +191,7 @@ class haltestelle_t * removes a ground tile from a station, deletes the building and, if last tile, also the halthandle * @author prissi */ - static bool remove(spieler_t *sp, koord3d pos); + static bool remove(player_t *player, koord3d pos); /** * Station destruction method. @@ -316,7 +316,7 @@ class haltestelle_t */ slist_tpl fab_list; - spieler_t *besitzer_p; + player_t *owner_p; static karte_ptr_t welt; /** @@ -369,7 +369,7 @@ class haltestelle_t bool resort_freight_info; haltestelle_t(loadsave_t *file); - haltestelle_t(koord pos, spieler_t *sp); + haltestelle_t(koord pos, player_t *player); ~haltestelle_t(); public: @@ -425,12 +425,12 @@ class haltestelle_t void rotate90( const sint16 y_size ); - spieler_t *get_besitzer() const {return besitzer_p;} + player_t *get_besitzer() const {return owner_p;} // just for info so far sint64 calc_maintenance() const; - void make_public_and_join( spieler_t *sp ); + void make_public_and_join( player_t *player ); vector_tpl const& get_pax_connections() const { return all_links[warenbauer_t::INDEX_PAS].connections; } vector_tpl const& get_mail_connections() const { return all_links[warenbauer_t::INDEX_MAIL].connections; } @@ -631,7 +631,7 @@ class haltestelle_t * @param sp Company that's requesting the fetch. * @author Dwachs */ - void fetch_goods( slist_tpl &load, const ware_besch_t *good_category, uint32 requested_amount, const schedule_t *schedule, const spieler_t *sp ); + void fetch_goods( slist_tpl &load, const ware_besch_t *good_category, uint32 requested_amount, const schedule_t *schedule, const player_t *player ); /* liefert ware an. Falls die Ware zu wartender Ware dazugenommen * werden kann, kann ware_t gelöscht werden! D.h. man darf ware nach diff --git a/siminteraction.cc b/siminteraction.cc index cef95d368d4..9161c3ca4ee 100644 --- a/siminteraction.cc +++ b/siminteraction.cc @@ -339,12 +339,12 @@ bool interaction_t::process_event( event_t &ev ) // they will be restored in karte_t::laden uint16 unlocked_players = 0; for( int i=0; iget_spieler(i); - if( sp==NULL || sp->access_password_hash().empty() ) { + player_t *player = world->get_player(i); + if( player==NULL || player->access_password_hash().empty() ) { unlocked_players |= (1<access_password_hash().clear(); + player->access_password_hash().clear(); } } diff --git a/simintr.cc b/simintr.cc index 7fadbb75466..901afe27ef7 100644 --- a/simintr.cc +++ b/simintr.cc @@ -74,7 +74,7 @@ void intr_refresh_display(bool dirty) wasser_t::prepare_for_refresh(); dr_prepare_flush(); welt_ansicht->display( dirty ); - win_display_flush(welt_modell->get_active_player()->get_konto_als_double()); + win_display_flush(welt_modell->get_active_player()->get_account_balance_as_double()); dr_flush(); } diff --git a/simline.cc b/simline.cc index 8daaecd504c..0b946063990 100644 --- a/simline.cc +++ b/simline.cc @@ -30,7 +30,7 @@ uint8 simline_t::convoi_to_line_catgory(uint8 cnv_cost) karte_ptr_t simline_t::welt; -simline_t::simline_t(spieler_t* sp, linetype type) +simline_t::simline_t(player_t* player, linetype type) { self = linehandle_t(this); char printname[128]; @@ -40,20 +40,20 @@ simline_t::simline_t(spieler_t* sp, linetype type) init_financial_history(); this->type = type; this->fpl = NULL; - this->sp = sp; + this->player = player; withdraw = false; state_color = COL_WHITE; create_schedule(); } -simline_t::simline_t(spieler_t* sp, linetype type, loadsave_t *file) +simline_t::simline_t(player_t* player, linetype type, loadsave_t *file) { // id will be read and assigned during rdwr self = linehandle_t(); this->type = type; this->fpl = NULL; - this->sp = sp; + this->player = player; withdraw = false; create_schedule(); rdwr(file); @@ -284,7 +284,7 @@ void simline_t::laden_abschliessen() { if( !self.is_bound() ) { // get correct handle - self = sp->simlinemgmt.get_line_with_id_zero(); + self = player->simlinemgmt.get_line_with_id_zero(); assert( self.get_rep() == this ); DBG_MESSAGE("simline_t::laden_abschliessen", "assigned id=%d to line %s", self.get_id(), get_name()); } @@ -300,7 +300,7 @@ void simline_t::register_stops(schedule_t * fpl) { DBG_DEBUG("simline_t::register_stops()", "%d fpl entries in schedule %p", fpl->get_count(),fpl); FOR(minivec_tpl, const& i, fpl->eintrag) { - halthandle_t const halt = haltestelle_t::get_halt(i.pos, sp); + halthandle_t const halt = haltestelle_t::get_halt(i.pos, player); if(halt.is_bound()) { //DBG_DEBUG("simline_t::register_stops()", "halt not null"); halt->add_line(self); @@ -322,7 +322,7 @@ void simline_t::unregister_stops() void simline_t::unregister_stops(schedule_t * fpl) { FOR(minivec_tpl, const& i, fpl->eintrag) { - halthandle_t const halt = haltestelle_t::get_halt(i.pos, sp); + halthandle_t const halt = haltestelle_t::get_halt(i.pos, player); if(halt.is_bound()) { halt->remove_line(self); } diff --git a/simline.h b/simline.h index b87600ef3d3..17485c0ae10 100644 --- a/simline.h +++ b/simline.h @@ -29,7 +29,7 @@ class karte_ptr_t; class loadsave_t; -class spieler_t; +class player_t; class schedule_t; class simline_t { @@ -39,7 +39,7 @@ class simline_t { protected: schedule_t * fpl; - spieler_t *sp; + player_t *player; linetype type; bool withdraw; @@ -88,8 +88,8 @@ class simline_t { void recalc_status(); public: - simline_t(spieler_t *sp, linetype type); - simline_t(spieler_t *sp, linetype type, loadsave_t *file); + simline_t(player_t *player, linetype type); + simline_t(player_t *player, linetype type, loadsave_t *file); ~simline_t(); @@ -196,7 +196,7 @@ class simline_t { bool get_withdraw() const { return withdraw; } - spieler_t *get_besitzer() const {return sp;} + player_t *get_besitzer() const {return player;} }; diff --git a/simlinemgmt.cc b/simlinemgmt.cc index 10d00d28262..de514f7e277 100644 --- a/simlinemgmt.cc +++ b/simlinemgmt.cc @@ -68,7 +68,7 @@ void simlinemgmt_t::update_line(linehandle_t line) } -void simlinemgmt_t::rdwr(loadsave_t *file, spieler_t *sp) +void simlinemgmt_t::rdwr(loadsave_t *file, player_t *player) { xml_tag_t l( file, "simlinemgmt_t" ); @@ -112,7 +112,7 @@ DBG_MESSAGE("simlinemgmt_t::rdwr()","number of lines=%i",totalLines); if(lt < simline_t::truckline || lt > simline_t::narrowgaugeline) { dbg->fatal( "simlinemgmt_t::rdwr()", "Cannot create default line!" ); } - simline_t *line = new simline_t(sp, lt, file); + simline_t *line = new simline_t(player, lt, file); if (!line->get_handle().is_bound()) { // line id was saved as zero ... if (unbound_line) { @@ -187,13 +187,13 @@ void simlinemgmt_t::new_month() } -linehandle_t simlinemgmt_t::create_line(int ltype, spieler_t * sp) +linehandle_t simlinemgmt_t::create_line(int ltype, player_t * player_) { if(ltype < simline_t::truckline || ltype > simline_t::narrowgaugeline) { dbg->fatal( "simlinemgmt_t::create_line()", "Cannot create default line!" ); } - simline_t * line = new simline_t(sp, (simline_t::linetype)ltype); + simline_t * line = new simline_t(player_, (simline_t::linetype)ltype); add_line( line->get_handle() ); sort_lines(); @@ -201,9 +201,9 @@ linehandle_t simlinemgmt_t::create_line(int ltype, spieler_t * sp) } -linehandle_t simlinemgmt_t::create_line(int ltype, spieler_t * sp, schedule_t * fpl) +linehandle_t simlinemgmt_t::create_line(int ltype, player_t * player_, schedule_t * fpl) { - linehandle_t line = create_line( ltype, sp ); + linehandle_t line = create_line( ltype, player_ ); if(fpl) { line->get_schedule()->copy_from(fpl); } @@ -222,15 +222,15 @@ void simlinemgmt_t::get_lines(int type, vector_tpl* lines) const } -void simlinemgmt_t::show_lineinfo(spieler_t *sp, linehandle_t line) +void simlinemgmt_t::show_lineinfo(player_t *player, linehandle_t line) { - gui_frame_t *schedule_list_gui = win_get_magic( magic_line_management_t + sp->get_player_nr() ); + gui_frame_t *schedule_list_gui = win_get_magic( magic_line_management_t + player->get_player_nr() ); if( schedule_list_gui ) { top_win( schedule_list_gui ); } else { - schedule_list_gui = new schedule_list_gui_t(sp); - create_win( schedule_list_gui, w_info, magic_line_management_t+sp->get_player_nr() ); + schedule_list_gui = new schedule_list_gui_t(player); + create_win( schedule_list_gui, w_info, magic_line_management_t+player->get_player_nr() ); } dynamic_cast(schedule_list_gui)->show_lineinfo(line); } diff --git a/simlinemgmt.h b/simlinemgmt.h index 0b970acf1b1..997132a5df8 100644 --- a/simlinemgmt.h +++ b/simlinemgmt.h @@ -13,7 +13,7 @@ class loadsave_t; class schedule_t; -class spieler_t; +class player_t; class schedule_list_gui_t; class simlinemgmt_t @@ -42,7 +42,7 @@ class simlinemgmt_t /* * load or save the linemanagement */ - void rdwr(loadsave_t * file, spieler_t * sp); + void rdwr(loadsave_t * file, player_t * player_); /* * sort the lines by name @@ -67,13 +67,13 @@ class simlinemgmt_t * creates a line with an empty schedule * @author hsiegeln */ - linehandle_t create_line(int ltype, spieler_t * sp); + linehandle_t create_line(int ltype, player_t * player_); /** * Creates a line and sets its schedule * @author prissi */ - linehandle_t create_line(int ltype, spieler_t * sp, schedule_t * fpl); + linehandle_t create_line(int ltype, player_t * player_, schedule_t * fpl); /** @@ -93,7 +93,7 @@ class simlinemgmt_t * Will open the line management window and offer information about the line * @author isidoro */ - void show_lineinfo(spieler_t *sp, linehandle_t line); + void show_lineinfo(player_t *player, linehandle_t line); vector_tpl const& get_line_list() const { return all_managed_lines; } diff --git a/simmain.cc b/simmain.cc index 9a598efa3f5..acd03cf9838 100644 --- a/simmain.cc +++ b/simmain.cc @@ -109,7 +109,7 @@ static void show_sizes() DBG_MESSAGE("sizes", "haltestelle_t: %d\n", sizeof(haltestelle_t)); DBG_MESSAGE("sizes", "karte_t: %d", sizeof(karte_t)); - DBG_MESSAGE("sizes", "spieler_t: %d\n", sizeof(spieler_t)); + DBG_MESSAGE("sizes", "player_t: %d\n", sizeof(player_t)); } diff --git a/simmenu.cc b/simmenu.cc index b8a08c71046..8b52d7d2a9d 100644 --- a/simmenu.cc +++ b/simmenu.cc @@ -64,10 +64,10 @@ class tool_dummy_t : public tool_t { public: tool_dummy_t() : tool_t(dummy_id) {} - bool init(spieler_t*) OVERRIDE { return false; } + bool init(player_t*) OVERRIDE { return false; } bool is_init_network_save() const OVERRIDE { return true; } bool is_work_network_save() const OVERRIDE { return true; } - bool is_move_network_save(spieler_t*) const OVERRIDE { return true; } + bool is_move_network_save(player_t*) const OVERRIDE { return true; } }; tool_t *tool_t::dummy = new tool_dummy_t(); @@ -656,7 +656,7 @@ bool tool_t::is_selected() const return welt->get_tool(welt->get_active_player_nr())==this; } -const char *tool_t::check_pos(spieler_t *, koord3d pos ) +const char *tool_t::check_pos(player_t *, koord3d pos ) { grund_t *gr = welt->lookup(pos); return (gr && !gr->is_visible()) ? "" : NULL; @@ -682,7 +682,7 @@ void tool_t::init_cursor( zeiger_t *zeiger) const zeiger->set_area( cursor_area, cursor_centered); } -const char *kartenboden_tool_t::check_pos(spieler_t *, koord3d pos ) +const char *kartenboden_tool_t::check_pos(player_t *, koord3d pos ) { grund_t *gr = welt->lookup_kartenboden(pos.get_2d()); return (gr && !gr->is_visible()) ? "" : NULL; @@ -690,14 +690,14 @@ const char *kartenboden_tool_t::check_pos(spieler_t *, koord3d pos ) -image_id toolbar_t::get_icon(spieler_t *sp) const +image_id toolbar_t::get_icon(player_t *player) const { // no image for edit tools => do not open - if( icon==IMG_LEER || (sp!=NULL && strcmp(default_param,"EDITTOOLS")==0 && sp->get_player_nr()!=1) ) { + if( icon==IMG_LEER || (player!=NULL && strcmp(default_param,"EDITTOOLS")==0 && player->get_player_nr()!=1) ) { return IMG_LEER; } // now have we a least one visible tool? - if (tool_selector && !tool_selector->empty(sp)) { + if (tool_selector && !tool_selector->empty(player)) { return icon; } return IMG_LEER; @@ -727,7 +727,7 @@ static sint16 get_sound( const char *c ) // fills and displays a toolbar -void toolbar_t::update(spieler_t *sp) +void toolbar_t::update(player_t *player) { const bool create = (tool_selector == NULL); if(create) { @@ -783,13 +783,13 @@ void toolbar_t::update(spieler_t *sp) // get the right city_road if(w->get_id() == (TOOL_BUILD_CITYROAD | GENERAL_TOOL)) { w->flags = 0; - w->init(sp); + w->init(player); } if( create ) { DBG_DEBUG( "toolbar_t::update()", "add tool %i (param=%s)", w->get_id(), w->get_default_param() ); } scenario_t *scen = welt->get_scenario(); - if( scen->is_scripted() && !scen->is_tool_allowed(sp, w->get_id(), w->get_waytype())) { + if( scen->is_scripted() && !scen->is_tool_allowed(player, w->get_id(), w->get_waytype())) { continue; } // now add it to the toolbar gui @@ -797,7 +797,7 @@ void toolbar_t::update(spieler_t *sp) } } - if( (strcmp(this->default_param,"EDITTOOLS")==0 && sp!=welt->get_spieler(1)) ) { + if( (strcmp(this->default_param,"EDITTOOLS")==0 && player!=welt->get_player(1)) ) { destroy_win(tool_selector); return; } @@ -806,10 +806,10 @@ void toolbar_t::update(spieler_t *sp) // fills and displays a toolbar -bool toolbar_t::init(spieler_t *sp) +bool toolbar_t::init(player_t *player) { - update( sp ); - bool close = (strcmp(this->default_param,"EDITTOOLS")==0 && sp!=welt->get_spieler(1)); + update( player ); + bool close = (strcmp(this->default_param,"EDITTOOLS")==0 && player!=welt->get_player(1)); // show/create window if( close ) { @@ -826,7 +826,7 @@ bool toolbar_t::init(spieler_t *sp) } -bool toolbar_t::exit(spieler_t *) +bool toolbar_t::exit(player_t *) { if( win_get_magic(magic_toolbar+toolbar_tool.index_of(this)) ) { destroy_win(tool_selector); @@ -835,7 +835,7 @@ bool toolbar_t::exit(spieler_t *) } -bool two_click_tool_t::init(spieler_t *) +bool two_click_tool_t::init(player_t *) { first_click_var = true; start = koord3d::invalid; @@ -862,13 +862,13 @@ bool two_click_tool_t::is_first_click() const } -bool two_click_tool_t::is_work_here_network_save(spieler_t *sp, koord3d pos ) +bool two_click_tool_t::is_work_here_network_save(player_t *player, koord3d pos ) { if( !is_first_click() ) { return false; } const char *error = ""; //default: nosound - uint8 value = is_valid_pos( sp, pos, error, koord3d::invalid ); + uint8 value = is_valid_pos( player, pos, error, koord3d::invalid ); DBG_MESSAGE("two_click_tool_t::is_work_here_network_save", "Position %s valid=%d", pos.get_str(), value ); if( value == 0 ) { return false; @@ -886,7 +886,7 @@ bool two_click_tool_t::is_work_here_network_save(spieler_t *sp, koord3d pos ) } -const char *two_click_tool_t::work(spieler_t *sp, koord3d pos ) +const char *two_click_tool_t::work(player_t *player, koord3d pos ) { if( !is_first_click() && start_marker ) { start = start_marker->get_pos(); // if map was rotated. @@ -896,11 +896,11 @@ const char *two_click_tool_t::work(spieler_t *sp, koord3d pos ) cleanup( true ); const char *error = ""; //default: nosound - uint8 value = is_valid_pos( sp, pos, error, !is_first_click() ? start : koord3d::invalid ); + uint8 value = is_valid_pos( player, pos, error, !is_first_click() ? start : koord3d::invalid ); DBG_MESSAGE("two_click_tool_t::work", "Position %s valid=%d", pos.get_str(), value ); if( value == 0 ) { flags &= ~(WFL_SHIFT | WFL_CTRL); - init( sp ); + init( player ); return error; } @@ -909,7 +909,7 @@ const char *two_click_tool_t::work(spieler_t *sp, koord3d pos ) if( (value & 1) && !( (value & 2) && is_ctrl_pressed())) { // Work here directly. DBG_MESSAGE("two_click_tool_t::work", "Call tool at %s", pos.get_str() ); - error = do_work( sp, pos, koord3d::invalid ); + error = do_work( player, pos, koord3d::invalid ); } else { // set starting position. @@ -920,16 +920,16 @@ const char *two_click_tool_t::work(spieler_t *sp, koord3d pos ) else { if( value & 2 ) { DBG_MESSAGE("two_click_tool_t::work", "Setting end to %s", pos.get_str() ); - error = do_work( sp, start, pos ); + error = do_work( player, start, pos ); } flags &= ~(WFL_SHIFT | WFL_CTRL); - init( sp ); // Do the cleanup stuff after(!) do_work (otherwise start==koord3d::invalid). + init( player ); // Do the cleanup stuff after(!) do_work (otherwise start==koord3d::invalid). } return error; } -const char *two_click_tool_t::move(spieler_t *sp, uint16 buttonstate, koord3d pos ) +const char *two_click_tool_t::move(player_t *player, uint16 buttonstate, koord3d pos ) { DBG_MESSAGE("two_click_tool_t::move", "Button: %d, Pos: %s", buttonstate, pos.get_str()); if( buttonstate == 0 ) { @@ -937,7 +937,7 @@ const char *two_click_tool_t::move(spieler_t *sp, uint16 buttonstate, koord3d po } if( start == pos ) { - init( sp ); + init( player ); } const char *error = NULL; @@ -946,7 +946,7 @@ const char *two_click_tool_t::move(spieler_t *sp, uint16 buttonstate, koord3d po // start dragging. cleanup( true ); - uint8 value = is_valid_pos( sp, pos, error, koord3d::invalid ); + uint8 value = is_valid_pos( player, pos, error, koord3d::invalid ); if( error || value == 0 ) { return error; } @@ -961,13 +961,13 @@ const char *two_click_tool_t::move(spieler_t *sp, uint16 buttonstate, koord3d po if( start_marker ) { start = start_marker->get_pos(); // if map was rotated. } - uint8 value = is_valid_pos( sp, pos, error, start ); + uint8 value = is_valid_pos( player, pos, error, start ); if( error || value == 0 ) { return error; } if( value & 2 ) { display_show_load_pointer( true ); - mark_tiles( sp, start, pos ); + mark_tiles( player, start, pos ); display_show_load_pointer( false ); } } diff --git a/simmenu.h b/simmenu.h index d90e5ae9d97..ce335ac4659 100644 --- a/simmenu.h +++ b/simmenu.h @@ -23,7 +23,7 @@ template class slist_tpl; class scr_coord; class tool_selector_t; -class spieler_t; +class player_t; class toolbar_t; class memory_rw_t; @@ -235,12 +235,12 @@ class tool_t { virtual ~tool_t() {} - virtual image_id get_icon(spieler_t *) const { return icon; } + virtual image_id get_icon(player_t *) const { return icon; } void set_icon(image_id i) { icon = i; } - // returns default_param of this tool for player sp + // returns default_param of this tool for player // if sp==NULL returns default_param that was used to create the tool - virtual const char* get_default_param(spieler_t* = NULL) const { return default_param; } + virtual const char* get_default_param(player_t* = NULL) const { return default_param; } void set_default_param(const char* str) { default_param = str; } // transfer additional information in networkgames @@ -251,18 +251,18 @@ class tool_t { // when true, local execution would do no harm virtual bool is_init_network_save() const { return false; } - virtual bool is_move_network_save(spieler_t *) const { return true; } + virtual bool is_move_network_save(player_t *) const { return true; } // if is_work_network_save()==false // and is_work_here_network_save(...)==false // then work-command is sent over network virtual bool is_work_network_save() const { return false; } - virtual bool is_work_here_network_save(spieler_t *, koord3d) { return false; } + virtual bool is_work_here_network_save(player_t *, koord3d) { return false; } // will draw a dark frame, if selected virtual void draw_after(scr_coord pos, bool dirty) const; - virtual const char *get_tooltip(const spieler_t *) const { return NULL; } + virtual const char *get_tooltip(const player_t *) const { return NULL; } /** * @return true if this tool operates over the grid, not the map tiles. @@ -273,13 +273,13 @@ class tool_t { * Returning false on init will automatically invoke previous tool. * Returning true will select tool and will make it possible to call work. */ - virtual bool init( spieler_t * ) { return true; } + virtual bool init( player_t * ) { return true; } /// initializes cursor (icon, marked area) void init_cursor( zeiger_t * ) const; // returning true on exit will have tool_selector resets to query-tool on right-click - virtual bool exit( spieler_t * ) { return true; } + virtual bool exit( player_t * ) { return true; } /* the return string can have different meanings: * NULL: ok @@ -288,9 +288,9 @@ class tool_t { * check: called before work (and move too?) koord3d already valid coordinate, checks visibility * work / move should depend on undergroundmode for not network safe tools */ - virtual const char *check_pos( spieler_t *, koord3d ); - virtual const char *work( spieler_t *, koord3d ) { return NULL; } - virtual const char *move( spieler_t *, uint16 /* buttonstate */, koord3d ) { return ""; } + virtual const char *check_pos( player_t *, koord3d ); + virtual const char *work( player_t *, koord3d ) { return NULL; } + virtual const char *move( player_t *, uint16 /* buttonstate */, koord3d ) { return ""; } /** * Returns whether the 2d koordinate passed it's a valid position for this tool to highlight a tile, @@ -317,7 +317,7 @@ class kartenboden_tool_t : public tool_t { public: kartenboden_tool_t(uint16 const id) : tool_t(id) {} - char const* check_pos(spieler_t*, koord3d) OVERRIDE; + char const* check_pos(player_t*, koord3d) OVERRIDE; }; /* @@ -333,13 +333,13 @@ class two_click_tool_t : public tool_t { } void rdwr_custom_data(memory_rw_t*) OVERRIDE; - bool init(spieler_t*) OVERRIDE; - bool exit(spieler_t* const sp) OVERRIDE { return init(sp); } + bool init(player_t*) OVERRIDE; + bool exit(player_t* const player) OVERRIDE { return init(player); } - char const* work(spieler_t*, koord3d) OVERRIDE; - char const* move(spieler_t*, uint16 /* buttonstate */, koord3d) OVERRIDE; + char const* work(player_t*, koord3d) OVERRIDE; + char const* move(player_t*, uint16 /* buttonstate */, koord3d) OVERRIDE; - bool is_work_here_network_save(spieler_t *, koord3d) OVERRIDE; + bool is_work_here_network_save(player_t *, koord3d) OVERRIDE; /** * @returns true if cleanup() needs to be called before another tool can be executed @@ -356,14 +356,14 @@ class two_click_tool_t : public tool_t { /* * This routine should fill marked_tiles. */ - virtual void mark_tiles( spieler_t *, const koord3d &start, const koord3d &end ) = 0; + virtual void mark_tiles( player_t *, const koord3d &start, const koord3d &end ) = 0; /* * This routine is called, if the real work should be done. * If the tool supports single clicks, end is sometimes == koord3d::invalid. * Returned string is passed by work/move. */ - virtual const char *do_work( spieler_t *, const koord3d &start, const koord3d &end ) = 0; + virtual const char *do_work( player_t *, const koord3d &start, const koord3d &end ) = 0; /* * Can the tool start/end on pos? If it is the second click, start is the position of the first click @@ -373,7 +373,7 @@ class two_click_tool_t : public tool_t { * 3 = Both (1 and 2) * error will contain an error message (if this is != NULL, return value should be 0). */ - virtual uint8 is_valid_pos( spieler_t *, const koord3d &pos, const char *&error, const koord3d &start ) = 0; + virtual uint8 is_valid_pos( player_t *, const koord3d &pos, const char *&error, const koord3d &start ) = 0; virtual image_id get_marker_image(); @@ -400,17 +400,17 @@ class toolbar_t : public tool_t { helpfile = h; tool_selector = NULL; } - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate(default_param); } + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate(default_param); } tool_selector_t *get_tool_selector() const { return tool_selector; } - image_id get_icon(spieler_t*) const OVERRIDE; + image_id get_icon(player_t*) const OVERRIDE; bool is_selected() const OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } bool is_work_network_save() const OVERRIDE { return true; } // show this toolbar - bool init(spieler_t*) OVERRIDE; + bool init(player_t*) OVERRIDE; // close this toolbar - bool exit(spieler_t*) OVERRIDE; - void update(spieler_t *); // just refresh content + bool exit(player_t*) OVERRIDE; + void update(player_t *); // just refresh content void append(tool_t *t) { tools.append(t); } }; diff --git a/simmesg.cc b/simmesg.cc index 436bb1b3fed..94f094c2490 100644 --- a/simmesg.cc +++ b/simmesg.cc @@ -43,8 +43,8 @@ PLAYER_COLOR_VAL message_t::node::get_player_color(karte_t *welt) const // correct for player color PLAYER_COLOR_VAL colorval = color; if( color&PLAYER_FLAG ) { - spieler_t *sp = welt->get_spieler(color&(~PLAYER_FLAG)); - colorval = sp ? PLAYER_FLAG+sp->get_player_color1()+1 : MN_GREY0; + player_t *player = welt->get_player(color&(~PLAYER_FLAG)); + colorval = player ? PLAYER_FLAG+player->get_player_color1()+1 : MN_GREY0; } return colorval; } diff --git a/simobj.cc b/simobj.cc index 9022f1a8838..5af62bae329 100644 --- a/simobj.cc +++ b/simobj.cc @@ -126,17 +126,17 @@ obj_t::~obj_t() /** * sets owner of object */ -void obj_t::set_besitzer(spieler_t *sp) +void obj_t::set_besitzer(player_t *player) { - int i = welt->sp2num(sp); + int i = welt->sp2num(player); assert(i>=0); besitzer_n = (uint8)i; } -spieler_t *obj_t::get_besitzer() const +player_t *obj_t::get_besitzer() const { - return welt->get_spieler(besitzer_n); + return welt->get_player(besitzer_n); } @@ -169,9 +169,9 @@ void obj_t::zeige_info() // returns NULL, if removal is allowed -const char *obj_t::ist_entfernbar(const spieler_t *sp) +const char *obj_t::ist_entfernbar(const player_t *player) { - if(besitzer_n==PLAYER_UNOWNED || welt->get_spieler(besitzer_n) == sp || welt->get_spieler(1) == sp) { + if(besitzer_n==PLAYER_UNOWNED || welt->get_player(besitzer_n) == player || welt->get_player(1) == player) { return NULL; } else { @@ -228,9 +228,9 @@ void obj_t::display(int xpos, int ypos) const if( besitzer_n != PLAYER_UNOWNED ) { if( obj_t::show_owner ) { #ifdef MULTI_THREAD - display_blend( bild, xpos, ypos, besitzer_n, (welt->get_spieler(besitzer_n)->get_player_color1()+2) | OUTLINE_FLAG | TRANSPARENT75_FLAG, 0, is_dirty, clip_num ); + display_blend( bild, xpos, ypos, besitzer_n, (welt->get_player(besitzer_n)->get_player_color1()+2) | OUTLINE_FLAG | TRANSPARENT75_FLAG, 0, is_dirty, clip_num ); #else - display_blend( bild, xpos, ypos, besitzer_n, (welt->get_spieler(besitzer_n)->get_player_color1()+2) | OUTLINE_FLAG | TRANSPARENT75_FLAG, 0, is_dirty ); + display_blend( bild, xpos, ypos, besitzer_n, (welt->get_player(besitzer_n)->get_player_color1()+2) | OUTLINE_FLAG | TRANSPARENT75_FLAG, 0, is_dirty ); #endif } else { @@ -315,9 +315,9 @@ void obj_t::display_after(int xpos, int ypos, bool) const if( besitzer_n != PLAYER_UNOWNED ) { if( obj_t::show_owner ) { #ifdef MULTI_THREAD - display_blend( bild, xpos, ypos, besitzer_n, (welt->get_spieler(besitzer_n)->get_player_color1()+2) | OUTLINE_FLAG | TRANSPARENT75_FLAG, 0, is_dirty, clip_num ); + display_blend( bild, xpos, ypos, besitzer_n, (welt->get_player(besitzer_n)->get_player_color1()+2) | OUTLINE_FLAG | TRANSPARENT75_FLAG, 0, is_dirty, clip_num ); #else - display_blend( bild, xpos, ypos, besitzer_n, (welt->get_spieler(besitzer_n)->get_player_color1()+2) | OUTLINE_FLAG | TRANSPARENT75_FLAG, 0, is_dirty ); + display_blend( bild, xpos, ypos, besitzer_n, (welt->get_player(besitzer_n)->get_player_color1()+2) | OUTLINE_FLAG | TRANSPARENT75_FLAG, 0, is_dirty ); #endif } else if( obj_t::get_flag( highlight ) ) { diff --git a/simobj.h b/simobj.h index d8b4a760044..d9ad456905c 100644 --- a/simobj.h +++ b/simobj.h @@ -16,7 +16,7 @@ class cbuffer_t; class karte_ptr_t; -class spieler_t; +class player_t; /** * Base class of all objects on the map, obj == thing @@ -100,12 +100,12 @@ class obj_t /** * sets owner of object */ - void set_besitzer(spieler_t *sp); + void set_besitzer(player_t *player); /** * returns owner of object */ - spieler_t * get_besitzer() const; + player_t * get_besitzer() const; /** * routines to set, clear, get bit flags @@ -206,7 +206,7 @@ class obj_t * Routine for cleanup if object is removed (ie book maintenance, cost for removal) * @author Hj. Malthaner */ - virtual void entferne(spieler_t *) {} + virtual void entferne(player_t *) {} /** * @returns untranslated name of object @@ -313,7 +313,7 @@ class obj_t * @return NULL if OK, otherwise an error message * @author Hj. Malthaner */ - virtual const char *ist_entfernbar(const spieler_t *sp); + virtual const char *ist_entfernbar(const player_t *player); /** * Draw background image of object diff --git a/simplan.cc b/simplan.cc index 82c22f6b56e..8880a6fa22c 100644 --- a/simplan.cc +++ b/simplan.cc @@ -617,8 +617,8 @@ void planquadrat_t::display_overlay(const sint16 xpos, const sint16 ypos) const // unfortunately, too expensive for display // plot player outline colours - we always plot in order of players so that the order of the stations in halt_list // doesn't affect the colour displayed [since blend(col1,blend(col2,screen)) != blend(col2,blend(col1,screen))] - for(int spieler_count = 0; spieler_countget_welt()->get_spieler(spieler_count); + for(int player_count = 0; player_countget_welt()->get_player(player_count); const PLAYER_COLOR_VAL transparent = PLAYER_FLAG | OUTLINE_FLAG | (display_player->get_player_color1() * 4 + 4); for(int halt_count = 0; halt_count < halt_list_count; halt_count++) { if(halt_list[halt_count]->get_besitzer() == display_player) { @@ -656,12 +656,15 @@ void planquadrat_t::display_overlay(const sint16 xpos, const sint16 ypos) const } -// finds halt belonging to player sp -halthandle_t planquadrat_t::get_halt(spieler_t *sp) const +/** + * Finds halt belonging to a player + * @param player owner of the halts we are interested in. + */ +halthandle_t planquadrat_t::get_halt(player_t *player) const { for( uint8 i=0; i < get_boden_count(); i++ ) { halthandle_t my_halt = get_boden_bei(i)->get_halt(); - if( my_halt.is_bound() && (sp == NULL || sp == my_halt->get_besitzer()) ) { + if( my_halt.is_bound() && (player == NULL || player == my_halt->get_besitzer()) ) { return my_halt; } } diff --git a/simplan.h b/simplan.h index ded65f66677..bca3667253b 100644 --- a/simplan.h +++ b/simplan.h @@ -198,11 +198,11 @@ class planquadrat_t void angehoben(); /** - * returns halthandle belonging to player sp if present + * returns halthandle belonging to player if present * @return NULL if no halt present * @author Kieron Green */ - halthandle_t get_halt(spieler_t *sp) const; + halthandle_t get_halt(player_t *player) const; private: // these functions are private helper functions for halt_list corrections diff --git a/simtool-dialogs.h b/simtool-dialogs.h index 656c7e5c7b9..788df064e36 100644 --- a/simtool-dialogs.h +++ b/simtool-dialogs.h @@ -47,7 +47,7 @@ #include "gui/schedule_list.h" #include "gui/themeselector.h" -class spieler_t; +class player_t; /********************** dialog tools *****************************/ @@ -55,13 +55,13 @@ class spieler_t; class dialog_help_t : public tool_t { public: dialog_help_t() : tool_t(DIALOG_HELP | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("Help"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("Help"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_mainhelp); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ help_frame_t::open_help_on("general.txt"); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_mainhelp); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_mainhelp); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -70,13 +70,13 @@ class dialog_help_t : public tool_t { class dialog_options_t : public tool_t { public: dialog_options_t() : tool_t(DIALOG_OPTIONS | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("Einstellungen aendern"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("Einstellungen aendern"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_optionen_gui_t); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ create_win(240, 120, new optionen_gui_t(), w_info, magic_optionen_gui_t); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_optionen_gui_t); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_optionen_gui_t); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -85,13 +85,13 @@ class dialog_options_t : public tool_t { class dialog_minimap_t : public tool_t { public: dialog_minimap_t() : tool_t(DIALOG_MINIMAP | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("Reliefkarte"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("Reliefkarte"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_reliefmap); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ create_win(new map_frame_t(), w_info, magic_reliefmap); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_reliefmap); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_reliefmap); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -100,16 +100,16 @@ class dialog_minimap_t : public tool_t { class dialog_lines_t : public tool_t { public: dialog_lines_t() : tool_t(DIALOG_LINEOVERVIEW | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("Line Management"); } - image_id get_icon(spieler_t* sp) const OVERRIDE{ return sp->get_player_nr() == 1 ? IMG_LEER : icon; } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("Line Management"); } + image_id get_icon(player_t* player_) const OVERRIDE{ return player_->get_player_nr() == 1 ? IMG_LEER : icon; } bool is_selected() const OVERRIDE{ return win_get_magic(magic_line_management_t + welt->get_active_player_nr()); } - bool init(spieler_t* sp) OVERRIDE{ - if (sp->get_player_nr() != 1) { - create_win(new schedule_list_gui_t(sp), w_info, magic_line_management_t + sp->get_player_nr()); + bool init(player_t* player_) OVERRIDE{ + if (player_->get_player_nr() != 1) { + create_win(new schedule_list_gui_t(player_), w_info, magic_line_management_t + player_->get_player_nr()); } return false; } - bool exit(spieler_t* const sp) OVERRIDE{ destroy_win(win_get_magic(magic_line_management_t + sp->get_player_nr())); return false; } + bool exit(player_t* const player) OVERRIDE{ destroy_win(win_get_magic(magic_line_management_t + player->get_player_nr())); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -118,13 +118,13 @@ class dialog_lines_t : public tool_t { class dialog_messages_t : public tool_t { public: dialog_messages_t() : tool_t(DIALOG_MESSAGES | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("Mailbox"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("Mailbox"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_messageframe); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ create_win(new message_frame_t(), w_info, magic_messageframe); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_messageframe); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_messageframe); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -133,13 +133,13 @@ class dialog_messages_t : public tool_t { class dialog_finances_t : public tool_t { public: dialog_finances_t() : tool_t(DIALOG_FINANCES | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("Finanzen"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("Finanzen"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_finances_t + welt->get_active_player_nr()); } - bool init(spieler_t* sp) OVERRIDE{ - create_win(new money_frame_t(sp), w_info, magic_finances_t + sp->get_player_nr()); + bool init(player_t* player_) OVERRIDE{ + create_win(new money_frame_t(player_), w_info, magic_finances_t + player_->get_player_nr()); return false; } - bool exit(spieler_t* const sp) OVERRIDE{ destroy_win(magic_finances_t + sp->get_player_nr()); return false; } + bool exit(player_t* const player) OVERRIDE{ destroy_win(magic_finances_t + player->get_player_nr()); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -148,13 +148,13 @@ class dialog_finances_t : public tool_t { class dialog_players_t : public tool_t { public: dialog_players_t() : tool_t(DIALOG_PLAYERS | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("Spielerliste"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("Spielerliste"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_ki_kontroll_t); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ create_win(272, 160, new ki_kontroll_t(), w_info, magic_ki_kontroll_t); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_ki_kontroll_t); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_ki_kontroll_t); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -163,13 +163,13 @@ class dialog_players_t : public tool_t { class dialog_displayoptions_t : public tool_t { public: dialog_displayoptions_t() : tool_t(DIALOG_DISPLAYOPTIONS | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("Helligk."); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("Helligk."); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_color_gui_t); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ create_win(new color_gui_t(), w_info, magic_color_gui_t); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_color_gui_t); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_color_gui_t); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -178,13 +178,13 @@ class dialog_displayoptions_t : public tool_t { class dialog_sound_t : public tool_t { public: dialog_sound_t() : tool_t(DIALOG_SOUND | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("Sound"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("Sound"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_sound_kontroll_t); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ create_win(new sound_frame_t(), w_info, magic_sound_kontroll_t); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_sound_kontroll_t); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_sound_kontroll_t); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -193,13 +193,13 @@ class dialog_sound_t : public tool_t { class dialog_language_t : public tool_t { public: dialog_language_t() : tool_t(DIALOG_LANGUAGE | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("Sprache"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("Sprache"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_sprachengui_t); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ create_win(new sprachengui_t(), w_info, magic_sprachengui_t); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_sprachengui_t); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_sprachengui_t); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -208,13 +208,13 @@ class dialog_language_t : public tool_t { class dialog_playercolor_t : public tool_t { public: dialog_playercolor_t() : tool_t(DIALOG_PLAYERCOLOR | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("Farbe"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("Farbe"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_farbengui_t); } - bool init(spieler_t* sp) OVERRIDE{ - create_win(new farbengui_t(sp), w_info, magic_farbengui_t); + bool init(player_t* player_) OVERRIDE{ + create_win(new farbengui_t(player_), w_info, magic_farbengui_t); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_farbengui_t); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_farbengui_t); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -223,13 +223,13 @@ class dialog_playercolor_t : public tool_t { class dialog_jump_t : public tool_t { public: dialog_jump_t() : tool_t(DIALOG_JUMP | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("Jump to"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("Jump to"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_jump); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ create_win(new jump_frame_t(), w_info, magic_jump); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_jump); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_jump); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -238,14 +238,14 @@ class dialog_jump_t : public tool_t { class dialog_load_t : public tool_t { public: dialog_load_t() : tool_t(DIALOG_LOAD | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("Laden"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("Laden"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_load_t); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ destroy_all_win(true); create_win(new loadsave_frame_t(true), w_info, magic_load_t); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_load_t); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_load_t); return false; } bool is_init_network_save() const OVERRIDE{ return true; } }; @@ -253,13 +253,13 @@ class dialog_load_t : public tool_t { class dialog_save_t : public tool_t { public: dialog_save_t() : tool_t(DIALOG_SAVE | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("Speichern"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("Speichern"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_save_t); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ create_win(new loadsave_frame_t(false), w_info, magic_save_t); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_save_t); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_save_t); return false; } bool is_init_network_save() const OVERRIDE{ return true; } }; @@ -267,13 +267,13 @@ class dialog_save_t : public tool_t { class dialog_list_halt_t : public tool_t { public: dialog_list_halt_t() : tool_t(DIALOG_LIST_HALT | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("hl_title"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("hl_title"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_halt_list_t); } - bool init(spieler_t* sp) OVERRIDE{ - create_win(new halt_list_frame_t(sp), w_info, magic_halt_list_t); + bool init(player_t* player_) OVERRIDE{ + create_win(new halt_list_frame_t(player_), w_info, magic_halt_list_t); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_halt_list_t); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_halt_list_t); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -282,13 +282,13 @@ class dialog_list_halt_t : public tool_t { class dialog_list_convoi_t : public tool_t { public: dialog_list_convoi_t() : tool_t(DIALOG_LIST_CONVOI | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("cl_title"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("cl_title"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_convoi_list + welt->get_active_player_nr()); } - bool init(spieler_t* sp) OVERRIDE{ - create_win(new convoi_frame_t(sp), w_info, magic_convoi_list + sp->get_player_nr()); + bool init(player_t* player_) OVERRIDE{ + create_win(new convoi_frame_t(player_), w_info, magic_convoi_list + player_->get_player_nr()); return false; } - bool exit(spieler_t* const sp) OVERRIDE{ destroy_win(magic_convoi_list + sp->get_player_nr()); return false; } + bool exit(player_t* const player) OVERRIDE{ destroy_win(magic_convoi_list + player->get_player_nr()); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -297,13 +297,13 @@ class dialog_list_convoi_t : public tool_t { class dialog_list_town_t : public tool_t { public: dialog_list_town_t() : tool_t(DIALOG_LIST_TOWN | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("tl_title"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("tl_title"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_citylist_frame_t); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ create_win(new citylist_frame_t(), w_info, magic_citylist_frame_t); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_citylist_frame_t); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_citylist_frame_t); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -312,13 +312,13 @@ class dialog_list_town_t : public tool_t { class dialog_list_goods_t : public tool_t { public: dialog_list_goods_t() : tool_t(DIALOG_LIST_GOODS | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("gl_title"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("gl_title"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_goodslist); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ create_win(new goods_frame_t(), w_info, magic_goodslist); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_goodslist); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_goodslist); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -327,13 +327,13 @@ class dialog_list_goods_t : public tool_t { class dialog_list_factory_t : public tool_t { public: dialog_list_factory_t() : tool_t(DIALOG_LIST_FACTORY | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("fl_title"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("fl_title"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_factorylist); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ create_win(new factorylist_frame_t(), w_info, magic_factorylist); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_factorylist); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_factorylist); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -342,13 +342,13 @@ class dialog_list_factory_t : public tool_t { class dialog_list_curiosity_t : public tool_t { public: dialog_list_curiosity_t() : tool_t(DIALOG_LIST_CURIOSITY | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("curlist_title"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("curlist_title"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_curiositylist); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ create_win(new curiositylist_frame_t(), w_info, magic_curiositylist); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_curiositylist); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_curiositylist); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -357,15 +357,15 @@ class dialog_list_curiosity_t : public tool_t { class dialog_edit_factory_t : public tool_t { public: dialog_edit_factory_t() : tool_t(DIALOG_EDIT_FACTORY | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("factorybuilder"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("factorybuilder"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_edit_factory); } - bool init(spieler_t* sp) OVERRIDE{ + bool init(player_t* player_) OVERRIDE{ if (!is_selected()) { - create_win(new factory_edit_frame_t(sp), w_info, magic_edit_factory); + create_win(new factory_edit_frame_t(player_), w_info, magic_edit_factory); } return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_edit_factory); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_edit_factory); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -374,15 +374,15 @@ class dialog_edit_factory_t : public tool_t { class dialog_edit_attraction_t : public tool_t { public: dialog_edit_attraction_t() : tool_t(DIALOG_EDIT_ATTRACTION | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("curiosity builder"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("curiosity builder"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_edit_attraction); } - bool init(spieler_t* sp) OVERRIDE{ + bool init(player_t* player_) OVERRIDE{ if (!is_selected()) { - create_win(new curiosity_edit_frame_t(sp), w_info, magic_edit_attraction); + create_win(new curiosity_edit_frame_t(player_), w_info, magic_edit_attraction); } return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_edit_attraction); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_edit_attraction); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -391,15 +391,15 @@ class dialog_edit_attraction_t : public tool_t { class dialog_edit_house_t : public tool_t { public: dialog_edit_house_t() : tool_t(DIALOG_EDIT_HOUSE | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("citybuilding builder"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("citybuilding builder"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_edit_house); } - bool init(spieler_t* sp) OVERRIDE{ + bool init(player_t* player_) OVERRIDE{ if (!is_selected()) { - create_win(new citybuilding_edit_frame_t(sp), w_info, magic_edit_house); + create_win(new citybuilding_edit_frame_t(player_), w_info, magic_edit_house); } return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_edit_house); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_edit_house); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -408,16 +408,16 @@ class dialog_edit_house_t : public tool_t { class dialog_edit_tree_t : public tool_t { public: dialog_edit_tree_t() : tool_t(DIALOG_EDIT_TREE | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("baum builder"); } - image_id get_icon(spieler_t *) const { return baum_t::get_anzahl_besch() > 0 ? icon : IMG_LEER; } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("baum builder"); } + image_id get_icon(player_t *) const { return baum_t::get_anzahl_besch() > 0 ? icon : IMG_LEER; } bool is_selected() const OVERRIDE{ return win_get_magic(magic_edit_tree); } - bool init(spieler_t* sp) OVERRIDE{ + bool init(player_t* player_) OVERRIDE{ if (baum_t::get_anzahl_besch() > 0 && !is_selected()) { - create_win(new baum_edit_frame_t(sp), w_info, magic_edit_tree); + create_win(new baum_edit_frame_t(player_), w_info, magic_edit_tree); } return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_edit_tree); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_edit_tree); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -426,30 +426,30 @@ class dialog_edit_tree_t : public tool_t { class dialog_enlarge_map_t : public tool_t{ public: dialog_enlarge_map_t() : tool_t(DIALOG_ENLARGE_MAP | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return env_t::networkmode ? translator::translate("deactivated in online mode") : translator::translate("enlarge map"); } - image_id get_icon(spieler_t *) const { return env_t::networkmode ? IMG_LEER : icon; } + char const* get_tooltip(player_t const*) const OVERRIDE{ return env_t::networkmode ? translator::translate("deactivated in online mode") : translator::translate("enlarge map"); } + image_id get_icon(player_t *) const { return env_t::networkmode ? IMG_LEER : icon; } bool is_selected() const OVERRIDE{ return win_get_magic(magic_bigger_map); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ if (!env_t::networkmode) { destroy_all_win(true); create_win(new enlarge_map_frame_t(), w_info, magic_bigger_map); } return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_bigger_map); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_bigger_map); return false; } }; /* open the list of label */ class dialog_list_label_t : public tool_t { public: dialog_list_label_t() : tool_t(DIALOG_LIST_LABEL | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("labellist_title"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("labellist_title"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_labellist); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ create_win(new labellist_frame_t(), w_info, magic_labellist); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_labellist); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_labellist); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -458,45 +458,45 @@ class dialog_list_label_t : public tool_t { class dialog_climates_t : public tool_t { public: dialog_climates_t() : tool_t(DIALOG_CLIMATES | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return (!env_t::networkmode || env_t::server) ? translator::translate("Climate Control") : translator::translate("deactivated in online mode"); } - image_id get_icon(spieler_t *) const { return (!env_t::networkmode || env_t::server) ? icon : IMG_LEER; } + char const* get_tooltip(player_t const*) const OVERRIDE{ return (!env_t::networkmode || env_t::server) ? translator::translate("Climate Control") : translator::translate("deactivated in online mode"); } + image_id get_icon(player_t *) const { return (!env_t::networkmode || env_t::server) ? icon : IMG_LEER; } bool is_selected() const OVERRIDE{ return win_get_magic(magic_climate); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ if (!env_t::networkmode || env_t::server) { create_win(new climate_gui_t(&welt->get_settings()), w_info, magic_climate); } return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_climate); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_climate); return false; } }; /* open all game settings */ class dialog_settings_t : public tool_t { public: dialog_settings_t() : tool_t(DIALOG_SETTINGS | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return (!env_t::networkmode || env_t::server) ? translator::translate("Setting") : translator::translate("deactivated in online mode"); } - image_id get_icon(spieler_t *) const { return (!env_t::networkmode || env_t::server) ? icon : IMG_LEER; } + char const* get_tooltip(player_t const*) const OVERRIDE{ return (!env_t::networkmode || env_t::server) ? translator::translate("Setting") : translator::translate("deactivated in online mode"); } + image_id get_icon(player_t *) const { return (!env_t::networkmode || env_t::server) ? icon : IMG_LEER; } bool is_selected() const OVERRIDE{ return win_get_magic(magic_settings_frame_t); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ if (!env_t::networkmode || env_t::server) { create_win(new settings_frame_t(&welt->get_settings()), w_info, magic_settings_frame_t); } return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_settings_frame_t); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_settings_frame_t); return false; } }; /* server info and join dialog */ class dialog_gameinfo_t : public tool_t { public: dialog_gameinfo_t() : tool_t(DIALOG_GAMEINFO | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("Game info"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("Game info"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_server_frame_t); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ create_win(new server_frame_t(), w_info, magic_server_frame_t); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_server_frame_t); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_server_frame_t); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; @@ -505,13 +505,13 @@ class dialog_gameinfo_t : public tool_t { class dialog_themes_t : public tool_t { public: dialog_themes_t() : tool_t(DIALOG_THEMES | DIALOGE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE{ return translator::translate("Select a theme for display"); } + char const* get_tooltip(player_t const*) const OVERRIDE{ return translator::translate("Select a theme for display"); } bool is_selected() const OVERRIDE{ return win_get_magic(magic_themes); } - bool init(spieler_t*) OVERRIDE{ + bool init(player_t*) OVERRIDE{ create_win(new themeselector_t(), w_info, magic_themes); return false; } - bool exit(spieler_t*) OVERRIDE{ destroy_win(magic_themes); return false; } + bool exit(player_t*) OVERRIDE{ destroy_win(magic_themes); return false; } bool is_init_network_save() const OVERRIDE{ return true; } bool is_work_network_save() const OVERRIDE{ return true; } }; diff --git a/simtool.cc b/simtool.cc index e9c68c1a1c3..f4d47ca3b4d 100644 --- a/simtool.cc +++ b/simtool.cc @@ -99,7 +99,7 @@ #define CHECK_FUNDS() \ /* do not allow, if out of money */ \ - if( !welt->get_settings().is_freeplay() && sp->get_player_nr()!=1 && !sp->has_money_or_assets() ) {\ + if( !welt->get_settings().is_freeplay() && player->get_player_nr()!=1 && !player->has_money_or_assets() ) {\ return "Out of funds";\ }\ @@ -177,14 +177,14 @@ static char const* tooltip_with_price_maintenance_capacity(karte_t* const welt, * extended to search first in our direction * @author Hj. Malthaner, V.Meyer, prissi */ -static halthandle_t suche_nahe_haltestelle(spieler_t *sp, karte_t *welt, koord3d pos, sint16 b=1, sint16 h=1) +static halthandle_t suche_nahe_haltestelle(player_t *player, karte_t *welt, koord3d pos, sint16 b=1, sint16 h=1) { koord k(pos.get_2d()); // any other ground with a valid stop here? halthandle_t my_halt; if( planquadrat_t* plan=welt->access(pos.get_2d()) ) { - my_halt = plan->get_halt( sp ); + my_halt = plan->get_halt( player ); if( my_halt.is_bound() ) { return my_halt; } @@ -201,7 +201,7 @@ static halthandle_t suche_nahe_haltestelle(spieler_t *sp, karte_t *welt, koord3d for( int i=0; i<4; i++ ) { if( ribi_t::nsow[i] & ribi ) { if( planquadrat_t* plan=welt->access(k+koord::nsow[i]) ) { - my_halt = plan->get_halt( sp ); + my_halt = plan->get_halt( player ); if( my_halt.is_bound() ) { return my_halt; } @@ -214,7 +214,7 @@ static halthandle_t suche_nahe_haltestelle(spieler_t *sp, karte_t *welt, koord3d for( sint16 y=-1; y<=h; y++ ) { for( sint16 x=-1; x<=b; (x==-1 && y>-1 && yaccess(k+koord(x,y)) ) { - my_halt = plan->get_halt( sp ); + my_halt = plan->get_halt( player ); if( my_halt.is_bound() ) { return my_halt; } @@ -226,7 +226,7 @@ static halthandle_t suche_nahe_haltestelle(spieler_t *sp, karte_t *welt, koord3d // now search everything for public stops for( int i=0; i<8; i++ ) { if( planquadrat_t* plan=welt->access(k+koord::neighbours[i]) ) { - my_halt = plan->get_halt( welt->get_spieler(1) ); + my_halt = plan->get_halt( welt->get_player(1) ); if( my_halt.is_bound() ) { return my_halt; } @@ -240,7 +240,7 @@ static halthandle_t suche_nahe_haltestelle(spieler_t *sp, karte_t *welt, koord3d // converts a 2d koord to a suitable ground pointer -static grund_t *tool_intern_koord_to_weg_grund(spieler_t *sp, karte_t *welt, koord3d pos, waytype_t wt) +static grund_t *tool_intern_koord_to_weg_grund(player_t *player, karte_t *welt, koord3d pos, waytype_t wt) { // check for valid ground grund_t *gr=welt->lookup(pos); @@ -250,7 +250,7 @@ static grund_t *tool_intern_koord_to_weg_grund(spieler_t *sp, karte_t *welt, koo if( wt==powerline_wt && gr->get_leitung() ) { // check for ownership - if(gr->get_leitung()->ist_entfernbar(sp)!=NULL) { + if(gr->get_leitung()->ist_entfernbar(player)!=NULL) { return NULL; } // ok @@ -262,7 +262,7 @@ static grund_t *tool_intern_koord_to_weg_grund(spieler_t *sp, karte_t *welt, koo // tram if(wt==tram_wt) { weg_t *way = gr->get_weg(track_wt); - if (way && way->get_besch()->get_styp() == weg_t::type_tram && way->ist_entfernbar(sp)==NULL) { + if (way && way->get_besch()->get_styp() == weg_t::type_tram && way->ist_entfernbar(player)==NULL) { return gr; } else { @@ -276,7 +276,7 @@ static grund_t *tool_intern_koord_to_weg_grund(spieler_t *sp, karte_t *welt, koo return NULL; } // check for ownership - if(gr->get_weg(wt)->ist_entfernbar(sp)!=NULL){ + if(gr->get_weg(wt)->ist_entfernbar(player)!=NULL){ return NULL; } // ok, now we have a valid ground @@ -286,7 +286,7 @@ static grund_t *tool_intern_koord_to_weg_grund(spieler_t *sp, karte_t *welt, koo /****************************************** now the actual tools **************************************/ -const char *tool_query_t::work( spieler_t *sp, koord3d pos ) +const char *tool_query_t::work( player_t *player, koord3d pos ) { grund_t *gr = welt->lookup(pos); if(gr) { @@ -374,7 +374,7 @@ const char *tool_query_t::work( spieler_t *sp, koord3d pos ) } } - if(gr->get_depot() && gr->get_depot()->get_besitzer()==sp) { + if(gr->get_depot() && gr->get_depot()->get_besitzer()==player) { int old_count = win_get_open_count(); gr->get_depot()->zeige_info(); // did some new window open? @@ -390,7 +390,7 @@ const char *tool_query_t::work( spieler_t *sp, koord3d pos ) /* delete things from a tile * citycars and pedestrian first and then go up to queue to more important objects */ -bool tool_remover_t::tool_remover_intern(spieler_t *sp, koord3d pos, sint8 type, const char *&msg) +bool tool_remover_t::tool_remover_intern(player_t *player, koord3d pos, sint8 type, const char *&msg) { DBG_MESSAGE("tool_remover_intern()","at (%s)", pos.get_str()); // check if there is something to remove from here ... @@ -403,7 +403,7 @@ DBG_MESSAGE("tool_remover_intern()","at (%s)", pos.get_str()); // marker? if (type == obj_t::label || type == obj_t::undefined) { if (label_t* l = gr->find()) { - msg = l->ist_entfernbar(sp); + msg = l->ist_entfernbar(player); if(msg==NULL) { delete l; return true; @@ -438,7 +438,7 @@ DBG_MESSAGE("tool_remover_intern()","at (%s)", pos.get_str()); leitung_t* lt = gr->get_leitung(); // check whether powerline related stuff should be removed, and if there is any to remove if ( (type == obj_t::label || type == obj_t::pumpe || type == obj_t::senke || type == obj_t::undefined) - && lt != NULL && lt->ist_entfernbar(sp) == NULL) { + && lt != NULL && lt->ist_entfernbar(player) == NULL) { if( gr->ist_bruecke() ) { bruecke_t* br = gr->find(); if( br == NULL ) { @@ -449,24 +449,24 @@ DBG_MESSAGE("tool_remover_intern()","at (%s)", pos.get_str()); gr = gr_new; } else if( br->get_besch()->get_waytype() == powerline_wt ) { - msg = brueckenbauer_t::remove(sp, gr->get_pos(), powerline_wt ); + msg = brueckenbauer_t::remove(player, gr->get_pos(), powerline_wt ); return msg == NULL; } } if(gr->ist_tunnel() && gr->ist_karten_boden()) { if (gr->find()->get_besch()->get_waytype()==powerline_wt) { - msg = tunnelbauer_t::remove(sp, gr->get_pos(), powerline_wt, is_ctrl_pressed() ); + msg = tunnelbauer_t::remove(player, gr->get_pos(), powerline_wt, is_ctrl_pressed() ); return msg == NULL; } } if( gr->ist_im_tunnel() ) { - lt->entferne(sp); + lt->entferne(player); delete lt; // now everything gone? if( gr->get_top() == 1 ) { // delete tunnel too tunnel_t *t = gr->find(); - t->entferne(sp); + t->entferne(player); delete t; } // unmark kartenboden (is marked during underground mode deletion) @@ -476,7 +476,7 @@ DBG_MESSAGE("tool_remover_intern()","at (%s)", pos.get_str()); delete gr; } else { - lt->entferne(sp); + lt->entferne(player); delete lt; } return true; @@ -486,7 +486,7 @@ DBG_MESSAGE("tool_remover_intern()","at (%s)", pos.get_str()); roadsign_t* rs = gr->find(); if (rs == NULL) rs = gr->find(); if ( (type == obj_t::signal || type == obj_t::roadsign || type == obj_t::undefined) && rs!=NULL) { - msg = rs->ist_entfernbar(sp); + msg = rs->ist_entfernbar(player); if(msg) { return false; } @@ -495,7 +495,7 @@ DBG_MESSAGE("tool_remover()", "removing roadsign at (%s)", pos.get_str()); if( weg==NULL && rs->get_besch()->get_wtyp()==tram_wt ) { weg = gr->get_weg(track_wt); } - rs->entferne(sp); + rs->entferne(player); delete rs; assert( weg ); weg->count_sign(); @@ -507,20 +507,20 @@ DBG_MESSAGE("tool_remover()", "removing roadsign at (%s)", pos.get_str()); DBG_MESSAGE("tool_remover()", "bound=%i",halt.is_bound()); if (gr->is_halt() && halt.is_bound() && fabrik_t::get_fab(k)==NULL && type == obj_t::undefined) { // halt and not a factory (oil rig etc.) - const spieler_t* owner = halt->get_besitzer(); - if( spieler_t::check_owner( owner, sp ) ) { - return haltestelle_t::remove(sp, gr->get_pos()); + const player_t* owner = halt->get_besitzer(); + if( player_t::check_owner( owner, player ) ) { + return haltestelle_t::remove(player, gr->get_pos()); } } // catenary or something like this wayobj_t* wo = gr->find(); if(wo && (type == obj_t::wayobj || type == obj_t::undefined)) { - msg = wo->ist_entfernbar(sp); + msg = wo->ist_entfernbar(player); if(msg) { return false; } - wo->entferne(sp); + wo->entferne(player); delete wo; depot_t *dep = gr->get_depot(); if( dep ) { @@ -535,7 +535,7 @@ DBG_MESSAGE("tool_remover()", "check tunnel/bridge"); if(gr->ist_bruecke() && (type == obj_t::bruecke || type == obj_t::undefined)) { DBG_MESSAGE("tool_remover()", "removing bridge from %d,%d,%d",gr->get_pos().x, gr->get_pos().y, gr->get_pos().z); bruecke_t* br = gr->find(); - msg = brueckenbauer_t::remove(sp, gr->get_pos(), br->get_besch()->get_waytype()); + msg = brueckenbauer_t::remove(player, gr->get_pos(), br->get_besch()->get_waytype()); return msg == NULL; } @@ -543,16 +543,16 @@ DBG_MESSAGE("tool_remover()", "removing bridge from %d,%d,%d",gr->get_pos().x, if(gr->ist_tunnel() && gr->ist_karten_boden() && (type == obj_t::tunnel || type == obj_t::undefined)) { DBG_MESSAGE("tool_remover()", "removing tunnel from %d,%d,%d",gr->get_pos().x, gr->get_pos().y, gr->get_pos().z); waytype_t wegtyp = gr->get_leitung() ? powerline_wt : gr->get_weg_nr(0)->get_waytype(); - msg = tunnelbauer_t::remove(sp, gr->get_pos(), wegtyp, is_ctrl_pressed()); + msg = tunnelbauer_t::remove(player, gr->get_pos(), wegtyp, is_ctrl_pressed()); return msg == NULL; } // fields field_t* f = gr->find(); if (f && (type == obj_t::field || type == obj_t::undefined)) { - msg = f->ist_entfernbar(sp); + msg = f->ist_entfernbar(player); if(msg==NULL) { - f->entferne(sp); + f->entferne(player); delete f; // fields have foundations ... sint8 dummy; @@ -567,11 +567,11 @@ DBG_MESSAGE("tool_remover()", "removing tunnel from %d,%d,%d",gr->get_pos().x, depot_t* dep = gr->get_depot(); if (dep && (type == obj_t::bahndepot || type == obj_t::undefined)) { // type == bahndepot to remove any type of depot - msg = dep->ist_entfernbar(sp); + msg = dep->ist_entfernbar(player); if(msg) { return false; } - dep->entferne(sp); + dep->entferne(player); delete dep; return true; } @@ -579,7 +579,7 @@ DBG_MESSAGE("tool_remover()", "removing tunnel from %d,%d,%d",gr->get_pos().x, // since buildings can have more than one tile, we must handle them together gebaeude_t* gb = gr->find(); if(gb != NULL && (type == obj_t::gebaeude || type == obj_t::undefined)) { - msg = gb->ist_entfernbar(sp); + msg = gb->ist_entfernbar(player); if(msg) { return false; } @@ -599,7 +599,7 @@ DBG_MESSAGE("tool_remover()", "removing tunnel from %d,%d,%d",gr->get_pos().x, } else { // townhall is also removed during town removal - hausbauer_t::remove( sp, gb ); + hausbauer_t::remove( player, gb ); } return true; } @@ -637,8 +637,8 @@ DBG_MESSAGE("tool_remover()", "took out powerline"); bool return_ok = false; uint8 num_obj = gr->obj_count(); if(num_obj>0) { - msg = gr->kann_alle_obj_entfernen(sp); - return_ok = (msg==NULL && !(gr->get_typ()==grund_t::brueckenboden || gr->get_typ()==grund_t::tunnelboden) && gr->obj_loesche_alle(sp)); + msg = gr->kann_alle_obj_entfernen(player); + return_ok = (msg==NULL && !(gr->get_typ()==grund_t::brueckenboden || gr->get_typ()==grund_t::tunnelboden) && gr->obj_loesche_alle(player)); DBG_MESSAGE("tool_remover()", "removing everything from %d,%d,%d",gr->get_pos().x, gr->get_pos().y, gr->get_pos().z); } @@ -681,29 +681,29 @@ DBG_MESSAGE("tool_remover()", "removing way"); // remove the other way first w = NULL; } - if(w==NULL || w->ist_entfernbar(sp)!=NULL) { + if(w==NULL || w->ist_entfernbar(player)!=NULL) { w = gr->get_weg_nr(0); if(w==NULL) { // no way at all ... return true; } - if(w->ist_entfernbar(sp)!=NULL){ - msg = w->ist_entfernbar(sp); + if(w->ist_entfernbar(player)!=NULL){ + msg = w->ist_entfernbar(player); return false; } } wt = w->get_besch()->get_finance_waytype(); long cost_sum = gr->weg_entfernen(w->get_waytype(), true); - spieler_t::book_construction_costs(sp, -cost_sum, k, wt); + player_t::book_construction_costs(player, -cost_sum, k, wt); } else { // remove ways and tunnel if( weg_t *weg = gr->get_weg_nr(0) ) { - gr->remove_everything_from_way(sp, weg->get_waytype(), ribi_t::keine); + gr->remove_everything_from_way(player, weg->get_waytype(), ribi_t::keine); } // tunnel without way: delete anything else if( !gr->hat_wege() ) { - gr->obj_loesche_alle(sp); + gr->obj_loesche_alle(player); } } @@ -721,7 +721,7 @@ DBG_MESSAGE("tool_remover()", "removing way"); -const char *tool_remover_t::work( spieler_t *sp, koord3d pos ) +const char *tool_remover_t::work( player_t *player, koord3d pos ) { DBG_MESSAGE("tool_remover()","at %d,%d", pos.x, pos.y); @@ -735,7 +735,7 @@ const char *tool_remover_t::work( spieler_t *sp, koord3d pos ) } const char *fail = NULL; - if(!tool_remover_intern(sp, pos, type, fail)) { + if(!tool_remover_intern(player, pos, type, fail)) { return fail; } @@ -759,7 +759,7 @@ const char *tool_remover_t::work( spieler_t *sp, koord3d pos ) -const char *tool_raise_lower_base_t::move( spieler_t *sp, uint16 buttonstate, koord3d pos ) +const char *tool_raise_lower_base_t::move( player_t *player, uint16 buttonstate, koord3d pos ) { CHECK_FUNDS(); @@ -774,11 +774,11 @@ const char *tool_raise_lower_base_t::move( spieler_t *sp, uint16 buttonstate, ko default_param = buf; if (env_t::networkmode) { // queue tool for network - nwc_tool_t *nwc = new nwc_tool_t(sp, this, pos, welt->get_steps(), welt->get_map_counter(), false); + nwc_tool_t *nwc = new nwc_tool_t(player, this, pos, welt->get_steps(), welt->get_map_counter(), false); network_send_server(nwc); } else { - result = work( sp, pos ); + result = work( player, pos ); } default_param = NULL; } @@ -786,7 +786,7 @@ const char *tool_raise_lower_base_t::move( spieler_t *sp, uint16 buttonstate, ko } -const char* tool_raise_lower_base_t::drag(spieler_t *sp, koord k, sint16 height, int &n) +const char* tool_raise_lower_base_t::drag(player_t *player, koord k, sint16 height, int &n) { if( !welt->is_within_grid_limits(k) ) { return ""; @@ -795,7 +795,7 @@ const char* tool_raise_lower_base_t::drag(spieler_t *sp, koord k, sint16 height, // dragging may be going up or down! while( welt->lookup_hgt(k) < height && height <= welt->get_maximumheight() ) { - int diff = welt->grid_raise( sp, k, err ); + int diff = welt->grid_raise( player, k, err ); if( diff == 0 ) { break; } @@ -805,7 +805,7 @@ const char* tool_raise_lower_base_t::drag(spieler_t *sp, koord k, sint16 height, // when going down need to check here we will not be going below sea level // cannot rely on check within lower as water height can be recalculated while( height >= welt->get_water_hgt(k) && welt->lookup_hgt(k) > height && height >= welt->get_minimumheight() ) { - int diff = welt->grid_lower( sp, k, err ); + int diff = welt->grid_lower( player, k, err ); if( diff == 0 ) { break; } @@ -835,7 +835,7 @@ sint16 tool_raise_t::get_drag_height(koord k) } -const char *tool_raise_t::check_pos(spieler_t *, koord3d pos ) +const char *tool_raise_t::check_pos(player_t *, koord3d pos ) { // check for underground mode if( is_dragging && drag_height-1 > grund_t::underground_level ) { @@ -853,7 +853,7 @@ const char *tool_raise_t::check_pos(spieler_t *, koord3d pos ) } -const char *tool_raise_t::work(spieler_t* sp, koord3d pos ) +const char *tool_raise_t::work(player_t* player, koord3d pos ) { if (!check_dragging()) { return NULL; @@ -873,13 +873,13 @@ const char *tool_raise_t::work(spieler_t* sp, koord3d pos ) int n = 0; // tiles changed if( !strempty(default_param) ) { // called by dragging or by AI - err = drag(sp, k, atoi(default_param), n); + err = drag(player, k, atoi(default_param), n); } else { - n = welt->grid_raise(sp, k, err); + n = welt->grid_raise(player, k, err); } if(n>0) { - spieler_t::book_construction_costs(sp, welt->get_settings().cst_alter_land * n, k, ignore_wt); + player_t::book_construction_costs(player, welt->get_settings().cst_alter_land * n, k, ignore_wt); } return err == NULL ? (n ? NULL : "") : (*err == 0 ? "Tile not empty." : err); @@ -901,7 +901,7 @@ sint16 tool_lower_t::get_drag_height(koord k) } -const char *tool_lower_t::check_pos( spieler_t *, koord3d pos ) +const char *tool_lower_t::check_pos( player_t *, koord3d pos ) { // check for underground mode if (is_dragging && drag_height+1 > grund_t::underground_level) { @@ -919,7 +919,7 @@ const char *tool_lower_t::check_pos( spieler_t *, koord3d pos ) } -const char *tool_lower_t::work( spieler_t *sp, koord3d pos ) +const char *tool_lower_t::work( player_t *player, koord3d pos ) { if (!check_dragging()) { return NULL; @@ -937,13 +937,13 @@ const char *tool_lower_t::work( spieler_t *sp, koord3d pos ) int n = 0; // tiles changed if (!strempty(default_param)) { // called by dragging or by AI - err = drag(sp, k, atoi(default_param), n); + err = drag(player, k, atoi(default_param), n); } else { - n = welt->grid_lower(sp, k, err); + n = welt->grid_lower(player, k, err); } if(n>0) { - spieler_t::book_construction_costs(sp, welt->get_settings().cst_alter_land * n, k, ignore_wt); + player_t::book_construction_costs(player, welt->get_settings().cst_alter_land * n, k, ignore_wt); } return err == NULL ? (n ? NULL : "") : (*err == 0 ? "Tile not empty." : err); @@ -957,7 +957,7 @@ const char *tool_lower_t::work( spieler_t *sp, koord3d pos ) } -const char *tool_setslope_t::check_pos( spieler_t *, koord3d pos) +const char *tool_setslope_t::check_pos( player_t *, koord3d pos) { grund_t *gr1 = welt->lookup(pos); if(gr1) { @@ -972,7 +972,7 @@ const char *tool_setslope_t::check_pos( spieler_t *, koord3d pos) return NULL; } -const char *tool_restoreslope_t::check_pos( spieler_t *, koord3d pos) +const char *tool_restoreslope_t::check_pos( player_t *, koord3d pos) { grund_t *gr1 = welt->lookup(pos); if(gr1) { @@ -992,7 +992,7 @@ const char *tool_restoreslope_t::check_pos( spieler_t *, koord3d pos) * @param param the slope type * @author Hj. Malthaner */ -const char *tool_setslope_t::tool_set_slope_work( spieler_t *sp, koord3d pos, int new_slope ) +const char *tool_setslope_t::tool_set_slope_work( player_t *player, koord3d pos, int new_slope ) { if( !grund_besch_t::double_grounds ) { // translate old single slope parameter to new double slope @@ -1033,7 +1033,7 @@ const char *tool_setslope_t::tool_set_slope_work( spieler_t *sp, koord3d pos, in } // finally: empty enough - if( gr1->get_grund_hang()!=gr1->get_weg_hang() || gr1->get_halt().is_bound() || gr1->kann_alle_obj_entfernen(sp) || + if( gr1->get_grund_hang()!=gr1->get_weg_hang() || gr1->get_halt().is_bound() || gr1->kann_alle_obj_entfernen(player) || gr1->find() || gr1->get_depot() || (gr1->get_leitung() && gr1->hat_wege()) || gr1->get_weg(air_wt) || gr1->find() || gr1->get_typ()==grund_t::brueckenboden) { return "Tile not empty."; } @@ -1234,16 +1234,16 @@ const char *tool_setslope_t::tool_set_slope_work( spieler_t *sp, koord3d pos, in ok |= slope_changed; if(ok) { - if( gr1->kann_alle_obj_entfernen(sp) ) { + if( gr1->kann_alle_obj_entfernen(player) ) { // not empty ... return "Tile not empty."; } // check way ownership if(gr1->hat_wege()) { - if(gr1->get_weg_nr(0)->ist_entfernbar(sp)!=NULL) { + if(gr1->get_weg_nr(0)->ist_entfernbar(player)!=NULL) { return "Tile not empty."; } - if(gr1->has_two_ways() && gr1->get_weg_nr(1)->ist_entfernbar(sp)!=NULL) { + if(gr1->has_two_ways() && gr1->get_weg_nr(1)->ist_entfernbar(player)!=NULL) { return "Tile not empty."; } } @@ -1251,16 +1251,16 @@ const char *tool_setslope_t::tool_set_slope_work( spieler_t *sp, koord3d pos, in // ok, it was a success if( !gr1->ist_wasser() && new_slope == 0 && hgt == water_hgt && gr1->get_typ() != grund_t::tunnelboden ) { // now water - gr1->obj_loesche_alle(sp); + gr1->obj_loesche_alle(player); welt->access(k)->kartenboden_setzen( new wasser_t(new_pos) ); gr1 = welt->lookup_kartenboden(k); } else if( gr1->ist_wasser() && (new_pos.z > water_hgt || new_slope != 0) ) { // build underwater hill first - if( !welt->ebne_planquadrat( sp, k, water_hgt, false, true ) ) { + if( !welt->ebne_planquadrat( player, k, water_hgt, false, true ) ) { return "Tile not empty."; } - gr1->obj_loesche_alle(sp); + gr1->obj_loesche_alle(player); welt->access(k)->kartenboden_setzen( new boden_t(new_pos,new_slope) ); gr1 = welt->lookup_kartenboden(k); welt->set_water_hgt(k, welt->get_grundwasser()-4); @@ -1294,7 +1294,7 @@ const char *tool_setslope_t::tool_set_slope_work( spieler_t *sp, koord3d pos, in leitung_t *lt = gr1->get_leitung(); if( lt ) { // remove maintenance for existing powerline - spieler_t::add_maintenance(lt->get_besitzer(), -lt->get_besch()->get_wartung(), powerline_wt); + player_t::add_maintenance(lt->get_besitzer(), -lt->get_besch()->get_wartung(), powerline_wt); lt->laden_abschliessen(); } @@ -1303,7 +1303,7 @@ const char *tool_setslope_t::tool_set_slope_work( spieler_t *sp, koord3d pos, in // no lakes on slopes ... groundobj_t *obj = gr1->find(); if( obj && obj->get_besch()->get_phases()!=16 ) { - obj->entferne(sp); + obj->entferne(player); delete obj; } // connect canals to sea @@ -1335,7 +1335,7 @@ const char *tool_setslope_t::tool_set_slope_work( spieler_t *sp, koord3d pos, in welt->calc_climate( k, true ); } settings_t const& s = welt->get_settings(); - spieler_t::book_construction_costs(sp, new_slope == RESTORE_SLOPE ? s.cst_alter_land : s.cst_set_slope, k, ignore_wt); + player_t::book_construction_costs(player, new_slope == RESTORE_SLOPE ? s.cst_alter_land : s.cst_set_slope, k, ignore_wt); } // update limits if( welt->min_height > gr1->get_hoehe() ) { @@ -1351,14 +1351,14 @@ const char *tool_setslope_t::tool_set_slope_work( spieler_t *sp, koord3d pos, in // set marker -const char *tool_marker_t::work( spieler_t *sp, koord3d pos ) +const char *tool_marker_t::work( player_t *player, koord3d pos ) { grund_t *gr = welt->lookup_kartenboden(pos.get_2d()); if (gr) { if(!gr->get_text()) { const obj_t* thing = gr->obj_bei(0); - if(thing == NULL || thing->get_besitzer() == sp || (spieler_t::check_owner(thing->get_besitzer(), sp) && (thing->get_typ() != obj_t::gebaeude))) { - gr->obj_add(new label_t(gr->get_pos(), sp, "\0")); + if(thing == NULL || thing->get_besitzer() == player || (player_t::check_owner(thing->get_besitzer(), player) && (thing->get_typ() != obj_t::gebaeude))) { + gr->obj_add(new label_t(gr->get_pos(), player, "\0")); if (is_local_execution()) { gr->find()->zeige_info(); } @@ -1372,7 +1372,7 @@ const char *tool_marker_t::work( spieler_t *sp, koord3d pos ) // show/repair blocks -bool tool_clear_reservation_t::init( spieler_t * ) +bool tool_clear_reservation_t::init( player_t * ) { if (is_local_execution()) { schiene_t::show_reservations = true; @@ -1381,7 +1381,7 @@ bool tool_clear_reservation_t::init( spieler_t * ) return true; } -bool tool_clear_reservation_t::exit( spieler_t * ) +bool tool_clear_reservation_t::exit( player_t * ) { if (is_local_execution()) { schiene_t::show_reservations = false; @@ -1390,7 +1390,7 @@ bool tool_clear_reservation_t::exit( spieler_t * ) return true; } -const char *tool_clear_reservation_t::work( spieler_t *, koord3d pos ) +const char *tool_clear_reservation_t::work( player_t *, koord3d pos ) { grund_t *gr = welt->lookup(pos); if(gr) { @@ -1429,25 +1429,25 @@ const char *tool_clear_reservation_t::work( spieler_t *, koord3d pos ) // transformer for electricity supply -const char* tool_transformer_t::get_tooltip(const spieler_t *) const +const char* tool_transformer_t::get_tooltip(const player_t *) const { settings_t const& s = welt->get_settings(); sprintf(toolstr, "%s, %ld$ (%ld$)", translator::translate("Build drain"), (long)(s.cst_transformer / -100), (long)(welt->scale_with_month_length(s.cst_maintain_transformer)) / -100); return toolstr; } -image_id tool_transformer_t::get_icon(spieler_t*) const +image_id tool_transformer_t::get_icon(player_t*) const { return wegbauer_t::waytype_available( powerline_wt, welt->get_timeline_year_month() ) ? icon : IMG_LEER; } -bool tool_transformer_t::init( spieler_t *) +bool tool_transformer_t::init( player_t *) { return wegbauer_t::waytype_available( powerline_wt, welt->get_timeline_year_month() ); } -const char *tool_transformer_t::check_pos( spieler_t *, koord3d pos ) +const char *tool_transformer_t::check_pos( player_t *, koord3d pos ) { if(grund_t::underground_mode == grund_t::ugm_all && env_t::networkmode) { // clients cannot guess at which height transformer should be build @@ -1462,7 +1462,7 @@ const char *tool_transformer_t::check_pos( spieler_t *, koord3d pos ) } -const char *tool_transformer_t::work( spieler_t *sp, koord3d pos ) +const char *tool_transformer_t::work( player_t *player, koord3d pos ) { DBG_MESSAGE("tool_transformer_t()","called on %d,%d", pos.x, pos.y); @@ -1519,8 +1519,8 @@ const char *tool_transformer_t::work( spieler_t *sp, koord3d pos ) tunnelboden_t* tunnel = new tunnelboden_t(pos, 0); welt->access(k)->boden_hinzufuegen(tunnel); - tunnel->obj_add(new tunnel_t(pos, sp, tunnel_besch)); - spieler_t::add_maintenance( sp, tunnel_besch->get_wartung(), tunnel_besch->get_finance_waytype() ); + tunnel->obj_add(new tunnel_t(pos, player, tunnel_besch)); + player_t::add_maintenance( player, tunnel_besch->get_wartung(), tunnel_besch->get_finance_waytype() ); gr = tunnel; } else { @@ -1529,21 +1529,21 @@ const char *tool_transformer_t::work( spieler_t *sp, koord3d pos ) return "Transformer only on flat bare land!"; } // remove everything on that spot - if(const char *fail = gr->kann_alle_obj_entfernen(sp)) { + if(const char *fail = gr->kann_alle_obj_entfernen(player)) { return fail; } - gr->obj_loesche_alle(sp); + gr->obj_loesche_alle(player); } // transformer will be build on tile pointed to by gr // build source or drain depending on factory type if(fab->get_besch()->is_electricity_producer()) { - pumpe_t *p = new pumpe_t(gr->get_pos(), sp); + pumpe_t *p = new pumpe_t(gr->get_pos(), player); gr->obj_add( p ); p->laden_abschliessen(); } else { - senke_t *s = new senke_t(gr->get_pos(), sp); + senke_t *s = new senke_t(gr->get_pos(), player); gr->obj_add(s); s->laden_abschliessen(); } @@ -1557,7 +1557,7 @@ const char *tool_transformer_t::work( spieler_t *sp, koord3d pos ) * found a new city * @author Hj. Malthaner */ -const char *tool_add_city_t::work( spieler_t *sp, koord3d pos ) +const char *tool_add_city_t::work( player_t *player, koord3d pos ) { CHECK_FUNDS(); @@ -1582,10 +1582,10 @@ const char *tool_add_city_t::work( spieler_t *sp, koord3d pos ) // always belong to player 1 int const citizens = (int)(welt->get_settings().get_mittlere_einwohnerzahl() * 0.9); - // stadt_t *stadt = new stadt_t(welt->get_spieler(1), pos,citizens/10+simrand(2*citizens+1)); + // stadt_t *stadt = new stadt_t(welt->get_player(1), pos,citizens/10+simrand(2*citizens+1)); // always start with 1/10 citizens - stadt_t* stadt = new stadt_t(welt->get_spieler(1), k, citizens / 10); + stadt_t* stadt = new stadt_t(welt->get_player(1), k, citizens / 10); if (stadt->get_buildings() == 0) { delete stadt; return "No suitable ground!"; @@ -1595,7 +1595,7 @@ const char *tool_add_city_t::work( spieler_t *sp, koord3d pos ) stadt->laden_abschliessen(); stadt->verbinde_fabriken(); - spieler_t::book_construction_costs(sp, welt->get_settings().cst_found_city, k, ignore_wt); + player_t::book_construction_costs(player, welt->get_settings().cst_found_city, k, ignore_wt); reliefkarte_t::get_karte()->calc_map(); return NULL; } @@ -1608,9 +1608,9 @@ const char *tool_add_city_t::work( spieler_t *sp, koord3d pos ) } // buy a house -const char *tool_buy_house_t::work( spieler_t *sp, koord3d pos) +const char *tool_buy_house_t::work( player_t *player, koord3d pos) { - if ( sp == welt->get_spieler(1) ) { + if ( player == welt->get_player(1) ) { return ""; } grund_t* gr = welt->lookup_kartenboden(pos.get_2d()); @@ -1620,16 +1620,16 @@ const char *tool_buy_house_t::work( spieler_t *sp, koord3d pos) // since buildings can have more than one tile, we must handle them together gebaeude_t* gb = gr->find(); - if( gb== NULL || gb->get_haustyp()==gebaeude_t::unbekannt || !spieler_t::check_owner(gb->get_besitzer(),sp) ) { + if( gb== NULL || gb->get_haustyp()==gebaeude_t::unbekannt || !player_t::check_owner(gb->get_besitzer(),player) ) { return "Das Feld gehoert\neinem anderen Spieler\n"; } - if( gb->get_besitzer()==sp ) { + if( gb->get_besitzer()==player ) { // I bought this already ... return ""; } - spieler_t *old_owner = gb->get_besitzer(); + player_t *old_owner = gb->get_besitzer(); const haus_tile_besch_t *tile = gb->get_tile(); const haus_besch_t * hb = tile->get_besch(); koord size = hb->get_groesse( tile->get_layout() ); @@ -1641,12 +1641,12 @@ const char *tool_buy_house_t::work( spieler_t *sp, koord3d pos) if(gr) { gebaeude_t *gb_part = gr->find(); // there may be buildings with holes - if( gb_part && gb_part->get_tile()->get_besch()==hb && spieler_t::check_owner(gb_part->get_besitzer(),sp) ) { + if( gb_part && gb_part->get_tile()->get_besch()==hb && player_t::check_owner(gb_part->get_besitzer(),player) ) { sint32 const maint = welt->get_settings().maint_building * hb->get_level(); - spieler_t::add_maintenance(old_owner, -maint, gb->get_waytype()); - spieler_t::add_maintenance(sp, +maint, gb->get_waytype()); - gb->set_besitzer(sp); - spieler_t::book_construction_costs(sp, -maint, k + pos.get_2d(), gb->get_waytype()); + player_t::add_maintenance(old_owner, -maint, gb->get_waytype()); + player_t::add_maintenance(player, +maint, gb->get_waytype()); + gb->set_besitzer(player); + player_t::book_construction_costs(player, -maint, k + pos.get_2d(), gb->get_waytype()); } } } @@ -1657,13 +1657,13 @@ const char *tool_buy_house_t::work( spieler_t *sp, koord3d pos) /* change city size * @author prissi */ -bool tool_change_city_size_t::init( spieler_t * ) +bool tool_change_city_size_t::init( player_t * ) { cursor = atoi(default_param)>0 ? tool_t::general_tool[TOOL_RAISE_LAND]->cursor : tool_t::general_tool[TOOL_LOWER_LAND]->cursor; return true; } -const char *tool_change_city_size_t::work( spieler_t *, koord3d pos ) +const char *tool_change_city_size_t::work( player_t *, koord3d pos ) { stadt_t *city = welt->suche_naechste_stadt(pos.get_2d()); if(city!=NULL) { @@ -1682,20 +1682,20 @@ const char *tool_change_city_size_t::work( spieler_t *, koord3d pos ) /* change climate * @author kieron */ -const char *tool_set_climate_t::get_tooltip(spieler_t const*) const +const char *tool_set_climate_t::get_tooltip(player_t const*) const { char temp[1024]; sprintf( temp, translator::translate( "Set tile climate" ), translator::translate( grund_besch_t::get_climate_name_from_bit((climate)atoi(default_param)) ) ); return tooltip_with_price( temp, welt->get_settings().cst_alter_climate ); } -uint8 tool_set_climate_t::is_valid_pos(spieler_t *sp, const koord3d &, const char *&, const koord3d &) +uint8 tool_set_climate_t::is_valid_pos(player_t *player, const koord3d &, const char *&, const koord3d &) { // no dragging in networkmode but for admin - return env_t::networkmode ? (sp->get_player_nr()==1)+1 : 2; + return env_t::networkmode ? (player->get_player_nr()==1)+1 : 2; } -void tool_set_climate_t::mark_tiles(spieler_t *, const koord3d &start, const koord3d &end) +void tool_set_climate_t::mark_tiles(player_t *, const koord3d &start, const koord3d &end) { koord k1, k2; k1.x = start.x < end.x ? start.x : end.x; @@ -1724,7 +1724,7 @@ void tool_set_climate_t::mark_tiles(spieler_t *, const koord3d &start, const koo } -const char *tool_set_climate_t::do_work( spieler_t *sp, const koord3d &start, const koord3d &end ) +const char *tool_set_climate_t::do_work( player_t *player, const koord3d &start, const koord3d &end ) { int n = 0; // tiles altered climate cl = (climate) atoi(default_param); @@ -1789,7 +1789,7 @@ const char *tool_set_climate_t::do_work( spieler_t *sp, const koord3d &start, co } } if(n>0) { - spieler_t::book_construction_costs(sp, welt->get_settings().cst_alter_climate * n, k, ignore_wt); + player_t::book_construction_costs(player, welt->get_settings().cst_alter_climate * n, k, ignore_wt); } return NULL; } @@ -1798,14 +1798,14 @@ const char *tool_set_climate_t::do_work( spieler_t *sp, const koord3d &start, co /* change water height * @author kieron */ -bool tool_change_water_height_t::init( spieler_t *sp ) +bool tool_change_water_height_t::init( player_t *player ) { cursor = atoi(default_param) > 0 ? tool_t::general_tool[TOOL_RAISE_LAND]->cursor : tool_t::general_tool[TOOL_LOWER_LAND]->cursor; - return !env_t::networkmode || sp->get_player_nr()==1; + return !env_t::networkmode || player->get_player_nr()==1; } -const char *tool_change_water_height_t::work( spieler_t *, koord3d pos ) +const char *tool_change_water_height_t::work( player_t *, koord3d pos ) { if( pos == koord3d::invalid ) { return "Cannot alter water"; @@ -1986,24 +1986,24 @@ const char *tool_change_water_height_t::work( spieler_t *, koord3d pos ) } -char const* tool_plant_tree_t::move(spieler_t* const sp, uint16 const b, koord3d const pos) +char const* tool_plant_tree_t::move(player_t* const player, uint16 const b, koord3d const pos) { if (b==0) { return NULL; } if (env_t::networkmode) { // queue tool for network - nwc_tool_t *nwc = new nwc_tool_t(sp, this, pos, welt->get_steps(), welt->get_map_counter(), false); + nwc_tool_t *nwc = new nwc_tool_t(player, this, pos, welt->get_steps(), welt->get_map_counter(), false); network_send_server(nwc); return NULL; } else { - return work( sp, pos ); + return work( player, pos ); } } -const char *tool_plant_tree_t::work( spieler_t *sp, koord3d pos ) +const char *tool_plant_tree_t::work( player_t *player, koord3d pos ) { koord k(pos.get_2d()); @@ -2022,7 +2022,7 @@ const char *tool_plant_tree_t::work( spieler_t *sp, koord3d pos ) besch = baum_t::find_tree(default_param+3); } if(besch && baum_t::plant_tree_on_coordinate( k, besch, check_climates, random_age ) ) { - spieler_t::book_construction_costs(sp, welt->get_settings().cst_remove_tree, k, ignore_wt); + player_t::book_construction_costs(player, welt->get_settings().cst_remove_tree, k, ignore_wt); return NULL; } return ""; @@ -2037,7 +2037,7 @@ const char *tool_plant_tree_t::work( spieler_t *sp, koord3d pos ) * So if there is a halt, then it must be either public or ours! * @author prissi */ -static const char *tool_fahrplan_insert_aux(karte_t *welt, spieler_t *sp, koord3d pos, schedule_t *fpl, bool append) +static const char *tool_fahrplan_insert_aux(karte_t *welt, player_t *player, koord3d pos, schedule_t *fpl, bool append) { if(fpl == NULL) { dbg->warning("tool_fahrplan_insert_aux()","Schedule is (null), doing nothing"); @@ -2056,14 +2056,14 @@ static const char *tool_fahrplan_insert_aux(karte_t *welt, spieler_t *sp, koord3 if( w==NULL && fpl->get_waytype()==tram_wt ) { w = bd->get_weg( track_wt ); } - if( w!=NULL && w->get_besitzer()!=welt->get_spieler(1) && !spieler_t::check_owner(w->get_besitzer(),sp) ) { + if( w!=NULL && w->get_besitzer()!=welt->get_player(1) && !player_t::check_owner(w->get_besitzer(),player) ) { return "Das Feld gehoert\neinem anderen Spieler\n"; } - if( bd->get_depot() && !spieler_t::check_owner( bd->get_depot()->get_besitzer(), sp ) ) { + if( bd->get_depot() && !player_t::check_owner( bd->get_depot()->get_besitzer(), player ) ) { return "Das Feld gehoert\neinem anderen Spieler\n"; } } - if( bd->is_halt() && !spieler_t::check_owner( sp, bd->get_halt()->get_besitzer()) ) { + if( bd->is_halt() && !player_t::check_owner( player, bd->get_halt()->get_besitzer()) ) { return "Das Feld gehoert\neinem anderen Spieler\n"; } // ok, now we have a valid ground @@ -2077,14 +2077,14 @@ static const char *tool_fahrplan_insert_aux(karte_t *welt, spieler_t *sp, koord3 return NULL; } -const char *tool_schedule_add_t::work( spieler_t *sp, koord3d pos ) +const char *tool_schedule_add_t::work( player_t *player, koord3d pos ) { - return tool_fahrplan_insert_aux( welt, sp, pos, (schedule_t*)const_cast(default_param), true ); + return tool_fahrplan_insert_aux( welt, player, pos, (schedule_t*)const_cast(default_param), true ); } -const char *tool_schedule_ins_t::work( spieler_t *sp, koord3d pos ) +const char *tool_schedule_ins_t::work( player_t *player, koord3d pos ) { - return tool_fahrplan_insert_aux( welt, sp, pos, (schedule_t*)const_cast(default_param), false ); + return tool_fahrplan_insert_aux( welt, player, pos, (schedule_t*)const_cast(default_param), false ); } @@ -2113,14 +2113,14 @@ const weg_besch_t *tool_build_way_t::get_besch( uint16 timeline_year_month, bool return besch; } -image_id tool_build_way_t::get_icon(spieler_t *) const +image_id tool_build_way_t::get_icon(player_t *) const { const weg_besch_t *besch = wegbauer_t::get_besch(default_param,0); const bool is_tram = besch ? (besch->get_wtyp()==tram_wt) || (besch->get_styp() == weg_t::type_tram) : false; return (grund_t::underground_mode==grund_t::ugm_all && !is_tram ) ? IMG_LEER : icon; } -const char* tool_build_way_t::get_tooltip(const spieler_t *) const +const char* tool_build_way_t::get_tooltip(const player_t *) const { const weg_besch_t *besch = get_besch(welt->get_timeline_year_month(),false); if (besch == NULL) { @@ -2134,9 +2134,9 @@ const char* tool_build_way_t::get_tooltip(const spieler_t *) const // default ways are not initialized synchronously for different clients // always return the name of a way, never the string containing the waytype -const char* tool_build_way_t::get_default_param(spieler_t *sp) const +const char* tool_build_way_t::get_default_param(player_t *player) const { - if (sp==NULL) { + if (player==NULL) { return default_param; } if (besch) { @@ -2167,9 +2167,9 @@ bool tool_build_way_t::is_selected() const return (selected && selected->get_besch(welt->get_timeline_year_month(),false) == get_besch(welt->get_timeline_year_month(),false)); } -bool tool_build_way_t::init( spieler_t *sp ) +bool tool_build_way_t::init( player_t *player ) { - two_click_tool_t::init( sp ); + two_click_tool_t::init( player ); if( ok_sound == NO_SOUND ) { ok_sound = SFX_CASH; } @@ -2179,7 +2179,7 @@ bool tool_build_way_t::init( spieler_t *sp ) if( besch && besch->get_cursor()->get_bild_nr(0) != IMG_LEER ) { cursor = besch->get_cursor()->get_bild_nr(0); } - if( besch && !besch->is_available(welt->get_timeline_year_month()) && sp!=NULL && sp!=welt->get_spieler(1) ) { + if( besch && !besch->is_available(welt->get_timeline_year_month()) && player!=NULL && player!=welt->get_player(1) ) { // non available way => fail return false; } @@ -2188,7 +2188,7 @@ bool tool_build_way_t::init( spieler_t *sp ) waytype_t tool_build_way_t::get_waytype() const { - const weg_besch_t *besch = get_besch( spieler_t::get_welt()->get_timeline_year_month(), false ); + const weg_besch_t *besch = get_besch( player_t::get_welt()->get_timeline_year_month(), false ); waytype_t wt = besch ? besch->get_wtyp() : invalid_wt; if ( wt==track_wt && besch->get_styp()==7 ) { wt = tram_wt; @@ -2196,7 +2196,7 @@ waytype_t tool_build_way_t::get_waytype() const return wt; } -uint8 tool_build_way_t::is_valid_pos( spieler_t *sp, const koord3d &pos, const char *&error, const koord3d & ) +uint8 tool_build_way_t::is_valid_pos( player_t *player, const koord3d &pos, const char *&error, const koord3d & ) { error = NULL; grund_t *gr=welt->lookup(pos); @@ -2230,15 +2230,15 @@ uint8 tool_build_way_t::is_valid_pos( spieler_t *sp, const koord3d &pos, const if( besch->get_wtyp() == road_wt || besch->get_wtyp() == water_wt ) { return 2; } - error = way->ist_entfernbar(sp); + error = way->ist_entfernbar(player); return error==NULL ? 2 : 0; } // check for ownership but ignore moving things - if(sp!=NULL) { + if(player!=NULL) { for(uint8 i=0; iobj_count(); i++) { obj_t* dt = gr->obj_bei(i); - if (!dt->is_moving() && dt->ist_entfernbar(sp)!=NULL) { - error = dt->ist_entfernbar(sp); // "Das Feld gehoert\neinem anderen Spieler\n"; + if (!dt->is_moving() && dt->ist_entfernbar(player)!=NULL) { + error = dt->ist_entfernbar(player); // "Das Feld gehoert\neinem anderen Spieler\n"; return 0; } } @@ -2279,9 +2279,9 @@ void tool_build_way_t::calc_route( wegbauer_t &bauigel, const koord3d &start, co DBG_MESSAGE("tool_build_way_t()", "builder found route with %d squares length.", bauigel.get_count()); } -const char *tool_build_way_t::do_work( spieler_t *sp, const koord3d &start, const koord3d &end ) +const char *tool_build_way_t::do_work( player_t *player, const koord3d &start, const koord3d &end ) { - wegbauer_t bauigel(sp); + wegbauer_t bauigel(player); calc_route( bauigel, start, end ); if( bauigel.get_route().get_count()>1 ) { welt->mute_sound(true); @@ -2293,9 +2293,9 @@ const char *tool_build_way_t::do_work( spieler_t *sp, const koord3d &start, cons return ""; } -void tool_build_way_t::mark_tiles( spieler_t *sp, const koord3d &start, const koord3d &end ) +void tool_build_way_t::mark_tiles( player_t *player, const koord3d &start, const koord3d &end ) { - wegbauer_t bauigel(sp); + wegbauer_t bauigel(player); calc_route( bauigel, start, end ); uint8 offset = (besch->get_styp() == 1 && besch->get_wtyp() != air_wt) ? welt->get_settings().get_way_height_clearance() : 0; @@ -2341,9 +2341,9 @@ const weg_besch_t *tool_build_cityroad::get_besch(uint16,bool) const return welt->get_city_road(); } -const char *tool_build_cityroad::do_work( spieler_t *sp, const koord3d &start, const koord3d &end ) +const char *tool_build_cityroad::do_work( player_t *player, const koord3d &start, const koord3d &end ) { - wegbauer_t bauigel(sp); + wegbauer_t bauigel(player); bauigel.set_build_sidewalk(true); calc_route( bauigel, start, end ); if( bauigel.get_route().get_count()>1 ) { @@ -2358,7 +2358,7 @@ const char *tool_build_cityroad::do_work( spieler_t *sp, const koord3d &start, c /* bridge construction */ -const char* tool_build_bridge_t::get_tooltip(const spieler_t *) const +const char* tool_build_bridge_t::get_tooltip(const player_t *) const { const bruecke_besch_t * besch = brueckenbauer_t::get_besch(default_param); if (besch == NULL) { @@ -2382,31 +2382,31 @@ waytype_t tool_build_bridge_t::get_waytype() const } -bool tool_build_bridge_t::init( spieler_t *sp ) +bool tool_build_bridge_t::init( player_t *player ) { - two_click_tool_t::init( sp ); + two_click_tool_t::init( player ); // now get current besch const bruecke_besch_t *besch = brueckenbauer_t::get_besch(default_param); - if( besch && !besch->is_available(welt->get_timeline_year_month()) && sp!=NULL && sp!=welt->get_spieler(1) ) { + if( besch && !besch->is_available(welt->get_timeline_year_month()) && player!=NULL && player!=welt->get_player(1) ) { return false; } return besch!=NULL; } -const char *tool_build_bridge_t::do_work( spieler_t *sp, const koord3d &start, const koord3d &end ) +const char *tool_build_bridge_t::do_work( player_t *player, const koord3d &start, const koord3d &end ) { const bruecke_besch_t *besch = brueckenbauer_t::get_besch(default_param); if (end==koord3d::invalid) { - return brueckenbauer_t::baue( sp, start, besch ); + return brueckenbauer_t::baue( player, start, besch ); } else { const koord zv(ribi_typ(end-start)); sint8 bridge_height; const char *error; - koord3d end2 = brueckenbauer_t::finde_ende(sp, start, zv, besch, error, bridge_height, false, koord_distance(start, end), is_ctrl_pressed()); + koord3d end2 = brueckenbauer_t::finde_ende(player, start, zv, besch, error, bridge_height, false, koord_distance(start, end), is_ctrl_pressed()); assert(end2 == end); - brueckenbauer_t::baue_bruecke( sp, start, end, zv, bridge_height, besch, wegbauer_t::weg_search(besch->get_waytype(), besch->get_topspeed(), welt->get_timeline_year_month(), weg_t::type_flat)); + brueckenbauer_t::baue_bruecke( player, start, end, zv, bridge_height, besch, wegbauer_t::weg_search(besch->get_waytype(), besch->get_topspeed(), welt->get_timeline_year_month(), weg_t::type_flat)); return NULL; // all checks are performed before building. } } @@ -2419,14 +2419,14 @@ void tool_build_bridge_t::rdwr_custom_data(memory_rw_t *packet) ribi = (ribi_t::ribi)i; } -void tool_build_bridge_t::mark_tiles( spieler_t *sp, const koord3d &start, const koord3d &end ) +void tool_build_bridge_t::mark_tiles( player_t *player, const koord3d &start, const koord3d &end ) { const ribi_t::ribi ribi_mark = ribi_typ(end-start); const koord zv(ribi_mark); const bruecke_besch_t *besch = brueckenbauer_t::get_besch(default_param); const char *error; sint8 bridge_height; - koord3d end2 = brueckenbauer_t::finde_ende(sp, start, zv, besch, error, bridge_height, false, koord_distance(start, end), is_ctrl_pressed()); + koord3d end2 = brueckenbauer_t::finde_ende(player, start, zv, besch, error, bridge_height, false, koord_distance(start, end), is_ctrl_pressed()); assert(end == end2); @@ -2441,7 +2441,7 @@ void tool_build_bridge_t::mark_tiles( spieler_t *sp, const koord3d &start, cons const hang_t::typ slope = gr->get_grund_hang(); uint8 max_height = slope ? hang_t::max_diff(slope) : bridge_height; - zeiger_t *way = new zeiger_t(start, sp ); + zeiger_t *way = new zeiger_t(start, player ); const bruecke_besch_t::img_t img0 = besch->get_end( slope, slope, hang_typ(zv)*max_height ); gr->obj_add( way ); @@ -2477,7 +2477,7 @@ void tool_build_bridge_t::mark_tiles( spieler_t *sp, const koord3d &start, cons gr->set_grund_hang( 0 ); welt->access(pos.get_2d())->boden_hinzufuegen(gr); } - zeiger_t *way = new zeiger_t(pos, sp ); + zeiger_t *way = new zeiger_t(pos, player ); gr->obj_add( way ); grund_t *kb = welt->lookup_kartenboden(pos.get_2d()); sint16 height = pos.z - kb->get_pos().z; @@ -2499,7 +2499,7 @@ void tool_build_bridge_t::mark_tiles( spieler_t *sp, const koord3d &start, cons const uint8 end_max_height = end_slope ? ((end_slope & 7) ? 1 : 2) : (pos.z-end.z); if( gr->ist_karten_boden() && end.z + end_max_height == start.z + max_height ) { - zeiger_t *way = new zeiger_t(end, sp ); + zeiger_t *way = new zeiger_t(end, player ); const bruecke_besch_t::img_t img1 = besch->get_end( end_slope, end_slope, end_slope?0:(pos.z-end.z)*hang_typ(-zv) ); gr->obj_add( way ); way->set_bild(besch->get_hintergrund(img1, 0)); @@ -2535,14 +2535,14 @@ void tool_build_bridge_t::mark_tiles( spieler_t *sp, const koord3d &start, cons win_set_static_tooltip( tooltip_with_price("Building costs estimates", costs ) ); } -uint8 tool_build_bridge_t::is_valid_pos( spieler_t *sp, const koord3d &pos, const char *&error, const koord3d &start ) +uint8 tool_build_bridge_t::is_valid_pos( player_t *player, const koord3d &pos, const char *&error, const koord3d &start ) { const bruecke_besch_t *besch = brueckenbauer_t::get_besch(default_param); const waytype_t wt = besch->get_waytype(); error = NULL; grund_t *gr = welt->lookup(pos); - if( gr==NULL || !hang_t::ist_wegbar(gr->get_grund_hang()) || !brueckenbauer_t::ist_ende_ok( sp, gr, wt, (is_first_click() ? 0 : ribi_typ(pos-start)) ) ) { + if( gr==NULL || !hang_t::ist_wegbar(gr->get_grund_hang()) || !brueckenbauer_t::ist_ende_ok( player, gr, wt, (is_first_click() ? 0 : ribi_typ(pos-start)) ) ) { return 0; } @@ -2629,7 +2629,7 @@ uint8 tool_build_bridge_t::is_valid_pos( spieler_t *sp, const koord3d &pos, con // check whether we can build a bridge here const char *error = NULL; sint8 bridge_height; - koord3d end = brueckenbauer_t::finde_ende(sp, start, koord(test), besch, error, bridge_height, false, koord_distance(start, pos), is_ctrl_pressed()); + koord3d end = brueckenbauer_t::finde_ende(player, start, koord(test), besch, error, bridge_height, false, koord_distance(start, pos), is_ctrl_pressed()); if (end!=pos) { return 0; } @@ -2639,7 +2639,7 @@ uint8 tool_build_bridge_t::is_valid_pos( spieler_t *sp, const koord3d &pos, con /* more difficult, since this builds also underground ways */ -const char* tool_build_tunnel_t::get_tooltip(const spieler_t *) const +const char* tool_build_tunnel_t::get_tooltip(const player_t *) const { const tunnel_besch_t * besch = tunnelbauer_t::get_besch(default_param); tooltip_with_price_maintenance( welt, besch->get_name(), -besch->get_preis(), besch->get_wartung() ); @@ -2658,25 +2658,25 @@ waytype_t tool_build_tunnel_t::get_waytype() const } -bool tool_build_tunnel_t::init( spieler_t *sp ) +bool tool_build_tunnel_t::init( player_t *player ) { - two_click_tool_t::init( sp ); + two_click_tool_t::init( player ); // now get current besch const tunnel_besch_t * besch = tunnelbauer_t::get_besch(default_param); - if( besch && !besch->is_available(welt->get_timeline_year_month()) && sp!=NULL && sp!=welt->get_spieler(1) ) { + if( besch && !besch->is_available(welt->get_timeline_year_month()) && player!=NULL && player!=welt->get_player(1) ) { return false; } return besch!=NULL; } -const char *tool_build_tunnel_t::check_pos( spieler_t *sp, koord3d pos) +const char *tool_build_tunnel_t::check_pos( player_t *player, koord3d pos) { if (grund_t::underground_mode == grund_t::ugm_all) { return NULL; } else { - return two_click_tool_t::check_pos(sp, pos); + return two_click_tool_t::check_pos(player, pos); } } @@ -2697,13 +2697,13 @@ void tool_build_tunnel_t::calc_route( wegbauer_t &bauigel, const koord3d &start, bauigel.calc_straight_route(start,end); } -const char *tool_build_tunnel_t::do_work( spieler_t *sp, const koord3d &start, const koord3d &end ) +const char *tool_build_tunnel_t::do_work( player_t *player, const koord3d &start, const koord3d &end ) { if( end == koord3d::invalid ) { // Build tunnel mouths if (welt->lookup_kartenboden(start.get_2d())->get_hoehe() == start.z) { const tunnel_besch_t *besch = tunnelbauer_t::get_besch(default_param); - return tunnelbauer_t::baue( sp, start.get_2d(), besch, !is_ctrl_pressed() ); + return tunnelbauer_t::baue( player, start.get_2d(), besch, !is_ctrl_pressed() ); } else { return ""; @@ -2711,7 +2711,7 @@ const char *tool_build_tunnel_t::do_work( spieler_t *sp, const koord3d &start, c } else { // Build tunnels - wegbauer_t bauigel(sp); + wegbauer_t bauigel(player); calc_route( bauigel, start, end ); welt->mute_sound(true); bauigel.baue(); @@ -2721,7 +2721,7 @@ const char *tool_build_tunnel_t::do_work( spieler_t *sp, const koord3d &start, c } } -uint8 tool_build_tunnel_t::is_valid_pos( spieler_t *sp, const koord3d &pos, const char *&error, const koord3d & ) +uint8 tool_build_tunnel_t::is_valid_pos( player_t *player, const koord3d &pos, const char *&error, const koord3d & ) { if( !is_first_click() ) { error = NULL; @@ -2740,8 +2740,8 @@ uint8 tool_build_tunnel_t::is_valid_pos( spieler_t *sp, const koord3d &pos, con error = "No suitable ground!"; return 0; } - wegbauer_t bauigel(sp); - if(!bauigel.check_owner( w->get_besitzer(), sp )) { + wegbauer_t bauigel(player); + if(!bauigel.check_owner( w->get_besitzer(), player )) { error = "Das Feld gehoert\neinem anderen Spieler\n"; return 0; } @@ -2762,9 +2762,9 @@ uint8 tool_build_tunnel_t::is_valid_pos( spieler_t *sp, const koord3d &pos, con } } -void tool_build_tunnel_t::mark_tiles( spieler_t *sp, const koord3d &start, const koord3d &end ) +void tool_build_tunnel_t::mark_tiles( player_t *player, const koord3d &start, const koord3d &end ) { - wegbauer_t bauigel(sp); + wegbauer_t bauigel(player); calc_route( bauigel, start, end ); const tunnel_besch_t *besch = tunnelbauer_t::get_besch(default_param); @@ -2792,7 +2792,7 @@ void tool_build_tunnel_t::mark_tiles( spieler_t *sp, const koord3d &start, cons } ribi_t::ribi zeige = gr->get_weg_ribi_unmasked(wb->get_wtyp()) | bauigel.get_route().get_ribi( j ); - zeiger_t *way = new zeiger_t(pos, sp ); + zeiger_t *way = new zeiger_t(pos, player ); if(gr->get_weg_hang()) { way->set_bild( wb->get_hang_bild_nr(gr->get_weg_hang(),0) ); } @@ -2812,7 +2812,7 @@ void tool_build_tunnel_t::mark_tiles( spieler_t *sp, const koord3d &start, cons /* removes a way like a driving car ... */ -char const* tool_wayremover_t::get_tooltip(spieler_t const*) const +char const* tool_wayremover_t::get_tooltip(player_t const*) const { switch(atoi(default_param)) { case road_wt: return translator::translate("remove roads"); @@ -2828,7 +2828,7 @@ char const* tool_wayremover_t::get_tooltip(spieler_t const*) const return NULL; } -image_id tool_wayremover_t::get_icon(spieler_t *) const +image_id tool_wayremover_t::get_icon(player_t *) const { if( default_param && wegbauer_t::waytype_available( (waytype_t)atoi(default_param), welt->get_timeline_year_month() ) ) { return icon; @@ -2854,37 +2854,37 @@ class scenario_checker_t : public fahrer_t { fahrer_t *other; scenario_t *scenario; uint16 id; - spieler_t *sp; + player_t *player; ~scenario_checker_t() { delete other; } /** * checks for active scenario, * @returns scenario_checker_t if scenario active, the supplied test_driver otherwise */ - static fahrer_t* apply(fahrer_t *test_driver, spieler_t *sp, tool_t *tool) { + static fahrer_t* apply(fahrer_t *test_driver, player_t *player, tool_t *tool) { karte_t *welt = world(); if (is_scenario()) { scenario_checker_t *td2 = new scenario_checker_t(); td2->other = test_driver; td2->scenario = welt->get_scenario(); td2->id = tool->get_id(); - td2->sp = sp; + td2->player = player; return td2; } return test_driver; } private: - bool ist_befahrbar(const grund_t* gr) const { return other->ist_befahrbar(gr) && scenario->is_work_allowed_here(sp, id, other->get_waytype(), gr->get_pos())==NULL;} + bool ist_befahrbar(const grund_t* gr) const { return other->ist_befahrbar(gr) && scenario->is_work_allowed_here(player, id, other->get_waytype(), gr->get_pos())==NULL;} virtual ribi_t::ribi get_ribi(const grund_t* gr) const { return other->get_ribi(gr); } virtual waytype_t get_waytype() const { return other->get_waytype(); } virtual int get_kosten(const grund_t *gr, const sint32 c, koord p) const { return other->get_kosten(gr,c,p); } virtual bool ist_ziel(const grund_t *gr,const grund_t *gr2) const { return other->ist_ziel(gr,gr2); } }; -void tool_wayremover_t::mark_tiles( spieler_t *sp, const koord3d &start, const koord3d &end ) +void tool_wayremover_t::mark_tiles( player_t *player, const koord3d &start, const koord3d &end ) { route_t verbindung; - bool can_built = calc_route( verbindung, sp, start, end ); + bool can_built = calc_route( verbindung, player, start, end ); if( can_built ) { FOR(vector_tpl, const& pos, verbindung.get_route()) { zeiger_t *marker = new zeiger_t(pos, NULL ); @@ -2896,11 +2896,11 @@ void tool_wayremover_t::mark_tiles( spieler_t *sp, const koord3d &start, const k } } -uint8 tool_wayremover_t::is_valid_pos( spieler_t *sp, const koord3d &pos, const char *&error, const koord3d & ) +uint8 tool_wayremover_t::is_valid_pos( player_t *player, const koord3d &pos, const char *&error, const koord3d & ) { // search for starting ground waytype_t wt = get_waytype(); - grund_t *gr=tool_intern_koord_to_weg_grund(sp,welt,pos,wt); + grund_t *gr=tool_intern_koord_to_weg_grund(player,welt,pos,wt); if(gr==NULL) { DBG_MESSAGE("tool_wayremover_t()", "no ground on %i,%i",pos.x, pos.y); // wrong ground or not this way here => exit @@ -2912,7 +2912,7 @@ uint8 tool_wayremover_t::is_valid_pos( spieler_t *sp, const koord3d &pos, const return 0; } if(is_scenario()) { - error = welt->get_scenario()->is_work_allowed_here(sp, get_id(), wt, pos); + error = welt->get_scenario()->is_work_allowed_here(player, get_id(), wt, pos); if (error) { dbg->warning("tool_wayremover_t::is_within_limits()", error); return 0; @@ -2922,7 +2922,7 @@ uint8 tool_wayremover_t::is_valid_pos( spieler_t *sp, const koord3d &pos, const return 2; } -bool tool_wayremover_t::calc_route( route_t &verbindung, spieler_t *sp, const koord3d &start, const koord3d &end ) +bool tool_wayremover_t::calc_route( route_t &verbindung, player_t *player, const koord3d &start, const koord3d &end ) { waytype_t wt = get_waytype(); if (wt == tram_wt) { @@ -2941,14 +2941,14 @@ bool tool_wayremover_t::calc_route( route_t &verbindung, spieler_t *sp, const ko fahrer_t* test_driver; if( wt!=powerline_wt ) { vehikel_besch_t remover_besch(wt, 500, vehikel_besch_t::diesel ); - vehikel_t *driver = vehikelbauer_t::baue(start, sp, NULL, &remover_besch); + vehikel_t *driver = vehikelbauer_t::baue(start, player, NULL, &remover_besch); driver->set_flag( obj_t::not_on_map ); test_driver = driver; } else { test_driver = new electron_t(); } - test_driver = scenario_checker_t::apply(test_driver, sp, this); + test_driver = scenario_checker_t::apply(test_driver, player, this); verbindung.calc_route(welt, start, end, test_driver, 0, 0); delete test_driver; @@ -2989,18 +2989,18 @@ bool tool_wayremover_t::calc_route( route_t &verbindung, spieler_t *sp, const ko // special case: stations - take care not to produce station without any way const bool lonely_station = type==obj_t::gebaeude && !gr->has_two_ways(); if (check_all || obj_wt == wt || lonely_station) { - can_delete = (calc_route_error = obj->ist_entfernbar(sp)) == NULL; + can_delete = (calc_route_error = obj->ist_entfernbar(player)) == NULL; } } // all other stuff else { - can_delete = (calc_route_error = obj->ist_entfernbar(sp)) == NULL; + can_delete = (calc_route_error = obj->ist_entfernbar(player)) == NULL; } } } else { // for powerline: only a ground and a powerline to remove - if( gr==NULL || gr->get_leitung()==NULL || (calc_route_error = gr->get_leitung()->ist_entfernbar(sp))!=NULL ) { + if( gr==NULL || gr->get_leitung()==NULL || (calc_route_error = gr->get_leitung()->ist_entfernbar(player))!=NULL ) { can_delete = false; break; } @@ -3012,11 +3012,11 @@ bool tool_wayremover_t::calc_route( route_t &verbindung, spieler_t *sp, const ko return can_delete; } -const char *tool_wayremover_t::do_work( spieler_t *sp, const koord3d &start, const koord3d &end ) +const char *tool_wayremover_t::do_work( player_t *player, const koord3d &start, const koord3d &end ) { waytype_t wt = get_waytype(); route_t verbindung; - if( !calc_route( verbindung, sp, start, end ) ) { + if( !calc_route( verbindung, player, start, end ) ) { DBG_MESSAGE("tool_wayremover_t()","no route found"); if (calc_route_error && *calc_route_error) { return calc_route_error; @@ -3039,7 +3039,7 @@ const char *tool_wayremover_t::do_work( spieler_t *sp, const koord3d &start, con if(gr->find()->get_besch()->get_waytype()==wt) { if( brueckenbauer_t::is_start_of_bridge(gr) ) { const char *err = NULL; - err = brueckenbauer_t::remove(sp,verbindung.position_bei(i),wt); + err = brueckenbauer_t::remove(player,verbindung.position_bei(i),wt); if(err) { return err; } @@ -3066,12 +3066,12 @@ const char *tool_wayremover_t::do_work( spieler_t *sp, const koord3d &start, con if( wt!=powerline_wt ) { if(!gr->get_flag(grund_t::is_kartenboden) && (gr->get_typ()==grund_t::tunnelboden || gr->get_typ()==grund_t::monorailboden) && gr->get_weg_nr(0)->get_waytype()==wt) { - can_delete &= gr->remove_everything_from_way(sp,wt,rem); + can_delete &= gr->remove_everything_from_way(player,wt,rem); if(can_delete && gr->get_weg(wt)==NULL) { if(gr->get_weg_nr(0)!=0) { - gr->remove_everything_from_way(sp,gr->get_weg_nr(0)->get_waytype(),ribi_t::keine); + gr->remove_everything_from_way(player,gr->get_weg_nr(0)->get_waytype(),ribi_t::keine); } - gr->obj_loesche_alle(sp); + gr->obj_loesche_alle(player); gr->mark_image_dirty(); if (gr->is_visible() && gr->get_typ()==grund_t::tunnelboden && i>0) { // visibility test does not influence execution grund_t *bd = welt->access(verbindung.position_bei(i-1).get_2d())->get_kartenboden(); @@ -3084,18 +3084,18 @@ const char *tool_wayremover_t::do_work( spieler_t *sp, const koord3d &start, con } } else { - can_delete &= gr->remove_everything_from_way(sp,wt,rem); + can_delete &= gr->remove_everything_from_way(player,wt,rem); } } else { leitung_t *lt = gr->get_leitung(); if( lt && (rem<->get_ribi())==0 ) { // remove only single connections - lt->entferne(sp); + lt->entferne(player); delete lt; // delete tunnel ground too, if empty if (gr->get_typ()==grund_t::tunnelboden) { - gr->obj_loesche_alle(sp); + gr->obj_loesche_alle(player); gr->mark_image_dirty(); if (!gr->get_flag(grund_t::is_kartenboden)) { welt->access(gr->get_pos().get_2d())->boden_entfernen(gr); @@ -3123,7 +3123,7 @@ const char *tool_wayremover_t::do_work( spieler_t *sp, const koord3d &start, con /* add catenary during construction */ const way_obj_besch_t *tool_build_wayobj_t::default_electric = NULL; -const char* tool_build_wayobj_t::get_tooltip(const spieler_t *) const +const char* tool_build_wayobj_t::get_tooltip(const player_t *) const { if( build ) { const way_obj_besch_t *besch = get_besch(); @@ -3174,9 +3174,9 @@ bool tool_build_wayobj_t::is_selected() const return (selected && selected->build==build && selected->get_besch() == get_besch()); } -bool tool_build_wayobj_t::init( spieler_t *sp ) +bool tool_build_wayobj_t::init( player_t *player ) { - two_click_tool_t::init( sp ); + two_click_tool_t::init( player ); if( build ) { besch = get_besch(); @@ -3194,13 +3194,13 @@ bool tool_build_wayobj_t::init( spieler_t *sp ) } } -bool tool_build_wayobj_t::calc_route( route_t &verbindung, spieler_t *sp, const koord3d& start, const koord3d& to ) +bool tool_build_wayobj_t::calc_route( route_t &verbindung, player_t *player, const koord3d& start, const koord3d& to ) { // get a default vehikel vehikel_besch_t remover_besch( wt, 500, vehikel_besch_t::diesel ); - vehikel_t* test_vehicle = vehikelbauer_t::baue(start, sp, NULL, &remover_besch); + vehikel_t* test_vehicle = vehikelbauer_t::baue(start, player, NULL, &remover_besch); test_vehicle->set_flag( obj_t::not_on_map ); - fahrer_t* test_driver = scenario_checker_t::apply(test_vehicle, sp, this); + fahrer_t* test_driver = scenario_checker_t::apply(test_vehicle, player, this); bool can_built; if( start != to ) { @@ -3215,10 +3215,10 @@ bool tool_build_wayobj_t::calc_route( route_t &verbindung, spieler_t *sp, const return can_built; } -uint8 tool_build_wayobj_t::is_valid_pos( spieler_t * sp, const koord3d& pos, const char *&error, const koord3d & ) +uint8 tool_build_wayobj_t::is_valid_pos( player_t* player, const koord3d& pos, const char *&error, const koord3d & ) { // search for starting ground - grund_t *gr=tool_intern_koord_to_weg_grund(sp, welt, pos, wt ); + grund_t *gr=tool_intern_koord_to_weg_grund(player, welt, pos, wt ); if( gr == NULL ) { DBG_MESSAGE("tool_build_wayobj_t::is_within_limits()", "no ground on %s",pos.get_str()); // wrong ground or not this way here => exit @@ -3228,10 +3228,10 @@ uint8 tool_build_wayobj_t::is_valid_pos( spieler_t * sp, const koord3d& pos, con return 2; } -void tool_build_wayobj_t::mark_tiles( spieler_t * sp, const koord3d &start, const koord3d &end ) +void tool_build_wayobj_t::mark_tiles( player_t* player, const koord3d &start, const koord3d &end ) { route_t verbindung; - bool can_built = calc_route( verbindung, sp, start, end ); + bool can_built = calc_route( verbindung, player, start, end ); if( can_built ) { sint32 cost_estimate = 0; @@ -3288,10 +3288,10 @@ void tool_build_wayobj_t::mark_tiles( spieler_t * sp, const koord3d &start, cons } } -const char *tool_build_wayobj_t::do_work( spieler_t * sp, const koord3d &start, const koord3d &end ) +const char *tool_build_wayobj_t::do_work( player_t* player, const koord3d &start, const koord3d &end ) { route_t verbindung; - bool can_built = calc_route( verbindung, sp, start, end ); + bool can_built = calc_route( verbindung, player, start, end ); DBG_MESSAGE("tool_build_wayobj_t::work()","route search returned %d",can_built); if(!can_built) { @@ -3302,13 +3302,13 @@ const char *tool_build_wayobj_t::do_work( spieler_t * sp, const koord3d &start, koord3d_vector_t const& r = verbindung.get_route(); for(uint32 i=0; ilookup(r[i])->find()) { - const char *err = wo->ist_entfernbar( sp ); + const char *err = wo->ist_entfernbar( player ); if( !err ) { - wo->entferne( sp ); + wo->entferne( player ); delete wo; } } @@ -3329,7 +3329,7 @@ const char *tool_build_wayobj_t::do_work( spieler_t * sp, const koord3d &start, /* build all kind of station extension buildings */ -const char *tool_build_station_t::tool_station_building_aux(spieler_t *sp, bool extend_public_halt, koord3d pos, const haus_besch_t *besch, sint8 rotation ) +const char *tool_build_station_t::tool_station_building_aux(player_t *player, bool extend_public_halt, koord3d pos, const haus_besch_t *besch, sint8 rotation ) { koord k = pos.get_2d(); @@ -3339,9 +3339,9 @@ const char *tool_build_station_t::tool_station_building_aux(spieler_t *sp, bool } DBG_MESSAGE("tool_station_building_aux()", "building mail office/station building on square %d,%d", k.x, k.y); - // Player sp pays for the construction + // Player pays for the construction // but we try to extend stations of Player new_owner that may be the public player - spieler_t *new_owner = extend_public_halt ? welt->get_spieler(1) : sp; + player_t *new_owner = extend_public_halt ? welt->get_player(1) : player; koord offsets; halthandle_t halt; @@ -3370,7 +3370,7 @@ DBG_MESSAGE("tool_station_building_aux()", "building mail office/station buildin for( uint8 i=0; i < pl->get_boden_count(); i++ ) { halthandle_t test_halt = pl->get_boden_bei(i)->get_halt(); if(test_halt.is_bound()) { - if(!spieler_t::check_owner( new_owner, test_halt->get_besitzer())) { + if(!player_t::check_owner( new_owner, test_halt->get_besitzer())) { // there is another player's halt ok = false; msg = "Das Feld gehoert\neinem anderen Spieler\n"; @@ -3483,7 +3483,7 @@ DBG_MESSAGE("tool_station_building_aux()", "building mail office/station buildin const planquadrat_t *pl = welt->access( k-offsets+koord(x,y) ); for( uint8 i=0; i < pl->get_boden_count(); i++ ) { halthandle_t test_halt = pl->get_boden_bei(i)->get_halt(); - if( test_halt.is_bound() && spieler_t::check_owner( new_owner, test_halt->get_besitzer()) ) { + if( test_halt.is_bound() && player_t::check_owner( new_owner, test_halt->get_besitzer()) ) { halt = test_halt; break; } @@ -3511,7 +3511,7 @@ DBG_MESSAGE("tool_station_building_aux()", "building mail office/station buildin for( uint8 i=0; i < pl->get_boden_count(); i++ ) { halthandle_t test_halt = pl->get_boden_bei(i)->get_halt(); if(test_halt.is_bound()) { - if(!spieler_t::check_owner( new_owner, test_halt->get_besitzer())) { + if(!player_t::check_owner( new_owner, test_halt->get_besitzer())) { return "Das Feld gehoert\neinem anderen Spieler\n"; } else if(!halt.is_bound()) { @@ -3542,19 +3542,19 @@ DBG_MESSAGE("tool_station_building_aux()", "building mail office/station buildin sint32 const factor = besch->get_b() * besch->get_h(); sint64 cost = -besch->get_price(welt) * factor; - if( sp!=halt->get_besitzer() && halt->get_besitzer()==welt->get_spieler(1) ) { + if( player!=halt->get_besitzer() && halt->get_besitzer()==welt->get_player(1) ) { // public stops are expensive! cost -= (besch->get_maintenance(welt) * factor * 60); } // difficult to distinguish correctly most suitable waytype - spieler_t::book_construction_costs(sp, cost, k, besch->get_finance_waytype()); + player_t::book_construction_costs(player, cost, k, besch->get_finance_waytype()); halt->recalc_station_type(); return NULL; } /* build a dock either small or large */ -const char *tool_build_station_t::tool_station_dock_aux(spieler_t *sp, koord3d pos, const haus_besch_t *besch) +const char *tool_build_station_t::tool_station_dock_aux(player_t *player, koord3d pos, const haus_besch_t *besch) { // the cursor cannot be outside the map from here on koord k = pos.get_2d(); @@ -3584,7 +3584,7 @@ const char *tool_build_station_t::tool_station_dock_aux(spieler_t *sp, koord3d p for( uint8 j=0; j < pl->get_boden_count(); j++ ) { halthandle_t test_halt = pl->get_boden_bei(j)->get_halt(); if(test_halt.is_bound()) { - if(!spieler_t::check_owner( sp, test_halt->get_besitzer())) { + if(!player_t::check_owner( player, test_halt->get_besitzer())) { return "Das Feld gehoert\neinem anderen Spieler\n"; } else if(!halt.is_bound()) { @@ -3598,7 +3598,7 @@ const char *tool_build_station_t::tool_station_dock_aux(spieler_t *sp, koord3d p // check whether we can build something const grund_t *gr=welt->lookup_kartenboden(k-dx*i); - if (const char *msg = gr->kann_alle_obj_entfernen(sp)) { + if (const char *msg = gr->kann_alle_obj_entfernen(player)) { return msg; } @@ -3618,7 +3618,7 @@ const char *tool_build_station_t::tool_station_dock_aux(spieler_t *sp, koord3d p } // remove everything from tile - gr->obj_loesche_alle(sp); + gr->obj_loesche_alle(player); DBG_MESSAGE("tool_station_dock_aux()","building dock from square (%d,%d) to (%d,%d)", k.x, k.y, last_k.x, last_k.y); int layout = 0; @@ -3665,7 +3665,7 @@ DBG_MESSAGE("tool_station_dock_aux()","building dock from square (%d,%d) to (%d, gr = welt->lookup_kartenboden(k+dx2); // find out if middle end or start tile - if(gr && gr->is_halt() && spieler_t::check_owner( sp, gr->get_halt()->get_besitzer() )) { + if(gr && gr->is_halt() && player_t::check_owner( player, gr->get_halt()->get_besitzer() )) { gebaeude_t *gb = gr->find(); if(gb && gb->get_tile()->get_besch()->get_utyp()==haus_besch_t::hafen) { if(change_layout) { @@ -3681,7 +3681,7 @@ DBG_MESSAGE("tool_station_dock_aux()","building dock from square (%d,%d) to (%d, } gr = welt->lookup_kartenboden(k-dx2); - if(gr && gr->is_halt() && spieler_t::check_owner( sp, gr->get_halt()->get_besitzer() )) { + if(gr && gr->is_halt() && player_t::check_owner( player, gr->get_halt()->get_besitzer() )) { gebaeude_t *gb = gr->find(); if(gb && gb->get_tile()->get_besch()->get_utyp()==haus_besch_t::hafen) { if(change_layout) { @@ -3698,7 +3698,7 @@ DBG_MESSAGE("tool_station_dock_aux()","building dock from square (%d,%d) to (%d, //DBG_MESSAGE("tool_station_dock_aux()","search for stop"); if(!halt.is_bound()) { - halt = suche_nahe_haltestelle(sp, welt, welt->lookup_kartenboden(k)->get_pos() ); + halt = suche_nahe_haltestelle(player, welt, welt->lookup_kartenboden(k)->get_pos() ); } bool neu = !halt.is_bound(); @@ -3707,18 +3707,18 @@ DBG_MESSAGE("tool_station_dock_aux()","building dock from square (%d,%d) to (%d, return "Das Feld gehoert\neinem anderen Spieler\n"; } // ok, really new stop on this tile then - halt = haltestelle_t::create(k, sp); + halt = haltestelle_t::create(k, player); } hausbauer_t::baue(halt->get_besitzer(), bau_pos, layout, besch, &halt); sint64 costs = -besch->get_price(welt); - if( sp!=halt->get_besitzer() && sp != welt->get_spieler(1) ) { + if( player!=halt->get_besitzer() && player != welt->get_player(1) ) { // public stops are expensive! // (Except for the public player itself) costs -= (besch->get_maintenance(welt) * 60); } for( int i=0; i<=len; i++ ) { koord p=k-dx*i; - spieler_t::book_construction_costs(sp, costs, p, water_wt); + player_t::book_construction_costs(player, costs, p, water_wt); } halt->recalc_station_type(); @@ -3736,7 +3736,7 @@ DBG_MESSAGE("tool_station_dock_aux()","building dock from square (%d,%d) to (%d, } // build all types of stops but sea harbours -const char *tool_build_station_t::tool_station_aux(spieler_t *sp, koord3d pos, const haus_besch_t *besch, waytype_t wegtype, const char *type_name ) +const char *tool_build_station_t::tool_station_aux(player_t *player, koord3d pos, const haus_besch_t *besch, waytype_t wegtype, const char *type_name ) { koord k = pos.get_2d(); DBG_MESSAGE("tool_station_aux()", "building %s on square %d,%d for waytype %x", besch->get_name(), k.x, k.y, wegtype); @@ -3744,7 +3744,7 @@ DBG_MESSAGE("tool_station_aux()", "building %s on square %d,%d for waytype %x", // underground is checked in work(); if underground only simple stations are allowed // get valid ground - grund_t *bd = tool_intern_koord_to_weg_grund(sp, welt, pos, wegtype); + grund_t *bd = tool_intern_koord_to_weg_grund(player, welt, pos, wegtype); if( !bd || bd->get_weg_hang()!=hang_t::flach ) { // only flat tiles, only one stop per map square @@ -3909,7 +3909,7 @@ DBG_MESSAGE("tool_station_aux()", "building %s on square %d,%d for waytype %x", } } else { - halt = suche_nahe_haltestelle(sp,welt,bd->get_pos()); + halt = suche_nahe_haltestelle(player,welt,bd->get_pos()); } // seems everything ok, lets build @@ -3919,7 +3919,7 @@ DBG_MESSAGE("tool_station_aux()", "building %s on square %d,%d for waytype %x", if( bd && bd->get_halt().is_bound() ) { return "Das Feld gehoert\neinem anderen Spieler\n"; } - halt = haltestelle_t::create(k, sp); + halt = haltestelle_t::create(k, player); } hausbauer_t::neues_gebaeude(halt->get_besitzer(), bd->get_pos(), layout, besch, &halt); halt->recalc_station_type(); @@ -3934,13 +3934,13 @@ DBG_MESSAGE("tool_station_aux()", "building %s on square %d,%d for waytype %x", sint64 cost = -besch->get_price(welt)*besch->get_b()*besch->get_h(); // discount for existing station cost += old_cost/2; - if( sp!=halt->get_besitzer() && sp != welt->get_spieler(1) ) { + if( player!=halt->get_besitzer() && player != welt->get_player(1) ) { // public stops are expensive! // (Except for the public player itself) cost -= (besch->get_maintenance(welt) * besch->get_b() * besch->get_h() * 60); } - spieler_t::book_construction_costs(sp, cost, k, wegtype); + player_t::book_construction_costs(player, cost, k, wegtype); if( env_t::station_coverage_show && welt->get_zeiger()->get_pos().get_2d()==k ) { // since we are larger now ... halt->mark_unmark_coverage( true ); @@ -3977,7 +3977,7 @@ const haus_besch_t *tool_build_station_t::get_besch( sint8 &rotation ) const return ht->get_besch(); } -bool tool_build_station_t::init( spieler_t * ) +bool tool_build_station_t::init( player_t * ) { sint8 rotation = -1; const haus_besch_t *hb = get_besch( rotation ); @@ -4016,7 +4016,7 @@ bool tool_build_station_t::init( spieler_t * ) } -image_id tool_build_station_t::get_icon( spieler_t * ) const +image_id tool_build_station_t::get_icon( player_t * ) const { sint8 dummy; const haus_besch_t *besch=get_besch(dummy); @@ -4041,7 +4041,7 @@ image_id tool_build_station_t::get_icon( spieler_t * ) const } -const char* tool_build_station_t::get_tooltip(const spieler_t *) const +const char* tool_build_station_t::get_tooltip(const player_t *) const { sint8 dummy; haus_besch_t const* besch = get_besch(dummy); @@ -4088,7 +4088,7 @@ waytype_t tool_build_station_t::get_waytype() const } -const char *tool_build_station_t::check_pos( spieler_t*, koord3d pos ) +const char *tool_build_station_t::check_pos( player_t*, koord3d pos ) { if( grund_t *gr = welt->lookup( pos ) ) { sint8 rotation; @@ -4115,7 +4115,7 @@ const char *tool_build_station_t::check_pos( spieler_t*, koord3d pos ) } -const char *tool_build_station_t::move( spieler_t *sp, uint16 buttonstate, koord3d pos ) +const char *tool_build_station_t::move( player_t *player, uint16 buttonstate, koord3d pos ) { CHECK_FUNDS(); @@ -4128,24 +4128,24 @@ const char *tool_build_station_t::move( spieler_t *sp, uint16 buttonstate, koord // ownership allowed? halthandle_t halt = gr->get_halt(); - if(halt.is_bound() && !spieler_t::check_owner( sp, halt->get_besitzer())) { + if(halt.is_bound() && !player_t::check_owner( player, halt->get_besitzer())) { return ""; } if( env_t::networkmode ) { // queue tool for network - nwc_tool_t *nwc = new nwc_tool_t(sp, this, pos, welt->get_steps(), welt->get_map_counter(), false); + nwc_tool_t *nwc = new nwc_tool_t(player, this, pos, welt->get_steps(), welt->get_map_counter(), false); network_send_server(nwc); } else { - result = work( sp, pos ); + result = work( player, pos ); } } return result; } -const char *tool_build_station_t::work( spieler_t *sp, koord3d pos ) +const char *tool_build_station_t::work( player_t *player, koord3d pos ) { const grund_t *gr = welt->lookup(pos); if(!gr) { @@ -4154,12 +4154,12 @@ const char *tool_build_station_t::work( spieler_t *sp, koord3d pos ) // ownership allowed? halthandle_t halt = gr->get_halt(); - if(halt.is_bound() && !spieler_t::check_owner( sp, halt->get_besitzer())) { + if(halt.is_bound() && !player_t::check_owner( player, halt->get_besitzer())) { return "Das Feld gehoert\neinem anderen Spieler\n"; } // check underground / above ground - if (const char* msg = check_pos(sp, pos)) { + if (const char* msg = check_pos(player, pos)) { return msg; } @@ -4168,33 +4168,33 @@ const char *tool_build_station_t::work( spieler_t *sp, koord3d pos ) const char *msg = NULL; switch (besch->get_utyp()) { case haus_besch_t::hafen: - msg = tool_build_station_t::tool_station_dock_aux(sp, pos, besch ); + msg = tool_build_station_t::tool_station_dock_aux(player, pos, besch ); break; case haus_besch_t::hafen_geb: case haus_besch_t::generic_extension: - msg = tool_build_station_t::tool_station_building_aux(sp, false, pos, besch, rotation ); + msg = tool_build_station_t::tool_station_building_aux(player, false, pos, besch, rotation ); if (msg) { // try to build near a public halt - msg = tool_build_station_t::tool_station_building_aux(sp, true, pos, besch, rotation ); + msg = tool_build_station_t::tool_station_building_aux(player, true, pos, besch, rotation ); } break; case haus_besch_t::generic_stop: { switch(besch->get_extra()) { case road_wt: - msg = tool_build_station_t::tool_station_aux(sp, pos, besch, road_wt, "H"); + msg = tool_build_station_t::tool_station_aux(player, pos, besch, road_wt, "H"); break; case track_wt: case monorail_wt: case maglev_wt: case narrowgauge_wt: case tram_wt: - msg = tool_build_station_t::tool_station_aux(sp, pos, besch, (waytype_t)besch->get_extra(), "BF"); + msg = tool_build_station_t::tool_station_aux(player, pos, besch, (waytype_t)besch->get_extra(), "BF"); break; case water_wt: - msg = tool_build_station_t::tool_station_aux(sp, pos, besch, water_wt, "Dock"); + msg = tool_build_station_t::tool_station_aux(player, pos, besch, water_wt, "Dock"); break; case air_wt: - msg = tool_build_station_t::tool_station_aux(sp, pos, besch, air_wt, "Airport"); + msg = tool_build_station_t::tool_station_aux(player, pos, besch, air_wt, "Airport"); break; } break; @@ -4208,7 +4208,7 @@ const char *tool_build_station_t::work( spieler_t *sp, koord3d pos ) } -char const* tool_build_roadsign_t::get_tooltip(spieler_t const*) const +char const* tool_build_roadsign_t::get_tooltip(player_t const*) const { const roadsign_besch_t * besch = roadsign_t::find_besch(default_param); if(besch) { @@ -4227,18 +4227,18 @@ void tool_build_roadsign_t::draw_after(scr_coord k, bool dirty) const } } -const char* tool_build_roadsign_t::check_pos_intern(spieler_t *sp, koord3d pos) +const char* tool_build_roadsign_t::check_pos_intern(player_t *player, koord3d pos) { const char * error = "Hier kann kein\nSignal aufge-\nstellt werden!\n"; if (besch==NULL) { // read data from string - read_default_param(sp); + read_default_param(player); } if (besch==NULL) { return error; } // search for starting ground - grund_t *gr = tool_intern_koord_to_weg_grund(sp, welt, pos, besch->get_wtyp()); + grund_t *gr = tool_intern_koord_to_weg_grund(player, welt, pos, besch->get_wtyp()); if(gr) { signal_t *s = gr->find(); @@ -4279,7 +4279,7 @@ const char* tool_build_roadsign_t::check_pos_intern(spieler_t *sp, koord3d pos) // if there is already a signal, we might need to inverse the direction rs = gr->find(); if (rs) { - if( !spieler_t::check_owner( rs->get_besitzer(), sp ) ) { + if( !player_t::check_owner( rs->get_besitzer(), player ) ) { return "Das Feld gehoert\neinem anderen Spieler\n"; } } @@ -4288,7 +4288,7 @@ const char* tool_build_roadsign_t::check_pos_intern(spieler_t *sp, koord3d pos) // if there is already a sign, we might need to inverse the direction rs = gr->find(); if (rs) { - if( !spieler_t::check_owner( rs->get_besitzer(), sp ) ) { + if( !player_t::check_owner( rs->get_besitzer(), player ) ) { return "Das Feld gehoert\neinem anderen Spieler\n"; } } @@ -4301,10 +4301,10 @@ const char* tool_build_roadsign_t::check_pos_intern(spieler_t *sp, koord3d pos) char tool_build_roadsign_t::toolstring[256]; -const char* tool_build_roadsign_t::get_default_param(spieler_t *sp) const +const char* tool_build_roadsign_t::get_default_param(player_t *player) const { - if (besch && sp) { - signal_info const& s = signal[sp->get_player_nr()]; + if (besch && player) { + signal_info const& s = signal[player->get_player_nr()]; sprintf(toolstring, "%s,%d,%d,%d", besch->get_name(), s.spacing, s.remove_intermediate, s.replace_other); return toolstring; } @@ -4321,7 +4321,7 @@ waytype_t tool_build_roadsign_t::get_waytype() const // read variables from default_param if cmd comes from network // default_param: sign_name,signal_spacing,remove,replace // if the static variable toolstring is the default_param then reset default_param to name of signal -void tool_build_roadsign_t::read_default_param(spieler_t * sp) +void tool_build_roadsign_t::read_default_param(player_t * player) { char name[256]=""; uint32 i; @@ -4332,7 +4332,7 @@ void tool_build_roadsign_t::read_default_param(spieler_t * sp) besch = roadsign_t::find_besch(name); if (default_param[i]) { - signal_info& s = signal[sp->get_player_nr()]; + signal_info& s = signal[player->get_player_nr()]; int i_signal_spacing = s.spacing; int i_remove_intermediate_signals = s.remove_intermediate; int i_replace_other_signals = s.replace_other; @@ -4346,28 +4346,28 @@ void tool_build_roadsign_t::read_default_param(spieler_t * sp) } } -bool tool_build_roadsign_t::init( spieler_t * sp) +bool tool_build_roadsign_t::init( player_t * player) { // read data from string - read_default_param(sp); + read_default_param(player); if (is_ctrl_pressed() && is_local_execution()) { - create_win(new signal_spacing_frame_t(sp, this), w_info, (ptrdiff_t)this); + create_win(new signal_spacing_frame_t(player, this), w_info, (ptrdiff_t)this); } - return two_click_tool_t::init(sp) && (besch!=NULL); + return two_click_tool_t::init(player) && (besch!=NULL); } -bool tool_build_roadsign_t::exit( spieler_t *sp ) +bool tool_build_roadsign_t::exit( player_t *player ) { destroy_win((ptrdiff_t)this); - return two_click_tool_t::exit(sp); + return two_click_tool_t::exit(player); } -uint8 tool_build_roadsign_t::is_valid_pos( spieler_t *sp, const koord3d &pos, const char *&error, const koord3d &start) +uint8 tool_build_roadsign_t::is_valid_pos( player_t *player, const koord3d &pos, const char *&error, const koord3d &start) { // first click if (start==koord3d::invalid) { - error = check_pos_intern(sp, pos); + error = check_pos_intern(player, pos); return (error==NULL ? 3 : 0); } // second click @@ -4378,13 +4378,13 @@ uint8 tool_build_roadsign_t::is_valid_pos( spieler_t *sp, const koord3d &pos, co } -bool tool_build_roadsign_t::calc_route( route_t &verbindung, spieler_t *sp, const koord3d& start, const koord3d& to ) +bool tool_build_roadsign_t::calc_route( route_t &verbindung, player_t *player, const koord3d& start, const koord3d& to ) { // get a default vehikel vehikel_besch_t rs_besch( besch->get_wtyp(), 500, vehikel_besch_t::diesel ); - vehikel_t* test_vehicle = vehikelbauer_t::baue(start, sp, NULL, &rs_besch); + vehikel_t* test_vehicle = vehikelbauer_t::baue(start, player, NULL, &rs_besch); test_vehicle->set_flag(obj_t::not_on_map); - fahrer_t* test_driver = scenario_checker_t::apply(test_vehicle, sp, this); + fahrer_t* test_driver = scenario_checker_t::apply(test_vehicle, player, this); bool can_built; if( start != to ) { @@ -4407,13 +4407,13 @@ bool tool_build_roadsign_t::calc_route( route_t &verbindung, spieler_t *sp, cons return can_built; } -void tool_build_roadsign_t::mark_tiles( spieler_t *sp, const koord3d &start, const koord3d &ziel ) +void tool_build_roadsign_t::mark_tiles( player_t *player, const koord3d &start, const koord3d &ziel ) { route_t route; - if (!calc_route(route, sp, start, ziel)) { + if (!calc_route(route, player, start, ziel)) { return; } - signal_info const& s = signal[sp->get_player_nr()]; + signal_info const& s = signal[player->get_player_nr()]; uint8 const signal_density = 2 * s.spacing; // measured in half tiles (straight track count as 2, diagonal as 1, since sqrt(1/2) = 1/2 ;) uint8 next_signal = signal_density + 1; // to place a sign asap sint32 cost = 0; @@ -4421,10 +4421,10 @@ void tool_build_roadsign_t::mark_tiles( spieler_t *sp, const koord3d &start, con // dummy roadsign to get images for preview roadsign_t *dummy_rs; if (besch->is_signal_type()) { - dummy_rs = new signal_t(sp, koord3d::invalid, ribi_t::keine, besch); + dummy_rs = new signal_t(player, koord3d::invalid, ribi_t::keine, besch); } else { - dummy_rs = new roadsign_t(sp, koord3d::invalid, ribi_t::keine, besch); + dummy_rs = new roadsign_t(player, koord3d::invalid, ribi_t::keine, besch); } dummy_rs->set_flag(obj_t::not_on_map); @@ -4460,9 +4460,9 @@ void tool_build_roadsign_t::mark_tiles( spieler_t *sp, const koord3d &start, con next_signal += straight ? 2 : 1; if( next_signal >= signal_density ) { // can we place signal here? - if (check_pos_intern(sp, route.position_bei(i))==NULL || - (s.replace_other && rs && !rs->ist_entfernbar(sp))) { - zeiger_t* zeiger = new zeiger_t(gr->get_pos(), sp ); + if (check_pos_intern(player, route.position_bei(i))==NULL || + (s.replace_other && rs && !rs->ist_entfernbar(player))) { + zeiger_t* zeiger = new zeiger_t(gr->get_pos(), player ); marked.append(zeiger); zeiger->set_bild( skinverwaltung_t::bauigelsymbol->get_bild_nr(0) ); gr->obj_add( zeiger ); @@ -4477,8 +4477,8 @@ void tool_build_roadsign_t::mark_tiles( spieler_t *sp, const koord3d &start, con cost += rs ? (rs->get_besch()==besch ? 0 : besch->get_preis()+rs->get_besch()->get_preis()) : besch->get_preis(); } } - else if (s.remove_intermediate && rs && !rs->ist_entfernbar(sp)) { - zeiger_t* zeiger = new zeiger_t(gr->get_pos(), sp ); + else if (s.remove_intermediate && rs && !rs->ist_entfernbar(player)) { + zeiger_t* zeiger = new zeiger_t(gr->get_pos(), player ); marked.append(zeiger); zeiger->set_bild( tool_t::general_tool[TOOL_REMOVER]->cursor ); gr->obj_add( zeiger ); @@ -4490,17 +4490,17 @@ void tool_build_roadsign_t::mark_tiles( spieler_t *sp, const koord3d &start, con win_set_static_tooltip( tooltip_with_price("Building costs estimates", cost ) ); } -const char *tool_build_roadsign_t::do_work( spieler_t *sp, const koord3d &start, const koord3d &end) +const char *tool_build_roadsign_t::do_work( player_t *player, const koord3d &start, const koord3d &end) { // read data from string - read_default_param(sp); + read_default_param(player); // single click ->place signal if( end == koord3d::invalid || start == end ) { grund_t *gr = welt->lookup(start); - return place_sign_intern( sp, gr ); + return place_sign_intern( player, gr ); } // mark tiles to calculate positions of signals - mark_tiles(sp, start, end); + mark_tiles(player, start, end); // only search the marked tiles uint32 j=0; FOR(slist_tpl, const i, marked) { @@ -4509,15 +4509,15 @@ const char *tool_build_roadsign_t::do_work( spieler_t *sp, const koord3d &start, ribi_t::ribi dir = directions[j++]; if (dir) { // try to place signal - const char* error_text = place_sign_intern( sp, gr ); + const char* error_text = place_sign_intern( player, gr ); if( error_text ) { - if (signal[sp->get_player_nr()].replace_other) { + if (signal[player->get_player_nr()].replace_other) { roadsign_t* rs = gr->find(); if(rs == NULL) rs = gr->find(); - if( rs != NULL && rs->ist_entfernbar(sp) == NULL ) { - rs->entferne(sp); + if( rs != NULL && rs->ist_entfernbar(player) == NULL ) { + rs->entferne(player); delete rs; - error_text = place_sign_intern( sp, gr ); + error_text = place_sign_intern( player, gr ); } } } @@ -4533,8 +4533,8 @@ const char *tool_build_roadsign_t::do_work( spieler_t *sp, const koord3d &start, // Place no signal -> remove existing signal roadsign_t* rs = gr->find(); if(rs == NULL) rs = gr->find(); - if( rs != NULL && rs->ist_entfernbar(sp) == NULL ) { - rs->entferne(sp); + if( rs != NULL && rs->ist_entfernbar(player) == NULL ) { + rs->entferne(player); delete rs; }; } @@ -4549,25 +4549,25 @@ const char *tool_build_roadsign_t::do_work( spieler_t *sp, const koord3d &start, /* * Called by the GUI (gui/signal_spacing.*) */ -void tool_build_roadsign_t::set_values( spieler_t *sp, uint8 spacing, bool remove, bool replace ) +void tool_build_roadsign_t::set_values( player_t *player, uint8 spacing, bool remove, bool replace ) { - signal_info& s = signal[sp->get_player_nr()]; + signal_info& s = signal[player->get_player_nr()]; s.spacing = spacing; s.remove_intermediate = remove; s.replace_other = replace; } -void tool_build_roadsign_t::get_values( spieler_t *sp, uint8 &spacing, bool &remove, bool &replace ) +void tool_build_roadsign_t::get_values( player_t *player, uint8 &spacing, bool &remove, bool &replace ) { - signal_info const& s = signal[sp->get_player_nr()]; + signal_info const& s = signal[player->get_player_nr()]; spacing = s.spacing; remove = s.remove_intermediate; replace = s.replace_other; } -const char *tool_build_roadsign_t::place_sign_intern( spieler_t *sp, grund_t* gr, const roadsign_besch_t*) +const char *tool_build_roadsign_t::place_sign_intern( player_t *player, grund_t* gr, const roadsign_besch_t*) { const char * error = "Hier kann kein\nSignal aufge-\nstellt werden!\n"; // search for starting ground @@ -4592,7 +4592,7 @@ const char *tool_build_roadsign_t::place_sign_intern( spieler_t *sp, grund_t* gr // if there is already a signal, we might need to inverse the direction rs = gr->find(); if (rs) { - if( !spieler_t::check_owner( rs->get_besitzer(), sp ) ) { + if( !player_t::check_owner( rs->get_besitzer(), player ) ) { return "Das Feld gehoert\neinem anderen Spieler\n"; } // signals have three options @@ -4618,7 +4618,7 @@ const char *tool_build_roadsign_t::place_sign_intern( spieler_t *sp, grund_t* gr } else { // add a new signal at position zero! - rs = new signal_t(sp, gr->get_pos(), dir, besch); + rs = new signal_t(player, gr->get_pos(), dir, besch); DBG_MESSAGE("tool_roadsign()", "new signal, dir is %i", dir); goto built_sign; } @@ -4627,7 +4627,7 @@ const char *tool_build_roadsign_t::place_sign_intern( spieler_t *sp, grund_t* gr // if there is already a sign, we might need to inverse the direction rs = gr->find(); if (rs) { - if( !spieler_t::check_owner( rs->get_besitzer(), sp ) ) { + if( !player_t::check_owner( rs->get_besitzer(), player ) ) { return "Das Feld gehoert\neinem anderen Spieler\n"; } // reverse only if single way sign @@ -4649,12 +4649,12 @@ const char *tool_build_roadsign_t::place_sign_intern( spieler_t *sp, grund_t* gr } } DBG_MESSAGE("tool_roadsign()", "new roadsign, dir is %i", dir); - rs = new roadsign_t(sp, gr->get_pos(), dir, besch); + rs = new roadsign_t(player, gr->get_pos(), dir, besch); built_sign: gr->obj_add(rs); rs->laden_abschliessen(); // to make them visible weg->count_sign(); - spieler_t::book_construction_costs(sp, -besch->get_preis(), gr->get_pos().get_2d(), weg->get_waytype()); + player_t::book_construction_costs(player, -besch->get_preis(), gr->get_pos().get_2d(), weg->get_waytype()); } } error = NULL; @@ -4666,7 +4666,7 @@ const char *tool_build_roadsign_t::place_sign_intern( spieler_t *sp, grund_t* gr // built all types of depots -const char *tool_build_depot_t::tool_depot_aux(spieler_t *sp, koord3d pos, const haus_besch_t *besch, waytype_t wegtype, sint64 cost) +const char *tool_build_depot_t::tool_depot_aux(player_t *player, koord3d pos, const haus_besch_t *besch, waytype_t wegtype, sint64 cost) { if(welt->is_within_limits(pos.get_2d())) { grund_t *bd=NULL; @@ -4678,7 +4678,7 @@ const char *tool_build_depot_t::tool_depot_aux(spieler_t *sp, koord3d pos, const } } if(bd==NULL) { - bd = tool_intern_koord_to_weg_grund(sp,welt,pos,wegtype); + bd = tool_intern_koord_to_weg_grund(player,welt,pos,wegtype); } if(!bd || bd->has_two_ways()) { return "Cannot built depot here!"; @@ -4689,7 +4689,7 @@ const char *tool_build_depot_t::tool_depot_aux(spieler_t *sp, koord3d pos, const return "Cannot built depot here!"; } - const char *p=bd->kann_alle_obj_entfernen(sp); + const char *p=bd->kann_alle_obj_entfernen(player); if(p) { return p; } @@ -4717,10 +4717,10 @@ const char *tool_build_depot_t::tool_depot_aux(spieler_t *sp, koord3d pos, const case ribi_t::nord: layout = 2; break; case ribi_t::west: layout = 3; break; } - hausbauer_t::neues_gebaeude(sp, bd->get_pos(), layout, besch ); - spieler_t::book_construction_costs(sp, cost, pos.get_2d(), besch->get_finance_waytype()); - if(is_local_execution() && sp == welt->get_active_player()) { - welt->set_tool( general_tool[TOOL_QUERY], sp ); + hausbauer_t::neues_gebaeude(player, bd->get_pos(), layout, besch ); + player_t::book_construction_costs(player, cost, pos.get_2d(), besch->get_finance_waytype()); + if(is_local_execution() && player == welt->get_active_player()) { + welt->set_tool( general_tool[TOOL_QUERY], player ); } return NULL; @@ -4730,9 +4730,9 @@ const char *tool_build_depot_t::tool_depot_aux(spieler_t *sp, koord3d pos, const return ""; } -image_id tool_build_depot_t::get_icon(spieler_t *sp) const +image_id tool_build_depot_t::get_icon(player_t *player) const { - if( sp && sp->get_player_nr()!=1 ) { + if( player && player->get_player_nr()!=1 ) { const haus_besch_t *besch = hausbauer_t::find_tile(default_param,0)->get_besch(); const uint16 time = welt->get_timeline_year_month(); if( besch && besch->is_available(time) ) { @@ -4742,21 +4742,21 @@ image_id tool_build_depot_t::get_icon(spieler_t *sp) const return IMG_LEER; } -bool tool_build_depot_t::init( spieler_t *sp ) +bool tool_build_depot_t::init( player_t *player ) { haus_besch_t const* besch = hausbauer_t::find_tile(default_param, 0)->get_besch(); if (besch == NULL) { return false; } // no depots for player 1 - if(sp!=welt->get_spieler(1)) { + if(player!=welt->get_player(1)) { cursor = besch->get_cursor()->get_bild_nr(0); return true; } return false; } -const char* tool_build_depot_t::get_tooltip(const spieler_t *) const +const char* tool_build_depot_t::get_tooltip(const player_t *) const { settings_t const& settings = welt->get_settings(); haus_besch_t const* besch = hausbauer_t::find_tile(default_param, 0)->get_besch(); @@ -4786,9 +4786,9 @@ waytype_t tool_build_depot_t::get_waytype() const return besch ? (waytype_t)besch->get_extra() : invalid_wt; } -const char *tool_build_depot_t::work( spieler_t *sp, koord3d pos ) +const char *tool_build_depot_t::work( player_t *player, koord3d pos ) { - if(sp==welt->get_spieler(1)) { + if(player==welt->get_player(1)) { // no depots for player 1 return 0; } @@ -4797,31 +4797,31 @@ const char *tool_build_depot_t::work( spieler_t *sp, koord3d pos ) settings_t const& s = welt->get_settings(); switch(besch->get_extra()) { case road_wt: - return tool_build_depot_t::tool_depot_aux(sp, pos, besch, road_wt, s.cst_depot_road); + return tool_build_depot_t::tool_depot_aux(player, pos, besch, road_wt, s.cst_depot_road); case track_wt: - return tool_build_depot_t::tool_depot_aux(sp, pos, besch, track_wt, s.cst_depot_rail); + return tool_build_depot_t::tool_depot_aux(player, pos, besch, track_wt, s.cst_depot_rail); case monorail_wt: { // since it needs also a foundation, this is slightly more complex ... - char const* const err = tool_build_depot_t::tool_depot_aux(sp, pos, besch, monorail_wt, s.cst_depot_rail); + char const* const err = tool_build_depot_t::tool_depot_aux(player, pos, besch, monorail_wt, s.cst_depot_rail); if(err==NULL) { grund_t *bd = welt->lookup_kartenboden(pos.get_2d()); if(hausbauer_t::elevated_foundation_besch && pos.z-bd->get_pos().z==1 && bd->ist_natur()) { - hausbauer_t::baue(sp, bd->get_pos(), 0, hausbauer_t::elevated_foundation_besch ); + hausbauer_t::baue(player, bd->get_pos(), 0, hausbauer_t::elevated_foundation_besch ); } } return err; } case tram_wt: - return tool_build_depot_t::tool_depot_aux(sp, pos, besch, track_wt, s.cst_depot_rail); + return tool_build_depot_t::tool_depot_aux(player, pos, besch, track_wt, s.cst_depot_rail); case water_wt: - return tool_build_depot_t::tool_depot_aux(sp, pos, besch, water_wt, s.cst_depot_ship); + return tool_build_depot_t::tool_depot_aux(player, pos, besch, water_wt, s.cst_depot_ship); case air_wt: - return tool_build_depot_t::tool_depot_aux(sp, pos, besch, air_wt, s.cst_depot_air); + return tool_build_depot_t::tool_depot_aux(player, pos, besch, air_wt, s.cst_depot_air); case maglev_wt: - return tool_build_depot_t::tool_depot_aux(sp, pos, besch, maglev_wt, s.cst_depot_rail); + return tool_build_depot_t::tool_depot_aux(player, pos, besch, maglev_wt, s.cst_depot_rail); case narrowgauge_wt: - return tool_build_depot_t::tool_depot_aux(sp, pos, besch, narrowgauge_wt, s.cst_depot_rail); + return tool_build_depot_t::tool_depot_aux(player, pos, besch, narrowgauge_wt, s.cst_depot_rail); default: dbg->warning("tool_depot()","called with unknown besch %s",besch->get_name() ); return "Unknown depot object"; @@ -4839,7 +4839,7 @@ const char *tool_build_depot_t::work( spieler_t *sp, koord3d pos ) * finally building name * @author prissi */ -bool tool_build_house_t::init( spieler_t * ) +bool tool_build_house_t::init( player_t * ) { if (is_local_execution() && !strempty(default_param)) { const char *c = default_param+2; @@ -4855,7 +4855,7 @@ bool tool_build_house_t::init( spieler_t * ) // TODO: merge this into building_layout defined in simcity.cc static int const building_layout[] = { 0, 0, 1, 4, 2, 0, 5, 1, 3, 7, 1, 0, 6, 3, 2, 0 }; -const char *tool_build_house_t::work( spieler_t *sp, koord3d pos ) +const char *tool_build_house_t::work( player_t *player, koord3d pos ) { koord k(pos.get_2d()); @@ -4924,8 +4924,8 @@ const char *tool_build_house_t::work( spieler_t *sp, koord3d pos ) // Place found... if(hat_platz) { - spieler_t *gb_sp = besch->get_typ()!=gebaeude_t::unbekannt ? NULL : welt->get_spieler(1); - gebaeude_t *gb = hausbauer_t::baue(gb_sp, gr->get_pos(), rotation, besch); + player_t *gb_player = besch->get_typ()!=gebaeude_t::unbekannt ? NULL : welt->get_player(1); + gebaeude_t *gb = hausbauer_t::baue(gb_player, gr->get_pos(), rotation, besch); if(gb) { // building successful if( besch->get_utyp()!=haus_besch_t::attraction_land && besch->get_utyp()!=haus_besch_t::attraction_city ) { @@ -4934,7 +4934,7 @@ const char *tool_build_house_t::work( spieler_t *sp, koord3d pos ) city->add_gebaeude_to_stadt(gb); } } - spieler_t::book_construction_costs(sp, welt->get_settings().cst_multiply_remove_haus * besch->get_level() * size.x * size.y, k, gb->get_waytype()); + player_t::book_construction_costs(player, welt->get_settings().cst_multiply_remove_haus * besch->get_level() * size.x * size.y, k, gb->get_waytype()); return NULL; } } @@ -4944,7 +4944,7 @@ const char *tool_build_house_t::work( spieler_t *sp, koord3d pos ) // show industry size in cursor (in known) -bool tool_build_land_chain_t::init( spieler_t * ) +bool tool_build_land_chain_t::init( player_t * ) { if (is_local_execution() && !strempty(default_param)) { const char *c = default_param+2; @@ -4968,7 +4968,7 @@ bool tool_build_land_chain_t::init( spieler_t * ) * next number is production value * finally industry name */ -const char *tool_build_land_chain_t::work( spieler_t *sp, koord3d pos ) +const char *tool_build_land_chain_t::work( player_t *player, koord3d pos ) { const grund_t* gr = welt->lookup_kartenboden(pos.get_2d()); if(gr==NULL) { @@ -5024,12 +5024,12 @@ const char *tool_build_land_chain_t::work( spieler_t *sp, koord3d pos ) } koord3d build_pos = gr->get_pos(); - int anzahl = fabrikbauer_t::baue_hierarchie(NULL, fab, initial_prod, rotation, &build_pos, welt->get_spieler(1), 10000 ); + int anzahl = fabrikbauer_t::baue_hierarchie(NULL, fab, initial_prod, rotation, &build_pos, welt->get_player(1), 10000 ); if(anzahl>0) { // at least one factory has been built welt->get_viewport()->change_world_position( build_pos ); - spieler_t::book_construction_costs(sp, anzahl * welt->get_settings().cst_multiply_found_industry, build_pos.get_2d(), ignore_wt); + player_t::book_construction_costs(player, anzahl * welt->get_settings().cst_multiply_found_industry, build_pos.get_2d(), ignore_wt); // crossconnect all? if (welt->get_settings().is_crossconnect_factories()) { @@ -5045,7 +5045,7 @@ const char *tool_build_land_chain_t::work( spieler_t *sp, koord3d pos ) // show industry size in cursor (in known) -bool tool_city_chain_t::init( spieler_t * ) +bool tool_city_chain_t::init( player_t * ) { if (is_local_execution() && !strempty(default_param)) { const char *c = default_param+2; @@ -5064,7 +5064,7 @@ bool tool_city_chain_t::init( spieler_t * ) /* builds a industry chain in the next town * defaukt_param see previous function */ -const char *tool_city_chain_t::work( spieler_t *sp, koord3d pos ) +const char *tool_city_chain_t::work( player_t *player, koord3d pos ) { const grund_t* gr = welt->lookup_kartenboden(pos.get_2d()); if(gr==NULL) { @@ -5092,7 +5092,7 @@ const char *tool_city_chain_t::work( spieler_t *sp, koord3d pos ) } pos = gr->get_pos(); - int anzahl = fabrikbauer_t::baue_hierarchie(NULL, fab, initial_prod, 0, &pos, welt->get_spieler(1), 10000 ); + int anzahl = fabrikbauer_t::baue_hierarchie(NULL, fab, initial_prod, 0, &pos, welt->get_player(1), 10000 ); if(anzahl>0) { // at least one factory has been built welt->get_viewport()->change_world_position( pos ); @@ -5104,7 +5104,7 @@ const char *tool_city_chain_t::work( spieler_t *sp, koord3d pos ) } } // ain't going to be cheap - spieler_t::book_construction_costs(sp, anzahl * welt->get_settings().cst_multiply_found_industry, pos.get_2d(), ignore_wt); + player_t::book_construction_costs(player, anzahl * welt->get_settings().cst_multiply_found_industry, pos.get_2d(), ignore_wt); return NULL; } return "No suitable ground!"; @@ -5113,7 +5113,7 @@ const char *tool_city_chain_t::work( spieler_t *sp, koord3d pos ) // show industry size in cursor (must be known!) -bool tool_build_factory_t::init( spieler_t * ) +bool tool_build_factory_t::init( player_t * ) { if (is_local_execution() && !strempty(default_param)) { const char *c = default_param+2; @@ -5131,7 +5131,7 @@ bool tool_build_factory_t::init( spieler_t * ) } /* builds an industry next to the cursor (default_param see above) */ -const char *tool_build_factory_t::work( spieler_t *sp, koord3d pos ) +const char *tool_build_factory_t::work( player_t *player, koord3d pos ) { const grund_t* gr = welt->lookup_kartenboden(pos.get_2d()); if(gr==NULL) { @@ -5186,11 +5186,11 @@ const char *tool_build_factory_t::work( spieler_t *sp, koord3d pos ) initial_prod = welt->inverse_scale_with_month_length( atol(default_param+2) ); } - fabrik_t *f = fabrikbauer_t::baue_fabrik(NULL, fab, initial_prod, rotation, gr->get_pos(), welt->get_spieler(1)); + fabrik_t *f = fabrikbauer_t::baue_fabrik(NULL, fab, initial_prod, rotation, gr->get_pos(), welt->get_player(1)); if(f) { // at least one factory has been built welt->get_viewport()->change_world_position( pos ); - spieler_t::book_construction_costs(sp, welt->get_settings().cst_multiply_found_industry, pos.get_2d(), ignore_wt); + player_t::book_construction_costs(player, welt->get_settings().cst_multiply_found_industry, pos.get_2d(), ignore_wt); // crossconnect all? if (welt->get_settings().is_crossconnect_factories()) { @@ -5214,7 +5214,7 @@ image_id tool_link_factory_t::get_marker_image() } -uint8 tool_link_factory_t::is_valid_pos( spieler_t *, const koord3d &pos, const char *&error, const koord3d & ) +uint8 tool_link_factory_t::is_valid_pos( player_t *, const koord3d &pos, const char *&error, const koord3d & ) { fabrik_t *fab = fabrik_t::get_fab( pos.get_2d() ); if (fab == NULL) { @@ -5225,7 +5225,7 @@ uint8 tool_link_factory_t::is_valid_pos( spieler_t *, const koord3d &pos, const } -const char *tool_link_factory_t::do_work( spieler_t *, const koord3d &start, const koord3d &pos ) +const char *tool_link_factory_t::do_work( player_t *, const koord3d &start, const koord3d &pos ) { fabrik_t *last_fab = fabrik_t::get_fab( start.get_2d() ); fabrik_t *fab = fabrik_t::get_fab( pos.get_2d() ); @@ -5254,26 +5254,26 @@ const char *tool_link_factory_t::do_work( spieler_t *, const koord3d &start, con /* builds company headquarters * @author prissi */ -const haus_besch_t *tool_headquarter_t::next_level( const spieler_t *sp ) const +const haus_besch_t *tool_headquarter_t::next_level( const player_t *player ) const { - return hausbauer_t::get_headquarter(sp->get_headquarter_level(), welt->get_timeline_year_month()); + return hausbauer_t::get_headquarter(player->get_headquarter_level(), welt->get_timeline_year_month()); } -const char* tool_headquarter_t::get_tooltip(const spieler_t *sp) const +const char* tool_headquarter_t::get_tooltip(const player_t *player) const { - if (haus_besch_t const* const besch = next_level(sp)) { + if (haus_besch_t const* const besch = next_level(player)) { settings_t const& s = welt->get_settings(); - char const* const tip = sp->get_headquarter_level() == 0 ? "build HQ" : "upgrade HQ"; + char const* const tip = player->get_headquarter_level() == 0 ? "build HQ" : "upgrade HQ"; sint64 const factor = (sint64)besch->get_level() * besch->get_b() * besch->get_h(); return tooltip_with_price_maintenance(welt, tip, factor * s.cst_multiply_headquarter, factor * s.maint_building); } return NULL; } -bool tool_headquarter_t::init( spieler_t *sp ) +bool tool_headquarter_t::init( player_t *player ) { // do no use this, if there is no next level to build ... - const haus_besch_t *besch = next_level(sp); + const haus_besch_t *besch = next_level(player); if (besch) { if (is_local_execution()) { const int rotation = 0; @@ -5285,13 +5285,13 @@ bool tool_headquarter_t::init( spieler_t *sp ) } -const char *tool_headquarter_t::work( spieler_t *sp, koord3d pos ) +const char *tool_headquarter_t::work( player_t *player, koord3d pos ) { bool ok=false; bool built = false; DBG_MESSAGE("tool_headquarter()", "building headquarters at (%d,%d)", pos.x, pos.y); - const haus_besch_t* besch = next_level(sp); + const haus_besch_t* besch = next_level(player); if(besch==NULL) { // no further headquarters level dbg->message( "tool_headquarter()", "Already at maximum level!" ); @@ -5300,7 +5300,7 @@ DBG_MESSAGE("tool_headquarter()", "building headquarters at (%d,%d)", pos.x, pos koord size = besch->get_groesse(); sint64 const cost = welt->get_settings().cst_multiply_headquarter * besch->get_level() * size.x * size.y; - if( -cost > sp->get_finance()->get_account_balance() ) { + if( -cost > player->get_finance()->get_account_balance() ) { return "Not enough money!"; } @@ -5312,13 +5312,13 @@ DBG_MESSAGE("tool_headquarter()", "building headquarters at (%d,%d)", pos.x, pos if(gr) { gebaeude_t *hq = NULL; // check for current head quarter - koord previous = sp->get_headquarter_pos(); + koord previous = player->get_headquarter_pos(); if(previous!=koord::invalid) { grund_t *gr_hq = welt->lookup_kartenboden(previous); gebaeude_t *prev_hq = gr_hq->find(); // check if upgrade should be built at same place as current one gebaeude_t *gb = gr->find(); - if (gb && gb->get_besitzer()==sp && prev_hq->get_tile()->get_besch()==gb->get_tile()->get_besch()) { + if (gb && gb->get_besitzer()==player && prev_hq->get_tile()->get_besch()==gb->get_tile()->get_besch()) { const haus_besch_t* prev_besch = prev_hq->get_tile()->get_besch(); // check if sizes fit uint8 prev_layout = prev_hq->get_tile()->get_layout(); @@ -5341,10 +5341,10 @@ DBG_MESSAGE("tool_headquarter()", "building headquarters at (%d,%d)", pos.x, pos if( const haus_tile_besch_t *tile = besch->get_tile(layout, x, y) ) { if( grund_t *gr2 = welt->lookup_kartenboden(k_hq + koord(x, y)) ) { if( gebaeude_t *gb = gr2->find() ) { - if( gb && gb->get_besitzer() == sp && prev_besch == gb->get_tile()->get_besch() ) { - spieler_t::add_maintenance( sp, -prev_besch->get_maintenance(welt), prev_besch->get_finance_waytype() ); + if( gb && gb->get_besitzer() == player && prev_besch == gb->get_tile()->get_besch() ) { + player_t::add_maintenance( player, -prev_besch->get_maintenance(welt), prev_besch->get_finance_waytype() ); gb->set_tile( tile, true ); - spieler_t::add_maintenance( sp, besch->get_maintenance(welt), besch->get_finance_waytype() ); + player_t::add_maintenance( player, besch->get_maintenance(welt), besch->get_finance_waytype() ); } } } @@ -5358,9 +5358,9 @@ DBG_MESSAGE("tool_headquarter()", "building headquarters at (%d,%d)", pos.x, pos // did not upgrade old one, need to remove it if( !built ) { // remove previous one - hausbauer_t::remove( sp, prev_hq ); + hausbauer_t::remove( player, prev_hq ); // resize cursor - init(sp); + init(player); } } @@ -5379,7 +5379,7 @@ DBG_MESSAGE("tool_headquarter()", "building headquarters at (%d,%d)", pos.x, pos if(ok) { // then built it - hq = hausbauer_t::baue(sp, gr->get_pos(), rotate, besch, NULL); + hq = hausbauer_t::baue(player, gr->get_pos(), rotate, besch, NULL); stadt_t *city = welt->suche_naechste_stadt( k ); if(city) { city->add_gebaeude_to_stadt( hq ); @@ -5394,15 +5394,15 @@ DBG_MESSAGE("tool_headquarter()", "building headquarters at (%d,%d)", pos.x, pos if( built ) { // sometimes those are not correct after rotation ... - sp->add_headquarter( besch->get_extra() + 1, hq->get_pos().get_2d() - hq->get_tile()->get_offset() ); - spieler_t::book_construction_costs(sp, cost, k, ignore_wt); + player->add_headquarter( besch->get_extra() + 1, hq->get_pos().get_2d() - hq->get_tile()->get_offset() ); + player_t::book_construction_costs(player, cost, k, ignore_wt); // tell the world of it ... cbuffer_t buf; - buf.printf( translator::translate("%s s\nheadquarter now\nat (%i,%i)."), sp->get_name(), pos.x, pos.y ); - welt->get_message()->add_message( buf, k, message_t::ai, PLAYER_FLAG|sp->get_player_nr(), hq->get_tile()->get_hintergrund(0,0,0) ); + buf.printf( translator::translate("%s s\nheadquarter now\nat (%i,%i)."), player->get_name(), pos.x, pos.y ); + welt->get_message()->add_message( buf, k, message_t::ai, PLAYER_FLAG|player->get_player_nr(), hq->get_tile()->get_hintergrund(0,0,0) ); // reset to query tool, since costly relocations should be avoided - if(is_local_execution() && sp == welt->get_active_player()) { - welt->set_tool( tool_t::general_tool[TOOL_QUERY], sp ); + if(is_local_execution() && player == welt->get_active_player()) { + welt->set_tool( tool_t::general_tool[TOOL_QUERY], player ); } return NULL; } @@ -5410,35 +5410,35 @@ DBG_MESSAGE("tool_headquarter()", "building headquarters at (%d,%d)", pos.x, pos return ""; } -const char *tool_lock_game_t::work( spieler_t *, koord3d ) +const char *tool_lock_game_t::work( player_t *, koord3d ) { // tool can never be executed in network mode if (env_t::networkmode) { return ""; } // as the result depends on the local locked state of public player - if (welt->get_spieler(1)->is_locked() || !welt->get_settings().get_allow_player_change()) { + if (welt->get_player(1)->is_locked() || !welt->get_settings().get_allow_player_change()) { return "Only public player can lock games!"; } welt->clear_player_password_hashes(); - if( !welt->get_spieler(1)->is_locked() ) { + if( !welt->get_player(1)->is_locked() ) { return "In order to lock the game, you have to protect the public player by password!"; } welt->get_settings().set_allow_player_change(false); destroy_all_win( true ); welt->switch_active_player( 0, true ); - welt->set_tool( general_tool[TOOL_QUERY], welt->get_spieler(0) ); + welt->set_tool( general_tool[TOOL_QUERY], welt->get_player(0) ); return NULL; } -const char *tool_add_citycar_t::work( spieler_t *sp, koord3d pos ) +const char *tool_add_citycar_t::work( player_t *player, koord3d pos ) { if( stadtauto_t::list_empty() ) { // No citycar return ""; } - grund_t *gr = tool_intern_koord_to_weg_grund( sp, welt, pos, road_wt ); + grund_t *gr = tool_intern_koord_to_weg_grund( player, welt, pos, road_wt ); if( gr != NULL && ribi_t::is_twoway(gr->get_weg_ribi_unmasked(road_wt)) && gr->find() == NULL) { // add citycar @@ -5451,14 +5451,14 @@ const char *tool_add_citycar_t::work( spieler_t *sp, koord3d pos ) } -uint8 tool_forest_t::is_valid_pos( spieler_t *, const koord3d &, const char *&, const koord3d & ) +uint8 tool_forest_t::is_valid_pos( player_t *, const koord3d &, const char *&, const koord3d & ) { // do really nothing ... return 2; } -void tool_forest_t::mark_tiles( spieler_t *, const koord3d &start, const koord3d &end ) +void tool_forest_t::mark_tiles( player_t *, const koord3d &start, const koord3d &end ) { koord k1, k2; k1.x = start.x < end.x ? start.x : end.x; @@ -5490,7 +5490,7 @@ void tool_forest_t::mark_tiles( spieler_t *, const koord3d &start, const koord3 } -const char *tool_forest_t::do_work( spieler_t *sp, const koord3d &start, const koord3d &end ) +const char *tool_forest_t::do_work( player_t *player, const koord3d &start, const koord3d &end ) { koord wh, nw; wh.x = abs(end.x-start.x)+1; @@ -5499,7 +5499,7 @@ const char *tool_forest_t::do_work( spieler_t *sp, const koord3d &start, const k nw.y = min(start.y, end.y)+(wh.y/2); sint64 costs = baum_t::create_forest( nw, wh ); - spieler_t::book_construction_costs(sp, costs * welt->get_settings().cst_remove_tree, end.get_2d(), ignore_wt); + player_t::book_construction_costs(player, costs * welt->get_settings().cst_remove_tree, end.get_2d(), ignore_wt); return NULL; } @@ -5511,7 +5511,7 @@ image_id tool_stop_mover_t::get_marker_image() } -void tool_stop_mover_t::read_start_position(spieler_t *sp, const koord3d &pos) +void tool_stop_mover_t::read_start_position(player_t *player, const koord3d &pos) { waytype[0] = invalid_wt; waytype[1] = invalid_wt; @@ -5532,11 +5532,11 @@ void tool_stop_mover_t::read_start_position(spieler_t *sp, const koord3d &pos) } } // .. and halt - last_halt = haltestelle_t::get_halt(pos,sp); + last_halt = haltestelle_t::get_halt(pos,player); } -uint8 tool_stop_mover_t::is_valid_pos( spieler_t *sp, const koord3d &pos, const char *&error, const koord3d &start) +uint8 tool_stop_mover_t::is_valid_pos( player_t *player, const koord3d &pos, const char *&error, const koord3d &start) { grund_t *bd = welt->lookup(pos); if (bd==NULL) { @@ -5544,8 +5544,8 @@ uint8 tool_stop_mover_t::is_valid_pos( spieler_t *sp, const koord3d &pos, const return 0; } // check halt ownership - halthandle_t h = haltestelle_t::get_halt(pos,sp); - if( h.is_bound() && !spieler_t::check_owner( sp, h->get_besitzer() ) ) { + halthandle_t h = haltestelle_t::get_halt(pos,player); + if( h.is_bound() && !player_t::check_owner( player, h->get_besitzer() ) ) { error = "Das Feld gehoert\neinem anderen Spieler\n"; return 0; } @@ -5567,7 +5567,7 @@ uint8 tool_stop_mover_t::is_valid_pos( spieler_t *sp, const koord3d &pos, const } else { // read conditions at start point - read_start_position(sp, start); + read_start_position(player, start); // check halts vs waypoints if(h.is_bound() ^ last_halt.is_bound()) { error = "Can only move from halt to halt or waypoint to waypoint."; @@ -5585,14 +5585,14 @@ uint8 tool_stop_mover_t::is_valid_pos( spieler_t *sp, const koord3d &pos, const } } -const char *tool_stop_mover_t::do_work( spieler_t *sp, const koord3d &last_pos, const koord3d &pos) +const char *tool_stop_mover_t::do_work( player_t *player, const koord3d &last_pos, const koord3d &pos) { // read conditions at start point - read_start_position(sp, last_pos); + read_start_position(player, last_pos); // second click grund_t *bd = welt->lookup(pos); - halthandle_t h = haltestelle_t::get_halt(pos,sp); + halthandle_t h = haltestelle_t::get_halt(pos,player); if (bd) { const halthandle_t new_halt = h; @@ -5649,7 +5649,7 @@ const char *tool_stop_mover_t::do_work( spieler_t *sp, const koord3d &last_pos, // first, check convoi without line FOR(vector_tpl, const cnv, welt->convoys()) { // check line and owner - if(!cnv->get_line().is_bound() && cnv->get_besitzer()==sp) { + if(!cnv->get_line().is_bound() && cnv->get_besitzer()==player) { schedule_t *fpl = cnv->get_schedule(); // check waytype if(fpl && fpl->ist_halt_erlaubt(bd)) { @@ -5683,7 +5683,7 @@ const char *tool_stop_mover_t::do_work( spieler_t *sp, const koord3d &last_pos, } // next, check lines serving old_halt (no owner check needed for own lines ... vector_tpllines; - sp->simlinemgmt.get_lines(simline_t::line,&lines); + player->simlinemgmt.get_lines(simline_t::line,&lines); FOR(vector_tpl, const line, lines) { schedule_t *fpl = line->get_schedule(); // check waytype @@ -5704,7 +5704,7 @@ const char *tool_stop_mover_t::do_work( spieler_t *sp, const koord3d &last_pos, if(last_halt.is_bound()) { last_halt->remove_line(line); } - sp->simlinemgmt.update_line(line); + player->simlinemgmt.update_line(line); } } } @@ -5716,7 +5716,7 @@ const char *tool_stop_mover_t::do_work( spieler_t *sp, const koord3d &last_pos, } -char const* tool_daynight_level_t::get_tooltip(spieler_t const*) const +char const* tool_daynight_level_t::get_tooltip(player_t const*) const { if (!strempty(default_param)) { if(default_param[0]=='+' || default_param[0]=='-') { @@ -5734,7 +5734,7 @@ char const* tool_daynight_level_t::get_tooltip(spieler_t const*) const } } -bool tool_daynight_level_t::init( spieler_t * ) { +bool tool_daynight_level_t::init( player_t * ) { if(grund_t::underground_mode==grund_t::ugm_all || env_t::night_shift) { return false; } @@ -5760,26 +5760,26 @@ bool tool_daynight_level_t::init( spieler_t * ) { /* make all tiles of this player a public stop * if this player is public, make all connected tiles a public stop */ -bool tool_make_stop_public_t::init( spieler_t * ) +bool tool_make_stop_public_t::init( player_t * ) { win_set_static_tooltip( NULL ); return true; } -const char* tool_make_stop_public_t::get_tooltip(const spieler_t *) const +const char* tool_make_stop_public_t::get_tooltip(const player_t *) const { sint32 const cost = (welt->get_settings().maint_building * 60); sprintf(toolstr, translator::translate("make stop public (or join with public stop next) costs %i per tile and level"), cost); return toolstr; } -const char *tool_make_stop_public_t::move( spieler_t *sp, uint16, koord3d p ) +const char *tool_make_stop_public_t::move( player_t *player, uint16, koord3d p ) { win_set_static_tooltip( NULL ); const grund_t *gr = welt->lookup(p); if(gr!=NULL) { halthandle_t halt = gr->get_halt(); - if( halt.is_bound() && spieler_t::check_owner(halt->get_besitzer(),sp) && halt->get_besitzer()!=welt->get_spieler(1) ) { + if( halt.is_bound() && player_t::check_owner(halt->get_besitzer(),player) && halt->get_besitzer()!=welt->get_player(1) ) { sint64 costs = halt->calc_maintenance(); // set only tooltip if it costs (us) if(costs>0) { @@ -5793,9 +5793,9 @@ const char *tool_make_stop_public_t::move( spieler_t *sp, uint16, koord3d p ) } weg_t *w = gr->get_weg_nr(0); // no need for action if already player(1) => XOR ... - if( !(w && ( (w->get_besitzer()==sp) ^ (sp==welt->get_spieler(1)) )) ) { + if( !(w && ( (w->get_besitzer()==player) ^ (player==welt->get_player(1)) )) ) { w = gr->get_weg_nr(1); - if( !(w && ( (w->get_besitzer()==sp) ^ (sp==welt->get_spieler(1)) )) ) { + if( !(w && ( (w->get_besitzer()==player) ^ (player==welt->get_player(1)) )) ) { w = NULL; } } @@ -5820,10 +5820,10 @@ const char *tool_make_stop_public_t::move( spieler_t *sp, uint16, koord3d p ) return NULL; } -const char *tool_make_stop_public_t::work( spieler_t *sp, koord3d p ) +const char *tool_make_stop_public_t::work( player_t *player, koord3d p ) { const grund_t *gr = welt->lookup(p); - if( !gr || !gr->get_halt().is_bound() || gr->get_halt()->get_besitzer()==welt->get_spieler(1) ) { + if( !gr || !gr->get_halt().is_bound() || gr->get_halt()->get_besitzer()==welt->get_player(1) ) { weg_t *w = NULL; //convert a way here, if there is no halt or already public halt { @@ -5833,9 +5833,9 @@ const char *tool_make_stop_public_t::work( spieler_t *sp, koord3d p ) } w = gr->get_weg_nr(0); // no need for action if already player(1) => XOR ... - if( !(w && ( (w->get_besitzer()==sp) ^ (sp==welt->get_spieler(1)) )) ) { + if( !(w && ( (w->get_besitzer()==player) ^ (player==welt->get_player(1)) )) ) { w = gr->get_weg_nr(1); - if( !(w && ( (w->get_besitzer()==sp) ^ (sp==welt->get_spieler(1)) )) ) { + if( !(w && ( (w->get_besitzer()==player) ^ (player==welt->get_player(1)) )) ) { w = NULL; } } @@ -5849,31 +5849,31 @@ const char *tool_make_stop_public_t::work( spieler_t *sp, koord3d p ) if( gr->ist_im_tunnel() ) { tunnel_t *t = gr->find(); costs = t->get_besch()->get_wartung(); - t->set_besitzer( welt->get_spieler(1) ); + t->set_besitzer( welt->get_player(1) ); } - spieler_t::add_maintenance( w->get_besitzer(), -costs, w->get_besch()->get_finance_waytype() ); - spieler_t::book_construction_costs( w->get_besitzer(), -costs*60, gr->get_pos().get_2d(), w->get_besch()->get_finance_waytype()); - spieler_t::book_construction_costs( welt->get_spieler(1), costs*60, koord::invalid, w->get_besch()->get_finance_waytype()); - w->set_besitzer( welt->get_spieler(1) ); + player_t::add_maintenance( w->get_besitzer(), -costs, w->get_besch()->get_finance_waytype() ); + player_t::book_construction_costs( w->get_besitzer(), -costs*60, gr->get_pos().get_2d(), w->get_besch()->get_finance_waytype()); + player_t::book_construction_costs( welt->get_player(1), costs*60, koord::invalid, w->get_besch()->get_finance_waytype()); + w->set_besitzer( welt->get_player(1) ); w->set_flag(obj_t::dirty); - spieler_t::add_maintenance( welt->get_spieler(1), costs, w->get_besch()->get_finance_waytype() ); + player_t::add_maintenance( welt->get_player(1), costs, w->get_besch()->get_finance_waytype() ); // now search for wayobjects for( uint8 i=1; iget_top(); i++ ) { if( wayobj_t *wo = obj_cast(gr->obj_bei(i)) ) { costs = wo->get_besch()->get_wartung(); - spieler_t::add_maintenance( wo->get_besitzer(), -costs, w->get_besch()->get_finance_waytype() ); - spieler_t::book_construction_costs(wo->get_besitzer(), -costs*60, gr->get_pos().get_2d(), w->get_waytype()); - wo->set_besitzer( welt->get_spieler(1) ); + player_t::add_maintenance( wo->get_besitzer(), -costs, w->get_besch()->get_finance_waytype() ); + player_t::book_construction_costs(wo->get_besitzer(), -costs*60, gr->get_pos().get_2d(), w->get_waytype()); + wo->set_besitzer( welt->get_player(1) ); wo->set_flag(obj_t::dirty); - spieler_t::add_maintenance( welt->get_spieler(1), costs, w->get_besch()->get_finance_waytype() ); - spieler_t::book_construction_costs( welt->get_spieler(1), costs*60, koord::invalid, w->get_waytype()); + player_t::add_maintenance( welt->get_player(1), costs, w->get_besch()->get_finance_waytype() ); + player_t::book_construction_costs( welt->get_player(1), costs*60, koord::invalid, w->get_waytype()); } } // and add message - if( sp->get_player_nr()!=1 && env_t::networkmode ) { + if( player->get_player_nr()!=1 && env_t::networkmode ) { cbuffer_t buf; buf.printf( translator::translate("(%s) now public way."), w->get_pos().get_str() ); - welt->get_message()->add_message( buf, w->get_pos().get_2d(), message_t::ai, PLAYER_FLAG|sp->get_player_nr(), IMG_LEER ); + welt->get_message()->add_message( buf, w->get_pos().get_2d(), message_t::ai, PLAYER_FLAG|player->get_player_nr(), IMG_LEER ); } } } @@ -5883,11 +5883,11 @@ const char *tool_make_stop_public_t::work( spieler_t *sp, koord3d p ) } else { halthandle_t halt = gr->get_halt(); - if( !(spieler_t::check_owner(halt->get_besitzer(),sp) || halt->get_besitzer()==welt->get_spieler(1)) ) { + if( !(player_t::check_owner(halt->get_besitzer(),player) || halt->get_besitzer()==welt->get_player(1)) ) { return "Das Feld gehoert\neinem anderen Spieler\n"; } else { - halt->make_public_and_join(sp); + halt->make_public_and_join(player); } } return NULL; @@ -5895,7 +5895,7 @@ const char *tool_make_stop_public_t::work( spieler_t *sp, koord3d p ) -bool tool_show_trees_t::init( spieler_t * ) +bool tool_show_trees_t::init( player_t * ) { env_t::hide_trees = !env_t::hide_trees; baum_t::recalc_outline_color(); @@ -5906,7 +5906,7 @@ bool tool_show_trees_t::init( spieler_t * ) sint8 tool_show_underground_t::save_underground_level = -128; -bool tool_show_underground_t::init( spieler_t * ) +bool tool_show_underground_t::init( player_t * ) { koord3d zpos = welt->get_zeiger()->get_pos(); // move zeiger (pointer) to invalid position -> unmark tiles @@ -6012,7 +6012,7 @@ bool tool_show_underground_t::init( spieler_t * ) return needs_click; } -const char *tool_show_underground_t::work( spieler_t *sp, koord3d pos) +const char *tool_show_underground_t::work( player_t *player, koord3d pos) { koord3d zpos = welt->get_zeiger()->get_pos(); // move zeiger (pointer) to invalid position -> unmark tiles @@ -6030,15 +6030,15 @@ const char *tool_show_underground_t::work( spieler_t *sp, koord3d pos) // recalc all images on map welt->update_map(); - if(sp == welt->get_active_player()) { - welt->set_tool( general_tool[TOOL_QUERY], sp ); + if(player == welt->get_active_player()) { + welt->set_tool( general_tool[TOOL_QUERY], player ); } return NULL; } -char const* tool_show_underground_t::get_tooltip(spieler_t const*) const +char const* tool_show_underground_t::get_tooltip(player_t const*) const { // no default-param == U for backward compatibility if( default_param == NULL ) { @@ -6106,7 +6106,7 @@ void tool_show_underground_t::draw_after(scr_coord k, bool dirty) const } -bool tool_rotate90_t::init( spieler_t * ) +bool tool_rotate90_t::init( player_t * ) { if( !env_t::networkmode ) { welt->rotate90(); @@ -6116,7 +6116,7 @@ bool tool_rotate90_t::init( spieler_t * ) } -bool tool_quit_t::init( spieler_t * ) +bool tool_quit_t::init( player_t * ) { destroy_all_win( true ); welt->stop( true ); @@ -6124,7 +6124,7 @@ bool tool_quit_t::init( spieler_t * ) } -bool tool_screenshot_t::init( spieler_t * ) +bool tool_screenshot_t::init( player_t * ) { if( is_ctrl_pressed() ) { if( const gui_frame_t * topwin = win_get_top() ) { @@ -6144,23 +6144,23 @@ bool tool_screenshot_t::init( spieler_t * ) } -bool tool_undo_t::init( spieler_t *sp ) +bool tool_undo_t::init( player_t *player ) { - if(!sp->undo() && is_local_execution()) { + if(!player->undo() && is_local_execution()) { create_win( new news_img("UNDO failed!"), w_time_delete, magic_none); } return false; } -bool tool_increase_industry_t::init( spieler_t * ) +bool tool_increase_industry_t::init( player_t * ) { fabrikbauer_t::increase_industry_density( false ); return false; } -bool tool_zoom_in_t::init( spieler_t * ) +bool tool_zoom_in_t::init( player_t * ) { win_change_zoom_factor(true); welt->set_dirty(); @@ -6168,7 +6168,7 @@ bool tool_zoom_in_t::init( spieler_t * ) } -bool tool_zoom_out_t::init( spieler_t * ) +bool tool_zoom_out_t::init( player_t * ) { win_change_zoom_factor(false); welt->set_dirty(); @@ -6177,12 +6177,12 @@ bool tool_zoom_out_t::init( spieler_t * ) /************************* internal tools, only need for networking ***************/ -static bool scenario_check_schedule(karte_t *welt, spieler_t *sp, schedule_t *schedule, bool local) +static bool scenario_check_schedule(karte_t *welt, player_t *player, schedule_t *schedule, bool local) { if (!is_scenario()) { return true; } - const char* err = welt->get_scenario()->is_schedule_allowed(sp, schedule); + const char* err = welt->get_scenario()->is_schedule_allowed(player, schedule); if (err) { if (*err && local) { create_win( new news_img(err), w_time_delete, magic_none); @@ -6204,7 +6204,7 @@ static bool scenario_check_schedule(karte_t *welt, spieler_t *sp, schedule_t *sc * 's' : change state to [number] (and maybe set open schedule flag) * 'l' : apply new line [number] */ -bool tool_change_convoi_t::init( spieler_t *sp ) +bool tool_change_convoi_t::init( player_t *player ) { char tool=0; uint16 convoi_id = 0; @@ -6238,7 +6238,7 @@ bool tool_change_convoi_t::init( spieler_t *sp ) return false; } // ownership check for network games - if (cnv.is_bound() && env_t::networkmode && !spieler_t::check_owner(cnv->get_besitzer(), sp)) { + if (cnv.is_bound() && env_t::networkmode && !player_t::check_owner(cnv->get_besitzer(), player)) { return false; } @@ -6271,7 +6271,7 @@ bool tool_change_convoi_t::init( spieler_t *sp ) { schedule_t *fpl = cnv->create_schedule()->copy(); fpl->eingabe_abschliessen(); - if (fpl->sscanf_schedule( p ) && scenario_check_schedule(welt, sp, fpl, is_local_execution())) { + if (fpl->sscanf_schedule( p ) && scenario_check_schedule(welt, player, fpl, is_local_execution())) { cnv->set_schedule( fpl ); } else { @@ -6355,7 +6355,7 @@ bool tool_change_convoi_t::init( spieler_t *sp ) * following simple command exists: * 'g' : apply new schedule to line [schedule follows] */ -bool tool_change_line_t::init( spieler_t *sp ) +bool tool_change_line_t::init( player_t *player ) { uint16 line_id = 0; @@ -6381,7 +6381,7 @@ bool tool_change_line_t::init( spieler_t *sp ) line.set_id( line_id ); // ownership check for network games - if (line.is_bound() && env_t::networkmode && !spieler_t::check_owner(line->get_besitzer(), sp)) { + if (line.is_bound() && env_t::networkmode && !player_t::check_owner(line->get_besitzer(), player)) { return false; } @@ -6389,7 +6389,7 @@ bool tool_change_line_t::init( spieler_t *sp ) switch( tool ) { case 'c': // create line, next parameter line type and magic of schedule window (only right window gets updated) { - line = sp->simlinemgmt.create_line( atoi(p), sp ); + line = player->simlinemgmt.create_line( atoi(p), player ); while( *p && *p++!=',' ) { } long t; @@ -6405,13 +6405,13 @@ bool tool_change_line_t::init( spieler_t *sp ) if( fg ) { fg->init_line_selector(); } - schedule_list_gui_t *sl = dynamic_cast(win_get_magic(magic_line_management_t+sp->get_player_nr())); + schedule_list_gui_t *sl = dynamic_cast(win_get_magic(magic_line_management_t+player->get_player_nr())); if( sl ) { sl->show_lineinfo( line ); } // no schedule window open => then open one if( fg==NULL ) { - create_win( new line_management_gui_t(line, sp), w_info, (ptrdiff_t)line.get_rep() ); + create_win( new line_management_gui_t(line, player), w_info, (ptrdiff_t)line.get_rep() ); } } } @@ -6425,7 +6425,7 @@ bool tool_change_line_t::init( spieler_t *sp ) if(w) { destroy_win( w ); } - sp->simlinemgmt.delete_line(line); + player->simlinemgmt.delete_line(line); } } break; @@ -6434,7 +6434,7 @@ bool tool_change_line_t::init( spieler_t *sp ) { if (line.is_bound()) { schedule_t *fpl = line->get_schedule()->copy(); - if (fpl->sscanf_schedule( p ) && scenario_check_schedule(welt, sp, fpl, is_local_execution()) ) { + if (fpl->sscanf_schedule( p ) && scenario_check_schedule(welt, player, fpl, is_local_execution()) ) { fpl->eingabe_abschliessen(); line->set_schedule( fpl ); line->get_besitzer()->simlinemgmt.update_line(line); @@ -6475,7 +6475,7 @@ bool tool_change_line_t::init( spieler_t *sp ) for( uint32 i=0; i new line if( cnvs[i].get_count()>1 ) { - line = sp->simlinemgmt.create_line( cnvs[i][0]->get_schedule()->get_type(), sp, cnvs[i][0]->get_schedule() ); + line = player->simlinemgmt.create_line( cnvs[i][0]->get_schedule()->get_type(), player, cnvs[i][0]->get_schedule() ); FOR(vector_tpl, cnv, cnvs[i] ) { line->add_convoy( cnv ); cnv->set_line( line ); @@ -6513,7 +6513,7 @@ bool tool_change_line_t::init( spieler_t *sp ) * 'r' : removes a vehikel (+number in convoi) * 'R' : removes all vehikels including (+number in convoi) to end */ -bool tool_change_depot_t::init( spieler_t *sp ) +bool tool_change_depot_t::init( player_t *player ) { char tool=0; koord3d pos = koord3d::invalid; @@ -6543,7 +6543,7 @@ bool tool_change_depot_t::init( spieler_t *sp ) dbg->warning("tool_change_depot_t::init", "no depot found at (%s)", pos.get_str()); return false; } - if( !spieler_t::check_owner( depot->get_besitzer(), sp) ) { + if( !player_t::check_owner( depot->get_besitzer(), player) ) { dbg->warning("tool_change_depot_t::init", "depot at (%s) belongs to another player", pos.get_str()); return false; } @@ -6560,7 +6560,7 @@ bool tool_change_depot_t::init( spieler_t *sp ) depot_frame_t *depot_frame = dynamic_cast(win_get_magic( (ptrdiff_t)depot )); if( is_local_execution() ) { - if( welt->get_active_player()==sp && depot_frame ) { + if( welt->get_active_player()==player && depot_frame ) { create_win( new line_management_gui_t( selected_line, depot->get_besitzer() ), w_info, (ptrdiff_t)selected_line.get_rep() ); } } @@ -6573,7 +6573,7 @@ bool tool_change_depot_t::init( spieler_t *sp ) depot_frame->update_data(); } - schedule_list_gui_t *sl = dynamic_cast(win_get_magic( magic_line_management_t + sp->get_player_nr() )); + schedule_list_gui_t *sl = dynamic_cast(win_get_magic( magic_line_management_t + player->get_player_nr() )); if( sl ) { sl->update_data( selected_line ); } @@ -6735,7 +6735,7 @@ bool tool_change_depot_t::init( spieler_t *sp ) * 'f' : activates/deactivates freeplay * 'c' : change player color */ -bool tool_change_player_t::init( spieler_t *sp) +bool tool_change_player_t::init( player_t *player_in) { if( default_param==NULL ) { dbg->warning( "tool_change_player_t::init()", "nothing to do!" ); @@ -6753,18 +6753,18 @@ bool tool_change_player_t::init( spieler_t *sp) } sscanf( p, "%c,%i,%i", &tool, &id, &state ); - spieler_t *player = welt->get_spieler(id); + player_t *player = welt->get_player(id); // ok now do our stuff switch( tool ) { case 'a': // activate/deactivate AI - if( player && player->get_ai_id()!=spieler_t::HUMAN && (sp==welt->get_spieler(1) || !env_t::networkmode) ) { + if( player && player->get_ai_id()!=player_t::HUMAN && (player_in==welt->get_player(1) || !env_t::networkmode) ) { player->set_active(state); welt->get_settings().set_player_active(id, player->is_active()); } break; case 'c': // change player color - if( player && player==sp ) { + if( player && player==player_in ) { int c1, c2, dummy; sscanf( p, "%c,%i,%i,%i", &tool, &dummy, &c1, &c2 ); player->set_player_color( c1, c2 ); @@ -6789,7 +6789,7 @@ bool tool_change_player_t::init( spieler_t *sp) /* Sets traffic light phases via default_param: * [pos],[ns_flag],[ticks] */ -bool tool_change_traffic_light_t::init( spieler_t *sp ) +bool tool_change_traffic_light_t::init( player_t *player ) { koord3d pos; sint16 z, ns, ticks; @@ -6799,7 +6799,7 @@ bool tool_change_traffic_light_t::init( spieler_t *sp ) pos.z = (sint8)z; if( grund_t *gr = welt->lookup(pos) ) { if( roadsign_t *rs = gr->find() ) { - if( ( rs->get_besch()->is_traffic_light() || rs->get_besch()->is_private_way() ) && spieler_t::check_owner(rs->get_besitzer(),sp) ) { + if( ( rs->get_besch()->is_traffic_light() || rs->get_besch()->is_private_way() ) && player_t::check_owner(rs->get_besitzer(),player) ) { if( ns == 1 ) { rs->set_ticks_ns( (uint8)ticks ); } @@ -6833,9 +6833,9 @@ bool tool_change_traffic_light_t::init( spieler_t *sp ) * change city: * g[x],[y],[allow_city_growth] */ -bool tool_change_city_t::init( spieler_t *sp ) +bool tool_change_city_t::init( player_t *player ) { - if (sp != welt->get_spieler(1)) { + if (player != welt->get_player(1)) { return false; } koord k; @@ -6867,7 +6867,7 @@ bool tool_change_city_t::init( spieler_t *sp ) * c=convoi, h=halt, l=line, m=marker, t=town, p=player, f=factory * in case of marker / factory, id is a pos3d string */ -bool tool_rename_t::init(spieler_t *sp) +bool tool_rename_t::init(player_t *player) { uint16 id = 0; koord3d pos = koord3d::invalid; @@ -6911,7 +6911,7 @@ bool tool_rename_t::init(spieler_t *sp) { halthandle_t halt; halt.set_id( id ); - if( halt.is_bound() && (!env_t::networkmode || spieler_t::check_owner(halt->get_besitzer(), sp)) ) { + if( halt.is_bound() && (!env_t::networkmode || player_t::check_owner(halt->get_besitzer(), player)) ) { halt->set_name( p ); return false; } @@ -6922,10 +6922,10 @@ bool tool_rename_t::init(spieler_t *sp) { linehandle_t line; line.set_id( id ); - if( line.is_bound() && (!env_t::networkmode || spieler_t::check_owner(line->get_besitzer(), sp)) ) { + if( line.is_bound() && (!env_t::networkmode || player_t::check_owner(line->get_besitzer(), player)) ) { line->set_name( p ); - schedule_list_gui_t *sl = dynamic_cast(win_get_magic(magic_line_management_t+sp->get_player_nr())); + schedule_list_gui_t *sl = dynamic_cast(win_get_magic(magic_line_management_t+player->get_player_nr())); if( sl ) { sl->update_data( line ); } @@ -6938,7 +6938,7 @@ bool tool_rename_t::init(spieler_t *sp) { convoihandle_t cnv; cnv.set_id( id ); - if( cnv.is_bound() && (!env_t::networkmode || spieler_t::check_owner(cnv->get_besitzer(), sp)) ) { + if( cnv.is_bound() && (!env_t::networkmode || player_t::check_owner(cnv->get_besitzer(), player)) ) { // set name without ID cnv->set_name( p, false ); return false; @@ -6948,7 +6948,7 @@ bool tool_rename_t::init(spieler_t *sp) case 't': { - if( sp == welt->get_spieler(1) && idget_staedte().get_count() ) { + if( player == welt->get_player(1) && idget_staedte().get_count() ) { welt->get_staedte()[id]->set_name( p ); return false; } @@ -6958,7 +6958,7 @@ bool tool_rename_t::init(spieler_t *sp) case 'm': if( grund_t *gr = welt->lookup(pos) ) { label_t *label = gr->find(); - if (label && (!env_t::networkmode || spieler_t::check_owner(label->get_besitzer(), sp)) ) { + if (label && (!env_t::networkmode || player_t::check_owner(label->get_besitzer(), player)) ) { gr->set_text(p); } return false; @@ -6966,8 +6966,8 @@ bool tool_rename_t::init(spieler_t *sp) break; case 'p': { - spieler_t *other = welt->get_spieler((uint8)id); - if( other && other == sp ) { + player_t *other = welt->get_player((uint8)id); + if( other && other == player ) { other->set_name(p); return false; } @@ -6975,7 +6975,7 @@ bool tool_rename_t::init(spieler_t *sp) case 'f': { - if( sp == welt->get_spieler(1)) { + if( player == welt->get_player(1)) { if( grund_t *gr = welt->lookup(pos) ) { if( gebaeude_t* gb = gr->find() ) { if ( fabrik_t *fab = gb->get_fabrik() ) { @@ -6996,7 +6996,7 @@ bool tool_rename_t::init(spieler_t *sp) /* * Add a message to the message queue */ -bool tool_add_message_t::init(spieler_t*) +bool tool_add_message_t::init(player_t*) { if ( *default_param ) { // Local message, not stored by server diff --git a/simtool.h b/simtool.h index e5597639bce..8f76ac37c74 100644 --- a/simtool.h +++ b/simtool.h @@ -42,8 +42,8 @@ char *tooltip_with_price(const char * tip, sint64 price); class tool_query_t : public tool_t { public: tool_query_t() : tool_t(TOOL_QUERY | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Abfrage"); } - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Abfrage"); } + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } bool is_work_network_save() const OVERRIDE { return true; } }; @@ -52,11 +52,11 @@ class tool_query_t : public tool_t { // remove uppermost object from tile class tool_remover_t : public tool_t { private: - bool tool_remover_intern(spieler_t *sp, koord3d pos, sint8 type, const char *&msg); + bool tool_remover_intern(player_t *player, koord3d pos, sint8 type, const char *&msg); public: tool_remover_t() : tool_t(TOOL_REMOVER | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Abriss"); } - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Abriss"); } + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } }; @@ -66,19 +66,19 @@ class tool_raise_lower_base_t : public tool_t { bool is_dragging; sint16 drag_height; - const char* drag(spieler_t*, koord k, sint16 h, int &n); + const char* drag(player_t*, koord k, sint16 h, int &n); virtual sint16 get_drag_height(koord k) = 0; bool check_dragging(); public: tool_raise_lower_base_t(uint16 id) : tool_t(id | GENERAL_TOOL), is_dragging(false), drag_height(0) { offset = Z_GRID; } - image_id get_icon(spieler_t*) const OVERRIDE { return grund_t::underground_mode==grund_t::ugm_all ? IMG_LEER : icon; } - bool init(spieler_t*) OVERRIDE { is_dragging = false; return true; } - bool exit(spieler_t*) OVERRIDE { is_dragging = false; return true; } + image_id get_icon(player_t*) const OVERRIDE { return grund_t::underground_mode==grund_t::ugm_all ? IMG_LEER : icon; } + bool init(player_t*) OVERRIDE { is_dragging = false; return true; } + bool exit(player_t*) OVERRIDE { is_dragging = false; return true; } /** * technically move is not network safe, however its implementation is: * it sends work commands over network itself */ - char const* move(spieler_t*, uint16 /* buttonstate */, koord3d) OVERRIDE; + char const* move(player_t*, uint16 /* buttonstate */, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } /** @@ -98,18 +98,18 @@ class tool_raise_lower_base_t : public tool_t { class tool_raise_t : public tool_raise_lower_base_t { public: tool_raise_t() : tool_raise_lower_base_t(TOOL_RAISE_LAND) {} - char const* get_tooltip(spieler_t const* const sp) const OVERRIDE { return tooltip_with_price("Anheben", sp->get_welt()->get_settings().cst_alter_land); } - char const* check_pos(spieler_t*, koord3d) OVERRIDE; - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const* const player) const OVERRIDE { return tooltip_with_price("Anheben", player->get_welt()->get_settings().cst_alter_land); } + char const* check_pos(player_t*, koord3d) OVERRIDE; + char const* work(player_t*, koord3d) OVERRIDE; sint16 get_drag_height(koord k) OVERRIDE; }; class tool_lower_t : public tool_raise_lower_base_t { public: tool_lower_t() : tool_raise_lower_base_t(TOOL_LOWER_LAND) {} - char const* get_tooltip(spieler_t const* const sp) const OVERRIDE { return tooltip_with_price("Absenken", sp->get_welt()->get_settings().cst_alter_land); } - char const* check_pos(spieler_t*, koord3d) OVERRIDE; - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const* const player) const OVERRIDE { return tooltip_with_price("Absenken", player->get_welt()->get_settings().cst_alter_land); } + char const* check_pos(player_t*, koord3d) OVERRIDE; + char const* work(player_t*, koord3d) OVERRIDE; sint16 get_drag_height(koord k) OVERRIDE; }; @@ -117,37 +117,37 @@ class tool_lower_t : public tool_raise_lower_base_t { class tool_setslope_t : public tool_t { public: tool_setslope_t() : tool_t(TOOL_SETSLOPE | GENERAL_TOOL) {} - static const char *tool_set_slope_work( spieler_t *sp, koord3d pos, int slope ); - char const* get_tooltip(spieler_t const* const sp) const OVERRIDE { return tooltip_with_price("Built artifical slopes", sp->get_welt()->get_settings().cst_set_slope); } + static const char *tool_set_slope_work( player_t *player, koord3d pos, int slope ); + char const* get_tooltip(player_t const* const player) const OVERRIDE { return tooltip_with_price("Built artifical slopes", player->get_welt()->get_settings().cst_set_slope); } bool is_init_network_save() const OVERRIDE { return true; } - char const* check_pos(spieler_t*, koord3d) OVERRIDE; - char const* work(spieler_t* const sp, koord3d const k) OVERRIDE { return tool_set_slope_work(sp, k, atoi(default_param)); } + char const* check_pos(player_t*, koord3d) OVERRIDE; + char const* work(player_t* const player, koord3d const k) OVERRIDE { return tool_set_slope_work(player, k, atoi(default_param)); } }; class tool_restoreslope_t : public tool_t { public: tool_restoreslope_t() : tool_t(TOOL_RESTORESLOPE | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const* const sp) const OVERRIDE { return tooltip_with_price("Restore natural slope", sp->get_welt()->get_settings().cst_set_slope); } + char const* get_tooltip(player_t const* const player) const OVERRIDE { return tooltip_with_price("Restore natural slope", player->get_welt()->get_settings().cst_set_slope); } bool is_init_network_save() const OVERRIDE { return true; } - char const* check_pos(spieler_t*, koord3d) OVERRIDE; - char const* work(spieler_t* const sp, koord3d const k) OVERRIDE { return tool_setslope_t::tool_set_slope_work(sp, k, RESTORE_SLOPE); } + char const* check_pos(player_t*, koord3d) OVERRIDE; + char const* work(player_t* const player, koord3d const k) OVERRIDE { return tool_setslope_t::tool_set_slope_work(player, k, RESTORE_SLOPE); } }; class tool_marker_t : public kartenboden_tool_t { public: tool_marker_t() : kartenboden_tool_t(TOOL_MARKER | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const* const sp) const OVERRIDE { return tooltip_with_price("Marker", sp->get_welt()->get_settings().cst_buy_land); } - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const* const player) const OVERRIDE { return tooltip_with_price("Marker", player->get_welt()->get_settings().cst_buy_land); } + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } }; class tool_clear_reservation_t : public tool_t { public: tool_clear_reservation_t() : tool_t(TOOL_CLEAR_RESERVATION | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Clear block reservation"); } - bool init(spieler_t*) OVERRIDE; - bool exit(spieler_t*) OVERRIDE; - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Clear block reservation"); } + bool init(player_t*) OVERRIDE; + bool exit(player_t*) OVERRIDE; + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } }; @@ -156,11 +156,11 @@ class tool_transformer_t : public kartenboden_tool_t { bool is_powerline_available() const; public: tool_transformer_t() : kartenboden_tool_t(TOOL_TRANSFORMER | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE; - image_id get_icon(spieler_t*) const OVERRIDE; - bool init(spieler_t*) OVERRIDE; - char const* check_pos(spieler_t*, koord3d) OVERRIDE; - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE; + image_id get_icon(player_t*) const OVERRIDE; + bool init(player_t*) OVERRIDE; + char const* check_pos(player_t*, koord3d) OVERRIDE; + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } waytype_t get_waytype() const OVERRIDE { return powerline_wt; } }; @@ -168,8 +168,8 @@ class tool_transformer_t : public kartenboden_tool_t { class tool_add_city_t : public kartenboden_tool_t { public: tool_add_city_t() : kartenboden_tool_t(TOOL_ADD_CITY | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const* const sp) const OVERRIDE { return tooltip_with_price("Found new city", sp->get_welt()->get_settings().cst_found_city); } - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const* const player) const OVERRIDE { return tooltip_with_price("Found new city", player->get_welt()->get_settings().cst_found_city); } + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } }; @@ -177,8 +177,8 @@ class tool_add_city_t : public kartenboden_tool_t { class tool_buy_house_t : public kartenboden_tool_t { public: tool_buy_house_t() : kartenboden_tool_t(TOOL_BUY_HOUSE | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Haus kaufen"); } - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Haus kaufen"); } + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } }; /************** the following tools need a valid default_param ************************/ @@ -187,9 +187,9 @@ class tool_buy_house_t : public kartenboden_tool_t { class tool_change_city_size_t : public tool_t { public: tool_change_city_size_t() : tool_t(TOOL_CHANGE_CITY_SIZE | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate( atoi(default_param)>=0 ? "Grow city" : "Shrink city" ); } - bool init(spieler_t*) OVERRIDE; - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate( atoi(default_param)>=0 ? "Grow city" : "Shrink city" ); } + bool init(player_t*) OVERRIDE; + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } }; @@ -197,10 +197,10 @@ class tool_change_city_size_t : public tool_t { class tool_change_water_height_t : public tool_t { public: tool_change_water_height_t() : tool_t(TOOL_CHANGE_WATER_HEIGHT | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate( atoi(default_param)>=0 ? "Increase water height" : "Decrease water height" ); } - bool init(spieler_t*) OVERRIDE; - image_id get_icon(spieler_t *sp) const OVERRIDE { return (!env_t::networkmode || sp->get_player_nr()==1) ? icon : IMG_LEER; } - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate( atoi(default_param)>=0 ? "Increase water height" : "Decrease water height" ); } + bool init(player_t*) OVERRIDE; + image_id get_icon(player_t *player) const OVERRIDE { return (!env_t::networkmode || player->get_player_nr()==1) ? icon : IMG_LEER; } + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } }; @@ -208,22 +208,22 @@ class tool_change_water_height_t : public tool_t { class tool_set_climate_t : public two_click_tool_t { public: tool_set_climate_t() : two_click_tool_t(TOOL_SET_CLIMATE | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE; private: - char const* do_work(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - void mark_tiles(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - uint8 is_valid_pos(spieler_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; + char const* do_work(player_t*, koord3d const&, koord3d const&) OVERRIDE; + void mark_tiles(player_t*, koord3d const&, koord3d const&) OVERRIDE; + uint8 is_valid_pos(player_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } }; class tool_plant_tree_t : public kartenboden_tool_t { public: tool_plant_tree_t() : kartenboden_tool_t(TOOL_PLANT_TREE | GENERAL_TOOL) {} - image_id get_icon(spieler_t *) const { return baum_t::get_anzahl_besch() > 0 ? icon : IMG_LEER; } - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate( "Plant tree" ); } - bool init(spieler_t*) { return baum_t::get_anzahl_besch() > 0; } - char const* move(spieler_t* const sp, uint16 const b, koord3d const k) OVERRIDE; - char const* work(spieler_t*, koord3d) OVERRIDE; + image_id get_icon(player_t *) const { return baum_t::get_anzahl_besch() > 0 ? icon : IMG_LEER; } + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate( "Plant tree" ); } + bool init(player_t*) { return baum_t::get_anzahl_besch() > 0; } + char const* move(player_t* const player, uint16 const b, koord3d const k) OVERRIDE; + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } }; @@ -233,7 +233,7 @@ class tool_plant_tree_t : public kartenboden_tool_t { class tool_schedule_add_t : public tool_t { public: tool_schedule_add_t() : tool_t(TOOL_SCHEDULE_ADD | GENERAL_TOOL) {} - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } bool is_work_network_save() const OVERRIDE { return true; } }; @@ -241,7 +241,7 @@ class tool_schedule_add_t : public tool_t { class tool_schedule_ins_t : public tool_t { public: tool_schedule_ins_t() : tool_t(TOOL_SCHEDULE_INS | GENERAL_TOOL) {} - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } bool is_work_network_save() const OVERRIDE { return true; } }; @@ -250,9 +250,9 @@ class tool_build_way_t : public two_click_tool_t { private: static const weg_besch_t *defaults[17]; // default ways for all types - char const* do_work(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - void mark_tiles(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - uint8 is_valid_pos(spieler_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; + char const* do_work(player_t*, koord3d const&, koord3d const&) OVERRIDE; + void mark_tiles(player_t*, koord3d const&, koord3d const&) OVERRIDE; + uint8 is_valid_pos(player_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; protected: const weg_besch_t *besch; @@ -262,11 +262,11 @@ class tool_build_way_t : public two_click_tool_t { public: tool_build_way_t(uint16 const id = TOOL_BUILD_WAY | GENERAL_TOOL) : two_click_tool_t(id), besch() {} - image_id get_icon(spieler_t*) const OVERRIDE; - char const* get_tooltip(spieler_t const*) const OVERRIDE; - char const* get_default_param(spieler_t*) const OVERRIDE; + image_id get_icon(player_t*) const OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE; + char const* get_default_param(player_t*) const OVERRIDE; bool is_selected() const OVERRIDE; - bool init(spieler_t*) OVERRIDE; + bool init(player_t*) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } waytype_t get_waytype() const OVERRIDE; // remove preview necessary while building elevated ways @@ -275,11 +275,11 @@ class tool_build_way_t : public two_click_tool_t { class tool_build_cityroad : public tool_build_way_t { private: - char const* do_work(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; + char const* do_work(player_t*, koord3d const&, koord3d const&) OVERRIDE; public: tool_build_cityroad() : tool_build_way_t(TOOL_BUILD_CITYROAD | GENERAL_TOOL) {} weg_besch_t const* get_besch(uint16, bool) const OVERRIDE; - image_id get_icon(spieler_t* const sp) const OVERRIDE { return tool_t::get_icon(sp); } + image_id get_icon(player_t* const player) const OVERRIDE { return tool_t::get_icon(player); } bool is_selected() const OVERRIDE { return tool_t::is_selected(); } bool is_init_network_save() const OVERRIDE { return true; } waytype_t get_waytype() const OVERRIDE { return road_wt; } @@ -289,48 +289,48 @@ class tool_build_bridge_t : public two_click_tool_t { private: ribi_t::ribi ribi; - char const* do_work(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - void mark_tiles(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - uint8 is_valid_pos(spieler_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; + char const* do_work(player_t*, koord3d const&, koord3d const&) OVERRIDE; + void mark_tiles(player_t*, koord3d const&, koord3d const&) OVERRIDE; + uint8 is_valid_pos(player_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; public: tool_build_bridge_t() : two_click_tool_t(TOOL_BUILD_BRIDGE | GENERAL_TOOL) {} - image_id get_icon(spieler_t*) const OVERRIDE { return grund_t::underground_mode==grund_t::ugm_all ? IMG_LEER : icon; } - char const* get_tooltip(spieler_t const*) const OVERRIDE; + image_id get_icon(player_t*) const OVERRIDE { return grund_t::underground_mode==grund_t::ugm_all ? IMG_LEER : icon; } + char const* get_tooltip(player_t const*) const OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } waytype_t get_waytype() const OVERRIDE; bool remove_preview_necessary() const OVERRIDE { return !is_first_click(); } void rdwr_custom_data(memory_rw_t*) OVERRIDE; - bool init(spieler_t*) OVERRIDE; + bool init(player_t*) OVERRIDE; }; class tool_build_tunnel_t : public two_click_tool_t { private: void calc_route( wegbauer_t &bauigel, const koord3d &, const koord3d &); - char const* do_work(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - void mark_tiles(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - uint8 is_valid_pos(spieler_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; + char const* do_work(player_t*, koord3d const&, koord3d const&) OVERRIDE; + void mark_tiles(player_t*, koord3d const&, koord3d const&) OVERRIDE; + uint8 is_valid_pos(player_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; public: tool_build_tunnel_t() : two_click_tool_t(TOOL_BUILD_TUNNEL | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE; - char const* check_pos(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE; + char const* check_pos(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } waytype_t get_waytype() const OVERRIDE; bool remove_preview_necessary() const OVERRIDE { return !is_first_click(); } - bool init(spieler_t*) OVERRIDE; + bool init(player_t*) OVERRIDE; }; class tool_wayremover_t : public two_click_tool_t { private: - bool calc_route( route_t &, spieler_t *, const koord3d& start, const koord3d &to ); - char const* do_work(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - void mark_tiles(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - uint8 is_valid_pos(spieler_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; + bool calc_route( route_t &, player_t *, const koord3d& start, const koord3d &to ); + char const* do_work(player_t*, koord3d const&, koord3d const&) OVERRIDE; + void mark_tiles(player_t*, koord3d const&, koord3d const&) OVERRIDE; + uint8 is_valid_pos(player_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; // error message to be returned by calc_route const char *calc_route_error; public: tool_wayremover_t() : two_click_tool_t(TOOL_WAYREMOVER | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE; - image_id get_icon(spieler_t*) const OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE; + image_id get_icon(player_t*) const OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } waytype_t get_waytype() const OVERRIDE; }; @@ -344,17 +344,17 @@ class tool_build_wayobj_t : public two_click_tool_t { const way_obj_besch_t *get_besch() const; waytype_t wt; - bool calc_route( route_t &, spieler_t *, const koord3d& start, const koord3d &to ); + bool calc_route( route_t &, player_t *, const koord3d& start, const koord3d &to ); - char const* do_work(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - void mark_tiles(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - uint8 is_valid_pos(spieler_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; + char const* do_work(player_t*, koord3d const&, koord3d const&) OVERRIDE; + void mark_tiles(player_t*, koord3d const&, koord3d const&) OVERRIDE; + uint8 is_valid_pos(player_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; public: tool_build_wayobj_t(uint16 const id = TOOL_BUILD_WAYOBJ | GENERAL_TOOL, bool b = true) : two_click_tool_t(id), build(b) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE; bool is_selected() const OVERRIDE; - bool init(spieler_t*) OVERRIDE; + bool init(player_t*) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } waytype_t get_waytype() const OVERRIDE; }; @@ -369,19 +369,19 @@ class tool_remove_wayobj_t : public tool_build_wayobj_t { class tool_build_station_t : public tool_t { private: static char toolstring[256]; - const char *tool_station_building_aux(spieler_t *, bool, koord3d, const haus_besch_t *, sint8 rotation ); - const char *tool_station_dock_aux(spieler_t *, koord3d, const haus_besch_t * ); - const char *tool_station_aux(spieler_t *, koord3d, const haus_besch_t *, waytype_t, const char *halt_suffix ); + const char *tool_station_building_aux(player_t *, bool, koord3d, const haus_besch_t *, sint8 rotation ); + const char *tool_station_dock_aux(player_t *, koord3d, const haus_besch_t * ); + const char *tool_station_aux(player_t *, koord3d, const haus_besch_t *, waytype_t, const char *halt_suffix ); const haus_besch_t *get_besch( sint8 &rotation ) const; public: tool_build_station_t() : tool_t(TOOL_BUILD_STATION | GENERAL_TOOL) {} - image_id get_icon(spieler_t*) const OVERRIDE; - char const* get_tooltip(spieler_t const*) const OVERRIDE; - bool init(spieler_t*) OVERRIDE; - char const* check_pos(spieler_t*, koord3d) OVERRIDE; - char const* move(spieler_t*, uint16 /* buttonstate */, koord3d) OVERRIDE; - char const* work(spieler_t*, koord3d) OVERRIDE; + image_id get_icon(player_t*) const OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE; + bool init(player_t*) OVERRIDE; + char const* check_pos(player_t*, koord3d) OVERRIDE; + char const* move(player_t*, uint16 /* buttonstate */, koord3d) OVERRIDE; + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } waytype_t get_waytype() const OVERRIDE; }; @@ -390,7 +390,7 @@ class tool_build_station_t : public tool_t { class tool_build_roadsign_t : public two_click_tool_t { private: const roadsign_besch_t* besch; - const char *place_sign_intern( spieler_t *, grund_t*, const roadsign_besch_t* b = NULL); + const char *place_sign_intern( player_t *, grund_t*, const roadsign_besch_t* b = NULL); struct signal_info { signal_info() : spacing(2), remove_intermediate(true), replace_other(true) {} @@ -402,14 +402,14 @@ class tool_build_roadsign_t : public two_click_tool_t { static char toolstring[256]; // read the variables from the default_param - void read_default_param(spieler_t *sp); + void read_default_param(player_t *player); - const char* check_pos_intern(spieler_t *, koord3d); - bool calc_route( route_t &, spieler_t *, const koord3d& start, const koord3d &to ); + const char* check_pos_intern(player_t *, koord3d); + bool calc_route( route_t &, player_t *, const koord3d& start, const koord3d &to ); - char const* do_work(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - void mark_tiles(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - uint8 is_valid_pos(spieler_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; + char const* do_work(player_t*, koord3d const&, koord3d const&) OVERRIDE; + void mark_tiles(player_t*, koord3d const&, koord3d const&) OVERRIDE; + uint8 is_valid_pos(player_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; /// save direction of new signs vector_tpl< ribi_t::ribi > directions; @@ -417,28 +417,28 @@ class tool_build_roadsign_t : public two_click_tool_t { public: tool_build_roadsign_t() : two_click_tool_t(TOOL_BUILD_ROADSIGN | GENERAL_TOOL), besch() {} - char const* get_tooltip(spieler_t const*) const OVERRIDE; - bool init(spieler_t*) OVERRIDE; - bool exit(spieler_t*) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE; + bool init(player_t*) OVERRIDE; + bool exit(player_t*) OVERRIDE; - void set_values(spieler_t *sp, uint8 spacing, bool remove, bool replace ); - void get_values(spieler_t *sp, uint8 &spacing, bool &remove, bool &replace ); + void set_values(player_t *player, uint8 spacing, bool remove, bool replace ); + void get_values(player_t *player, uint8 &spacing, bool &remove, bool &replace ); bool is_init_network_save() const OVERRIDE { return true; } void draw_after(scr_coord, bool dirty) const OVERRIDE; - char const* get_default_param(spieler_t*) const OVERRIDE; + char const* get_default_param(player_t*) const OVERRIDE; waytype_t get_waytype() const OVERRIDE; }; class tool_build_depot_t : public tool_t { private: static char toolstring[256]; - const char *tool_depot_aux(spieler_t *sp, koord3d pos, const haus_besch_t *besch, waytype_t wegtype, sint64 cost); + const char *tool_depot_aux(player_t *player, koord3d pos, const haus_besch_t *besch, waytype_t wegtype, sint64 cost); public: tool_build_depot_t() : tool_t(TOOL_BUILD_DEPOT | GENERAL_TOOL) {} - image_id get_icon(spieler_t*) const OVERRIDE; - char const* get_tooltip(spieler_t const*) const OVERRIDE; - bool init(spieler_t*) OVERRIDE; - char const* work(spieler_t*, koord3d) OVERRIDE; + image_id get_icon(player_t*) const OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE; + bool init(player_t*) OVERRIDE; + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } waytype_t get_waytype() const OVERRIDE; }; @@ -454,9 +454,9 @@ class tool_build_depot_t : public tool_t { class tool_build_house_t : public kartenboden_tool_t { public: tool_build_house_t() : kartenboden_tool_t(TOOL_BUILD_HOUSE | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Built random attraction"); } - bool init(spieler_t*) OVERRIDE; - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Built random attraction"); } + bool init(player_t*) OVERRIDE; + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } }; @@ -472,50 +472,50 @@ class tool_build_house_t : public kartenboden_tool_t { class tool_build_land_chain_t : public kartenboden_tool_t { public: tool_build_land_chain_t() : kartenboden_tool_t(TOOL_BUILD_LAND_CHAIN | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Build land consumer"); } - bool init(spieler_t*) OVERRIDE; - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Build land consumer"); } + bool init(player_t*) OVERRIDE; + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } }; class tool_city_chain_t : public kartenboden_tool_t { public: tool_city_chain_t() : kartenboden_tool_t(TOOL_CITY_CHAIN | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Build city market"); } - bool init(spieler_t*) OVERRIDE; - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Build city market"); } + bool init(player_t*) OVERRIDE; + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } }; class tool_build_factory_t : public kartenboden_tool_t { public: tool_build_factory_t() : kartenboden_tool_t(TOOL_BUILD_FACTORY | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Build city market"); } - bool init(spieler_t*) OVERRIDE; - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Build city market"); } + bool init(player_t*) OVERRIDE; + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } }; class tool_link_factory_t : public two_click_tool_t { public: tool_link_factory_t() : two_click_tool_t(TOOL_LINK_FACTORY | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Connect factory"); } + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Connect factory"); } bool is_init_network_save() const OVERRIDE { return true; } private: - char const* do_work(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - void mark_tiles(spieler_t*, koord3d const&, koord3d const&) OVERRIDE {} - uint8 is_valid_pos(spieler_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; + char const* do_work(player_t*, koord3d const&, koord3d const&) OVERRIDE; + void mark_tiles(player_t*, koord3d const&, koord3d const&) OVERRIDE {} + uint8 is_valid_pos(player_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; image_id get_marker_image() OVERRIDE; }; class tool_headquarter_t : public kartenboden_tool_t { private: - const haus_besch_t *next_level( const spieler_t *sp ) const; + const haus_besch_t *next_level( const player_t *player ) const; public: tool_headquarter_t() : kartenboden_tool_t(TOOL_HEADQUARTER | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE; - bool init(spieler_t*) OVERRIDE; - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE; + bool init(player_t*) OVERRIDE; + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } }; @@ -523,11 +523,11 @@ class tool_headquarter_t : public kartenboden_tool_t { class tool_lock_game_t : public tool_t { public: tool_lock_game_t() : tool_t(TOOL_LOCK_GAME | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return env_t::networkmode ? translator::translate("deactivated in online mode") : translator::translate("Lock game"); } - image_id get_icon(spieler_t*) const OVERRIDE { return env_t::networkmode ? IMG_LEER : icon; } + char const* get_tooltip(player_t const*) const OVERRIDE { return env_t::networkmode ? translator::translate("deactivated in online mode") : translator::translate("Lock game"); } + image_id get_icon(player_t*) const OVERRIDE { return env_t::networkmode ? IMG_LEER : icon; } // deactivate in network mode - bool init(spieler_t *) { return !env_t::networkmode; } - const char *work( spieler_t *, koord3d ); + bool init(player_t *) { return !env_t::networkmode; } + const char *work( player_t *, koord3d ); bool is_init_network_save() const OVERRIDE { return true; } }; @@ -535,8 +535,8 @@ class tool_lock_game_t : public tool_t { class tool_add_citycar_t : public tool_t { public: tool_add_citycar_t() : tool_t(TOOL_ADD_CITYCAR | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Add random citycar"); } - char const* work(spieler_t*, koord3d) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Add random citycar"); } + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } }; @@ -544,13 +544,13 @@ class tool_add_citycar_t : public tool_t { class tool_forest_t : public two_click_tool_t { public: tool_forest_t() : two_click_tool_t(TOOL_FOREST | GENERAL_TOOL) {} - image_id get_icon(spieler_t *) const { return baum_t::get_anzahl_besch() > 0 ? icon : IMG_LEER; } - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Add forest"); } - bool init( spieler_t *sp) { return baum_t::get_anzahl_besch() > 0 && two_click_tool_t::init(sp); } + image_id get_icon(player_t *) const { return baum_t::get_anzahl_besch() > 0 ? icon : IMG_LEER; } + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Add forest"); } + bool init( player_t *player) { return baum_t::get_anzahl_besch() > 0 && two_click_tool_t::init(player); } private: - char const* do_work(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - void mark_tiles(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - uint8 is_valid_pos(spieler_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; + char const* do_work(player_t*, koord3d const&, koord3d const&) OVERRIDE; + void mark_tiles(player_t*, koord3d const&, koord3d const&) OVERRIDE; + uint8 is_valid_pos(player_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } }; @@ -561,16 +561,16 @@ class tool_stop_mover_t : public two_click_tool_t { halthandle_t last_halt; public: tool_stop_mover_t() : two_click_tool_t(TOOL_STOP_MOVER | GENERAL_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("replace stop"); } + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("replace stop"); } bool is_init_network_save() const OVERRIDE { return true; } private: - char const* do_work(spieler_t*, koord3d const&, koord3d const&) OVERRIDE; - void mark_tiles(spieler_t*, koord3d const&, koord3d const&) OVERRIDE {} - uint8 is_valid_pos(spieler_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; + char const* do_work(player_t*, koord3d const&, koord3d const&) OVERRIDE; + void mark_tiles(player_t*, koord3d const&, koord3d const&) OVERRIDE {} + uint8 is_valid_pos(player_t*, koord3d const&, char const*&, koord3d const&) OVERRIDE; image_id get_marker_image() OVERRIDE; - void read_start_position(spieler_t *sp, const koord3d &pos); + void read_start_position(player_t *player, const koord3d &pos); }; /* make all tiles of this player a public stop @@ -578,11 +578,11 @@ class tool_stop_mover_t : public two_click_tool_t { class tool_make_stop_public_t : public tool_t { public: tool_make_stop_public_t() : tool_t(TOOL_MAKE_STOP_PUBLIC | GENERAL_TOOL) {} - bool init(spieler_t * ); - bool exit(spieler_t *s ) { return init(s); } - char const* get_tooltip(spieler_t const*) const OVERRIDE; - char const* move(spieler_t*, uint16 /* buttonstate */, koord3d) OVERRIDE; - char const* work(spieler_t*, koord3d) OVERRIDE; + bool init(player_t * ); + bool exit(player_t *s ) { return init(s); } + char const* get_tooltip(player_t const*) const OVERRIDE; + char const* move(player_t*, uint16 /* buttonstate */, koord3d) OVERRIDE; + char const* work(player_t*, koord3d) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } }; @@ -592,9 +592,9 @@ class tool_make_stop_public_t : public tool_t { class tool_error_message_t : public tool_t { public: tool_error_message_t() : tool_t(TOOL_ERROR_MESSAGE | GENERAL_TOOL) {} - bool init(spieler_t*) OVERRIDE { return true; } + bool init(player_t*) OVERRIDE { return true; } bool is_init_network_save() const OVERRIDE { return true; } - char const* work(spieler_t*, koord3d) OVERRIDE { return default_param ? default_param : ""; } + char const* work(player_t*, koord3d) OVERRIDE { return default_param ? default_param : ""; } }; /********************* one click tools ****************************/ @@ -602,17 +602,17 @@ class tool_error_message_t : public tool_t { class tool_pause_t : public tool_t { public: tool_pause_t() : tool_t(TOOL_PAUSE | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return env_t::networkmode ? translator::translate("deactivated in online mode") : translator::translate("Pause"); } - image_id get_icon(spieler_t*) const OVERRIDE { return env_t::networkmode ? IMG_LEER : icon; } + char const* get_tooltip(player_t const*) const OVERRIDE { return env_t::networkmode ? translator::translate("deactivated in online mode") : translator::translate("Pause"); } + image_id get_icon(player_t*) const OVERRIDE { return env_t::networkmode ? IMG_LEER : icon; } bool is_selected() const OVERRIDE { return welt->is_paused(); } - bool init( spieler_t * ) { + bool init( player_t * ) { if( !env_t::networkmode ) { welt->set_fast_forward(0); welt->set_pause( welt->is_paused()^1 ); } return false; } - bool exit(spieler_t *s ) { return init(s); } + bool exit(player_t *s ) { return init(s); } bool is_init_network_save() const OVERRIDE { return !env_t::networkmode; } bool is_work_network_save() const OVERRIDE { return !env_t::networkmode; } }; @@ -620,10 +620,10 @@ class tool_pause_t : public tool_t { class tool_fastforward_t : public tool_t { public: tool_fastforward_t() : tool_t(TOOL_FASTFORWARD | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return env_t::networkmode ? translator::translate("deactivated in online mode") : translator::translate("Fast forward"); } - image_id get_icon(spieler_t*) const OVERRIDE { return env_t::networkmode ? IMG_LEER : icon; } + char const* get_tooltip(player_t const*) const OVERRIDE { return env_t::networkmode ? translator::translate("deactivated in online mode") : translator::translate("Fast forward"); } + image_id get_icon(player_t*) const OVERRIDE { return env_t::networkmode ? IMG_LEER : icon; } bool is_selected() const OVERRIDE { return welt->is_fast_forward(); } - bool init( spieler_t * ) { + bool init( player_t * ) { if( !env_t::networkmode ) { if( welt->is_fast_forward() && env_t::simple_drawing_fast_forward ) { welt->set_dirty(); @@ -633,7 +633,7 @@ class tool_fastforward_t : public tool_t { } return false; } - bool exit(spieler_t *s ) { return init(s); } + bool exit(player_t *s ) { return init(s); } bool is_init_network_save() const OVERRIDE { return !env_t::networkmode; } bool is_work_network_save() const OVERRIDE { return !env_t::networkmode; } }; @@ -641,8 +641,8 @@ class tool_fastforward_t : public tool_t { class tool_screenshot_t : public tool_t { public: tool_screenshot_t() : tool_t(TOOL_SCREENSHOT | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Screenshot"); } - bool init(spieler_t * ) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Screenshot"); } + bool init(player_t * ) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } bool is_work_network_save() const OVERRIDE { return true; } }; @@ -651,16 +651,16 @@ class tool_screenshot_t : public tool_t { class tool_increase_industry_t : public tool_t { public: tool_increase_industry_t() : tool_t(TOOL_INCREASE_INDUSTRY | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Increase Industry density"); } - bool init( spieler_t * ); + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Increase Industry density"); } + bool init( player_t * ); }; /* prissi: undo building */ class tool_undo_t : public tool_t { public: tool_undo_t() : tool_t(TOOL_UNDO | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Undo last ways construction"); } - bool init(spieler_t *sp ) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Undo last ways construction"); } + bool init(player_t *player ) OVERRIDE; }; /* switch to next player @@ -669,8 +669,8 @@ class tool_undo_t : public tool_t { class tool_switch_player_t : public tool_t { public: tool_switch_player_t() : tool_t(TOOL_SWITCH_PLAYER | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Change player"); } - bool init( spieler_t * ) { + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Change player"); } + bool init( player_t * ) { welt->switch_active_player( welt->get_active_player_nr()+1, true ); return false; } @@ -683,8 +683,8 @@ class tool_switch_player_t : public tool_t { class tool_step_year_t : public tool_t { public: tool_step_year_t() : tool_t(TOOL_STEP_YEAR | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Step timeline one year"); } - bool init( spieler_t * ) { + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Step timeline one year"); } + bool init( player_t * ) { welt->step_year(); return false; } @@ -693,12 +693,12 @@ class tool_step_year_t : public tool_t { class tool_change_game_speed_t : public tool_t { public: tool_change_game_speed_t() : tool_t(TOOL_CHANGE_GAME_SPEED | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { + char const* get_tooltip(player_t const*) const OVERRIDE { int faktor = atoi(default_param); return faktor>0 ? translator::translate("Accelerate time") : translator::translate("Deccelerate time"); } - bool init( spieler_t *sp ) { - if( !env_t::networkmode || sp->get_player_nr()==1 ) { + bool init( player_t *player ) { + if( !env_t::networkmode || player->get_player_nr()==1 ) { // in networkmode only for public player welt->change_time_multiplier( atoi(default_param) ); } @@ -710,8 +710,8 @@ class tool_change_game_speed_t : public tool_t { class tool_zoom_in_t : public tool_t { public: tool_zoom_in_t() : tool_t(TOOL_ZOOM_IN | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("zooming in"); } - bool init( spieler_t * ) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("zooming in"); } + bool init( player_t * ) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } bool is_work_network_save() const OVERRIDE { return true; } }; @@ -719,8 +719,8 @@ class tool_zoom_in_t : public tool_t { class tool_zoom_out_t : public tool_t { public: tool_zoom_out_t() : tool_t(TOOL_ZOOM_OUT | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("zooming out"); } - bool init( spieler_t * ) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("zooming out"); } + bool init( player_t * ) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } bool is_work_network_save() const OVERRIDE { return true; } }; @@ -728,14 +728,14 @@ class tool_zoom_out_t : public tool_t { class tool_show_coverage_t : public tool_t { public: tool_show_coverage_t() : tool_t(TOOL_SHOW_COVERAGE | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("show station coverage"); } + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("show station coverage"); } bool is_selected() const OVERRIDE { return env_t::station_coverage_show; } - bool init( spieler_t * ) { + bool init( player_t * ) { env_t::station_coverage_show = !env_t::station_coverage_show; welt->set_dirty(); return false; } - bool exit(spieler_t *s ) { return init(s); } + bool exit(player_t *s ) { return init(s); } bool is_init_network_save() const OVERRIDE { return true; } bool is_work_network_save() const OVERRIDE { return true; } }; @@ -743,12 +743,12 @@ class tool_show_coverage_t : public tool_t { class tool_show_name_t : public tool_t { public: tool_show_name_t() : tool_t(TOOL_SHOW_NAME | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate( (env_t::show_names>>2)==2 ? "hide station names" : (env_t::show_names&1) ? "show waiting bars" : "show station names"); } - bool init( spieler_t * ) { + bool init( player_t * ) { if( env_t::show_names>=11 ) { if( (env_t::show_names&3)==3 ) { env_t::show_names = 0; @@ -776,14 +776,14 @@ class tool_show_name_t : public tool_t { class tool_show_grid_t : public tool_t { public: tool_show_grid_t() : tool_t(TOOL_SHOW_GRID | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("show grid"); } + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("show grid"); } bool is_selected() const OVERRIDE { return grund_t::show_grid; } - bool init( spieler_t * ) { + bool init( player_t * ) { grund_t::toggle_grid(); welt->set_dirty(); return false; } - bool exit(spieler_t *s ) { return init(s); } + bool exit(player_t *s ) { return init(s); } bool is_init_network_save() const OVERRIDE { return true; } bool is_work_network_save() const OVERRIDE { return true; } }; @@ -791,10 +791,10 @@ class tool_show_grid_t : public tool_t { class tool_show_trees_t : public tool_t { public: tool_show_trees_t() : tool_t(TOOL_SHOW_TREES | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("hide trees"); } + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("hide trees"); } bool is_selected() const OVERRIDE {return env_t::hide_trees; } - bool init( spieler_t * ); - bool exit(spieler_t *s ) { return init(s); } + bool init( player_t * ); + bool exit(player_t *s ) { return init(s); } bool is_init_network_save() const OVERRIDE { return true; } bool is_work_network_save() const OVERRIDE { return true; } }; @@ -802,12 +802,12 @@ class tool_show_trees_t : public tool_t { class tool_show_houses_t : public tool_t { public: tool_show_houses_t() : tool_t(TOOL_SHOW_HOUSES | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate( env_t::hide_buildings==0 ? "hide city building" : (env_t::hide_buildings==1) ? "hide all building" : "show all building"); } - bool init( spieler_t * ) { + bool init( player_t * ) { env_t::hide_buildings ++; if(env_t::hide_buildings>env_t::ALL_HIDDEN_BUILDING) { env_t::hide_buildings = env_t::NOT_HIDE; @@ -823,12 +823,12 @@ class tool_show_underground_t : public tool_t { public: tool_show_underground_t() : tool_t(TOOL_SHOW_UNDERGROUND | SIMPLE_TOOL) {} static sint8 save_underground_level; - char const* get_tooltip(spieler_t const*) const OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE; bool is_selected() const OVERRIDE; void draw_after(scr_coord, bool dirty) const OVERRIDE; - bool init( spieler_t * ); - char const* work(spieler_t*, koord3d) OVERRIDE; - bool exit(spieler_t * ) { return false; } + bool init( player_t * ); + char const* work(player_t*, koord3d) OVERRIDE; + bool exit(player_t * ) { return false; } bool is_init_network_save() const OVERRIDE { return true; } bool is_work_network_save() const OVERRIDE { return true; } }; @@ -836,9 +836,9 @@ class tool_show_underground_t : public tool_t { class tool_rotate90_t : public tool_t { public: tool_rotate90_t() : tool_t(TOOL_ROTATE90 | SIMPLE_TOOL) {} - image_id get_icon(spieler_t*) const OVERRIDE { return env_t::networkmode ? IMG_LEER : icon; } - char const* get_tooltip(spieler_t const*) const OVERRIDE { return env_t::networkmode ? translator::translate("deactivated in online mode") : translator::translate("Rotate map"); } - bool init( spieler_t * ) OVERRIDE; + image_id get_icon(player_t*) const OVERRIDE { return env_t::networkmode ? IMG_LEER : icon; } + char const* get_tooltip(player_t const*) const OVERRIDE { return env_t::networkmode ? translator::translate("deactivated in online mode") : translator::translate("Rotate map"); } + bool init( player_t * ) OVERRIDE; bool is_init_network_save() const OVERRIDE { return !env_t::networkmode; } bool is_work_network_save() const OVERRIDE { return !env_t::networkmode; } }; @@ -846,8 +846,8 @@ class tool_rotate90_t : public tool_t { class tool_quit_t : public tool_t { public: tool_quit_t() : tool_t(TOOL_QUIT | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Beenden"); } - bool init( spieler_t * ) OVERRIDE; + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Beenden"); } + bool init( player_t * ) OVERRIDE; bool is_init_network_save() const OVERRIDE { return true; } bool is_work_network_save() const OVERRIDE { return true; } }; @@ -856,9 +856,9 @@ class tool_quit_t : public tool_t { class tool_fill_trees_t : public tool_t { public: tool_fill_trees_t() : tool_t(TOOL_FILL_TREES | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Fill trees"); } - image_id get_icon(spieler_t *) const { return baum_t::get_anzahl_besch() > 0 ? icon : IMG_LEER; } - bool init(spieler_t * ) { + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Fill trees"); } + image_id get_icon(player_t *) const { return baum_t::get_anzahl_besch() > 0 ? icon : IMG_LEER; } + bool init(player_t * ) { if( baum_t::get_anzahl_besch() > 0 && default_param ) { baum_t::fill_trees( atoi(default_param) ); } @@ -870,8 +870,8 @@ class tool_fill_trees_t : public tool_t { class tool_daynight_level_t : public tool_t { public: tool_daynight_level_t() : tool_t(TOOL_DAYNIGHT_LEVEL | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE; - bool init(spieler_t * ); + char const* get_tooltip(player_t const*) const OVERRIDE; + bool init(player_t * ); bool is_init_network_save() const OVERRIDE { return true; } bool is_work_network_save() const OVERRIDE { return true; } }; @@ -879,8 +879,8 @@ class tool_daynight_level_t : public tool_t { class tool_vehicle_tooltips_t : public tool_t { public: tool_vehicle_tooltips_t() : tool_t(TOOL_VEHICLE_TOOLTIPS | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("Toggle vehicle tooltips"); } - bool init( spieler_t * ) { + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("Toggle vehicle tooltips"); } + bool init( player_t * ) { env_t::show_vehicle_states = (env_t::show_vehicle_states+1)%3; welt->set_dirty(); return false; @@ -892,41 +892,41 @@ class tool_vehicle_tooltips_t : public tool_t { class tool_toggle_pax_station_t : public tool_t { public: tool_toggle_pax_station_t() : tool_t(TOOL_TOOGLE_PAX | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("5LIGHT_CHOOSE"); } + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("5LIGHT_CHOOSE"); } bool is_selected() const OVERRIDE { return welt->get_settings().get_show_pax(); } - bool init( spieler_t * ) { + bool init( player_t * ) { if( !env_t::networkmode) { settings_t& s = welt->get_settings(); s.set_show_pax(!s.get_show_pax()); } return false; } - bool exit(spieler_t *s ) { return init(s); } + bool exit(player_t *s ) { return init(s); } bool is_init_network_save() const OVERRIDE { return false; } }; class tool_toggle_pedestrians_t : public tool_t { public: tool_toggle_pedestrians_t() : tool_t(TOOL_TOOGLE_PEDESTRIANS | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("6LIGHT_CHOOSE"); } + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("6LIGHT_CHOOSE"); } bool is_selected() const OVERRIDE { return welt->get_settings().get_random_pedestrians(); } - bool init( spieler_t * ) { + bool init( player_t * ) { if( !env_t::networkmode) { settings_t& s = welt->get_settings(); s.set_random_pedestrians(!s.get_random_pedestrians()); } return false; } - bool exit(spieler_t *s ) { return init(s); } + bool exit(player_t *s ) { return init(s); } bool is_init_network_save() const OVERRIDE { return false; } }; class tool_toggle_reservation_t : public tool_t { public: tool_toggle_reservation_t() : tool_t(TOOL_TOGGLE_RESERVATION | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("show/hide block reservations"); } + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("show/hide block reservations"); } bool is_selected() const OVERRIDE { return schiene_t::show_reservations; } - bool init( spieler_t * ) { + bool init( player_t * ) { schiene_t::show_reservations ^= 1; welt->set_dirty(); return false; @@ -938,9 +938,9 @@ class tool_toggle_reservation_t : public tool_t { class tool_view_owner_t : public tool_t { public: tool_view_owner_t() : tool_t(TOOL_VIEW_OWNER | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("show/hide object owner"); } + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("show/hide object owner"); } bool is_selected() const OVERRIDE { return obj_t::show_owner; } - bool init( spieler_t * ) { + bool init( player_t * ) { obj_t::show_owner ^= 1; welt->set_dirty(); return false; @@ -952,14 +952,14 @@ class tool_view_owner_t : public tool_t { class tool_hide_under_cursor_t : public tool_t { public: tool_hide_under_cursor_t() : tool_t(TOOL_HIDE_UNDER_CURSOR | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("hide objects under cursor"); } + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("hide objects under cursor"); } bool is_selected() const OVERRIDE { return env_t::hide_under_cursor; } - bool init( spieler_t * ) { + bool init( player_t * ) { env_t::hide_under_cursor = !env_t::hide_under_cursor && env_t::cursor_hide_range>0; welt->set_dirty(); return false; } - bool exit(spieler_t *s ) { return init(s); } + bool exit(player_t *s ) { return init(s); } bool is_init_network_save() const OVERRIDE { return true; } bool is_work_network_save() const OVERRIDE { return true; } }; @@ -969,9 +969,9 @@ class tool_hide_under_cursor_t : public tool_t { class tool_traffic_level_t : public tool_t { public: tool_traffic_level_t() : tool_t(TOOL_TRAFFIC_LEVEL | SIMPLE_TOOL) {} - char const* get_tooltip(spieler_t const*) const OVERRIDE { return translator::translate("6WORLD_CHOOSE"); } + char const* get_tooltip(player_t const*) const OVERRIDE { return translator::translate("6WORLD_CHOOSE"); } bool is_selected() const OVERRIDE { return false; } - bool init( spieler_t * ) { + bool init( player_t * ) { assert( default_param ); sint16 level = min( max( atoi(default_param), 0), 16); welt->get_settings().set_verkehr_level(level); @@ -983,21 +983,21 @@ class tool_traffic_level_t : public tool_t { class tool_change_convoi_t : public tool_t { public: tool_change_convoi_t() : tool_t(TOOL_CHANGE_CONVOI | SIMPLE_TOOL) {} - bool init(spieler_t*) OVERRIDE; + bool init(player_t*) OVERRIDE; bool is_init_network_save() const OVERRIDE { return false; } }; class tool_change_line_t : public tool_t { public: tool_change_line_t() : tool_t(TOOL_CHANGE_LINE | SIMPLE_TOOL) {} - bool init(spieler_t*) OVERRIDE; + bool init(player_t*) OVERRIDE; bool is_init_network_save() const OVERRIDE { return false; } }; class tool_change_depot_t : public tool_t { public: tool_change_depot_t() : tool_t(TOOL_CHANGE_DEPOT | SIMPLE_TOOL) {} - bool init(spieler_t*) OVERRIDE; + bool init(player_t*) OVERRIDE; bool is_init_network_save() const OVERRIDE { return false; } }; @@ -1005,14 +1005,14 @@ class tool_change_depot_t : public tool_t { class tool_change_player_t : public tool_t { public: tool_change_player_t() : tool_t(TOOL_CHANGE_PLAYER | SIMPLE_TOOL) {} - bool init(spieler_t*) OVERRIDE; + bool init(player_t*) OVERRIDE; }; // change timing of traffic light class tool_change_traffic_light_t : public tool_t { public: tool_change_traffic_light_t() : tool_t(TOOL_CHANGE_TRAFFIC_LIGHT | SIMPLE_TOOL) {} - bool init(spieler_t*) OVERRIDE; + bool init(player_t*) OVERRIDE; bool is_init_network_save() const OVERRIDE { return false; } }; @@ -1020,7 +1020,7 @@ class tool_change_traffic_light_t : public tool_t { class tool_change_city_t : public tool_t { public: tool_change_city_t() : tool_t(TOOL_CHANGE_CITY | SIMPLE_TOOL) {} - bool init(spieler_t*) OVERRIDE; + bool init(player_t*) OVERRIDE; bool is_init_network_save() const OVERRIDE { return false; } }; @@ -1028,7 +1028,7 @@ class tool_change_city_t : public tool_t { class tool_rename_t : public tool_t { public: tool_rename_t() : tool_t(TOOL_RENAME | SIMPLE_TOOL) {} - bool init(spieler_t*) OVERRIDE; + bool init(player_t*) OVERRIDE; bool is_init_network_save() const OVERRIDE { return false; } }; @@ -1036,7 +1036,7 @@ class tool_rename_t : public tool_t { class tool_add_message_t : public tool_t { public: tool_add_message_t() : tool_t(TOOL_ADD_MESSAGE | SIMPLE_TOOL) {} - bool init(spieler_t*) OVERRIDE; + bool init(player_t*) OVERRIDE; bool is_init_network_save() const OVERRIDE { return false; } }; diff --git a/simware.h b/simware.h index c024c714717..945ae18ea64 100644 --- a/simware.h +++ b/simware.h @@ -7,7 +7,7 @@ class warenbauer_t; class karte_t; -class spieler_t; +class player_t; /** Class to handle goods packets (and their destinations) */ class ware_t diff --git a/simworld.cc b/simworld.cc index 659a51fe646..6eb6fdcc00a 100644 --- a/simworld.cc +++ b/simworld.cc @@ -798,10 +798,10 @@ DBG_MESSAGE("karte_t::destroy()", "sync list cleared"); delete [] water_hgts; water_hgts = NULL; - // spieler aufraeumen + // player cleanup for(int i=0; iget_city_history_month())[HIST_CITICENS] ); if (s->get_buildings() > 0) { add_stadt(s); @@ -1173,7 +1173,7 @@ DBG_DEBUG("karte_t::distribute_groundobjs_cities()","prepare cities"); besch = wegbauer_t::weg_search(road_wt,80,get_timeline_year_month(),weg_t::type_flat); } - wegbauer_t bauigel (spieler[1] ); + wegbauer_t bauigel (players[1] ); bauigel.route_fuer(wegbauer_t::strasse | wegbauer_t::terraform_flag, besch, tunnelbauer_t::find_tunnel(road_wt,15,get_timeline_year_month()), brueckenbauer_t::find_bridge(road_wt,15,get_timeline_year_month()) ); bauigel.set_keep_existing_ways(true); bauigel.set_maximum(env_t::intercity_road_length); @@ -1253,7 +1253,7 @@ DBG_DEBUG("karte_t::distribute_groundobjs_cities()","prepare cities"); route_t verbindung; vehikel_t* test_driver; vehikel_besch_t test_drive_besch(road_wt, 500, vehikel_besch_t::diesel ); - test_driver = vehikelbauer_t::baue(koord3d(), spieler[1], NULL, &test_drive_besch); + test_driver = vehikelbauer_t::baue(koord3d(), players[1], NULL, &test_drive_besch); test_driver->set_flag( obj_t::not_on_map ); bool ready=false; @@ -1570,20 +1570,20 @@ DBG_DEBUG("karte_t::init()","built timeline"); } // finishes the line preparation and sets id 0 to invalid ... - spieler[0]->simlinemgmt.laden_abschliessen(); + players[0]->simlinemgmt.laden_abschliessen(); set_tool( tool_t::general_tool[TOOL_QUERY], get_active_player() ); recalc_average_speed(); for (int i = 0; i < MAX_PLAYER_COUNT; i++) { - if( spieler[i] ) { - spieler[i]->set_active(settings.automaten[i]); + if( players[i] ) { + players[i]->set_active(settings.player_active[i]); } } active_player_nr = 0; - active_player = spieler[0]; + active_player = players[0]; tool_t::update_toolbars(); set_dirty(); @@ -2270,7 +2270,7 @@ karte_t::karte_t() : last_month = 0; for(int i=0; iis_scripted()) { - return get_scenario()->is_work_allowed_here(sp, TOOL_LOWER_LAND|GENERAL_TOOL, ignore_wt, plan->get_kartenboden()->get_pos()); + return get_scenario()->is_work_allowed_here(player, TOOL_LOWER_LAND|GENERAL_TOOL, ignore_wt, plan->get_kartenboden()->get_pos()); } return NULL; } -const char* karte_t::can_raise_plan_to(const spieler_t *sp, sint16 x, sint16 y, sint8 h) const +const char* karte_t::can_raise_plan_to(const player_t *player, sint16 x, sint16 y, sint8 h) const { const planquadrat_t *plan = access(x,y); if( plan == 0 || !is_plan_height_changeable(x, y) ) { @@ -2379,7 +2379,7 @@ const char* karte_t::can_raise_plan_to(const spieler_t *sp, sint16 x, sint16 y, // check allowance by scenario if (get_scenario()->is_scripted()) { - return get_scenario()->is_work_allowed_here(sp, TOOL_RAISE_LAND|GENERAL_TOOL, ignore_wt, plan->get_kartenboden()->get_pos()); + return get_scenario()->is_work_allowed_here(player, TOOL_RAISE_LAND|GENERAL_TOOL, ignore_wt, plan->get_kartenboden()->get_pos()); } return NULL; @@ -2483,21 +2483,21 @@ void karte_t::terraformer_t::iterate(bool raise) } -const char* karte_t::terraformer_t::can_raise_all(const spieler_t *sp, bool keep_water) const +const char* karte_t::terraformer_t::can_raise_all(const player_t *player, bool keep_water) const { const char* err = NULL; FOR(vector_tpl, const &i, list) { - err = welt->can_raise_to(sp, i.x, i.y, keep_water, i.h[0], i.h[1], i.h[2], i.h[3]); + err = welt->can_raise_to(player, i.x, i.y, keep_water, i.h[0], i.h[1], i.h[2], i.h[3]); if (err) return err; } return NULL; } -const char* karte_t::terraformer_t::can_lower_all(const spieler_t *sp) const +const char* karte_t::terraformer_t::can_lower_all(const player_t *player) const { const char* err = NULL; FOR(vector_tpl, const &i, list) { - err = welt->can_lower_to(sp, i.x, i.y, i.h[0], i.h[1], i.h[2], i.h[3]); + err = welt->can_lower_to(player, i.x, i.y, i.h[0], i.h[1], i.h[2], i.h[3]); if (err) { return err; } @@ -2524,7 +2524,7 @@ int karte_t::terraformer_t::lower_all() } -const char* karte_t::can_raise_to(const spieler_t *sp, sint16 x, sint16 y, bool keep_water, sint8 hsw, sint8 hse, sint8 hne, sint8 hnw) const +const char* karte_t::can_raise_to(const player_t *player, sint16 x, sint16 y, bool keep_water, sint8 hsw, sint8 hse, sint8 hne, sint8 hnw) const { assert(is_within_limits(x,y)); grund_t *gr = lookup_kartenboden_nocheck(x,y); @@ -2536,7 +2536,7 @@ const char* karte_t::can_raise_to(const spieler_t *sp, sint16 x, sint16 y, bool return ""; } - const char* err = can_raise_plan_to(sp, x, y, max_hgt); + const char* err = can_raise_plan_to(player, x, y, max_hgt); return err; } @@ -2716,7 +2716,7 @@ void karte_t::raise_grid_to(sint16 x, sint16 y, sint8 h) } -int karte_t::grid_raise(const spieler_t *sp, koord k, const char*&err) +int karte_t::grid_raise(const player_t *player, koord k, const char*&err) { int n = 0; @@ -2747,7 +2747,7 @@ int karte_t::grid_raise(const spieler_t *sp, koord k, const char*&err) digger.add_raise_node(x, y, hsw, hse, hne, hnw); digger.iterate(true); - err = digger.can_raise_all(sp); + err = digger.can_raise_all(player); if (err) { return 0; } @@ -2819,7 +2819,7 @@ void karte_t::prepare_lower(terraformer_t& digger, sint16 x, sint16 y, sint8 hsw // lower plan // new heights for each corner given // only test corners in ctest to avoid infinite loops -const char* karte_t::can_lower_to(const spieler_t* sp, sint16 x, sint16 y, sint8 hsw, sint8 hse, sint8 hne, sint8 hnw) const +const char* karte_t::can_lower_to(const player_t* player, sint16 x, sint16 y, sint8 hsw, sint8 hse, sint8 hne, sint8 hnw) const { assert(is_within_limits(x,y)); @@ -2835,7 +2835,7 @@ const char* karte_t::can_lower_to(const spieler_t* sp, sint16 x, sint16 y, sint8 } } - return can_lower_plan_to(sp, x, y, hneu ); + return can_lower_plan_to(player, x, y, hneu ); } @@ -3033,7 +3033,7 @@ void karte_t::lower_grid_to(sint16 x, sint16 y, sint8 h) } -int karte_t::grid_lower(const spieler_t *sp, koord k, const char*&err) +int karte_t::grid_lower(const player_t *player, koord k, const char*&err) { int n = 0; @@ -3057,7 +3057,7 @@ int karte_t::grid_lower(const spieler_t *sp, koord k, const char*&err) digger.add_lower_node(x, y, hsw, hse, hne, hnw); digger.iterate(false); - err = digger.can_lower_all(sp); + err = digger.can_lower_all(player); if (err) { return 0; } @@ -3076,14 +3076,14 @@ int karte_t::grid_lower(const spieler_t *sp, koord k, const char*&err) } -bool karte_t::can_ebne_planquadrat(spieler_t *sp, koord k, sint8 hgt, bool keep_water, bool make_underwater_hill) +bool karte_t::can_ebne_planquadrat(player_t *player, koord k, sint8 hgt, bool keep_water, bool make_underwater_hill) { - return ebne_planquadrat(sp, k, hgt, keep_water, make_underwater_hill, true /* justcheck */); + return ebne_planquadrat(player, k, hgt, keep_water, make_underwater_hill, true /* justcheck */); } // make a flat level at this position (only used for AI at the moment) -bool karte_t::ebne_planquadrat(spieler_t *sp, koord k, sint8 hgt, bool keep_water, bool make_underwater_hill, bool justcheck) +bool karte_t::ebne_planquadrat(player_t *player, koord k, sint8 hgt, bool keep_water, bool make_underwater_hill, bool justcheck) { int n = 0; bool ok = true; @@ -3097,7 +3097,7 @@ bool karte_t::ebne_planquadrat(spieler_t *sp, koord k, sint8 hgt, bool keep_wate digger.add_lower_node(k.x, k.y, hgt, hgt, hgt, hgt); digger.iterate(false); - ok = digger.can_lower_all(sp) == NULL; + ok = digger.can_lower_all(player) == NULL; if (ok && !justcheck) { n += digger.lower_all(); @@ -3109,7 +3109,7 @@ bool karte_t::ebne_planquadrat(spieler_t *sp, koord k, sint8 hgt, bool keep_wate digger.add_raise_node(k.x, k.y, hgt, hgt, hgt, hgt); digger.iterate(true); - ok = digger.can_raise_all(sp, keep_water) == NULL; + ok = digger.can_raise_all(player, keep_water) == NULL; if (ok && !justcheck) { n += digger.raise_all(); @@ -3118,7 +3118,7 @@ bool karte_t::ebne_planquadrat(spieler_t *sp, koord k, sint8 hgt, bool keep_wate // was changed => pay for it if(n>0) { n = (n+3) >> 2; - spieler_t::book_construction_costs(sp, n * settings.cst_alter_land, k, ignore_wt); + player_t::book_construction_costs(player, n * settings.cst_alter_land, k, ignore_wt); } return ok; } @@ -3134,8 +3134,8 @@ void karte_t::clear_player_password_hashes() { for(int i=0; icheck_unlock(player_password_hash[i]); + if (players[i]) { + players[i]->check_unlock(player_password_hash[i]); } } } @@ -3145,7 +3145,7 @@ void karte_t::rdwr_player_password_hashes(loadsave_t *file) { pwd_hash_t dummy; for( int i=0; iaccess_password_hash() : &dummy; + pwd_hash_t *p = players[i] ? &players[i]->access_password_hash() : &dummy; for( uint8 j=0; j<20; j++) { file->rdwr_byte( (*p)[j] ); } @@ -3161,7 +3161,7 @@ void karte_t::call_change_player_tool(uint8 cmd, uint8 player_nr, uint16 param, network_send_server(nwc); } else { - change_player_tool(cmd, player_nr, param, !get_spieler(1)->is_locked() || scripted_call, true); + change_player_tool(cmd, player_nr, param, !get_player(1)->is_locked() || scripted_call, true); // update the window ki_kontroll_t* playerwin = (ki_kontroll_t*)win_get_magic(magic_ki_kontroll_t); if (playerwin) { @@ -3176,20 +3176,20 @@ bool karte_t::change_player_tool(uint8 cmd, uint8 player_nr, uint16 param, bool switch(cmd) { case new_player: { // only public player can start AI - if( (param != spieler_t::HUMAN && !public_player_unlocked) || param >= spieler_t::MAX_AI ) { + if( (param != player_t::HUMAN && !public_player_unlocked) || param >= player_t::MAX_AI ) { return false; } // range check, player already existent? - if( player_nr >= PLAYER_UNOWNED || get_spieler(player_nr) ) { + if( player_nr >= PLAYER_UNOWNED || get_player(player_nr) ) { return false; } if(exec) { - new_spieler( player_nr, (uint8) param ); + init_new_player( player_nr, (uint8) param ); // activate/deactivate AI immediately - spieler_t *sp = get_spieler(player_nr); - if (param != spieler_t::HUMAN && sp) { - sp->set_active(true); - settings.set_player_active(player_nr, sp->is_active()); + player_t *player = get_player(player_nr); + if (param != player_t::HUMAN && player) { + player->set_active(true); + settings.set_player_active(player_nr, player->is_active()); } } return true; @@ -3206,7 +3206,7 @@ bool karte_t::change_player_tool(uint8 cmd, uint8 player_nr, uint16 param, bool } case delete_player: { // range check, player existent? - if ( player_nr >= PLAYER_UNOWNED || get_spieler(player_nr)==NULL ) { + if ( player_nr >= PLAYER_UNOWNED || get_player(player_nr)==NULL ) { return false; } if (exec) { @@ -3221,7 +3221,7 @@ bool karte_t::change_player_tool(uint8 cmd, uint8 player_nr, uint16 param, bool } -void karte_t::set_tool( tool_t *tool_in, spieler_t *sp ) +void karte_t::set_tool( tool_t *tool_in, player_t *player ) { if( get_random_mode()&LOAD_RANDOM ) { dbg->warning("karte_t::set_tool", "Ignored tool %i during loading.", tool_in->get_id() ); @@ -3229,47 +3229,47 @@ void karte_t::set_tool( tool_t *tool_in, spieler_t *sp ) } bool scripted_call = tool_in->is_scripted(); // check for scenario conditions - if( !scripted_call && !scenario->is_tool_allowed(sp, tool_in->get_id(), tool_in->get_waytype()) ) { + if( !scripted_call && !scenario->is_tool_allowed(player, tool_in->get_id(), tool_in->get_waytype()) ) { return; } // check for password-protected players if( (!tool_in->is_init_network_save() || !tool_in->is_work_network_save()) && !scripted_call && !(tool_in->get_id()==(TOOL_CHANGE_PLAYER|SIMPLE_TOOL) || tool_in->get_id()==(TOOL_ADD_MESSAGE|SIMPLE_TOOL)) && - sp && sp->is_locked() ) { + player && player->is_locked() ) { // player is currently password protected => request unlock first - create_win( -1, -1, new password_frame_t(sp), w_info, magic_pwd_t + sp->get_player_nr() ); + create_win( -1, -1, new password_frame_t(player), w_info, magic_pwd_t + player->get_player_nr() ); return; } tool_in->flags |= event_get_last_control_shift(); if(!env_t::networkmode || tool_in->is_init_network_save() ) { - local_set_tool(tool_in, sp); + local_set_tool(tool_in, player); } else { // queue tool for network - nwc_tool_t *nwc = new nwc_tool_t(sp, tool_in, zeiger->get_pos(), steps, map_counter, true); + nwc_tool_t *nwc = new nwc_tool_t(player, tool_in, zeiger->get_pos(), steps, map_counter, true); network_send_server(nwc); } } // set a new tool on our client, calls init -void karte_t::local_set_tool( tool_t *tool_in, spieler_t * sp ) +void karte_t::local_set_tool( tool_t *tool_in, player_t * player ) { tool_in->flags |= tool_t::WFL_LOCAL; - if (get_scenario()->is_scripted() && !get_scenario()->is_tool_allowed(sp, tool_in->get_id()) ) { + if (get_scenario()->is_scripted() && !get_scenario()->is_tool_allowed(player, tool_in->get_id()) ) { tool_in->flags = 0; return; } // now call init - bool init_result = tool_in->init(sp); + bool init_result = tool_in->init(player); // for unsafe tools init() must return false assert(tool_in->is_init_network_save() || !init_result); - if (sp && init_result) { + if (player && init_result) { set_dirty(); - tool_t *sp_tool = selected_tool[sp->get_player_nr()]; + tool_t *sp_tool = selected_tool[player->get_player_nr()]; if(tool_in != sp_tool) { // reinit same tool => do not play sound twice @@ -3277,11 +3277,11 @@ void karte_t::local_set_tool( tool_t *tool_in, spieler_t * sp ) // only exit, if it is not the same tool again ... sp_tool->flags |= tool_t::WFL_LOCAL; - sp_tool->exit(sp); + sp_tool->exit(player); sp_tool->flags =0; } - if( sp==active_player ) { + if( player==active_player ) { // reset pointer koord3d zpos = zeiger->get_pos(); // remove marks @@ -3296,7 +3296,7 @@ void karte_t::local_set_tool( tool_t *tool_in, spieler_t * sp ) zeiger->change_pos( koord3d::invalid ); } } - selected_tool[sp->get_player_nr()] = tool_in; + selected_tool[player->get_player_nr()] = tool_in; } tool_in->flags = 0; } @@ -3500,8 +3500,8 @@ DBG_MESSAGE( "karte_t::rotate90()", "called" ); } for( int i=0; irotate90( cached_size.x ); + if( players[i] ) { + players[i]->rotate90( cached_size.x ); } } @@ -3954,8 +3954,8 @@ void karte_t::sync_step(uint32 delta_t, bool sync, bool display ) // only omitted in fast forward mode for the magic steps for(int x=0; xage_messages(delta_t); + if(players[x]) { + players[x]->age_messages(delta_t); } } @@ -4173,19 +4173,19 @@ void karte_t::new_month() INT_CHECK("simworld 1282"); - // spieler + // player for(uint i=0; i=2 && last_month == 0 && !settings.is_freeplay() ) { // remove all player (but first and second) who went bankrupt during last year - if( spieler[i] != NULL && spieler[i]->get_finance()->is_bancrupted() ) + if( players[i] != NULL && players[i]->get_finance()->is_bancrupted() ) { remove_player(i); } } - if( spieler[i] != NULL ) { + if( players[i] != NULL ) { // if returns false -> remove player - if (!spieler[i]->neuer_monat()) { + if (!players[i]->new_month()) { remove_player(i); } } @@ -4256,8 +4256,8 @@ DBG_MESSAGE("karte_t::new_year()","speedbonus for %d %i, %i, %i, %i, %i, %i, %i, } for(int i=0; ineues_jahr(); + if( players[i] != NULL ) { + players[i]->new_year(); } } @@ -4515,8 +4515,8 @@ void karte_t::step() DBG_DEBUG4("karte_t::step", "step players"); // then step all players for( int i=0; istep(); + if( players[i] != NULL ) { + players[i]->step(); } } @@ -4606,8 +4606,8 @@ void karte_t::restore_history() for( int m=min(MAX_WORLD_HISTORY_MONTHS,MAX_PLAYER_HISTORY_MONTHS)-1; m>0; m-- ) { sint64 transported = 0; for( uint i=0; iget_finance()->get_history_veh_month( TT_ALL, m, ATV_TRANSPORTED ); + if( players[i]!=NULL ) { + transported += players[i]->get_finance()->get_history_veh_month( TT_ALL, m, ATV_TRANSPORTED ); } } finance_history_month[m][WORLD_TRANSPORTED_GOODS] = transported; @@ -4649,8 +4649,8 @@ void karte_t::restore_history() for( int y=min(MAX_WORLD_HISTORY_YEARS,MAX_CITY_HISTORY_YEARS)-1; y>0; y-- ) { sint64 transported_year = 0; for( uint i=0; iget_finance()->get_history_veh_year( TT_ALL, y, ATV_TRANSPORTED ); + if( players[i] ) { + transported_year += players[i]->get_finance()->get_history_veh_year( TT_ALL, y, ATV_TRANSPORTED ); } } finance_history_year[y][WORLD_TRANSPORTED_GOODS] = transported_year; @@ -4715,9 +4715,9 @@ void karte_t::update_history() sint64 transported = 0; sint64 transported_year = 0; for( uint i=0; iget_finance()->get_history_veh_month( TT_ALL, 0, ATV_TRANSPORTED_GOOD ); - transported_year += spieler[i]->get_finance()->get_history_veh_year( TT_ALL, 0, ATV_TRANSPORTED_GOOD ); + if( players[i]!=NULL ) { + transported += players[i]->get_finance()->get_history_veh_month( TT_ALL, 0, ATV_TRANSPORTED_GOOD ); + transported_year += players[i]->get_finance()->get_history_veh_year( TT_ALL, 0, ATV_TRANSPORTED_GOOD ); } } finance_history_month[0][WORLD_TRANSPORTED_GOODS] = transported; @@ -5056,16 +5056,16 @@ DBG_MESSAGE("karte_t::speichern(loadsave_t *file)", "start"); file->set_buffered(true); // do not set value for empty player - uint8 old_sp[MAX_PLAYER_COUNT]; + uint8 old_players[MAX_PLAYER_COUNT]; for( int i=0; irdwr_long(ticks); @@ -5151,20 +5151,20 @@ DBG_MESSAGE("karte_t::speichern(loadsave_t *file)", "saved %i convois",convoi_ar // **** REMOVE IF SOON! ********* if(file->get_version()<101000) { if( i<8 ) { - if( spieler[i] ) { - spieler[i]->rdwr(file); + if( players[i] ) { + players[i]->rdwr(file); } else { // simulate old ones ... - spieler_t *sp = new spieler_t( this, i ); - sp->rdwr(file); - delete sp; + player_t *player = new player_t( this, i ); + player->rdwr(file); + delete player; } } } else { - if( spieler[i] ) { - spieler[i]->rdwr(file); + if( players[i] ) { + players[i]->rdwr(file); } } } @@ -5633,20 +5633,20 @@ DBG_MESSAGE("karte_t::laden()", "init player"); for(int i=0; iget_version()>=101000 ) { // since we have different kind of AIs - delete spieler[i]; - spieler[i] = NULL; - new_spieler(i, settings.spieler_type[i]); + delete players[i]; + players[i] = NULL; + init_new_player(i, settings.player_type[i]); } else if(i<8) { // get the old player ... - if( spieler[i]==NULL ) { - new_spieler( i, (i==3) ? spieler_t::AI_PASSENGER : spieler_t::AI_GOODS ); + if( players[i]==NULL ) { + init_new_player( i, (i==3) ? player_t::AI_PASSENGER : player_t::AI_GOODS ); } - settings.spieler_type[i] = spieler[i]->get_ai_id(); + settings.player_type[i] = players[i]->get_ai_id(); } } // so far, player 1 will be active (may change in future) - active_player = spieler[0]; + active_player = players[0]; active_player_nr = 0; // rdwr cityrules, speedbonus for networkgames @@ -5771,7 +5771,7 @@ DBG_MESSAGE("karte_t::laden()", "init player"); // @author hsiegeln if (file->get_version() > 82003 && file->get_version()<88003) { DBG_MESSAGE("karte_t::laden()", "load linemanagement"); - get_spieler(0)->simlinemgmt.rdwr(file, get_spieler(0)); + get_player(0)->simlinemgmt.rdwr(file, get_player(0)); } // end load linemanagement @@ -5831,14 +5831,14 @@ DBG_MESSAGE("karte_t::laden()", "init player"); } DBG_MESSAGE("karte_t::laden()", "%d convois/trains loaded", convoi_array.get_count()); - // jetzt koennen die spieler geladen werden + // now the player can be loaded for(int i=0; irdwr(file); - settings.automaten[i] = spieler[i]->is_active(); + if( players[i] ) { + players[i]->rdwr(file); + settings.player_active[i] = players[i]->is_active(); } else { - settings.automaten[i] = false; + settings.player_active[i] = false; } ls.set_progress( (get_size().y*3)/2+128+8*i ); } @@ -5949,8 +5949,8 @@ DBG_MESSAGE("karte_t::laden()", "%d factories loaded", fab_list.get_count()); // register all line stops and change line types, if needed for(int i=0; iladen_abschliessen(); + if( players[i] ) { + players[i]->load_finished(); } } @@ -6004,8 +6004,8 @@ DBG_MESSAGE("karte_t::laden()", "%d factories loaded", fab_list.get_count()); // network game this will be done in nwc_sync_t::do_command if( !env_t::networkmode ) { for( uint8 i=0; icheck_unlock( player_password_hash[i] ); + if( players[i] ) { + players[i]->check_unlock( player_password_hash[i] ); } } } @@ -6032,7 +6032,7 @@ DBG_MESSAGE("karte_t::laden()", "%d factories loaded", fab_list.get_count()); if( file->get_version()>=102004 ) { if( env_t::restore_UI ) { file->rdwr_byte( active_player_nr ); - active_player = spieler[active_player_nr]; + active_player = players[active_player_nr]; /* restore all open windows * otherwise it will be ignored * which is save, since it is the end of file @@ -6295,13 +6295,13 @@ void karte_t::create_grounds_loop( sint16 x_min, sint16 x_max, sint16 y_min, sin } -uint8 karte_t::sp2num(spieler_t *sp) +uint8 karte_t::sp2num(player_t *player) { - if( sp==NULL ) { + if( player==NULL ) { return PLAYER_UNOWNED; } for(int i=0; i=PLAYER_UNOWNED || get_spieler(new_player)!=NULL ) { + if( new_player_in>=PLAYER_UNOWNED || get_player(new_player_in)!=NULL ) { return "Id invalid/already in use!"; } switch( type ) { - case spieler_t::EMPTY: break; - case spieler_t::HUMAN: spieler[new_player] = new spieler_t(this,new_player); break; - case spieler_t::AI_GOODS: spieler[new_player] = new ai_goods_t(this,new_player); break; - case spieler_t::AI_PASSENGER: spieler[new_player] = new ai_passenger_t(this,new_player); break; + case player_t::EMPTY: break; + case player_t::HUMAN: players[new_player_in] = new player_t(this,new_player_in); break; + case player_t::AI_GOODS: players[new_player_in] = new ai_goods_t(this,new_player_in); break; + case player_t::AI_PASSENGER: players[new_player_in] = new ai_passenger_t(this,new_player_in); break; default: return "Unknow AI type!"; } - settings.set_player_type(new_player, type); + settings.set_player_type(new_player_in, type); return NULL; } void karte_t::remove_player(uint8 player_nr) { - if ( player_nr!=1 && player_nrai_bankrupt(); - delete spieler[player_nr]; - spieler[player_nr] = 0; + if ( player_nr!=1 && player_nrai_bankrupt(); + delete players[player_nr]; + players[player_nr] = 0; nwc_chg_player_t::company_removed(player_nr); // if default human, create new instace of it (to avoid crashes) if( player_nr == 0 ) { - spieler[0] = new spieler_t( this, 0 ); + players[0] = new player_t( this, 0 ); } // if currently still active => reset to default human if( player_nr == active_player_nr ) { active_player_nr = 0; - active_player = spieler[0]; + active_player = players[0]; if( !env_t::server ) { create_win( display_get_width()/2-128, 40, new news_img("Bankrott:\n\nDu bist bankrott.\n"), w_info, magic_none); } @@ -6555,7 +6555,7 @@ void karte_t::remove_player(uint8 player_nr) void karte_t::switch_active_player(uint8 new_player, bool silent) { for( uint8 i=0; iget_pos(); // no cheating allowed? - if (!settings.get_allow_player_change() && spieler[1]->is_locked()) { + if (!settings.get_allow_player_change() && players[1]->is_locked()) { active_player_nr = 0; - active_player = spieler[0]; + active_player = players[0]; if(new_player!=0) { create_win( new news_img("On this map, you are not\nallowed to change player!\n"), w_time_delete, magic_none); } @@ -6577,7 +6577,7 @@ void karte_t::switch_active_player(uint8 new_player, bool silent) selected_tool[active_player_nr]->exit(active_player); } active_player_nr = new_player; - active_player = spieler[new_player]; + active_player = players[new_player]; if( !silent ) { // tell the player cbuffer_t buf; @@ -7084,9 +7084,9 @@ void karte_t::announce_server(int status) // Now add the game data part uint8 active = 0, locked = 0; for( uint8 i=0; iget_ai_id()!=spieler_t::EMPTY ) { + if( players[i] && players[i]->get_ai_id()!=player_t::EMPTY ) { active ++; - if( spieler[i]->is_locked() ) { + if( players[i]->is_locked() ) { locked ++; } } diff --git a/simworld.h b/simworld.h index 17873b2d4a8..298b91e7ce4 100644 --- a/simworld.h +++ b/simworld.h @@ -386,7 +386,7 @@ class karte_t * @param hnw desired height of nw-corner * @returns NULL if raise_to operation can be performed, an error message otherwise */ - const char* can_raise_to(const spieler_t* sp, sint16 x, sint16 y, bool keep_water, sint8 hsw, sint8 hse, sint8 hne, sint8 hnw) const; + const char* can_raise_to(const player_t* player, sint16 x, sint16 y, bool keep_water, sint8 hsw, sint8 hse, sint8 hne, sint8 hnw) const; /** * Raises heights of the corners of the tile at (@p x, @p y). @@ -410,7 +410,7 @@ class karte_t * @param hnw desired height of nw-corner * @returns NULL if lower_to operation can be performed, an error message otherwise */ - const char* can_lower_to(const spieler_t* sp, sint16 x, sint16 y, sint8 hsw, sint8 hse, sint8 hne, sint8 hnw) const; + const char* can_lower_to(const player_t* player, sint16 x, sint16 y, sint8 hsw, sint8 hse, sint8 hne, sint8 hnw) const; /** * Lowers heights of the corners of the tile at (@p x, @p y). @@ -476,12 +476,12 @@ class karte_t * The players of the game. * @note Standard human player has index 0, public player 1. */ - spieler_t *spieler[MAX_PLAYER_COUNT]; + player_t *players[MAX_PLAYER_COUNT]; /** * Active player. */ - spieler_t *active_player; + player_t *active_player; /** * Active player index. @@ -918,12 +918,12 @@ class karte_t /** * Player management here */ - uint8 sp2num(spieler_t *sp); - spieler_t * get_spieler(uint8 n) const { return spieler[n&15]; } - spieler_t* get_active_player() const { return active_player; } + uint8 sp2num(player_t *player); + player_t * get_player(uint8 n) const { return players[n&15]; } + player_t* get_active_player() const { return active_player; } uint8 get_active_player_nr() const { return active_player_nr; } void switch_active_player(uint8 nr, bool silent); - const char *new_spieler( uint8 nr, uint8 type ); + const char *init_new_player( uint8 nr, uint8 type ); void store_player_password_hash( uint8 player_nr, const pwd_hash_t& hash ); const pwd_hash_t& get_player_password_hash( uint8 player_nr ) const { return player_password_hash[player_nr]; } void clear_player_password_hashes(); @@ -1192,12 +1192,12 @@ class karte_t /** * Set a new tool as current: calls local_set_tool or sends to server. */ - void set_tool( tool_t *tool_in, spieler_t * sp ); + void set_tool( tool_t *tool_in, player_t* player ); /** * Set a new tool on our client, calls init. */ - void local_set_tool( tool_t *tool_in, spieler_t * sp ); + void local_set_tool( tool_t *tool_in, player_t* player ); tool_t *get_tool(uint8 nr) const { return selected_tool[nr]; } /** @@ -1420,14 +1420,14 @@ class karte_t * can be lowered at the specified height. * @author V. Meyer */ - const char* can_lower_plan_to(const spieler_t *sp, sint16 x, sint16 y, sint8 h) const; + const char* can_lower_plan_to(const player_t *player, sint16 x, sint16 y, sint8 h) const; /** * Checks if the planquadrat at coordinate (x,y) * can be raised at the specified height. * @author V. Meyer */ - const char* can_raise_plan_to(const spieler_t *sp, sint16 x, sint16 y, sint8 h) const; + const char* can_raise_plan_to(const player_t *player, sint16 x, sint16 y, sint8 h) const; /** * Checks if the whole planquadrat at coordinates (x,y) height can @@ -1440,17 +1440,17 @@ class karte_t * Increases the height of the grid coordinate (x, y) by one. * @param pos Grid coordinate. */ - int grid_raise(const spieler_t *sp, koord pos, const char*&err); + int grid_raise(const player_t *player, koord pos, const char*&err); /** * Decreases the height of the grid coordinate (x, y) by one. * @param pos Grid coordinate. */ - int grid_lower(const spieler_t *sp, koord pos, const char*&err); + int grid_lower(const player_t *player, koord pos, const char*&err); // mostly used by AI: Ask to flatten a tile - bool can_ebne_planquadrat(spieler_t *sp, koord k, sint8 hgt, bool keep_water=false, bool make_underwater_hill=false); - bool ebne_planquadrat(spieler_t *sp, koord k, sint8 hgt, bool keep_water=false, bool make_underwater_hill=false, bool justcheck=false); + bool can_ebne_planquadrat(player_t *player, koord k, sint8 hgt, bool keep_water=false, bool make_underwater_hill=false); + bool ebne_planquadrat(player_t *player, koord k, sint8 hgt, bool keep_water=false, bool make_underwater_hill=false, bool justcheck=false); /** * Class to manage terraform operations. @@ -1503,9 +1503,9 @@ class karte_t void iterate(bool raise); /// Check whether raise operation would succeed - const char* can_raise_all(const spieler_t *sp, bool keep_water=false) const; + const char* can_raise_all(const player_t *player, bool keep_water=false) const; /// Check whether lower operation would succeed - const char* can_lower_all(const spieler_t *sp) const; + const char* can_lower_all(const player_t *player) const; /// Do the raise operations int raise_all(); diff --git a/vehicle/movingobj.cc b/vehicle/movingobj.cc index 5bd4000f0a0..481c00b84a2 100644 --- a/vehicle/movingobj.cc +++ b/vehicle/movingobj.cc @@ -268,9 +268,9 @@ void movingobj_t::info(cbuffer_t & buf) const -void movingobj_t::entferne(spieler_t *sp) +void movingobj_t::entferne(player_t *player) { - spieler_t::book_construction_costs(sp, -get_besch()->get_preis(), get_pos().get_2d(), ignore_wt); + player_t::book_construction_costs(player, -get_besch()->get_preis(), get_pos().get_2d(), ignore_wt); mark_image_dirty( get_bild(), 0 ); welt->sync_remove( this ); } diff --git a/vehicle/movingobj.h b/vehicle/movingobj.h index 2a03eb6165b..6d7269ffd18 100644 --- a/vehicle/movingobj.h +++ b/vehicle/movingobj.h @@ -77,7 +77,7 @@ class movingobj_t : public vehikel_basis_t, public sync_steppable void info(cbuffer_t & buf) const; - void entferne(spieler_t *sp); + void entferne(player_t *player); const groundobj_besch_t* get_besch() const { return movingobj_typen[movingobjtype]; } diff --git a/vehicle/simvehikel.cc b/vehicle/simvehikel.cc index 37200596a6b..bf9a6b10ff3 100644 --- a/vehicle/simvehikel.cc +++ b/vehicle/simvehikel.cc @@ -921,12 +921,12 @@ void vehikel_t::neue_fahrt(uint16 start_route_index, bool recalc) } -vehikel_t::vehikel_t(koord3d pos, const vehikel_besch_t* besch, spieler_t* sp) : +vehikel_t::vehikel_t(koord3d pos, const vehikel_besch_t* besch, player_t* player_) : vehikel_basis_t(pos) { this->besch = besch; - set_besitzer( sp ); + set_besitzer( player_ ); insta_zeit = welt->get_current_month(); cnv = NULL; speed_limit = SPEED_UNLIMITED; @@ -1626,7 +1626,7 @@ void vehikel_t::info(cbuffer_t & buf) const } -const char *vehikel_t::ist_entfernbar(const spieler_t *) +const char *vehikel_t::ist_entfernbar(const player_t *) { return "Fahrzeuge koennen so nicht entfernt werden"; } @@ -1738,8 +1738,8 @@ void vehikel_t::display_after(int xpos, int ypos, bool is_gobal) const -automobil_t::automobil_t(koord3d pos, const vehikel_besch_t* besch, spieler_t* sp, convoi_t* cn) : - vehikel_t(pos, besch, sp) +automobil_t::automobil_t(koord3d pos, const vehikel_besch_t* besch, player_t* player_, convoi_t* cn) : + vehikel_t(pos, besch, player_) { cnv = cn; drives_on_left = welt->get_settings().is_drive_left(); @@ -2296,8 +2296,8 @@ DBG_MESSAGE("waggon_t::waggon_t()","replaced by %s",besch->get_name()); } -waggon_t::waggon_t(koord3d pos, const vehikel_besch_t* besch, spieler_t* sp, convoi_t* cn) : - vehikel_t(pos, besch, sp) +waggon_t::waggon_t(koord3d pos, const vehikel_besch_t* besch, player_t* player_, convoi_t* cn) : + vehikel_t(pos, besch, player_) { cnv = cn; } @@ -3064,8 +3064,8 @@ schedule_t * narrowgauge_waggon_t::erzeuge_neuen_fahrplan() const } -schiff_t::schiff_t(koord3d pos, const vehikel_besch_t* besch, spieler_t* sp, convoi_t* cn) : - vehikel_t(pos, besch, sp) +schiff_t::schiff_t(koord3d pos, const vehikel_besch_t* besch, player_t* player_, convoi_t* cn) : + vehikel_t(pos, besch, player_) { cnv = cn; } @@ -3893,8 +3893,8 @@ aircraft_t::aircraft_t(loadsave_t *file, bool is_first, bool is_last) : vehikel_ } -aircraft_t::aircraft_t(koord3d pos, const vehikel_besch_t* besch, spieler_t* sp, convoi_t* cn) : - vehikel_t(pos, besch, sp) +aircraft_t::aircraft_t(koord3d pos, const vehikel_besch_t* besch, player_t* player_, convoi_t* cn) : + vehikel_t(pos, besch, player_) { cnv = cn; state = taxiing; @@ -4208,10 +4208,10 @@ void aircraft_t::display_overlay(int xpos_org, int ypos_org) const } -const char *aircraft_t::ist_entfernbar(const spieler_t *sp) +const char *aircraft_t::ist_entfernbar(const player_t *player) { if (is_on_ground()) { - return vehikel_t::ist_entfernbar(sp); + return vehikel_t::ist_entfernbar(player); } return NULL; } diff --git a/vehicle/simvehikel.h b/vehicle/simvehikel.h index fad6aaba7ce..25a5d3e5047 100644 --- a/vehicle/simvehikel.h +++ b/vehicle/simvehikel.h @@ -308,7 +308,7 @@ class vehikel_t : public vehikel_basis_t, public fahrer_t void neue_fahrt( uint16 start_route_index, bool recalc ); vehikel_t(); - vehikel_t(koord3d pos, const vehikel_besch_t* besch, spieler_t* sp); + vehikel_t(koord3d pos, const vehikel_besch_t* besch, player_t* player_); ~vehikel_t(); @@ -423,7 +423,7 @@ class vehikel_t : public vehikel_basis_t, public fahrer_t */ virtual schedule_t *erzeuge_neuen_fahrplan() const = 0; - const char *ist_entfernbar(const spieler_t *sp); + const char *ist_entfernbar(const player_t *player); void rdwr(loadsave_t *file); virtual void rdwr_from_convoi(loadsave_t *file); @@ -471,7 +471,7 @@ class automobil_t : public vehikel_t virtual waytype_t get_waytype() const { return road_wt; } automobil_t(loadsave_t *file, bool first, bool last); - automobil_t(koord3d pos, const vehikel_besch_t* besch, spieler_t* sp, convoi_t* cnv); // start and schedule + automobil_t(koord3d pos, const vehikel_besch_t* besch, player_t* player_, convoi_t* cnv); // start and schedule virtual void set_convoi(convoi_t *c); @@ -543,7 +543,7 @@ class waggon_t : public vehikel_t typ get_typ() const { return waggon; } waggon_t(loadsave_t *file, bool is_first, bool is_last); - waggon_t(koord3d pos, const vehikel_besch_t* besch, spieler_t* sp, convoi_t *cnv); + waggon_t(koord3d pos, const vehikel_besch_t* besch, player_t* player_, convoi_t *cnv); ~waggon_t(); virtual void set_convoi(convoi_t *c); @@ -565,7 +565,7 @@ class monorail_waggon_t : public waggon_t // all handled by waggon_t monorail_waggon_t(loadsave_t *file, bool is_first, bool is_last) : waggon_t(file,is_first, is_last) {} - monorail_waggon_t(koord3d pos, const vehikel_besch_t* besch, spieler_t* sp, convoi_t* cnv) : waggon_t(pos, besch, sp, cnv) {} + monorail_waggon_t(koord3d pos, const vehikel_besch_t* besch, player_t* player_, convoi_t* cnv) : waggon_t(pos, besch, player_, cnv) {} typ get_typ() const { return monorailwaggon; } @@ -586,7 +586,7 @@ class maglev_waggon_t : public waggon_t // all handled by waggon_t maglev_waggon_t(loadsave_t *file, bool is_first, bool is_last) : waggon_t(file, is_first, is_last) {} - maglev_waggon_t(koord3d pos, const vehikel_besch_t* besch, spieler_t* sp, convoi_t* cnv) : waggon_t(pos, besch, sp, cnv) {} + maglev_waggon_t(koord3d pos, const vehikel_besch_t* besch, player_t* player_, convoi_t* cnv) : waggon_t(pos, besch, player_, cnv) {} typ get_typ() const { return maglevwaggon; } @@ -607,7 +607,7 @@ class narrowgauge_waggon_t : public waggon_t // all handled by waggon_t narrowgauge_waggon_t(loadsave_t *file, bool is_first, bool is_last) : waggon_t(file, is_first, is_last) {} - narrowgauge_waggon_t(koord3d pos, const vehikel_besch_t* besch, spieler_t* sp, convoi_t* cnv) : waggon_t(pos, besch, sp, cnv) {} + narrowgauge_waggon_t(koord3d pos, const vehikel_besch_t* besch, player_t* player_, convoi_t* cnv) : waggon_t(pos, besch, player_, cnv) {} typ get_typ() const { return narrowgaugewaggon; } @@ -644,7 +644,7 @@ class schiff_t : public vehikel_t virtual bool ist_ziel(const grund_t *,const grund_t *) const {return 0;} schiff_t(loadsave_t *file, bool is_first, bool is_last); - schiff_t(koord3d pos, const vehikel_besch_t* besch, spieler_t* sp, convoi_t* cnv); + schiff_t(koord3d pos, const vehikel_besch_t* besch, player_t* player_, convoi_t* cnv); obj_t::typ get_typ() const { return schiff; } @@ -699,7 +699,7 @@ class aircraft_t : public vehikel_t public: aircraft_t(loadsave_t *file, bool is_first, bool is_last); - aircraft_t(koord3d pos, const vehikel_besch_t* besch, spieler_t* sp, convoi_t* cnv); // start and schedule + aircraft_t(koord3d pos, const vehikel_besch_t* besch, player_t* player_, convoi_t* cnv); // start and schedule // to shift the events around properly void get_event_index( flight_state &state_, uint32 &takeoff_, uint32 &stopsearch_, uint32 &landing_ ) { state_ = state; takeoff_ = takeoff; stopsearch_ = suchen; landing_ = touchdown; } @@ -758,7 +758,7 @@ class aircraft_t : public vehikel_t bool is_on_ground() const { return flughoehe==0 && !(state==circling || state==flying); } - const char *ist_entfernbar(const spieler_t *sp); + const char *ist_entfernbar(const player_t *player); }; #endif diff --git a/vehicle/simverkehr.cc b/vehicle/simverkehr.cc index b3c4eb2dab0..e0e53cdea21 100644 --- a/vehicle/simverkehr.cc +++ b/vehicle/simverkehr.cc @@ -47,7 +47,7 @@ verkehrsteilnehmer_t::verkehrsteilnehmer_t() : vehikel_basis_t() { - set_besitzer( welt->get_spieler(1) ); + set_besitzer( welt->get_player(1) ); time_to_life = 0; weg_next = 0; } @@ -110,7 +110,7 @@ verkehrsteilnehmer_t::verkehrsteilnehmer_t(grund_t* bd, uint16 random) : else { pos_next = welt->lookup_kartenboden(get_pos().get_2d() + koord(fahrtrichtung))->get_pos(); } - set_besitzer( welt->get_spieler(1) ); + set_besitzer( welt->get_player(1) ); } diff --git a/vehicle/simverkehr.h b/vehicle/simverkehr.h index 64afd556b39..d7f0e69705b 100644 --- a/vehicle/simverkehr.h +++ b/vehicle/simverkehr.h @@ -70,7 +70,7 @@ class verkehrsteilnehmer_t : public vehikel_basis_t, public sync_steppable void laden_abschliessen() {calc_bild();} // we allow to remove all cars etc. - const char *ist_entfernbar(const spieler_t *) { return NULL; } + const char *ist_entfernbar(const player_t *) { return NULL; } };