diff --git a/dataobj/settings.cc b/dataobj/settings.cc index 53525772..db81573f 100644 --- a/dataobj/settings.cc +++ b/dataobj/settings.cc @@ -55,6 +55,12 @@ settings_t::settings_t() : show_pax = true; + // default maximum length of convoi + max_rail_convoi_length = 24; + max_road_convoi_length = 4; + max_ship_convoi_length = 4; + max_air_convoi_length = 1; + // default climate zones set_default_climates( ); winter_snowline = 7; // not mediterranean @@ -1387,6 +1393,11 @@ void settings_t::parse_simuconf(tabfile_t& simuconf, sint16& disp_width, sint16& with_private_paks = contents.get_int("with_private_paks", with_private_paks)!=0; + max_rail_convoi_length = contents.get_int("max_rail_convoi_length",max_rail_convoi_length); + max_road_convoi_length = contents.get_int("max_road_convoi_length",max_road_convoi_length); + max_ship_convoi_length = contents.get_int("max_ship_convoi_length",max_ship_convoi_length); + max_air_convoi_length = contents.get_int("max_air_convoi_length",max_air_convoi_length); + // Default pak file path objfilename = ltrim(contents.get_string("pak_file_path", "" ) ); diff --git a/dataobj/settings.h b/dataobj/settings.h index 636024a5..69143c46 100644 --- a/dataobj/settings.h +++ b/dataobj/settings.h @@ -93,6 +93,12 @@ private: uint16 station_coverage_size; + // the maximum length of each convoi + uint16 max_rail_convoi_length; + uint16 max_road_convoi_length; + uint16 max_ship_convoi_length; + uint16 max_air_convoi_length; + /** * At which level buildings generate traffic? */ @@ -387,6 +393,11 @@ public: uint16 get_station_coverage() const {return station_coverage_size;} + uint16 get_max_rail_convoi_length() const {return max_rail_convoi_length;} + uint16 get_max_road_convoi_length() const {return max_road_convoi_length;} + uint16 get_max_ship_convoi_length() const {return max_ship_convoi_length;} + uint16 get_max_air_convoi_length() const {return max_air_convoi_length;} + void set_allow_player_change(char n) {allow_player_change=n;} // prissi, Oct-2005 uint8 get_allow_player_change() const {return allow_player_change;} diff --git a/gui/convoi_detail_t.cc b/gui/convoi_detail_t.cc index 2a52e8f3..06cd8baa 100644 --- a/gui/convoi_detail_t.cc +++ b/gui/convoi_detail_t.cc @@ -106,7 +106,7 @@ void convoi_detail_t::draw(scr_coord pos, scr_size size) offset_y += LINESPACE; buf.clear(); - buf.printf("%s %i", translator::translate("Station tiles:"), cnv->get_tile_length() ); + buf.printf("%s %i %s %i", translator::translate("Vehicle count:"), cnv->get_vehicle_count(), translator::translate("Station tiles:"), cnv->get_tile_length()); display_proportional_clip_rgb( pos.x+10, offset_y, buf, ALIGN_LEFT, SYSCOL_TEXT, true ); offset_y += LINESPACE; diff --git a/gui/depot_frame.cc b/gui/depot_frame.cc index d65d80a8..fb9823e6 100644 --- a/gui/depot_frame.cc +++ b/gui/depot_frame.cc @@ -91,6 +91,7 @@ depot_frame_t::depot_frame_t(depot_t* depot) : scrolly_electrics(&cont_electrics), scrolly_loks(&cont_loks), scrolly_waggons(&cont_waggons), + scrolly_convoi(&cont_convoi), lb_vehicle_filter("Filter:", SYSCOL_TEXT, gui_label_t::right) { scr_size size = scr_size(0,0); @@ -134,7 +135,11 @@ DBG_DEBUG("depot_frame_t::depot_frame_t()","get_max_convoi_length()=%i",depot->g convoi.set_player_nr(depot->get_player_nr()); convoi.add_listener(this); - add_component(&convoi); + cont_convoi.add_component(&lb_convoi_number); + cont_convoi.add_component(&convoi); + + // add_component(&convoi); + add_component(&lb_convoi_count); add_component(&lb_convoi_speed); add_component(&lb_convoi_cost); @@ -157,9 +162,14 @@ DBG_DEBUG("depot_frame_t::depot_frame_t()","get_max_convoi_length()=%i",depot->g sb_convoi_length.add_color_value(&convoi_length_ok_sb, color_idx_to_rgb(COL_GREEN)); sb_convoi_length.add_color_value(&convoi_length_slower_sb, color_idx_to_rgb(COL_ORANGE)); sb_convoi_length.add_color_value(&convoi_length_too_slow_sb, color_idx_to_rgb(COL_RED)); - add_component(&sb_convoi_length); + //add_component(&sb_convoi_length); + cont_convoi.add_component(&sb_convoi_length); } + scrolly_convoi.set_scrollbar_mode(scrollbar_t::show_disabled); + scrolly_convoi.set_size_corner(false); + add_component(&scrolly_convoi); + /* * [ACTIONS] */ @@ -240,7 +250,11 @@ DBG_DEBUG("depot_frame_t::depot_frame_t()","get_max_convoi_length()=%i",depot->g build_vehicle_lists(); // text will be translated by ourselves (after update data)! - lb_convois.set_text_pointer( txt_convois ); + lb_convois.set_text_pointer(txt_convois); + + lb_convoi_count.set_text_pointer(txt_convoi_count); + lb_convoi_number.set_text_pointer(txt_convoi_number); + lb_convoi_count.set_text_pointer( txt_convoi_count ); lb_convoi_speed.set_text_pointer( txt_convoi_speed ); lb_convoi_cost.set_text_pointer( txt_convoi_cost ); @@ -298,7 +312,7 @@ void depot_frame_t::layout(scr_size *size) scr_coord_val grid_dx; scr_coord_val placement_dx; - scr_size win_size = (size!=NULL)? *size : get_windowsize(); + scr_size win_size = (size != NULL) ? *size : get_windowsize(); /* * These parameter are adjusted to resolution. @@ -368,15 +382,16 @@ void depot_frame_t::layout(scr_size *size) /* * Total width is the max from [CONVOI] and [ACTIONS] width. */ - const scr_coord_val MIN_DEPOT_FRAME_WIDTH = max(CONVOI_WIDTH, ACTIONS_WIDTH); - const scr_coord_val DEPOT_FRAME_WIDTH = max(win_size.w, max(CONVOI_WIDTH, ACTIONS_WIDTH)); + const scr_coord_val MIN_DEPOT_FRAME_WIDTH = ACTIONS_WIDTH;//max(CONVOI_WIDTH, ACTIONS_WIDTH); + const scr_coord_val DEPOT_FRAME_WIDTH = max(win_size.w, ACTIONS_WIDTH);//max(win_size.w, max(CONVOI_WIDTH, ACTIONS_WIDTH)); /* * Now we can do the first vertical adjustment: + * タブ群までの個々の要素の位置を求める */ const scr_coord_val SELECT_VSTART = D_MARGIN_TOP; const scr_coord_val CONVOI_VSTART = SELECT_VSTART + SELECT_HEIGHT + LINESPACE; - const scr_coord_val CINFO_VSTART = CONVOI_VSTART + CLIST_HEIGHT; + const scr_coord_val CINFO_VSTART = CONVOI_VSTART + CLIST_HEIGHT + 16; const scr_coord_val ACTIONS_VSTART = CINFO_VSTART + CINFO_HEIGHT; const scr_coord_val PANEL_VSTART = ACTIONS_VSTART + ACTIONS_HEIGHT; @@ -387,8 +402,8 @@ void depot_frame_t::layout(scr_size *size) * Total width will be expanded to match complete columns in panel. */ const scr_coord_val total_h = PANEL_VSTART + VINFO_HEIGHT + D_TITLEBAR_HEIGHT + D_TAB_HEADER_HEIGHT + 2 * gui_image_list_t::BORDER + D_MARGIN_BOTTOM + 1; - scr_coord_val PANEL_ROWS = max(1, ((win_size.h-total_h)/grid.y) ); - if( size && size->h == 0 ) { + scr_coord_val PANEL_ROWS = max(1, ((win_size.h - total_h) / grid.y)); + if (size && size->h == 0) { PANEL_ROWS = 3; } const scr_coord_val PANEL_HEIGHT = PANEL_ROWS * grid.y + D_TAB_HEADER_HEIGHT + 2 * gui_image_list_t::BORDER; @@ -405,13 +420,13 @@ void depot_frame_t::layout(scr_size *size) * DONE with layout planning - now build everything. */ set_min_windowsize(scr_size(MIN_DEPOT_FRAME_WIDTH, MIN_TOTAL_HEIGHT)); - if( win_size.w < DEPOT_FRAME_WIDTH ) { - gui_frame_t::set_windowsize(scr_size(MIN_DEPOT_FRAME_WIDTH, max(win_size.h,MIN_TOTAL_HEIGHT) )); + if (win_size.w < DEPOT_FRAME_WIDTH) { + gui_frame_t::set_windowsize(scr_size(MIN_DEPOT_FRAME_WIDTH, max(win_size.h, MIN_TOTAL_HEIGHT))); } - if( size && size->w == 0 ) { + if (size && size->w == 0) { size->w = DEPOT_FRAME_WIDTH; } - if( size && size->h == 0 ) { + if (size && size->h == 0) { size->h = TOTAL_HEIGHT; } @@ -419,59 +434,74 @@ void depot_frame_t::layout(scr_size *size) const scr_coord_val second_column_w = DEPOT_FRAME_WIDTH - D_MARGIN_RIGHT - second_column_x; /* - * [SELECT]: - */ + * [SELECT]: + */ lb_convois.set_pos(scr_coord(D_MARGIN_LEFT, SELECT_VSTART + 3)); - lb_convois.set_width( selector_x - D_H_SPACE ); + lb_convois.set_width(selector_x - D_H_SPACE); convoy_selector.set_pos(scr_coord(D_MARGIN_LEFT + selector_x, SELECT_VSTART)); convoy_selector.set_size(scr_size(DEPOT_FRAME_WIDTH - D_MARGIN_RIGHT - D_MARGIN_LEFT - selector_x, D_BUTTON_HEIGHT)); convoy_selector.set_max_size(scr_size(DEPOT_FRAME_WIDTH - D_MARGIN_RIGHT - D_MARGIN_LEFT - selector_x, LINESPACE * 13 + 2 + 16)); /* - * [SELECT ROUTE]: - * @author hsiegeln - */ + * [SELECT ROUTE]: + * @author hsiegeln + */ line_button.set_pos(scr_coord(D_MARGIN_LEFT, SELECT_VSTART + D_BUTTON_HEIGHT + 3)); lb_convoi_line.set_pos(scr_coord(D_MARGIN_LEFT + line_button.get_size().w + 2, SELECT_VSTART + D_BUTTON_HEIGHT + 3)); - lb_convoi_line.set_width( selector_x - line_button.get_size().w - 2 - D_H_SPACE ); + lb_convoi_line.set_width(selector_x - line_button.get_size().w - 2 - D_H_SPACE); line_selector.set_pos(scr_coord(D_MARGIN_LEFT + selector_x, SELECT_VSTART + D_BUTTON_HEIGHT)); line_selector.set_size(scr_size(DEPOT_FRAME_WIDTH - D_MARGIN_RIGHT - D_MARGIN_LEFT - selector_x, D_BUTTON_HEIGHT)); line_selector.set_max_size(scr_size(DEPOT_FRAME_WIDTH - D_MARGIN_RIGHT - D_MARGIN_LEFT - selector_x, LINESPACE * 13 + 2 + 16)); /* - * [CONVOI] - */ + * [CONVOI] + */ convoi.set_grid(scr_coord(grid.x - grid_dx, grid.y)); convoi.set_placement(scr_coord(placement.x - placement_dx, placement.y)); - convoi.set_pos(scr_coord((DEPOT_FRAME_WIDTH-CLIST_WIDTH) / 2, CONVOI_VSTART)); + // convoi.set_pos(scr_coord((DEPOT_FRAME_WIDTH-CLIST_WIDTH) / 2, CONVOI_VSTART)); + convoi.set_pos(scr_coord(0, 0)); convoi.set_size(scr_size(CLIST_WIDTH, CLIST_HEIGHT)); - sb_convoi_length.set_pos(scr_coord((DEPOT_FRAME_WIDTH-CLIST_WIDTH) / 2 + 5,CONVOI_VSTART + grid.y + 5)); + // sb_convoi_length.set_pos(scr_coord((DEPOT_FRAME_WIDTH-CLIST_WIDTH) / 2 + 5,CONVOI_VSTART + grid.y + 5)); + sb_convoi_length.set_pos(scr_coord(5, grid.y + 5)); sb_convoi_length.set_size(scr_size(CLIST_WIDTH - 10, 4)); + cont_convoi.set_size(scr_size(CLIST_WIDTH, grid.y + 5 + 4)); + scrolly_convoi.set_size(scr_size(DEPOT_FRAME_WIDTH - 12, cont_convoi.get_size().h + 18)); + // scrolly_convoi.set_scroll_amount_x(grid.x); + scrolly_convoi.set_show_scroll_x(true); + scrolly_convoi.set_show_scroll_y(false); + scrolly_convoi.set_scroll_discrete_x(false); + scrolly_convoi.set_size_corner(false); + scrolly_convoi.set_pos(scr_coord(6, CONVOI_VSTART)); + + lb_convoi_number.set_width(30); + lb_convoi_number.set_color(COL_WHITE); + lb_convoi_count.set_pos(scr_coord(D_MARGIN_LEFT, CINFO_VSTART)); - lb_convoi_count.set_width( second_column_w - D_H_SPACE ); + lb_convoi_count.set_width(second_column_w - D_H_SPACE); + cont_convoi_capacity.set_pos(scr_coord(second_column_x, CINFO_VSTART)); cont_convoi_capacity.set_width(second_column_w); lb_convoi_cost.set_pos(scr_coord(D_MARGIN_LEFT, CINFO_VSTART + LINESPACE * 1)); - lb_convoi_cost.set_width( second_column_w - D_H_SPACE ); + lb_convoi_cost.set_width(second_column_w - D_H_SPACE); lb_convoi_value.set_pos(scr_coord(second_column_x, CINFO_VSTART + LINESPACE * 1)); lb_convoi_value.set_width(second_column_w); lb_convoi_power.set_pos(scr_coord(D_MARGIN_LEFT, CINFO_VSTART + LINESPACE * 2)); - lb_convoi_power.set_width( second_column_w - D_H_SPACE ); + lb_convoi_power.set_width(second_column_w - D_H_SPACE); lb_convoi_weight.set_pos(scr_coord(second_column_x, CINFO_VSTART + LINESPACE * 2)); lb_convoi_weight.set_width(second_column_w); lb_convoi_speed.set_pos(scr_coord(D_MARGIN_LEFT, CINFO_VSTART + LINESPACE * 3)); - lb_convoi_speed.set_width( DEPOT_FRAME_WIDTH - D_MARGIN_RIGHT - D_MARGIN_LEFT ); + lb_convoi_speed.set_width(DEPOT_FRAME_WIDTH - D_MARGIN_RIGHT - D_MARGIN_LEFT); /* - * [ACTIONS] - */ + * [ACTIONS] + */ bt_start.set_pos(scr_coord(D_MARGIN_LEFT, ACTIONS_VSTART)); bt_start.set_size(scr_size((DEPOT_FRAME_WIDTH - D_MARGIN_LEFT - D_MARGIN_RIGHT) / 4 - 3, D_BUTTON_HEIGHT)); bt_start.set_text("Start"); @@ -496,9 +526,9 @@ void depot_frame_t::layout(scr_size *size) pas.set_grid(grid); pas.set_placement(placement); - pas.set_size(tabs.get_size() - scr_size(D_SCROLLBAR_WIDTH,0)); + pas.set_size(tabs.get_size() - scr_size(D_SCROLLBAR_WIDTH, 0)); pas.recalc_size(); - pas.set_pos(scr_coord(0,0)); + pas.set_pos(scr_coord(0, 0)); cont_pas.set_size(pas.get_size()); scrolly_pas.set_size(scrolly_pas.get_size()); scrolly_pas.set_scroll_amount_y(grid.y); @@ -507,9 +537,9 @@ void depot_frame_t::layout(scr_size *size) electrics.set_grid(grid); electrics.set_placement(placement); - electrics.set_size(tabs.get_size() - scr_size(D_SCROLLBAR_WIDTH,0)); + electrics.set_size(tabs.get_size() - scr_size(D_SCROLLBAR_WIDTH, 0)); electrics.recalc_size(); - electrics.set_pos(scr_coord(0,0)); + electrics.set_pos(scr_coord(0, 0)); cont_electrics.set_size(electrics.get_size()); scrolly_electrics.set_size(scrolly_electrics.get_size()); scrolly_electrics.set_scroll_amount_y(grid.y); @@ -518,9 +548,9 @@ void depot_frame_t::layout(scr_size *size) loks.set_grid(grid); loks.set_placement(placement); - loks.set_size(tabs.get_size() - scr_size(D_SCROLLBAR_WIDTH,0)); + loks.set_size(tabs.get_size() - scr_size(D_SCROLLBAR_WIDTH, 0)); loks.recalc_size(); - loks.set_pos(scr_coord(0,0)); + loks.set_pos(scr_coord(0, 0)); cont_loks.set_size(loks.get_size()); scrolly_loks.set_size(scrolly_loks.get_size()); scrolly_loks.set_scroll_amount_y(grid.y); @@ -529,16 +559,16 @@ void depot_frame_t::layout(scr_size *size) waggons.set_grid(grid); waggons.set_placement(placement); - waggons.set_size(tabs.get_size() - scr_size(D_SCROLLBAR_WIDTH,0)); + waggons.set_size(tabs.get_size() - scr_size(D_SCROLLBAR_WIDTH, 0)); waggons.recalc_size(); - waggons.set_pos(scr_coord(0,0)); + waggons.set_pos(scr_coord(0, 0)); cont_waggons.set_size(waggons.get_size()); scrolly_waggons.set_size(scrolly_waggons.get_size()); scrolly_waggons.set_scroll_amount_y(grid.y); scrolly_waggons.set_scroll_discrete_y(false); scrolly_waggons.set_size_corner(false); - div_tabbottom.set_pos(scr_coord(0,PANEL_VSTART + PANEL_HEIGHT)); + div_tabbottom.set_pos(scr_coord(0, PANEL_VSTART + PANEL_HEIGHT)); div_tabbottom.set_width(DEPOT_FRAME_WIDTH); /* @@ -547,16 +577,16 @@ void depot_frame_t::layout(scr_size *size) bt_veh_action.set_pos(scr_coord(D_MARGIN_LEFT + (DEPOT_FRAME_WIDTH - D_MARGIN_LEFT - D_MARGIN_RIGHT) * 3 / 4 + 3, INFO_VSTART)); bt_veh_action.set_size(scr_size((DEPOT_FRAME_WIDTH - D_MARGIN_LEFT - D_MARGIN_RIGHT) - (DEPOT_FRAME_WIDTH - D_MARGIN_LEFT - D_MARGIN_RIGHT) * 3 / 4 - 3, D_BUTTON_HEIGHT)); - lb_veh_action.align_to(&bt_veh_action, ALIGN_RIGHT | ALIGN_EXTERIOR_H | ALIGN_CENTER_V, scr_coord(D_V_SPACE,0)); + lb_veh_action.align_to(&bt_veh_action, ALIGN_RIGHT | ALIGN_EXTERIOR_H | ALIGN_CENTER_V, scr_coord(D_V_SPACE, 0)); bt_show_all.set_pos(scr_coord(D_MARGIN_LEFT, INFO_VSTART + D_BUTTON_HEIGHT + 1)); const int w = max(72, bt_show_all.get_size().w); bt_obsolete.set_pos(scr_coord(D_MARGIN_LEFT + w + 4 + 6, INFO_VSTART + D_BUTTON_HEIGHT + 1)); - vehicle_filter.set_pos( scr_coord(D_MARGIN_LEFT + (DEPOT_FRAME_WIDTH - D_MARGIN_LEFT - D_MARGIN_RIGHT) * 3 / 4 + 3, INFO_VSTART + D_BUTTON_HEIGHT)); - vehicle_filter.set_size( scr_size((DEPOT_FRAME_WIDTH - D_MARGIN_LEFT - D_MARGIN_RIGHT) - (DEPOT_FRAME_WIDTH - D_MARGIN_LEFT - D_MARGIN_RIGHT) * 3 / 4 - 3, D_BUTTON_HEIGHT)); - vehicle_filter.set_max_size( scr_size( D_BUTTON_WIDTH + 60, ((size && size->h>0) ? size->h : gui_frame_t::get_windowsize().h)-INFO_VSTART-D_BUTTON_HEIGHT-D_MARGIN_BOTTOM-D_TITLEBAR_HEIGHT ) ); + vehicle_filter.set_pos(scr_coord(D_MARGIN_LEFT + (DEPOT_FRAME_WIDTH - D_MARGIN_LEFT - D_MARGIN_RIGHT) * 3 / 4 + 3, INFO_VSTART + D_BUTTON_HEIGHT)); + vehicle_filter.set_size(scr_size((DEPOT_FRAME_WIDTH - D_MARGIN_LEFT - D_MARGIN_RIGHT) - (DEPOT_FRAME_WIDTH - D_MARGIN_LEFT - D_MARGIN_RIGHT) * 3 / 4 - 3, D_BUTTON_HEIGHT)); + vehicle_filter.set_max_size(scr_size(D_BUTTON_WIDTH + 60, LINESPACE * 7)); lb_vehicle_filter.align_to(&vehicle_filter, ALIGN_RIGHT | ALIGN_EXTERIOR_H | ALIGN_TOP, scr_coord(0,D_GET_CENTER_ALIGN_OFFSET(LINESPACE,D_BUTTON_HEIGHT))); @@ -1055,7 +1085,7 @@ void depot_frame_t::update_data() convoi_tile_length_sb = convoi_length + (cnv->get_tile_length() * CARUNITS_PER_TILE - cnv->get_length()); txt_convoi_count.clear(); - txt_convoi_count.printf("%s %i",translator::translate("Station tiles:"), cnv->get_tile_length() ); + txt_convoi_count.printf("%s %i %s %i", translator::translate("Vehicle count:"), cnv->get_vehicle_count(), translator::translate("Station tiles:"), cnv->get_tile_length()); txt_convoi_speed.clear(); if( empty_kmh != (use_sel_weight ? sel_kmh : min_kmh) ) { @@ -1119,7 +1149,7 @@ void depot_frame_t::update_data() } else { txt_convoi_count.clear(); - txt_convoi_count.append( translator::translate("keine Fahrzeuge") ); + txt_convoi_count.append(translator::translate("keine Fahrzeuge")); txt_convoi_value.clear(); txt_convoi_cost.clear(); txt_convoi_power.clear(); @@ -1534,7 +1564,8 @@ void depot_frame_t::draw_vehicle_info_text(scr_coord pos) double resale_value = -1.0; const vehicle_desc_t *veh_type = NULL; bool new_vehicle_length_sb_force_zero = false; - scr_coord relpos = scr_coord( 0, ((gui_scrollpane_t *)tabs.get_aktives_tab())->get_scroll_y() ); + sint16 convoi_number = -1; + scr_coord relpos = scr_coord(0, ((gui_scrollpane_t *)tabs.get_aktives_tab())->get_scroll_y()); int sel_index = lst->index_at( pos + tabs.get_pos() - relpos, x, y - D_TITLEBAR_HEIGHT - D_TAB_HEADER_HEIGHT); if( (sel_index != -1) && (tabs.getroffen(x - pos.x, y - pos.y - D_TITLEBAR_HEIGHT)) ) { @@ -1551,7 +1582,9 @@ void depot_frame_t::draw_vehicle_info_text(scr_coord pos) } else { // cursor over a vehicle in the convoi - sel_index = convoi.index_at( pos , x, y - D_TITLEBAR_HEIGHT); + relpos = scr_coord(scrolly_convoi.get_scroll_x(), 0); + + convoi_number = sel_index = convoi.index_at(pos - relpos + scrolly_convoi.get_pos(), x, y - D_TITLEBAR_HEIGHT); if( sel_index != -1 ) { convoihandle_t cnv = depot->get_convoi( icnv ); veh_type = cnv->get_vehikel( sel_index )->get_desc(); @@ -1668,8 +1701,15 @@ void depot_frame_t::draw_vehicle_info_text(scr_coord pos) // update speedbar new_vehicle_length_sb = new_vehicle_length_sb_force_zero ? 0 : convoi_length_ok_sb + convoi_length_slower_sb + convoi_length_too_slow_sb + veh_type->get_length(); + + txt_convoi_number.clear(); + if (convoi_number>-1){ + txt_convoi_number.printf("%d", convoi_number + 1); + lb_convoi_number.set_pos(scr_coord(((depot->get_x_grid() * get_base_tile_raster_width() / 64 + 4) - (depot->get_x_grid() * get_base_tile_raster_width() / 64 / 2))*convoi_number + 4, 4)); + } } else { + txt_convoi_number.clear(); new_vehicle_length_sb = 0; } diff --git a/gui/depot_frame.h b/gui/depot_frame.h index a66e54f2..a88cd5a4 100644 --- a/gui/depot_frame.h +++ b/gui/depot_frame.h @@ -93,6 +93,9 @@ private: button_t line_button; // goto line ... gui_label_t lb_convoi_count; + + gui_label_t lb_convoi_number; + gui_label_t lb_convoi_speed; gui_label_t lb_convoi_cost; gui_label_t lb_convoi_value; @@ -134,6 +137,9 @@ private: vector_tpl convoi_pics; gui_image_list_t convoi; + gui_scrollpane_t scrolly_convoi; + gui_container_t cont_convoi; + /// image list of passenger cars vector_tpl pas_vec; /// image list of electrified passenger carrier units @@ -181,6 +187,7 @@ private: cbuffer_t txt_convois; cbuffer_t txt_convoi_count; + cbuffer_t txt_convoi_number; cbuffer_t txt_convoi_value; cbuffer_t txt_convoi_speed; cbuffer_t txt_convoi_cost; diff --git a/simconvoi.cc b/simconvoi.cc index af04ee73..1330fea9 100644 --- a/simconvoi.cc +++ b/simconvoi.cc @@ -166,7 +166,7 @@ void convoi_t::init(player_t *player) } -convoi_t::convoi_t(loadsave_t* file) : fahr(max_vehicle, NULL) +convoi_t::convoi_t(loadsave_t* file) : fahr(default_vehicle_length, NULL) { self = convoihandle_t(); init(0); @@ -174,7 +174,7 @@ convoi_t::convoi_t(loadsave_t* file) : fahr(max_vehicle, NULL) } -convoi_t::convoi_t(player_t* player_) : fahr(max_vehicle, NULL) +convoi_t::convoi_t(player_t* player_) : fahr(default_vehicle_length, NULL) { self = convoihandle_t(this); player_->book_convoi_number(1); @@ -1617,11 +1617,11 @@ void convoi_t::warten_bis_weg_frei(sint32 restart_speed) bool convoi_t::add_vehikel(vehicle_t *v, bool infront) { -DBG_MESSAGE("convoi_t::add_vehikel()","at pos %i of %i totals.",anz_vehikel,max_vehicle); - // extend array if requested (only needed for trains) - if(anz_vehikel == max_vehicle) { -DBG_MESSAGE("convoi_t::add_vehikel()","extend array_tpl to %i totals.",max_rail_vehicle); - fahr.resize(max_rail_vehicle, NULL); +DBG_MESSAGE("convoi_t::add_vehikel()","at pos %i of %i total vehikels.",anz_vehikel,fahr.get_count()); + // extend array if requested + if(anz_vehikel == fahr.get_count()) { + fahr.resize(anz_vehikel+1,NULL); +DBG_MESSAGE("convoi_t::add_vehikel()","extend array_tpl to %i totals.",fahr.get_count()); } // now append if (anz_vehikel < fahr.get_count()) { @@ -1669,7 +1669,7 @@ DBG_MESSAGE("convoi_t::add_vehikel()","extend array_tpl to %i totals.",max_rail_ // der convoi hat jetzt ein neues ende set_erstes_letztes(); -DBG_MESSAGE("convoi_t::add_vehikel()","now %i of %i total vehikels.",anz_vehikel,max_vehicle); +DBG_MESSAGE("convoi_t::add_vehikel()","now %i of %i total vehikels.",anz_vehikel,fahr.get_count()); return true; } @@ -2215,8 +2215,8 @@ void convoi_t::rdwr(loadsave_t *file) if(file->is_loading()) { // extend array if requested (only needed for trains) - if(anz_vehikel > max_vehicle) { - fahr.resize(max_rail_vehicle, NULL); + if(anz_vehikel > fahr.get_count()) { + fahr.resize(anz_vehikel, NULL); } owner_p = welt->get_player( owner_n ); diff --git a/simconvoi.h b/simconvoi.h index 6805c267..cba4c23a 100644 --- a/simconvoi.h +++ b/simconvoi.h @@ -55,7 +55,7 @@ public: /* Constants * @author prissi */ - enum { max_vehicle=4, max_rail_vehicle = 24 }; + enum { default_vehicle_length=4}; enum states {INITIAL, EDIT_SCHEDULE, diff --git a/simdepot.cc b/simdepot.cc index 39fd6794..029f0875 100644 --- a/simdepot.cc +++ b/simdepot.cc @@ -612,5 +612,17 @@ void depot_t::update_all_win() unsigned bahndepot_t::get_max_convoi_length() const { - return convoi_t::max_rail_vehicle; + return welt->get_settings().get_max_rail_convoi_length(); +} +unsigned strassendepot_t::get_max_convoi_length() const +{ + return welt->get_settings().get_max_road_convoi_length(); +} +unsigned schiffdepot_t::get_max_convoi_length() const +{ + return welt->get_settings().get_max_ship_convoi_length(); +} +unsigned airdepot_t::get_max_convoi_length() const +{ + return welt->get_settings().get_max_air_convoi_length(); } diff --git a/simdepot.h b/simdepot.h index 460a8505..e13a80ef 100644 --- a/simdepot.h +++ b/simdepot.h @@ -355,7 +355,7 @@ public: int get_y_placement() const { return -25; } int get_x_grid() const { return 24; } int get_y_grid() const { return 24; } - unsigned get_max_convoi_length() const { return 4; } + unsigned get_max_convoi_length() const; obj_t::typ get_typ() const { return strassendepot; } const char *get_name() const {return "Strassendepot";} @@ -392,7 +392,7 @@ public: int get_x_grid() const { return 60; } int get_y_grid() const { return 46; } - unsigned get_max_convoi_length() const { return 4; } + unsigned get_max_convoi_length() const; obj_t::typ get_typ() const { return schiffdepot; } const char *get_name() const {return "Schiffdepot";} }; @@ -422,7 +422,7 @@ public: int get_y_placement() const {return -23; } int get_x_grid() const { return 36; } int get_y_grid() const { return 36; } - unsigned get_max_convoi_length() const { return 1; } + unsigned get_max_convoi_length() const; obj_t::typ get_typ() const { return airdepot; } const char *get_name() const {return "Hangar";}