diff --git a/bauer/fabrikbauer.cc b/bauer/fabrikbauer.cc index f691c2faaea..79abcb8be12 100644 --- a/bauer/fabrikbauer.cc +++ b/bauer/fabrikbauer.cc @@ -475,7 +475,7 @@ static fabrik_t* baue_fabrik(karte_t* welt, koord3d* parent, const fabrik_besch_ */ int fabrikbauer_t::baue_hierarchie(koord3d* parent, const fabrik_besch_t* info, int rotate, koord3d* pos, spieler_t* sp) { - karte_t* welt = sp->gib_welt(); + karte_t* welt = sp->get_welt(); int n = 1; if(info==NULL) { diff --git a/boden/grund.h b/boden/grund.h index f42bd235941..d46083a4500 100644 --- a/boden/grund.h +++ b/boden/grund.h @@ -242,7 +242,7 @@ class grund_t */ static void toggle_underground_mode() { grund_t::underground_mode = !grund_t::underground_mode; } - karte_t *gib_welt() const {return welt;} + karte_t *get_welt() const {return welt;} /** * Setzt Flags für das neuzeichnen geänderter Untergründe diff --git a/dataobj/fahrplan.cc b/dataobj/fahrplan.cc index cf41fab1786..29f4fa7e7f5 100644 --- a/dataobj/fahrplan.cc +++ b/dataobj/fahrplan.cc @@ -366,7 +366,7 @@ schifffahrplan_t::zeige_fehlermeldung(karte_t *welt) const bool airfahrplan_t::ist_halt_erlaubt(const grund_t *gr) const { - bool hat_halt = haltestelle_t::gib_halt(gr->gib_welt(),gr->gib_pos().gib_2d()).is_bound(); + bool hat_halt = haltestelle_t::gib_halt(gr->get_welt(),gr->gib_pos().gib_2d()).is_bound(); return hat_halt ? gr->hat_weg(air_wt) : true; } diff --git a/documentation/coding_styles.txt b/documentation/coding_styles.txt index ddc0597e5b5..49345531694 100644 --- a/documentation/coding_styles.txt +++ b/documentation/coding_styles.txt @@ -24,6 +24,13 @@ yet conform 100% to this rules, but it should. -> Class names should be nouns because classes are static elements -> Method names should be verbs because methods are dynamic elements + There are some standard prefixes used throughout the program: + get_ gib_ return a value + set_ setze_ will set a value + is_ ist_ will test a conditions + For new functions, the first (english) form should be used. Function names + should never start with uppercase letters. + - Use const wherever possible -> This helps the reader of the program (he sees which values are intended not to be changed) and the compiler (to optimize the code) diff --git a/gui/components/gui_world_view_t.cc b/gui/components/gui_world_view_t.cc index ab09bdf89d0..dd300dd8743 100644 --- a/gui/components/gui_world_view_t.cc +++ b/gui/components/gui_world_view_t.cc @@ -37,7 +37,7 @@ world_view_t::world_view_t(ding_t* dt) : location(koord3d::invalid), ding(dt), raster(0), - welt(dt->World()) + welt(dt->get_welt()) { setze_groesse(koord(64,56)); } diff --git a/gui/convoi_detail_t.cc b/gui/convoi_detail_t.cc index 86774e52d87..8a60dd99311 100644 --- a/gui/convoi_detail_t.cc +++ b/gui/convoi_detail_t.cc @@ -77,7 +77,7 @@ convoi_detail_t::zeichnen(koord pos, koord gr) destroy_win(dynamic_cast (this)); } else { - if(cnv->gib_besitzer()==cnv->gib_welt()->get_active_player()) { + if(cnv->gib_besitzer()==cnv->get_welt()->get_active_player()) { withdraw_button.enable(); sale_button.enable(); } @@ -162,7 +162,7 @@ void gui_vehicleinfo_t::zeichnen(koord offset) char buf[256], tmp[256]; // for bonus stuff - const sint32 ref_speed = cnv->gib_welt()->get_average_speed( cnv->gib_vehikel(0)->gib_waytype() ); + const sint32 ref_speed = cnv->get_welt()->get_average_speed( cnv->gib_vehikel(0)->gib_waytype() ); const sint32 speed_base = (100*speed_to_kmh(cnv->gib_min_top_speed()))/ref_speed-100; static cbuffer_t freight_info(1024); diff --git a/gui/convoi_frame.cc b/gui/convoi_frame.cc index 7022a69a179..014928b2b73 100644 --- a/gui/convoi_frame.cc +++ b/gui/convoi_frame.cc @@ -219,7 +219,7 @@ convoi_frame_t::~convoi_frame_t() void convoi_frame_t::display_list(void) { - const karte_t* welt = owner->gib_welt(); + const karte_t* welt = owner->get_welt(); const unsigned count = welt->get_convoi_count(); ALLOCA(convoihandle_t, a, count); int n = 0; diff --git a/gui/convoi_info_t.cc b/gui/convoi_info_t.cc index 871b1fb88ff..08a53350d04 100644 --- a/gui/convoi_info_t.cc +++ b/gui/convoi_info_t.cc @@ -202,11 +202,11 @@ convoi_info_t::zeichnen(koord pos, koord gr) destroy_win(dynamic_cast (this)); } else { - if(cnv->gib_besitzer()==cnv->gib_welt()->get_active_player()) { + if(cnv->gib_besitzer()==cnv->get_welt()->get_active_player()) { button.enable(); go_home_button.pressed = route_search_in_progress; if (cnv->gib_fahrplan()->maxi() > 0) { - const grund_t* g = cnv->gib_welt()->lookup(cnv->gib_fahrplan()->eintrag[cnv->gib_fahrplan()->aktuell].pos); + const grund_t* g = cnv->get_welt()->lookup(cnv->gib_fahrplan()->eintrag[cnv->gib_fahrplan()->aktuell].pos); if (g != NULL && g->gib_depot()) { go_home_button.disable(); } else { @@ -225,7 +225,7 @@ convoi_info_t::zeichnen(koord pos, koord gr) go_home_button.disable(); no_load_button.disable(); } - follow_button.pressed = (cnv->gib_welt()->get_follow_convoi()==cnv); + follow_button.pressed = (cnv->get_welt()->get_follow_convoi()==cnv); // buffer update now only when needed by convoi itself => dedicated buffer for this cnv->get_freight_info(freight_info); @@ -268,7 +268,7 @@ convoi_info_t::zeichnen(koord pos, koord gr) const fahrplan_t * fpl = cnv->gib_fahrplan(); info_buf.clear(); info_buf.append(translator::translate("Fahrtziel")); - fahrplan_gui_t::gimme_short_stop_name(info_buf, cnv->gib_welt(), fpl, fpl->aktuell, 34); + fahrplan_gui_t::gimme_short_stop_name(info_buf, cnv->get_welt(), fpl, fpl->aktuell, 34); len = display_proportional( pos.x+11, pos.y+16+20+3*LINESPACE, info_buf, ALIGN_LEFT, COL_BLACK, true ); // convoi load indicator @@ -296,12 +296,12 @@ bool convoi_info_t::action_triggered(gui_komponente_t *komp,value_t /* */) { // follow convoi on map? if(komp == &follow_button) { - if(cnv->gib_welt()->get_follow_convoi()==cnv) { + if(cnv->get_welt()->get_follow_convoi()==cnv) { // stop following - cnv->gib_welt()->set_follow_convoi( convoihandle_t() ); + cnv->get_welt()->set_follow_convoi( convoihandle_t() ); } else { - cnv->gib_welt()->set_follow_convoi(cnv); + cnv->get_welt()->set_follow_convoi(cnv); } return true; } @@ -323,7 +323,7 @@ bool convoi_info_t::action_triggered(gui_komponente_t *komp,value_t /* */) } // some actions only allowed, when I am the player - if(cnv->gib_besitzer()==cnv->gib_welt()->get_active_player()) { + if(cnv->gib_besitzer()==cnv->get_welt()->get_active_player()) { if(komp == &button) //Fahrplan { @@ -380,7 +380,7 @@ DBG_MESSAGE("convoi_info_t::action_triggered()","convoi state %i => cannot chang bool b_depot_found = false; if (shortest_route->gib_max_n() > -1) { fahrplan_t *fpl = cnv->gib_fahrplan(); - karte_t* welt = cnv->gib_welt(); + karte_t* welt = cnv->get_welt(); fpl->insert(welt, welt->lookup(home)); b_depot_found = cnv->setze_fahrplan(fpl); } @@ -389,9 +389,9 @@ DBG_MESSAGE("convoi_info_t::action_triggered()","convoi state %i => cannot chang // show result if (b_depot_found) { - create_win(-1, -1, 120, new nachrichtenfenster_t(cnv->gib_welt(), translator::translate("Convoi has been sent\nto the nearest depot\nof appropriate type.\n")), w_autodelete); + create_win(-1, -1, 120, new nachrichtenfenster_t(cnv->get_welt(), translator::translate("Convoi has been sent\nto the nearest depot\nof appropriate type.\n")), w_autodelete); } else { - create_win(-1, -1, 120, new nachrichtenfenster_t(cnv->gib_welt(), translator::translate("Home depot not found!\nYou need to send the\nconvoi to the depot\nmanually.")), w_autodelete); + create_win(-1, -1, 120, new nachrichtenfenster_t(cnv->get_welt(), translator::translate("Home depot not found!\nYou need to send the\nconvoi to the depot\nmanually.")), w_autodelete); } } // end go home button } diff --git a/gui/depot_frame.cc b/gui/depot_frame.cc index cc6bb09044a..6c54123f264 100644 --- a/gui/depot_frame.cc +++ b/gui/depot_frame.cc @@ -176,7 +176,7 @@ DBG_DEBUG("depot_frame_t::depot_frame_t()","get_max_convoi_length()=%i",depot->g bool old_show_all=show_all; show_retired_vehicles = true; show_all = true; - einstellungen_t* e = World()->gib_einstellungen(); + einstellungen_t* e = get_welt()->gib_einstellungen(); char timeline = e->gib_use_timeline(); e->setze_use_timeline(0); build_vehicle_lists(); @@ -563,7 +563,7 @@ void depot_frame_t::add_to_vehicle_list(const vehikel_besch_t *info) // add all current vehicles void depot_frame_t::build_vehicle_lists() { - const int month_now = World()->get_timeline_year_month(); + const int month_now = get_welt()->get_timeline_year_month(); if (pas_vec.empty() && loks_vec.empty() && waggons_vec.empty()) { int loks = 0, waggons = 0, pax=0; @@ -591,7 +591,7 @@ void depot_frame_t::build_vehicle_lists() vehicle_map.clear(); // we do not allow to built electric vehicle in a depot without electrification - const schiene_t* sch = dynamic_cast(World()->lookup(depot->gib_pos())->gib_weg(track_wt)); + const schiene_t* sch = dynamic_cast(get_welt()->lookup(depot->gib_pos())->gib_weg(track_wt)); const bool schiene_electric = (sch==NULL) || sch->is_electrified(); // use this to show only sellable vehicles @@ -650,7 +650,7 @@ void depot_frame_t::update_data() static const char *txt_veh_action[3] = { "anhaengen", "voranstellen", "verkaufen" }; // change green into blue for retired vehicles - const int month_now = World()->get_timeline_year_month(); + const int month_now = get_welt()->get_timeline_year_month(); bt_veh_action.setze_text(txt_veh_action[veh_action]); @@ -1068,7 +1068,7 @@ void depot_frame_t::infowin_event(const event_t *ev) next_dep->zeige_info(); win_set_pos(next_dep->get_info_win(), x, y); - World()->setze_ij_off(next_dep->gib_pos()); + get_welt()->setze_ij_off(next_dep->gib_pos()); } } else if(IS_WINDOW_REZOOM(ev)) { koord gr = gib_fenstergroesse(); @@ -1091,7 +1091,7 @@ void depot_frame_t::infowin_event(const event_t *ev) void depot_frame_t::zeichnen(koord pos, koord groesse) { - if (World()->get_active_player() != depot->gib_besitzer()) { + if (get_welt()->get_active_player() != depot->gib_besitzer()) { destroy_win(this); } @@ -1201,11 +1201,11 @@ void depot_frame_t::fahrplaneingabe() } } else { - create_win(100, 64, new nachrichtenfenster_t(World(), "Es wird bereits\nein Fahrplan\neingegeben\n"), w_autodelete); + create_win(100, 64, new nachrichtenfenster_t(get_welt(), "Es wird bereits\nein Fahrplan\neingegeben\n"), w_autodelete); } } else { - create_win(100, 64, new nachrichtenfenster_t(World(), "Please choose vehicles first\n"), w_autodelete); + create_win(100, 64, new nachrichtenfenster_t(get_welt(), "Please choose vehicles first\n"), w_autodelete); } } diff --git a/gui/depot_frame.h b/gui/depot_frame.h index 853bf1ae53c..45c3683c525 100644 --- a/gui/depot_frame.h +++ b/gui/depot_frame.h @@ -192,7 +192,7 @@ class depot_frame_t : public gui_frame_t, void image_from_storage_list(gui_image_list_t::image_data_t *bild_data); - karte_t* World() { return depot->World(); } + karte_t* get_welt() { return depot->get_welt(); } public: depot_frame_t(depot_t* depot); diff --git a/gui/fabrik_info.cc b/gui/fabrik_info.cc index 6ed14f32c45..1f7e40ccd5a 100644 --- a/gui/fabrik_info.cc +++ b/gui/fabrik_info.cc @@ -161,7 +161,7 @@ void fabrik_info_t::zeichnen(koord pos, koord gr) */ bool fabrik_info_t::action_triggered(gui_komponente_t *komp,value_t /* */) { - karte_t* welt = ding->World(); + karte_t* welt = ding->get_welt(); unsigned int i; for(i=0; igib_lieferziele().get_count(); i++) { diff --git a/gui/fahrplan_gui.cc b/gui/fahrplan_gui.cc index 9a2bf7cc7ab..652a5c90e0b 100644 --- a/gui/fahrplan_gui.cc +++ b/gui/fahrplan_gui.cc @@ -240,7 +240,7 @@ void fahrplan_gui_t::init() line_selector.setze_pos(koord(BUTTON_WIDTH, 5)); line_selector.setze_groesse(koord(BUTTON_WIDTH*2, 14)); line_selector.set_max_size(koord(BUTTON_WIDTH*2, 13*LINESPACE+2+16)); - karte_t* welt = sp->gib_welt(); + karte_t* welt = sp->get_welt(); line_selector.set_highlight_color(welt->get_active_player()->get_player_color1() + 1); line_selector.clear_elements(); @@ -303,7 +303,7 @@ fahrplan_gui_t::infowin_event(const event_t *ev) fpl->cleanup(); fpl->eingabe_abschliessen(); - karte_t* welt = sp->gib_welt(); + karte_t* welt = sp->get_welt(); welt->setze_maus_funktion(wkz_abfrage, skinverwaltung_t::fragezeiger->gib_bild_nr(0), welt->Z_PLAN, NO_SOUND, NO_SOUND); if (cnv.is_bound()) { // if a line is selected @@ -336,7 +336,7 @@ DBG_MESSAGE("fahrplan_gui_t::action_triggered()","komp=%p combo=%p",komp,&line_s bt_add.pressed = true; bt_insert.pressed = false; bt_remove.pressed = false; - karte_t* welt = sp->gib_welt(); + karte_t* welt = sp->get_welt(); welt->setze_maus_funktion(wkz_fahrplan_add, skinverwaltung_t::fahrplanzeiger->gib_bild_nr(0), welt->Z_PLAN, @@ -351,7 +351,7 @@ DBG_MESSAGE("fahrplan_gui_t::action_triggered()","komp=%p combo=%p",komp,&line_s bt_add.pressed = false; bt_insert.pressed = true; bt_remove.pressed = false; - karte_t* welt = sp->gib_welt(); + karte_t* welt = sp->get_welt(); welt->setze_maus_funktion(wkz_fahrplan_ins, skinverwaltung_t::fahrplanzeiger->gib_bild_nr(0), welt->Z_PLAN, @@ -366,7 +366,7 @@ DBG_MESSAGE("fahrplan_gui_t::action_triggered()","komp=%p combo=%p",komp,&line_s bt_add.pressed = false; bt_insert.pressed = false; bt_remove.pressed = true; - karte_t* welt = sp->gib_welt(); + karte_t* welt = sp->get_welt(); welt->setze_maus_funktion(wkz_abfrage, skinverwaltung_t::fragezeiger->gib_bild_nr(0), welt->Z_PLAN, @@ -412,7 +412,7 @@ DBG_MESSAGE("fahrplan_gui_t::action_triggered()","line selection=%i",selection); } else if (komp == &bt_promote_to_line) { new_line = sp->simlinemgmt.create_line(fpl->get_type(), this->fpl); init_line_selector(); -// create_win(-1, -1, 120, new nachrichtenfenster_t(sp->gib_welt(), translator::translate("New line created!\nYou can assign the line now\nby selecting it from the\nline selector above.")), w_autodelete); +// create_win(-1, -1, 120, new nachrichtenfenster_t(sp->get_welt(), translator::translate("New line created!\nYou can assign the line now\nby selecting it from the\nline selector above.")), w_autodelete); } return true; } @@ -458,7 +458,7 @@ fahrplan_gui_t::get_fpl_text(cbuffer_t & buf) buf.append(i==fpl->aktuell ? "> " : " "); buf.append(i+1); buf.append(".) "); - gimme_stop_name(buf, sp->gib_welt(), fpl, i, 240); + gimme_stop_name(buf, sp->get_welt(), fpl, i, 240); buf.append("\n"); } buf.append("\n\n"); diff --git a/gui/ground_info.cc b/gui/ground_info.cc index 617042bc603..ea909505ac4 100644 --- a/gui/ground_info.cc +++ b/gui/ground_info.cc @@ -21,7 +21,7 @@ static cbuffer_t gr_info(1024); grund_info_t::grund_info_t(const grund_t* gr_) : gui_frame_t(gr_->gib_name(), NULL), gr(gr_), - view(gr_->gib_welt(), gr_->gib_pos()) + view(gr_->get_welt(), gr_->gib_pos()) { const ding_t* d = gr->obj_bei(0); if (d != NULL) set_owner(d->gib_besitzer()); diff --git a/gui/gui_convoiinfo.cc b/gui/gui_convoiinfo.cc index d2d175fde97..1a6b240269f 100644 --- a/gui/gui_convoiinfo.cc +++ b/gui/gui_convoiinfo.cc @@ -44,9 +44,9 @@ void gui_convoiinfo_t::infowin_event(const event_t *ev) if(cnv.is_bound()) { if(IS_LEFTRELEASE(ev)) { if(cnv->in_depot()) { - grund_t *gr = cnv->gib_welt()->lookup(cnv->gib_vehikel(0)->gib_pos()); + grund_t *gr = cnv->get_welt()->lookup(cnv->gib_vehikel(0)->gib_pos()); if(gr==NULL || gr->gib_depot()==NULL) { - gr = cnv->gib_welt()->lookup(cnv->get_home_depot()); + gr = cnv->get_welt()->lookup(cnv->get_home_depot()); } gr->gib_depot()->zeige_info(); } @@ -55,7 +55,7 @@ void gui_convoiinfo_t::infowin_event(const event_t *ev) } } else if(IS_RIGHTRELEASE(ev)) { - cnv->gib_welt()->setze_ij_off(cnv->gib_vehikel(0)->gib_pos()); + cnv->get_welt()->setze_ij_off(cnv->gib_vehikel(0)->gib_pos()); } } } diff --git a/gui/halt_list_stats.cc b/gui/halt_list_stats.cc index d589b2e456a..43de4bca6d0 100644 --- a/gui/halt_list_stats.cc +++ b/gui/halt_list_stats.cc @@ -38,7 +38,7 @@ void halt_list_stats_t::infowin_event(const event_t *ev) } } if(IS_RIGHTRELEASE(ev)) { - halt->gib_welt()->setze_ij_off(halt->gib_basis_pos3d()); + halt->get_welt()->setze_ij_off(halt->gib_basis_pos3d()); } } diff --git a/gui/karte.h b/gui/karte.h index a0f9b49c8a8..ae6c7cc3d9c 100644 --- a/gui/karte.h +++ b/gui/karte.h @@ -103,7 +103,7 @@ class reliefkarte_t : public gui_komponente_t ~reliefkarte_t(); - karte_t * gib_welt() const {return welt;} + karte_t * get_welt() const {return welt;} void setze_welt(karte_t *welt); diff --git a/gui/map_frame.cc b/gui/map_frame.cc index 9e9515a5a42..fd93b5e7772 100644 --- a/gui/map_frame.cc +++ b/gui/map_frame.cc @@ -291,7 +291,7 @@ void map_frame_t::infowin_event(const event_t *ev) // we track this here, and adjust size. if(IS_RIGHTCLICK(ev)) { is_dragging = false; - reliefkarte_t::gib_karte()->gib_welt()->set_scroll_lock(false); + reliefkarte_t::gib_karte()->get_welt()->set_scroll_lock(false); } if(IS_RIGHTRELEASE(ev)) { @@ -299,7 +299,7 @@ void map_frame_t::infowin_event(const event_t *ev) resize( koord(0,0) ); } is_dragging = false; - reliefkarte_t::gib_karte()->gib_welt()->set_scroll_lock(false); + reliefkarte_t::gib_karte()->get_welt()->set_scroll_lock(false); } if(reliefkarte_t::gib_karte()->getroffen(ev->mx,ev->my) && IS_RIGHTDRAG(ev)) { @@ -310,7 +310,7 @@ void map_frame_t::infowin_event(const event_t *ev) y += (ev->my - ev->cy)*2; is_dragging = true; - reliefkarte_t::gib_karte()->gib_welt()->set_scroll_lock(true); + reliefkarte_t::gib_karte()->get_welt()->set_scroll_lock(true); scrolly.setze_scroll_position( max(0, x), max(0, y) ); @@ -345,7 +345,7 @@ DBG_MESSAGE("map_frame_t::setze_fenstergroesse()","gr.x=%i, gr.y=%i",size.x,size */ void map_frame_t::resize(const koord delta) { - karte_t *welt=reliefkarte_t::gib_karte()->gib_welt(); + karte_t *welt=reliefkarte_t::gib_karte()->get_welt(); koord groesse = gib_fenstergroesse()+delta; @@ -422,7 +422,7 @@ void map_frame_t::zeichnen(koord pos, koord gr) screenpos = pos; // first: check if cursor within map screen size - karte_t *welt=reliefkarte_t::gib_karte()->gib_welt(); + karte_t *welt=reliefkarte_t::gib_karte()->get_welt(); koord ij = welt->gib_ij_off(); if(welt->ist_in_kartengrenzen(ij)) { reliefkarte_t::gib_karte()->karte_to_screen(ij); diff --git a/gui/money_frame.cc b/gui/money_frame.cc index 7c01ae103dd..935fd4f8bcd 100644 --- a/gui/money_frame.cc +++ b/gui/money_frame.cc @@ -115,10 +115,10 @@ money_frame_t::money_frame_t(spieler_t *sp) maintenance_label("This Month",COL_WHITE, gui_label_t::right), maintenance_money(NULL, COL_RED, gui_label_t::money), warn("", COL_RED), - headquarter_view(sp->gib_welt(), koord3d::invalid), + headquarter_view(sp->get_welt(), koord3d::invalid), old_hq(koord::invalid) { - if(sp->gib_welt()->gib_spieler(0)!=sp) { + if(sp->get_welt()->gib_spieler(0)!=sp) { sprintf(money_frame_title,translator::translate("Finances of %s"),translator::translate(sp->gib_name()) ); setze_name(money_frame_title); } @@ -132,7 +132,7 @@ money_frame_t::money_frame_t(spieler_t *sp) chart.setze_pos(koord(1,1)); chart.setze_groesse(koord(443,120)); chart.set_dimension(MAX_HISTORY_YEARS, 10000); - chart.set_seed(sp->gib_welt()->get_last_year()); + chart.set_seed(sp->get_welt()->get_last_year()); chart.set_background(MN_GREY1); for (int i = 0; iget_finance_history_year(), MAX_COST, i, 12, (i < 10) || i==COST_POWERLINES ? MONEY: STANDARD, false, false); @@ -357,7 +357,7 @@ void money_frame_t::zeichnen(koord pos, koord gr) warn.setze_text(str_buf[15]); if(sp->get_headquarter_pos()!=old_hq) { - headquarter_view.set_location( sp->gib_welt()->lookup_kartenboden(sp->get_headquarter_pos())->gib_pos() ); + headquarter_view.set_location( sp->get_welt()->lookup_kartenboden(sp->get_headquarter_pos())->gib_pos() ); headquarter.setze_text( "upgrade HQ" ); if(sp->get_headquarter_level()==hausbauer_t::headquarter.count()) { headquarter.disable(); @@ -378,7 +378,7 @@ void money_frame_t::zeichnen(koord pos, koord gr) } // Hajo: Money is counted in credit cents (100 cents = 1 Cr) - money_to_string(str_buf[16], (sp->add_maintenance(0)<<((sint64)sp->gib_welt()->ticks_bits_per_tag-18l))/100); + money_to_string(str_buf[16], (sp->add_maintenance(0)<<((sint64)sp->get_welt()->ticks_bits_per_tag-18l))/100); maintenance_money.setze_text(str_buf[16]); maintenance_money.set_color(sp->add_maintenance(0)>=0?MONEY_PLUS:MONEY_MINUS); @@ -388,7 +388,7 @@ void money_frame_t::zeichnen(koord pos, koord gr) } // Hajo: update chart seed - chart.set_seed(sp->gib_welt()->get_last_year()); + chart.set_seed(sp->get_welt()->get_last_year()); gui_frame_t::zeichnen(pos, gr); } @@ -396,7 +396,7 @@ void money_frame_t::zeichnen(koord pos, koord gr) bool money_frame_t::action_triggered(gui_komponente_t *komp,value_t /* */) { if(komp==&headquarter) { - sp->gib_welt()->setze_maus_funktion(wkz_headquarter, skinverwaltung_t::undoc_zeiger->gib_bild_nr(0), karte_t::Z_PLAN, SFX_JACKHAMMER, SFX_FAILURE); + sp->get_welt()->setze_maus_funktion(wkz_headquarter, skinverwaltung_t::undoc_zeiger->gib_bild_nr(0), karte_t::Z_PLAN, SFX_JACKHAMMER, SFX_FAILURE); return true; } diff --git a/gui/schedule_list.cc b/gui/schedule_list.cc index 2cf64dd666b..07a36f424b1 100644 --- a/gui/schedule_list.cc +++ b/gui/schedule_list.cc @@ -195,7 +195,7 @@ bool schedule_list_gui_t::action_triggered(gui_komponente_t *komp,value_t /* */) build_line_list( tabs.get_active_tab_index() ); } else { - create_win(-1, -1, 120, new nachrichtenfenster_t(sp->gib_welt(), translator::translate("Cannot create generic line!\nSelect line type by\nusing filter tabs.")), w_autodelete); + create_win(-1, -1, 120, new nachrichtenfenster_t(sp->get_welt(), translator::translate("Cannot create generic line!\nSelect line type by\nusing filter tabs.")), w_autodelete); } } else if (komp == &bt_delete_line) { @@ -391,7 +391,7 @@ void schedule_list_gui_t::update_lineinfo(linehandle_t new_line) slist_tpl tmp; // stores koords of stops that are allready displayed for(i=0; iget_fahrplan()->maxi(); i++) { const koord fahrplan_koord = new_line->get_fahrplan()->eintrag[i].pos.gib_2d(); - halthandle_t halt = haltestelle_t::gib_halt(sp->gib_welt(), fahrplan_koord); + halthandle_t halt = haltestelle_t::gib_halt(sp->get_welt(), fahrplan_koord); if (halt.is_bound()) { // only add a haltestelle to the list, if it is not in the list allready if (!tmp.contains(fahrplan_koord)) { diff --git a/gui/stadt_info.cc b/gui/stadt_info.cc index 9f9094e621f..be5e8e0ab83 100644 --- a/gui/stadt_info.cc +++ b/gui/stadt_info.cc @@ -48,7 +48,7 @@ stadt_info_t::stadt_info_t(stadt_t* stadt_) : chart.setze_pos(koord(1,1)); chart.setze_groesse(koord(360,120)); chart.set_dimension(MAX_CITY_HISTORY_YEARS, 10000); - chart.set_seed(stadt->gib_welt()->get_last_year()); + chart.set_seed(stadt->get_welt()->get_last_year()); chart.set_background(MN_GREY1); int i; for (i = 0; igib_welt()->get_last_year()); + chart.set_seed(stadt->get_welt()->get_last_year()); gui_frame_t::zeichnen(pos, gr); diff --git a/gui/thing_info.cc b/gui/thing_info.cc index 7f6fbc23e2c..a5fa8fb4290 100644 --- a/gui/thing_info.cc +++ b/gui/thing_info.cc @@ -24,7 +24,7 @@ cbuffer_t ding_infowin_t::buf (8192); ding_infowin_t::ding_infowin_t(const ding_t* ding_) : gui_frame_t("", ding_->gib_besitzer()), - view(ding_->World(), koord3d::invalid), + view(ding_->get_welt(), koord3d::invalid), ding(ding_) { setze_opaque(true); diff --git a/simcity.cc b/simcity.cc index 454905d5301..b544311a082 100644 --- a/simcity.cc +++ b/simcity.cc @@ -893,7 +893,7 @@ stadt_t::stadt_t(spieler_t* sp, koord pos, int citizens) : pax_ziele_neu(128, 128), arbeiterziele(4) { - welt = sp->gib_welt(); + welt = sp->get_welt(); assert(welt->ist_in_kartengrenzen(pos)); step_count = 0; diff --git a/simcity.h b/simcity.h index bc7ca1349a0..3b88684d365 100644 --- a/simcity.h +++ b/simcity.h @@ -177,7 +177,7 @@ class stadt_t { stadt_info_t *gib_stadt_info(); // just needed by stadt_info.cc - static inline karte_t* gib_welt() { return welt; } + static inline karte_t* get_welt() { return welt; } /* end of histroy related thingies */ private: diff --git a/simconvoi.cc b/simconvoi.cc index 680d85f9dfc..4451bb749f2 100644 --- a/simconvoi.cc +++ b/simconvoi.cc @@ -152,7 +152,7 @@ convoi_t::convoi_t(karte_t* wl, loadsave_t* file) : fahr(max_vehicle, NULL) convoi_t::convoi_t(spieler_t* sp) : fahr(max_vehicle, NULL) { self = convoihandle_t(this); - init(sp->gib_welt(), sp); + init(sp->get_welt(), sp); setze_name( "Unnamed" ); welt->add_convoi( self ); init_financial_history(); diff --git a/simconvoi.h b/simconvoi.h index 680cff302cf..89b728c6f0e 100644 --- a/simconvoi.h +++ b/simconvoi.h @@ -427,7 +427,7 @@ class convoi_t : public sync_steppable * @return Current map. * @author Hj. Malthaner */ - karte_t* gib_welt() { return welt; } + karte_t* get_welt() { return welt; } /** * Gibt Namen des Convois zurück. diff --git a/simdings.h b/simdings.h index 1e52dc60818..4966b853d03 100644 --- a/simdings.h +++ b/simdings.h @@ -208,7 +208,7 @@ class ding_t */ ding_t(karte_t *welt, koord3d pos); - karte_t* World() const { return welt; } + karte_t* get_welt() const { return welt; } /** * Der Destruktor schließt alle Beobachtungsfenster für dieses Objekt. diff --git a/simfab.cc b/simfab.cc index d98c536865a..6e5a4691584 100644 --- a/simfab.cc +++ b/simfab.cc @@ -128,7 +128,7 @@ fabrik_t::fabrik_t(karte_t* wl, loadsave_t* file) fabrik_t::fabrik_t(koord3d pos_, spieler_t* spieler, const fabrik_besch_t* fabesch) : - welt(spieler->gib_welt()), + welt(spieler->get_welt()), besch(fabesch), pos(pos_) { diff --git a/simhalt.h b/simhalt.h index cdec6239317..f622ca27b74 100644 --- a/simhalt.h +++ b/simhalt.h @@ -346,7 +346,7 @@ class haltestelle_t */ void neuer_monat(); - karte_t* gib_welt() const { return welt; } + karte_t* get_welt() const { return welt; } /** * Kann die Ware nicht zum Ziel geroutet werden (keine Route), dann werden diff --git a/simline.cc b/simline.cc index f6f2e02f39e..f93d641c6d2 100644 --- a/simline.cc +++ b/simline.cc @@ -16,7 +16,7 @@ karte_t *simline_t::welt=NULL; simline_t::simline_t(simlinemgmt_t* simlinemgmt, fahrplan_t* fpl) { - welt = simlinemgmt->World(); + welt = simlinemgmt->get_welt(); self = linehandle_t(this); init_financial_history(); const int i = simlinemgmt->get_unique_line_id(); diff --git a/simlinemgmt.h b/simlinemgmt.h index f33c4fb08b6..6733bdcd4ce 100644 --- a/simlinemgmt.h +++ b/simlinemgmt.h @@ -93,7 +93,7 @@ class simlinemgmt_t */ void get_lines(int type, vector_tpl* lines) const; - karte_t* World() const { return welt; } + karte_t* get_welt() const { return welt; } private: static uint8 used_ids[8192]; diff --git a/simplan.cc b/simplan.cc index b12924f9f74..36306a710ea 100644 --- a/simplan.cc +++ b/simplan.cc @@ -400,7 +400,7 @@ planquadrat_t::display_overlay(const sint16 xpos, const sint16 ypos, const sint1 // 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_countgib_welt()->gib_spieler(spieler_count); + spieler_t *display_player = gr->get_welt()->gib_spieler(spieler_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]->gib_besitzer() == display_player) { diff --git a/simplay.h b/simplay.h index 3b27c1f3b4e..541db73f76d 100644 --- a/simplay.h +++ b/simplay.h @@ -463,7 +463,7 @@ class spieler_t * Returns the world the player is in * @author hsiegeln */ - karte_t *gib_welt() { return welt; } + karte_t *get_welt() { return welt; } /** * Calculates the finance history for player diff --git a/simvehikel.cc b/simvehikel.cc index a754d98f634..b04938aa8ac 100644 --- a/simvehikel.cc +++ b/simvehikel.cc @@ -636,7 +636,7 @@ 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_basis_t(sp->gib_welt(), pos) + vehikel_basis_t(sp->get_welt(), pos) { this->besch = besch;