diff --git a/gui/baum_edit.cc b/gui/baum_edit.cc index ecda1c180..ca1d07bb3 100644 --- a/gui/baum_edit.cc +++ b/gui/baum_edit.cc @@ -31,8 +31,12 @@ tool_plant_tree_t baum_edit_frame_t::baum_tool; cbuffer_t baum_edit_frame_t::param_str; - static bool compare_tree_desc(const tree_desc_t* a, const tree_desc_t* b) +{ + int diff = strcmp( a->get_name(), b->get_name() ); + return diff < 0; +} +static bool compare_tree_desc_name(const tree_desc_t* a, const tree_desc_t* b) { int diff = strcmp( translator::translate(a->get_name()), translator::translate(b->get_name()) ); if(diff ==0) { @@ -46,27 +50,32 @@ baum_edit_frame_t::baum_edit_frame_t(player_t* player_) : extend_edit_gui_t(translator::translate("baum builder"), player_), tree_list(16) { - bt_timeline.set_text( "Random age" ); - bt_obsolete.set_visible(false); + cont_timeline.set_visible(false); + + bt_randomage.init( button_t::square_state, "Random age"); + bt_randomage.add_listener(this); + bt_randomage.pressed = true; + cont_options.add_component(&bt_randomage); desc = NULL; baum_tool.set_default_param(NULL); - fill_list( is_show_trans_name ); + fill_list(); - cont_left.add_component(&tree_image); + cont_scrolly.add_component(&tree_image); building_image.set_visible(false); } // fill the current tree_list -void baum_edit_frame_t::fill_list( bool translate ) +void baum_edit_frame_t::fill_list() { tree_list.clear(); + const bool is_sortedbyname = get_sortedby()==gui_sorting_item_t::BY_NAME_TRANSLATED; FOR(vector_tpl, const i, baum_t::get_all_desc()) { - if (i) { - tree_list.insert_ordered(i, compare_tree_desc); + if ( i && (i->get_allowed_climate_bits() & get_climate()) ) { + tree_list.insert_ordered(i, is_sortedbyname ? compare_tree_desc_name : compare_tree_desc); } } @@ -74,7 +83,7 @@ void baum_edit_frame_t::fill_list( bool translate ) scl.clear_elements(); scl.set_selection(-1); FOR(vector_tpl, const i, tree_list) { - char const* const name = translate ? translator::translate(i->get_name()): i->get_name(); + char const* const name = bt_translation.pressed ? i->get_name() : translator::translate(i->get_name()); scl.new_component(name, SYSCOL_TEXT); if (i == desc) { scl.set_selection(scl.get_count()-1); @@ -84,6 +93,14 @@ void baum_edit_frame_t::fill_list( bool translate ) change_item_info( scl.get_selection() ); } +bool baum_edit_frame_t::action_triggered( gui_action_creator_t *comp,value_t e) +{ + if( comp==&bt_randomage ) { + bt_randomage.pressed ^= 1; + change_item_info( scl.get_selection() ); + } + return extend_edit_gui_t::action_triggered(comp,e); +} void baum_edit_frame_t::change_item_info(sint32 entry) @@ -124,7 +141,7 @@ void baum_edit_frame_t::change_item_info(sint32 entry) tree_image.set_image(desc->get_image_id( 0, 3 ), true); param_str.clear(); - param_str.printf( "%i%i,%s", bt_climates.pressed, bt_timeline.pressed, desc->get_name() ); + param_str.printf( "%i%i,%s", bt_climates.pressed, bt_randomage.pressed, desc->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, player ); diff --git a/gui/baum_edit.h b/gui/baum_edit.h index 18622ba35..089e2fecf 100644 --- a/gui/baum_edit.h +++ b/gui/baum_edit.h @@ -29,7 +29,9 @@ private: vector_tpltree_list; - void fill_list( bool translate ) OVERRIDE; + button_t bt_randomage; + + void fill_list() OVERRIDE; void change_item_info( sint32 i ) OVERRIDE; @@ -47,6 +49,8 @@ public: * @return the filename for the helptext, or NULL */ const char* get_help_filename() const OVERRIDE { return "baum_build.txt"; } + + bool action_triggered(gui_action_creator_t*, value_t) OVERRIDE; }; #endif diff --git a/gui/citybuilding_edit.cc b/gui/citybuilding_edit.cc index 1ca25d6dc..9186b3ab6 100644 --- a/gui/citybuilding_edit.cc +++ b/gui/citybuilding_edit.cc @@ -31,29 +31,63 @@ cbuffer_t citybuilding_edit_frame_t::param_str; static bool compare_building_desc(const building_desc_t* a, const building_desc_t* b) { - int diff = a->get_level()-b->get_level(); + int diff = strcmp( a->get_name(), b->get_name() ); + return diff < 0; +} +static bool compare_building_desc_name(const building_desc_t* a, const building_desc_t* b) +{ + int diff = strcmp( translator::translate(a->get_name()), translator::translate(b->get_name()) ); if( diff==0 ) { - diff = a->get_type()-b->get_type(); + diff = strcmp(a->get_name(), b->get_name()); } + return diff < 0; +} +static bool compare_building_desc_level_pax(const building_desc_t* a, const building_desc_t* b) +{ + int diff = a->get_level() - b->get_level(); if( diff==0 ) { diff = strcmp(a->get_name(), b->get_name()); } return diff < 0; } - - -static bool compare_building_desc_trans(const building_desc_t* a, const building_desc_t* b) +static bool compare_building_desc_level_mail(const building_desc_t* a, const building_desc_t* b) { - int diff = strcmp( translator::translate(a->get_name()), translator::translate(b->get_name()) ); + int diff = a->get_mail_level() - b->get_mail_level(); if( diff==0 ) { - diff = a->get_level()-b->get_level(); + diff = strcmp(a->get_name(), b->get_name()); } + return diff < 0; +} +static bool compare_building_desc_date_intro(const building_desc_t* a, const building_desc_t* b) +{ + int diff = a->get_intro_year_month() - b->get_intro_year_month(); if( diff==0 ) { - diff = a->get_type()-b->get_type(); + diff = strcmp(a->get_name(), b->get_name()); + } + return diff < 0; +} +static bool compare_building_desc_date_retire(const building_desc_t* a, const building_desc_t* b) +{ + int diff = a->get_retire_year_month() - b->get_retire_year_month(); + if( diff==0 ) { + diff = strcmp(a->get_name(), b->get_name()); + } + return diff < 0; +} +static bool compare_building_desc_size(const building_desc_t* a, const building_desc_t* b) +{ + koord a_koord = a->get_size(); + koord b_koord = b->get_size(); + int diff = a_koord.x * a_koord.y - b_koord.x * b_koord.y; + if( diff==0 ) { + //same area - sort by side to seperate different shapes + diff = a_koord.x - b_koord.x; + } + if( diff==0 ) { + diff = strcmp(a->get_name(), b->get_name()); } return diff < 0; } - citybuilding_edit_frame_t::citybuilding_edit_frame_t(player_t* player_) : @@ -67,66 +101,84 @@ citybuilding_edit_frame_t::citybuilding_edit_frame_t(player_t* player_) : bt_res.init( button_t::square_state, "residential house"); bt_res.add_listener(this); bt_res.pressed = true; - cont_right.add_component(&bt_res); + cont_filter.add_component(&bt_res); bt_com.init( button_t::square_state, "shops and stores"); bt_com.add_listener(this); bt_com.pressed = true; - cont_right.add_component(&bt_com); + cont_filter.add_component(&bt_com); bt_ind.init( button_t::square_state, "industrial building"); bt_ind.add_listener(this); - cont_right.add_component(&bt_ind); - bt_com.pressed = true; + bt_ind.pressed = true; + cont_filter.add_component(&bt_ind); + + // add to sorting selection + cb_sortedby.new_component(gui_sorting_item_t::BY_LEVEL_PAX); + cb_sortedby.new_component(gui_sorting_item_t::BY_LEVEL_MAIL); + cb_sortedby.new_component(gui_sorting_item_t::BY_DATE_INTRO); + cb_sortedby.new_component(gui_sorting_item_t::BY_DATE_RETIRE); + cb_sortedby.new_component(gui_sorting_item_t::BY_SIZE); + cb_sortedby.set_selection(2); // rotation - gui_aligned_container_t *tbl = cont_right.add_table(2,0); + gui_aligned_container_t *tbl = cont_options.add_table(2,0); tbl->new_component("Rotation"); tbl->add_component(&cb_rotation); cb_rotation.add_listener(this); cb_rotation.new_component(gui_rotation_item_t::random); - cont_right.end_table(); + cont_options.end_table(); - fill_list( is_show_trans_name ); + fill_list(); reset_min_windowsize(); } - +// put item in list according to filter/sorter +void citybuilding_edit_frame_t::put_item_in_list( const building_desc_t* desc ) +{ + const bool allow_obsolete = bt_obsolete.pressed; + const bool use_timeline = bt_timeline.pressed | bt_timeline_custom.pressed; + const sint32 month_now = bt_timeline.pressed ? welt->get_current_month() : bt_timeline_custom.pressed ? ni_timeline_year.get_value()*12 + ni_timeline_month.get_value()-1 : 0; + const uint8 chosen_climate = get_climate(); + const uint8 sortedby = get_sortedby(); + if( (!use_timeline || (!desc->is_future(month_now) && (!desc->is_retired(month_now) || allow_obsolete)) ) + && ( desc->get_allowed_climate_bits() & chosen_climate) ) { + // timeline allows for this, and so does climates setting + switch(sortedby) { + case gui_sorting_item_t::BY_NAME_TRANSLATED: building_list.insert_ordered( desc, compare_building_desc_name ); break; + case gui_sorting_item_t::BY_LEVEL_PAX: building_list.insert_ordered( desc, compare_building_desc_level_pax ); break; + case gui_sorting_item_t::BY_LEVEL_MAIL: building_list.insert_ordered( desc, compare_building_desc_level_mail ); break; + case gui_sorting_item_t::BY_DATE_INTRO: building_list.insert_ordered( desc, compare_building_desc_date_intro ); break; + case gui_sorting_item_t::BY_DATE_RETIRE: building_list.insert_ordered( desc, compare_building_desc_date_retire ); break; + case gui_sorting_item_t::BY_SIZE: building_list.insert_ordered( desc, compare_building_desc_size ); break; + default: building_list.insert_ordered( desc, compare_building_desc ); + } + } +} // fill the current building_list -void citybuilding_edit_frame_t::fill_list( bool translate ) +void citybuilding_edit_frame_t::fill_list() { - const bool allow_obsolete = bt_obsolete.pressed; - const bool use_timeline = bt_timeline.pressed; - const sint32 month_now = bt_timeline.pressed ? welt->get_current_month() : 0; + building_list.clear(); if(bt_res.pressed) { FOR(vector_tpl, const desc, *hausbauer_t::get_citybuilding_list(building_desc_t::city_res)) { - if(!use_timeline || (!desc->is_future(month_now) && (!desc->is_retired(month_now) || allow_obsolete)) ) { - // timeline allows for this - building_list.insert_ordered(desc, translate?compare_building_desc_trans:compare_building_desc ); - } + put_item_in_list(desc); } } if(bt_com.pressed) { FOR(vector_tpl, const desc, *hausbauer_t::get_citybuilding_list(building_desc_t::city_com)) { - if(!use_timeline || (!desc->is_future(month_now) && (!desc->is_retired(month_now) || allow_obsolete)) ) { - // timeline allows for this - building_list.insert_ordered(desc, translate?compare_building_desc_trans:compare_building_desc ); - } + put_item_in_list(desc); } } if(bt_ind.pressed) { FOR(vector_tpl, const desc, *hausbauer_t::get_citybuilding_list(building_desc_t::city_ind)) { - if(!use_timeline || (!desc->is_future(month_now) && (!desc->is_retired(month_now) || allow_obsolete)) ) { - // timeline allows for this - building_list.insert_ordered(desc, translate?compare_building_desc_trans:compare_building_desc ); - } + put_item_in_list(desc); } } @@ -141,7 +193,7 @@ void citybuilding_edit_frame_t::fill_list( bool translate ) case building_desc_t::city_com: color = color_idx_to_rgb(COL_DARK_GREEN); break; default: color = SYSCOL_TEXT; break; } - char const* const name = translate ? translator::translate(i->get_name()) : i->get_name(); + char const* const name = bt_translation.pressed ? i->get_name() : translator::translate(i->get_name()); scl.new_component(name, color); if (i == desc) { scl.set_selection(scl.get_count()-1); @@ -160,15 +212,15 @@ bool citybuilding_edit_frame_t::action_triggered( gui_action_creator_t *comp,val // only one chain can be shown if( comp==&bt_res ) { bt_res.pressed ^= 1; - fill_list( is_show_trans_name ); + fill_list(); } else if( comp==&bt_com ) { bt_com.pressed ^= 1; - fill_list( is_show_trans_name ); + fill_list(); } else if( comp==&bt_ind ) { bt_ind.pressed ^= 1; - fill_list( is_show_trans_name ); + fill_list(); } else if( comp == &cb_rotation) { change_item_info( scl.get_selection() ); @@ -244,6 +296,7 @@ void citybuilding_edit_frame_t::change_item_info(sint32 entry) if(welt->get_tool(player->get_player_nr())==&haus_tool) { welt->set_tool( tool_t::general_tool[TOOL_QUERY], player ); } + buf.clear(); building_image.init(NULL, 0); cb_rotation.clear_elements(); cb_rotation.new_component(gui_rotation_item_t::random); diff --git a/gui/citybuilding_edit.h b/gui/citybuilding_edit.h index 2764c469b..04cc186d7 100644 --- a/gui/citybuilding_edit.h +++ b/gui/citybuilding_edit.h @@ -33,7 +33,8 @@ private: button_t bt_com; button_t bt_ind; - void fill_list( bool translate ) OVERRIDE; + void fill_list() OVERRIDE; + void put_item_in_list( const building_desc_t* desc ); void change_item_info( sint32 i ) OVERRIDE; diff --git a/gui/curiosity_edit.cc b/gui/curiosity_edit.cc index b046a5f07..6633647bd 100644 --- a/gui/curiosity_edit.cc +++ b/gui/curiosity_edit.cc @@ -32,15 +32,60 @@ static bool compare_building_desc(const building_desc_t* a, const building_desc_ int diff = strcmp( a->get_name(), b->get_name() ); return diff < 0; } - - -static bool compare_building_desc_trans(const building_desc_t* a, const building_desc_t* b) +static bool compare_building_desc_name(const building_desc_t* a, const building_desc_t* b) { int diff = strcmp( translator::translate(a->get_name()), translator::translate(b->get_name()) ); + if( diff==0 ) { + diff = strcmp(a->get_name(), b->get_name()); + } + return diff < 0; +} +static bool compare_building_desc_level_pax(const building_desc_t* a, const building_desc_t* b) +{ + int diff = a->get_level() - b->get_level(); + if( diff==0 ) { + diff = strcmp(a->get_name(), b->get_name()); + } + return diff < 0; +} +static bool compare_building_desc_level_mail(const building_desc_t* a, const building_desc_t* b) +{ + int diff = a->get_mail_level() - b->get_mail_level(); + if( diff==0 ) { + diff = strcmp(a->get_name(), b->get_name()); + } + return diff < 0; +} +static bool compare_building_desc_date_intro(const building_desc_t* a, const building_desc_t* b) +{ + int diff = a->get_intro_year_month() - b->get_intro_year_month(); + if( diff==0 ) { + diff = strcmp(a->get_name(), b->get_name()); + } + return diff < 0; +} +static bool compare_building_desc_date_retire(const building_desc_t* a, const building_desc_t* b) +{ + int diff = a->get_retire_year_month() - b->get_retire_year_month(); + if( diff==0 ) { + diff = strcmp(a->get_name(), b->get_name()); + } + return diff < 0; +} +static bool compare_building_desc_size(const building_desc_t* a, const building_desc_t* b) +{ + koord a_koord = a->get_size(); + koord b_koord = b->get_size(); + int diff = a_koord.x * a_koord.y - b_koord.x * b_koord.y; + if( diff==0 ) { + //same area - sort by side to seperate different shapes + diff = a_koord.x - b_koord.x; + } + if( diff==0 ) { + diff = strcmp(a->get_name(), b->get_name()); + } return diff < 0; } - - curiosity_edit_frame_t::curiosity_edit_frame_t(player_t* player_) : extend_edit_gui_t(translator::translate("curiosity builder"), player_), @@ -53,65 +98,81 @@ curiosity_edit_frame_t::curiosity_edit_frame_t(player_t* player_) : bt_city_attraction.init( button_t::square_state, "City attraction"); bt_city_attraction.add_listener(this); bt_city_attraction.pressed = true; - cont_right.add_component(&bt_city_attraction); + cont_filter.add_component(&bt_city_attraction); bt_land_attraction.init( button_t::square_state, "Land attraction"); bt_land_attraction.add_listener(this); bt_land_attraction.pressed = true; - cont_right.add_component(&bt_land_attraction); + cont_filter.add_component(&bt_land_attraction); bt_monuments.init( button_t::square_state, "Monument"); bt_monuments.add_listener(this); - cont_right.add_component(&bt_monuments); + cont_filter.add_component(&bt_monuments); + + // add to sorting selection + cb_sortedby.new_component(gui_sorting_item_t::BY_LEVEL_PAX); + cb_sortedby.new_component(gui_sorting_item_t::BY_LEVEL_MAIL); + cb_sortedby.new_component(gui_sorting_item_t::BY_DATE_INTRO); + cb_sortedby.new_component(gui_sorting_item_t::BY_DATE_RETIRE); + cb_sortedby.new_component(gui_sorting_item_t::BY_SIZE); + // rotation - gui_aligned_container_t *tbl = cont_right.add_table(2,0); + gui_aligned_container_t *tbl = cont_options.add_table(2,0); tbl->new_component("Rotation"); tbl->add_component(&cb_rotation); cb_rotation.add_listener(this); cb_rotation.new_component(gui_rotation_item_t::random); - cont_right.end_table(); + cont_options.end_table(); - fill_list( is_show_trans_name ); + fill_list(); reset_min_windowsize(); } - -// fill the current building_list -void curiosity_edit_frame_t::fill_list( bool translate ) +// put item in list according to filter/sorter +void curiosity_edit_frame_t::put_item_in_list( const building_desc_t* desc ) { const bool allow_obsolete = bt_obsolete.pressed; - const bool use_timeline = bt_timeline.pressed; - const sint32 month_now = bt_timeline.pressed ? welt->get_current_month() : 0; - + const bool use_timeline = bt_timeline.pressed | bt_timeline_custom.pressed; + const sint32 month_now = bt_timeline.pressed ? welt->get_current_month() : bt_timeline_custom.pressed ? ni_timeline_year.get_value()*12 + ni_timeline_month.get_value()-1 : 0; + const uint8 chosen_climate = get_climate(); + const uint8 sortedby = get_sortedby(); + if( (!use_timeline || (!desc->is_future(month_now) && (!desc->is_retired(month_now) || allow_obsolete)) ) + && ( desc->get_allowed_climate_bits() & chosen_climate) ) { + // timeline allows for this, and so does climates setting + switch(sortedby) { + case gui_sorting_item_t::BY_NAME_TRANSLATED: building_list.insert_ordered( desc, compare_building_desc_name ); break; + case gui_sorting_item_t::BY_LEVEL_PAX: building_list.insert_ordered( desc, compare_building_desc_level_pax ); break; + case gui_sorting_item_t::BY_LEVEL_MAIL: building_list.insert_ordered( desc, compare_building_desc_level_mail ); break; + case gui_sorting_item_t::BY_DATE_INTRO: building_list.insert_ordered( desc, compare_building_desc_date_intro ); break; + case gui_sorting_item_t::BY_DATE_RETIRE: building_list.insert_ordered( desc, compare_building_desc_date_retire ); break; + case gui_sorting_item_t::BY_SIZE: building_list.insert_ordered( desc, compare_building_desc_size ); break; + default: building_list.insert_ordered( desc, compare_building_desc ); + } + } +} +// fill the current building_list +void curiosity_edit_frame_t::fill_list() +{ building_list.clear(); if(bt_city_attraction.pressed) { FOR(vector_tpl, const desc, *hausbauer_t::get_list(building_desc_t::attraction_city)) { - if(!use_timeline || (!desc->is_future(month_now) && (!desc->is_retired(month_now) || allow_obsolete)) ) { - // timeline allows for this - building_list.insert_ordered( desc, translate?compare_building_desc_trans:compare_building_desc ); - } + put_item_in_list(desc); } } if(bt_land_attraction.pressed) { FOR(vector_tpl, const desc, *hausbauer_t::get_list(building_desc_t::attraction_land)) { - if(!use_timeline || (!desc->is_future(month_now) && (!desc->is_retired(month_now) || allow_obsolete)) ) { - // timeline allows for this - building_list.insert_ordered( desc, translate?compare_building_desc_trans:compare_building_desc ); - } + put_item_in_list(desc); } } if(bt_monuments.pressed) { FOR(vector_tpl, const desc, *hausbauer_t::get_list(building_desc_t::monument)) { - if(!use_timeline || (!desc->is_future(month_now) && (!desc->is_retired(month_now) || allow_obsolete)) ) { - // timeline allows for this - building_list.insert_ordered( desc, translate?compare_building_desc_trans:compare_building_desc ); - } + put_item_in_list(desc); } } @@ -126,7 +187,7 @@ void curiosity_edit_frame_t::fill_list( bool translate ) case building_desc_t::attraction_land: color = color_idx_to_rgb(COL_DARK_GREEN); break; default: color = color_idx_to_rgb(COL_BLACK); break; } - char const* const name = translate ? translator::translate(i->get_name()) : i->get_name(); + char const* const name = bt_translation.pressed ? i->get_name() : translator::translate(i->get_name()); scl.new_component(name, color); if (i == desc) { scl.set_selection(scl.get_count()-1); @@ -143,15 +204,15 @@ bool curiosity_edit_frame_t::action_triggered( gui_action_creator_t *comp,value_ // only one chain can be shown if( comp==&bt_city_attraction ) { bt_city_attraction.pressed ^= 1; - fill_list( is_show_trans_name ); + fill_list(); } else if( comp==&bt_land_attraction ) { bt_land_attraction.pressed ^= 1; - fill_list( is_show_trans_name ); + fill_list(); } else if( comp==&bt_monuments ) { bt_monuments.pressed ^= 1; - fill_list( is_show_trans_name ); + fill_list(); } else if( comp == &cb_rotation) { change_item_info( scl.get_selection() ); @@ -236,6 +297,7 @@ void curiosity_edit_frame_t::change_item_info(sint32 entry) building_image.init(NULL, 0); cb_rotation.clear_elements(); cb_rotation.new_component(gui_rotation_item_t::random); + buf.clear(); } reset_min_windowsize(); } @@ -247,7 +309,7 @@ void curiosity_edit_frame_t::draw(scr_coord pos, scr_size size) if(desc && desc->get_type()==building_desc_t::monument && !hausbauer_t::is_valid_monument(desc) ) { change_item_info(0x7FFFFFFF); scl.set_selection(-1); - fill_list( is_show_trans_name ); + fill_list(); } extend_edit_gui_t::draw(pos,size); diff --git a/gui/curiosity_edit.h b/gui/curiosity_edit.h index fbdb6f799..08998ecae 100644 --- a/gui/curiosity_edit.h +++ b/gui/curiosity_edit.h @@ -29,7 +29,8 @@ private: button_t bt_land_attraction; button_t bt_monuments; - void fill_list( bool translate ) OVERRIDE; + void fill_list() OVERRIDE; + void put_item_in_list(const building_desc_t* desc ); void change_item_info( sint32 i ) OVERRIDE; diff --git a/gui/extend_edit.cc b/gui/extend_edit.cc index eabe572a1..e22626ebd 100644 --- a/gui/extend_edit.cc +++ b/gui/extend_edit.cc @@ -9,29 +9,56 @@ #include "../simevent.h" #include "../dataobj/translator.h" +#include "../descriptor/ground_desc.h" #include "../player/simplay.h" #include "extend_edit.h" - -static const char* numbers[] = { "0", "1", "2", "3" }; - gui_rotation_item_t::gui_rotation_item_t(uint8 r) : gui_scrolled_list_t::const_text_scrollitem_t(NULL, SYSCOL_TEXT) { rotation = r; - - if (rotation <= 3) { - text = numbers[rotation]; + switch(rotation) { + case 0: text = translator::translate("[0] south-facing"); break; + case 1: text = translator::translate("[1] east-facing"); break; + case 2: text = translator::translate("[2] north-facing"); break; + case 3: text = translator::translate("[3] west-facing"); break; + case 4: text = translator::translate("[4] southeast corner"); break; + case 5: text = translator::translate("[5] northeast corner"); break; + case 6: text = translator::translate("[6] northwest corner"); break; + case 7: text = translator::translate("[7] southwest corner"); break; + case automatic: text = translator::translate("auto"); break; + case random: text = translator::translate("random"); break; + default: text = ""; } - else if (rotation == automatic) { - text = translator::translate("auto"); +} + +gui_climates_item_t::gui_climates_item_t(uint8 c) : gui_scrolled_list_t::const_text_scrollitem_t(NULL, SYSCOL_TEXT) +{ + if(c(); - // init scrolled list - cont_left.add_component(&scl); - scl.set_selection(-1); - scl.add_listener(this); - scl.set_min_width( (D_DEFAULT_WIDTH-D_MARGIN_LEFT-D_MARGIN_RIGHT-2*D_H_SPACE)/2 ); - // add image - cont_left.add_component(&building_image); - - end_table(); + printf("Between columns\n"); // right column - add_table(1,0); - - // add stretcher element - cont_left.new_component(); + add_component(&cont_right, 9); + cont_right.set_table_layout(1,0); + // add object settings (rotations, ...) + cont_right.add_component(&cont_options); + cont_options.set_table_layout(1,0); + // add divider element + cont_right.new_component(); + // add scrollable element + cont_right.add_component(&scrolly); + //cont scrolly is already in scrolly + cont_scrolly.set_table_layout(1,0); + // add object description + cont_scrolly.add_component(&info_text); + // add object image + cont_scrolly.add_component(&building_image); + //end of layouting. Now fill elements - bt_climates.init( button_t::square_state, "ignore climates"); - bt_climates.add_listener(this); - add_component(&bt_climates); + // init scrolled list + scl.set_selection(-1); + scl.add_listener(this); + scl.set_min_width( (D_DEFAULT_WIDTH-D_MARGIN_LEFT-D_MARGIN_RIGHT-2*D_H_SPACE)/2 ); + // start filling cont_timeline--------------------------------------------------------------------------------------------- bt_timeline.init( button_t::square_state, "Use timeline start year"); bt_timeline.pressed = welt->get_settings().get_use_timeline(); bt_timeline.add_listener(this); - add_component(&bt_timeline); + cont_timeline.add_component(&bt_timeline, 4); + + bt_timeline_custom.init( button_t::square_state, "Available at custom date:"); + bt_timeline_custom.add_listener(this); + cont_timeline.add_component(&bt_timeline_custom, 4); + + cont_timeline.new_component("Month"); + ni_timeline_month.init( (sint32)(welt->get_current_month()%12+1), 1, 12, 1, true ); + ni_timeline_month.add_listener(this); + cont_timeline.add_component(&ni_timeline_month); + cont_timeline.new_component("Year"); + ni_timeline_year.init( (sint32)(welt->get_current_month()/12), 0, 2999, 1, false ); + ni_timeline_year.add_listener(this); + cont_timeline.add_component(&ni_timeline_year); bt_obsolete.init( button_t::square_state, "Show obsolete"); bt_obsolete.add_listener(this); - add_component(&bt_obsolete); - - add_component(&cont_right); - cont_right.set_table_layout(1,0); + cont_timeline.add_component(&bt_obsolete, 4); + // end filling cont_timeline--------------------------------------------------------------------------------------------- + + // start filling cont_filter--------------------------------------------------------------------------------------------- + // climate filter + gui_aligned_container_t *tbl_climate = cont_filter.add_table(2,0); + tbl_climate->new_component("Climate"); + tbl_climate->add_component(&cb_climates); + cb_climates.add_listener(this); + cb_climates.new_component(climate::MAX_CLIMATES); + for(uint8 i=climate::desert_climate; i(i); + } + cb_climates.set_selection(0); + cont_filter.end_table(); + + cont_filter.add_component(&bt_translation); + bt_translation.add_listener(this); + bt_translation.init( button_t::square_state, "Show unique object name"); + + // Sorting box + gui_aligned_container_t *tbl_sorting = cont_filter.add_table(2,0); + tbl_sorting->new_component("Sort by"); + tbl_sorting->add_component(&cb_sortedby); + cb_sortedby.add_listener(this); + cb_sortedby.new_component(gui_sorting_item_t::BY_NAME_TRANSLATED); + cb_sortedby.new_component(gui_sorting_item_t::BY_NAME_OBJECT); + cb_sortedby.set_selection(0); + cont_filter.end_table(); + // end filling cont_filter--------------------------------------------------------------------------------------------- + + //filling cont_options + bt_climates.init( button_t::square_state, "ignore climates"); + bt_climates.add_listener(this); + cont_options.add_component(&bt_climates); - scrolly.set_visible(true); - add_component(&scrolly); + //setting scrollable content box + scrolly.set_visible(true); scrolly.set_min_width( (D_DEFAULT_WIDTH-D_MARGIN_LEFT-D_MARGIN_RIGHT-2*D_H_SPACE)/2 ); - end_table(); - - set_resizemode(diagonal_resize); } - /** * Mouse click are hereby reported to its GUI-Components */ @@ -116,7 +194,6 @@ bool extend_edit_gui_t::infowin_event(const event_t *ev) } - // resize flowtext to avoid horizontal scrollbar void extend_edit_gui_t::set_windowsize( scr_size s ) { @@ -127,18 +204,9 @@ void extend_edit_gui_t::set_windowsize( scr_size s ) bool extend_edit_gui_t::action_triggered( gui_action_creator_t *comp,value_t /* */) { - if (comp == &tabs) { - // switch list translation or object name - if (tabs.get_active_tab_index() == 0 && !is_show_trans_name) { - // show translation list - is_show_trans_name = true; - fill_list( is_show_trans_name ); - } - else if (tabs.get_active_tab_index() == 1 && is_show_trans_name) { - // show object list - is_show_trans_name = false; - fill_list( is_show_trans_name ); - } + if (comp == &bt_translation) { + bt_translation.pressed ^= 1; + fill_list(); } else if (comp == &scl) { // select an item of scroll list ? @@ -146,16 +214,36 @@ bool extend_edit_gui_t::action_triggered( gui_action_creator_t *comp,value_t /* } else if( comp==&bt_obsolete ) { bt_obsolete.pressed ^= 1; - fill_list( is_show_trans_name ); + fill_list(); } else if( comp==&bt_climates ) { bt_climates.pressed ^= 1; - fill_list( is_show_trans_name ); + fill_list(); } else if( comp==&bt_timeline ) { + bt_timeline_custom.pressed = false; bt_timeline.pressed ^= 1; - fill_list( is_show_trans_name ); + fill_list(); } + else if ( comp==&bt_timeline_custom ) { + bt_timeline.pressed = false; + bt_timeline_custom.pressed ^= 1; + fill_list(); + } + else if ( comp==&ni_timeline_year && bt_timeline_custom.pressed) { + fill_list(); + } + else if ( comp==&ni_timeline_month && bt_timeline_custom.pressed) { + fill_list(); + } + else if( comp==&cb_climates ) { + fill_list(); + change_item_info(scl.get_selection()); + } + else if( comp==&cb_sortedby ) { + fill_list(); + } + return true; } @@ -167,3 +255,18 @@ uint8 extend_edit_gui_t::get_rotation() const } return 0; } +uint8 extend_edit_gui_t::get_climate() const +{ + if (gui_climates_item_t *item = dynamic_cast( cb_climates.get_selected_item() ) ) { + return item->get_climate(); + } + return ALL_CLIMATES; +} + +uint8 extend_edit_gui_t::get_sortedby() const +{ + if (gui_sorting_item_t *item = dynamic_cast( cb_sortedby.get_selected_item() ) ) { + return item->get_sortedby(); + } + return ALL_CLIMATES; +} \ No newline at end of file diff --git a/gui/extend_edit.h b/gui/extend_edit.h index 83cf89851..0657039c6 100644 --- a/gui/extend_edit.h +++ b/gui/extend_edit.h @@ -17,6 +17,8 @@ #include "components/gui_fixedwidth_textarea.h" #include "components/gui_building.h" #include "components/gui_combobox.h" +#include "components/gui_numberinput.h" +#include "components/gui_divider.h" #include "../utils/cbuffer_t.h" #include "../simtypes.h" @@ -45,6 +47,55 @@ public: sint8 get_rotation() const { return rotation; } }; +/** + * Entries for climate selection. + */ +class gui_climates_item_t : public gui_scrolled_list_t::const_text_scrollitem_t +{ +private: + const char *text; + uint8 climate_; + +public: + gui_climates_item_t(uint8 r); + + char const* get_text () const OVERRIDE { return text; } + + sint8 get_climate() const { return climate_; } +}; + +/** + * Entries for sorting selection. + */ +class gui_sorting_item_t : public gui_scrolled_list_t::const_text_scrollitem_t +{ +private: + const char *text; + uint8 sorted_by; + +public: + enum sorting_options { + BY_NAME_TRANSLATED, + BY_NAME_OBJECT, + BY_LEVEL_PAX, + BY_LEVEL_MAIL, + BY_DATE_INTRO, + BY_DATE_RETIRE, + BY_SIZE, + BY_COST, + BY_GOODS_NUMBER + }; + + gui_sorting_item_t(uint8 r); + + char const* get_text () const OVERRIDE { return text; } + + sint8 get_sortedby() const { return sorted_by; } +}; + + + + /** * Base class map editor dialogues to select object to place on map. */ @@ -54,27 +105,36 @@ class extend_edit_gui_t : { protected: player_t *player; - /// cont_left: left column, right: between obsolete-button and text-area + /// cont_left: left column, cont_right: right column gui_aligned_container_t cont_left, cont_right; + /// cont_filter: Settings about the content of the list (above list) + /// cont_timeline: timeline-related filter settings + /// cont_options: Settings about the active object (eg. rotation) + /// cont_scrolly: the scrollable container (image + desc) + gui_aligned_container_t cont_filter, cont_options, cont_timeline, cont_scrolly; + + cbuffer_t buf; gui_fixedwidth_textarea_t info_text; + //container for object description gui_scrollpane_t scrolly; gui_scrolled_list_t scl; - gui_tab_panel_t tabs; //image gui_building_t building_image; - button_t bt_obsolete, bt_timeline, bt_climates; + button_t bt_obsolete, bt_timeline, bt_climates, bt_timeline_custom, bt_translation; // we make this available for child classes - gui_combobox_t cb_rotation; + gui_combobox_t cb_rotation, cb_climates, cb_sortedby; + + gui_numberinput_t ni_timeline_year, ni_timeline_month; /// show translated names bool is_show_trans_name; - virtual void fill_list( bool /* translate */ ) {} + virtual void fill_list() {} virtual void change_item_info( sint32 /*entry, -1= none */ ) {} @@ -84,6 +144,17 @@ protected: * defaults to zero. */ uint8 get_rotation() const; + + /** + * @returns selected climate of cb_climates. + */ + uint8 get_climate() const; + + /** + * @returns selected sorting method. + */ + uint8 get_sortedby() const; + public: extend_edit_gui_t(const char *name, player_t* player_); diff --git a/gui/factory_edit.cc b/gui/factory_edit.cc index 6cf76682d..324df591f 100644 --- a/gui/factory_edit.cc +++ b/gui/factory_edit.cc @@ -30,19 +30,83 @@ tool_city_chain_t factory_edit_frame_t::city_chain_tool = tool_city_chain_t(); tool_build_factory_t factory_edit_frame_t::fab_tool = tool_build_factory_t(); cbuffer_t factory_edit_frame_t::param_str; - -static bool compare_fabrik_desc(const factory_desc_t* a, const factory_desc_t* b) +static bool compare_factory_desc(const factory_desc_t* a, const factory_desc_t* b) { int diff = strcmp( a->get_name(), b->get_name() ); return diff < 0; } - -static bool compare_factory_desc_trans(const factory_desc_t* a, const factory_desc_t* b) +static bool compare_factory_desc_name(const factory_desc_t* a, const factory_desc_t* b) { int diff = strcmp( translator::translate(a->get_name()), translator::translate(b->get_name()) ); + if( diff==0 ) { + diff = strcmp(a->get_name(), b->get_name()); + } + return diff < 0; +} +static bool compare_factory_desc_level_pax(const factory_desc_t* a, const factory_desc_t* b) +{ + int diff = (a->get_pax_demand() != 65535 ? a->get_pax_demand() : a->get_pax_level()) + -(b->get_pax_demand() != 65535 ? b->get_pax_demand() : b->get_pax_level()); + if ( diff == 0 ) { + diff = strcmp(a->get_name(), b->get_name()); + } + return diff < 0; +} +static bool compare_factory_desc_level_mail(const factory_desc_t* a, const factory_desc_t* b) +{ + int diff = (a->get_mail_demand() != 65535 ? a->get_mail_demand() : a->get_pax_level()>>2) + -(b->get_mail_demand() != 65535 ? b->get_mail_demand() : b->get_pax_level()>>2); + if ( diff == 0 ) { + diff = strcmp(a->get_name(), b->get_name()); + } + return diff < 0; +} +static bool compare_factory_desc_date_intro(const factory_desc_t* a, const factory_desc_t* b) +{ + int diff = a->get_building()->get_intro_year_month() - b->get_building()->get_intro_year_month(); + if ( diff = 0) { + diff = strcmp(a->get_name(), b->get_name()); + } + return diff < 0; +} +static bool compare_factory_desc_date_retire(const factory_desc_t* a, const factory_desc_t* b) +{ + int diff = a->get_building()->get_retire_year_month() - b->get_building()->get_retire_year_month(); + if ( diff = 0) { + diff = strcmp(a->get_name(), b->get_name()); + } + return diff < 0; +} +static bool compare_factory_desc_size(const factory_desc_t* a, const factory_desc_t* b) +{ + koord a_koord = a->get_building()->get_size(); + koord b_koord = b->get_building()->get_size(); + int diff = a_koord.x * a_koord.y - b_koord.x * b_koord.y; + if( diff==0 ) { + //same area - sort by side to seperate different shapes + diff = a_koord.x - b_koord.x; + } + if( diff==0 ) { + diff = strcmp(a->get_name(), b->get_name()); + } + return diff < 0; +} +static bool compare_factory_desc_goods_number(const factory_desc_t* a, const factory_desc_t* b) +{ + koord a_koord = a->get_building()->get_size(); + koord b_koord = b->get_building()->get_size(); + int diff = a->get_product_count() - b->get_product_count(); + if( diff==0 ) { + //same number of products - go by number of required goods + diff = a->get_supplier_count() - b->get_supplier_count(); + } + if( diff==0 ) { + diff = strcmp(a->get_name(), b->get_name()); + } return diff < 0; } + factory_edit_frame_t::factory_edit_frame_t(player_t* player_) : extend_edit_gui_t(translator::translate("factorybuilder"), player_), factory_list(16) @@ -52,14 +116,25 @@ factory_edit_frame_t::factory_edit_frame_t(player_t* player_) : bt_city_chain.init( button_t::square_state, "Only city chains"); bt_city_chain.add_listener(this); - cont_right.add_component(&bt_city_chain); + cont_filter.add_component(&bt_city_chain); bt_land_chain.init( button_t::square_state, "Only land chains"); bt_land_chain.add_listener(this); - cont_right.add_component(&bt_land_chain); + cont_filter.add_component(&bt_land_chain); + + // add water to climate selection + cb_climates.new_component(climate::water_climate); + + // add to sorting selection + cb_sortedby.new_component(gui_sorting_item_t::BY_LEVEL_PAX); + cb_sortedby.new_component(gui_sorting_item_t::BY_LEVEL_MAIL); + cb_sortedby.new_component(gui_sorting_item_t::BY_DATE_INTRO); + cb_sortedby.new_component(gui_sorting_item_t::BY_DATE_RETIRE); + cb_sortedby.new_component(gui_sorting_item_t::BY_SIZE); + cb_sortedby.new_component(gui_sorting_item_t::BY_GOODS_NUMBER); // rotation, production - gui_aligned_container_t *tbl = cont_right.add_table(2,2); + gui_aligned_container_t *tbl = cont_options.add_table(2,2); tbl->new_component("Rotation"); tbl->add_component(&cb_rotation); cb_rotation.add_listener(this); @@ -70,9 +145,9 @@ factory_edit_frame_t::factory_edit_frame_t(player_t* player_) : inp_production.set_limits(0,9999); inp_production.add_listener( this ); tbl->add_component(&inp_production); - cont_right.end_table(); + cont_options.end_table(); - fill_list( is_show_trans_name ); + fill_list(); reset_min_windowsize(); } @@ -80,13 +155,14 @@ factory_edit_frame_t::factory_edit_frame_t(player_t* player_) : // fill the current factory_list -void factory_edit_frame_t::fill_list( bool translate ) +void factory_edit_frame_t::fill_list() { const bool allow_obsolete = bt_obsolete.pressed; - const bool use_timeline = bt_timeline.pressed; + const bool use_timeline = bt_timeline.pressed | bt_timeline_custom.pressed; const bool city_chain = bt_city_chain.pressed; const bool land_chain = bt_land_chain.pressed; - const sint32 month_now = bt_timeline.pressed ? welt->get_current_month() : 0; + const sint32 month_now = bt_timeline.pressed ? welt->get_current_month() : bt_timeline_custom.pressed ? ni_timeline_year.get_value()*12 + ni_timeline_month.get_value()-1 : 0; + const uint8 sortedby = get_sortedby(); factory_list.clear(); @@ -96,22 +172,24 @@ void factory_edit_frame_t::fill_list( bool translate ) if(desc->get_distribution_weight()>0) { // DistributionWeight=0 is obsoleted item, only for backward compatibility - if(!use_timeline || (!desc->get_building()->is_future(month_now) && (!desc->get_building()->is_retired(month_now) || allow_obsolete)) ) { - // timeline allows for this - - if(city_chain) { - if (desc->get_placement() == factory_desc_t::City && desc->is_consumer_only()) { - factory_list.insert_ordered( desc, translate?compare_factory_desc_trans:compare_fabrik_desc ); - } - } - if(land_chain) { - if (desc->get_placement() != factory_desc_t::City && desc->is_consumer_only()) { - factory_list.insert_ordered( desc, translate?compare_factory_desc_trans:compare_fabrik_desc ); + if( (!use_timeline || (!desc->get_building()->is_future(month_now) && (!desc->get_building()->is_retired(month_now) || allow_obsolete))) + && ( desc->get_building()->get_allowed_climate_bits() & get_climate()) ) { + // timeline allows for this, and so does climates setting + + if( ( city_chain && (desc->get_placement() == factory_desc_t::City && desc->is_consumer_only() ) ) + || ( land_chain && (desc->get_placement() != factory_desc_t::City && desc->is_consumer_only() ) ) + || (!city_chain && !land_chain) ) { + switch(sortedby) { + case gui_sorting_item_t::BY_NAME_TRANSLATED: factory_list.insert_ordered( desc, compare_factory_desc_name ); break; + case gui_sorting_item_t::BY_LEVEL_PAX: factory_list.insert_ordered( desc, compare_factory_desc_level_pax ); break; + case gui_sorting_item_t::BY_LEVEL_MAIL: factory_list.insert_ordered( desc, compare_factory_desc_level_mail ); break; + case gui_sorting_item_t::BY_DATE_INTRO: factory_list.insert_ordered( desc, compare_factory_desc_date_intro ); break; + case gui_sorting_item_t::BY_DATE_RETIRE: factory_list.insert_ordered( desc, compare_factory_desc_date_retire ); break; + case gui_sorting_item_t::BY_SIZE: factory_list.insert_ordered( desc, compare_factory_desc_size ); break; + case gui_sorting_item_t::BY_GOODS_NUMBER: factory_list.insert_ordered( desc, compare_factory_desc_goods_number ); break; + default: factory_list.insert_ordered( desc, compare_factory_desc ); } } - if(!city_chain && !land_chain) { - factory_list.insert_ordered( desc, translate?compare_factory_desc_trans:compare_fabrik_desc ); - } } } } @@ -124,7 +202,7 @@ void factory_edit_frame_t::fill_list( bool translate ) i->is_consumer_only() ? color_idx_to_rgb(COL_BLUE) : i->is_producer_only() ? color_idx_to_rgb(COL_DARK_GREEN) : SYSCOL_TEXT; - char const* const name = translate ? translator::translate(i->get_name()) : i->get_name(); + char const* const name = bt_translation.pressed ? i->get_name() : translator::translate(i->get_name()); scl.new_component(name, color); if (i == fac_desc) { scl.set_selection(scl.get_count()-1); @@ -146,14 +224,14 @@ bool factory_edit_frame_t::action_triggered( gui_action_creator_t *comp,value_t if(bt_city_chain.pressed) { bt_land_chain.pressed = 0; } - fill_list( is_show_trans_name ); + fill_list(); } else if( comp==&bt_land_chain ) { bt_land_chain.pressed ^= 1; if(bt_land_chain.pressed) { bt_city_chain.pressed = 0; } - fill_list( is_show_trans_name ); + fill_list(); } else if( comp == &cb_rotation) { change_item_info( scl.get_selection() ); @@ -307,6 +385,7 @@ void factory_edit_frame_t::change_item_info(sint32 entry) building_image.init(NULL, 0); fac_desc = NULL; welt->set_tool( tool_t::general_tool[TOOL_QUERY], player ); + buf.clear(); } info_text.recalc_size(); reset_min_windowsize(); diff --git a/gui/factory_edit.h b/gui/factory_edit.h index 868eb3b58..02a6bc57a 100644 --- a/gui/factory_edit.h +++ b/gui/factory_edit.h @@ -39,7 +39,7 @@ private: gui_numberinput_t inp_production; - void fill_list( bool translate ) OVERRIDE; + void fill_list() OVERRIDE; void change_item_info( sint32 i ) OVERRIDE; diff --git a/gui/groundobj_edit.cc b/gui/groundobj_edit.cc index 9ca4c35f5..061ce65cc 100644 --- a/gui/groundobj_edit.cc +++ b/gui/groundobj_edit.cc @@ -31,6 +31,7 @@ tool_plant_groundobj_t groundobj_edit_frame_t::groundobj_tool; cbuffer_t groundobj_edit_frame_t::param_str; + static bool compare_groundobj_desc(const groundobj_desc_t* a, const groundobj_desc_t* b) { int diff = strcmp( a->get_name(), b->get_name() ); @@ -58,41 +59,31 @@ groundobj_edit_frame_t::groundobj_edit_frame_t(player_t* player_) : extend_edit_gui_t(translator::translate("groundobj builder"), player_), groundobj_list(16) { -// cont_timeline.set_visible(false); - new_component_span( "Sort by", 2 ); - - cb_sortedby.new_component(translator::translate("Object"), SYSCOL_TEXT); - cb_sortedby.new_component(translator::translate("Translation"), SYSCOL_TEXT); - cb_sortedby.new_component(translator::translate("cost for removal"), SYSCOL_TEXT); - cb_sortedby.set_selection( 0 ); - cb_sortedby.add_listener(this); - add_component(&cb_sortedby); + cont_timeline.set_visible(false); + cb_sortedby.new_component(gui_sorting_item_t::BY_COST); desc = NULL; groundobj_tool.set_default_param(NULL); - fill_list( is_show_trans_name ); + fill_list(); - cont_right.add_component(&groundobj_image); + cont_scrolly.add_component(&groundobj_image); building_image.set_visible(false); } // fill the current groundobj_list -void groundobj_edit_frame_t::fill_list( bool translate ) +void groundobj_edit_frame_t::fill_list() { groundobj_list.clear(); - const uint8 sortedby = cb_rotation.get_selection(); + const uint8 sortedby = get_sortedby(); FOR(vector_tpl, const i, groundobj_t::get_all_desc()) { - switch(sortedby) { - case BY_TRANSLATION: - groundobj_list.insert_ordered( i, compare_groundobj_desc_name ); - break; - case BY_COST: - groundobj_list.insert_ordered( i, compare_groundobj_desc_cost ); - break; - default: - groundobj_list.insert_ordered( i, compare_groundobj_desc ); + if ( i && (i->get_allowed_climate_bits() & get_climate()) ) { + switch(sortedby) { + case gui_sorting_item_t::BY_NAME_TRANSLATED: groundobj_list.insert_ordered( i, compare_groundobj_desc_name ); break; + case gui_sorting_item_t::BY_COST: groundobj_list.insert_ordered( i, compare_groundobj_desc_cost ); break; + default: groundobj_list.insert_ordered( i, compare_groundobj_desc ); + } } } @@ -100,7 +91,7 @@ void groundobj_edit_frame_t::fill_list( bool translate ) scl.clear_elements(); scl.set_selection(-1); FOR(vector_tpl, const i, groundobj_list) { - char const* const name = translate ? translator::translate(i->get_name()): i->get_name(); + char const* const name = bt_translation.pressed ? i->get_name() : translator::translate(i->get_name()); scl.new_component(name, SYSCOL_TEXT); if (i == desc) { scl.set_selection(scl.get_count()-1); @@ -150,9 +141,9 @@ void groundobj_edit_frame_t::change_item_info(sint32 entry) if(desc->can_build_trees_here()){ buf.printf( "\n%s\n", translator::translate("Can be overgrown") ); } - buf.printf("\n%s ", translator::translate("cost for removal")); - buf.append_money( desc->get_price()/100.0 ); - buf.append("$\n"); + buf.printf("\n%s ", translator::translate("[go]price")); + buf.append_money( convert_money( desc->get_price() ) ); + buf.append("\n"); if (char const* const maker = desc->get_copyright()) { buf.append("\n"); diff --git a/gui/groundobj_edit.h b/gui/groundobj_edit.h index 948388eef..c29a382f4 100644 --- a/gui/groundobj_edit.h +++ b/gui/groundobj_edit.h @@ -20,19 +20,16 @@ class tool_plant_groundobj_t; class groundobj_edit_frame_t : public extend_edit_gui_t { private: - enum {BY_NAME, BY_TRANSLATION, BY_COST }; - static tool_plant_groundobj_t groundobj_tool; static cbuffer_t param_str; const groundobj_desc_t *desc; gui_image_t groundobj_image; - gui_combobox_t cb_sortedby; vector_tplgroundobj_list; - void fill_list( bool translate ) OVERRIDE; + void fill_list() OVERRIDE; void change_item_info( sint32 i ) OVERRIDE;