diff --git a/gui/citylist_frame_t.cc b/gui/citylist_frame_t.cc index 68a768865c..8625c2b21d 100644 --- a/gui/citylist_frame_t.cc +++ b/gui/citylist_frame_t.cc @@ -45,7 +45,8 @@ const char citylist_frame_t::hist_type[karte_t::MAX_WORLD_COST][20] = "sended", "Post", "Arrived", - "Goods" + "Goods", + "Halts" }; const uint8 citylist_frame_t::hist_type_color[karte_t::MAX_WORLD_COST] = @@ -61,7 +62,8 @@ const uint8 citylist_frame_t::hist_type_color[karte_t::MAX_WORLD_COST] = COL_LIGHT_YELLOW, COL_YELLOW, COL_LIGHT_BROWN, - COL_BROWN + COL_BROWN, + COL_DARK_BLUE }; const uint8 citylist_frame_t::hist_type_type[karte_t::MAX_WORLD_COST] = @@ -77,6 +79,7 @@ const uint8 citylist_frame_t::hist_type_type[karte_t::MAX_WORLD_COST] = PERCENT, STANDARD, PERCENT, + STANDARD, STANDARD }; @@ -173,7 +176,7 @@ citylist_frame_t::citylist_frame_t() : chart.set_background(SYSCOL_CHART_BACKGROUND); chart.set_min_size(scr_size(0, 8*LINESPACE)); - container_year.add_table(4,3); + container_year.add_table(4,0); for (int i = 0; iget_finance_history_year(), karte_t::MAX_WORLD_COST, i, MAX_WORLD_HISTORY_YEARS, hist_type_type[i], false, true, (i==1) ? 1 : 0 ); // add button @@ -192,7 +195,7 @@ citylist_frame_t::citylist_frame_t() : mchart.set_background(SYSCOL_CHART_BACKGROUND); mchart.set_min_size(scr_size(0, 8*LINESPACE)); - container_month.add_table(4,3); + container_month.add_table(4,0); for (int i = 0; iget_finance_history_month(), karte_t::MAX_WORLD_COST, i, MAX_WORLD_HISTORY_MONTHS, hist_type_type[i], false, true, (i==1) ? 1 : 0 ); diff --git a/simworld.cc b/simworld.cc index db95214350..0f49dad040 100644 --- a/simworld.cc +++ b/simworld.cc @@ -4496,6 +4496,7 @@ void karte_t::update_history() { finance_history_year[0][WORLD_CONVOIS] = finance_history_month[0][WORLD_CONVOIS] = convoi_array.get_count(); finance_history_year[0][WORLD_FACTORIES] = finance_history_month[0][WORLD_FACTORIES] = fab_list.get_count(); + finance_history_year[0][WORLD_HALTS] = finance_history_month[0][WORLD_HALTS] = haltestelle_t::get_alle_haltestellen().get_count(); // now step all towns (to generate passengers) sint64 bev=0; @@ -4930,6 +4931,15 @@ DBG_MESSAGE("karte_t::save(loadsave_t *file)", "saved messages"); file->rdwr_longlong(finance_history_month[month][cost_type]); } } + // WORLD_HALTS added in OTRP v56 + if( file->get_OTRP_version()>55 ) { + for(int year = 0; year < /*MAX_WORLD_HISTORY_YEARS*/12; year++) { + file->rdwr_longlong(finance_history_year[year][WORLD_HALTS]); + } + for(int month = 0; month < /*MAX_WORLD_HISTORY_MONTHS*/12; month++) { + file->rdwr_longlong(finance_history_month[month][WORLD_HALTS]); + } + } } // finally a possible scenario @@ -5512,15 +5522,32 @@ DBG_MESSAGE("karte_t::load()", "%d factories loaded", fab_list.get_count()); } else { for (int year = 0; yearrdwr_longlong(finance_history_year[year][cost_type]); } } for (int month = 0;monthrdwr_longlong(finance_history_month[month][cost_type]); } } + // WORLD_HALTS added in OTRP v56; older files have no recorded data + if( file->get_OTRP_version() > 55 ) { + for(int year = 0; year < /*MAX_WORLD_HISTORY_YEARS*/12; year++) { + file->rdwr_longlong(finance_history_year[year][WORLD_HALTS]); + } + for(int month = 0; month < /*MAX_WORLD_HISTORY_MONTHS*/12; month++) { + file->rdwr_longlong(finance_history_month[month][WORLD_HALTS]); + } + } + else { + for(int year = 0; year < /*MAX_WORLD_HISTORY_YEARS*/12; year++) { + finance_history_year[year][WORLD_HALTS] = 0; + } + for(int month = 0; month < /*MAX_WORLD_HISTORY_MONTHS*/12; month++) { + finance_history_month[month][WORLD_HALTS] = 0; + } + } last_month_bev = finance_history_month[1][WORLD_CITIZENS]; if (file->is_version_atleast(112, 5) && file->is_version_less(120, 6)) { diff --git a/simworld.h b/simworld.h index 2e1469ac19..fa3a46ea1b 100644 --- a/simworld.h +++ b/simworld.h @@ -95,6 +95,7 @@ class karte_t WORLD_MAIL_GENERATED, ///< all letters generated WORLD_GOODS_RATIO, ///< ratio of chain completeness WORLD_TRANSPORTED_GOODS, ///< all transported goods + WORLD_HALTS, ///< total number of halts (recorded from OTRP v56) MAX_WORLD_COST };