Merge lp:~widelands-dev/widelands/bug-1395278-editor into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 7900
Proposed branch: lp:~widelands-dev/widelands/bug-1395278-editor
Merge into: lp:widelands
Diff against target: 2595 lines (+528/-528)
42 files modified
src/editor/tools/editor_action_args.h (+10/-10)
src/editor/tools/editor_decrease_height_tool.cc (+4/-4)
src/editor/tools/editor_decrease_height_tool.h (+4/-4)
src/editor/tools/editor_decrease_resources_tool.cc (+6/-6)
src/editor/tools/editor_decrease_resources_tool.h (+7/-7)
src/editor/tools/editor_delete_bob_tool.cc (+3/-3)
src/editor/tools/editor_delete_immovable_tool.cc (+2/-2)
src/editor/tools/editor_history.cc (+40/-40)
src/editor/tools/editor_history.h (+8/-8)
src/editor/tools/editor_increase_height_tool.cc (+4/-4)
src/editor/tools/editor_increase_height_tool.h (+9/-9)
src/editor/tools/editor_increase_resources_tool.cc (+9/-9)
src/editor/tools/editor_increase_resources_tool.h (+14/-14)
src/editor/tools/editor_make_infrastructure_tool.cc (+1/-1)
src/editor/tools/editor_make_infrastructure_tool.h (+5/-5)
src/editor/tools/editor_noise_height_tool.cc (+6/-6)
src/editor/tools/editor_noise_height_tool.h (+7/-7)
src/editor/tools/editor_place_bob_tool.cc (+7/-7)
src/editor/tools/editor_place_immovable_tool.cc (+7/-7)
src/editor/tools/editor_set_height_tool.cc (+5/-5)
src/editor/tools/editor_set_height_tool.h (+4/-4)
src/editor/tools/editor_set_resources_tool.cc (+10/-10)
src/editor/tools/editor_set_resources_tool.h (+7/-7)
src/editor/tools/editor_set_starting_pos_tool.cc (+15/-15)
src/editor/tools/editor_set_starting_pos_tool.h (+3/-3)
src/editor/tools/editor_set_terrain_tool.cc (+7/-7)
src/editor/tools/editor_tool.h (+8/-8)
src/editor/tools/multi_select.h (+13/-13)
src/editor/ui_menus/editor_player_menu.cc (+50/-50)
src/editor/ui_menus/editor_player_menu.h (+11/-12)
src/editor/ui_menus/editor_tool_change_height_options_menu.cc (+54/-54)
src/editor/ui_menus/editor_tool_change_height_options_menu.h (+7/-7)
src/editor/ui_menus/editor_tool_change_resources_options_menu.cc (+63/-63)
src/editor/ui_menus/editor_tool_change_resources_options_menu.h (+9/-9)
src/editor/ui_menus/editor_tool_noise_height_options_menu.cc (+65/-65)
src/editor/ui_menus/editor_tool_noise_height_options_menu.h (+5/-5)
src/editor/ui_menus/editor_tool_options_menu.cc (+2/-2)
src/editor/ui_menus/editor_tool_options_menu.h (+2/-2)
src/editor/ui_menus/editor_tool_place_bob_options_menu.cc (+18/-18)
src/editor/ui_menus/editor_tool_place_bob_options_menu.h (+5/-4)
src/editor/ui_menus/editor_toolsize_menu.cc (+10/-10)
src/editor/ui_menus/editor_toolsize_menu.h (+2/-2)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1395278-editor
Reviewer Review Type Date Requested Status
Klaus Halfmann Approve
Review via email: mp+289494@code.launchpad.net

Commit message

Refactored member variable names in src/editor.

Description of the change

Almost there...

To post a comment you must log in.
Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Found only intended renamings or improvements,
Added some comments about minor things.

New for me are warnings like:
[ 44%] Building CXX object src/logic/CMakeFiles/logic.dir/map_objects/tribes/requirements.cc.o
.../bug-1395278-editor/src/logic/map_objects/tribes/requirements.cc:247:5: warning: format specifies type 'unsigned int' but the argument has underlying type 'uint8_t' (aka 'unsigned char') [-Wformat] TrainingAttribute::kHealth,

I think someone reenabled that clang warning.

Can be merged

review: Approve
Revision history for this message
GunChleoc (gunchleoc) wrote :

I think we should go through all the clang warnings on Travis sometime and fix.

Added replies to your comments.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Played this for a while now, found no anomalies.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 855. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/117018125.
Appveyor build 690. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1395278_editor-690.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks!

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/editor/tools/editor_action_args.h'
--- src/editor/tools/editor_action_args.h 2016-03-16 21:37:47 +0000
+++ src/editor/tools/editor_action_args.h 2016-03-18 12:52:47 +0000
@@ -48,9 +48,9 @@
4848
49 uint32_t sel_radius;49 uint32_t sel_radius;
5050
51 int32_t change_by; // resources, hight change tools51 int32_t change_by; // resources, change height tools
52 std::list<Widelands::Field::Height> origHights; // change hight tool52 std::list<Widelands::Field::Height> original_heights; // change height tool
53 uint8_t cur_res, set_to; // resources change tools53 uint8_t current_resource, set_to; // resources change tools
5454
55 struct ResourceState {55 struct ResourceState {
56 Widelands::FCoords location;56 Widelands::FCoords location;
@@ -58,14 +58,14 @@
58 uint8_t amount;58 uint8_t amount;
59 };59 };
6060
61 std::list<ResourceState> orgRes; // resources set tool61 std::list<ResourceState> original_resource; // resources set tool
62 std::list<const Widelands::BobDescr *> obob_type, nbob_type; // bob change tools62 std::list<const Widelands::BobDescr *> old_bob_type, new_bob_type; // bob change tools
63 std::list<std::string> oimmov_types; // immovable change tools63 std::list<std::string> old_immovable_types; // immovable change tools
64 std::list<int32_t> nimmov_types; // immovable change tools64 std::list<int32_t> new_immovable_types; // immovable change tools
65 Widelands::HeightInterval m_interval; // noise hight tool65 Widelands::HeightInterval interval; // noise height tool
66 std::list<Widelands::DescriptionIndex> terrainType, origTerrainType; // set terrain tool66 std::list<Widelands::DescriptionIndex> terrain_type, original_terrain_type; // set terrain tool
6767
68 std::list<EditorToolAction *> draw_actions; // draw tool68 std::list<EditorToolAction *> draw_actions; // draw tool
6969
70 uint32_t refcount;70 uint32_t refcount;
71};71};
7272
=== modified file 'src/editor/tools/editor_decrease_height_tool.cc'
--- src/editor/tools/editor_decrease_height_tool.cc 2016-01-04 20:50:19 +0000
+++ src/editor/tools/editor_decrease_height_tool.cc 2016-03-18 12:52:47 +0000
@@ -32,12 +32,12 @@
32 EditorInteractive& /* parent */,32 EditorInteractive& /* parent */,
33 EditorActionArgs* args,33 EditorActionArgs* args,
34 Widelands::Map* map) {34 Widelands::Map* map) {
35 if (args->origHights.empty()) {35 if (args->original_heights.empty()) {
36 Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr36 Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
37 (*map,37 (*map,
38 Widelands::Area<Widelands::FCoords>38 Widelands::Area<Widelands::FCoords>
39 (map->get_fcoords(center.node), args->sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 1));39 (map->get_fcoords(center.node), args->sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 1));
40 do args->origHights.push_back(mr.location().field->get_height());40 do args->original_heights.push_back(mr.location().field->get_height());
41 while (mr.advance(*map));41 while (mr.advance(*map));
42 }42 }
4343
@@ -58,7 +58,7 @@
58 (*map,58 (*map,
59 Widelands::Area<Widelands::FCoords>59 Widelands::Area<Widelands::FCoords>
60 (map->get_fcoords(center.node), args->sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 1));60 (map->get_fcoords(center.node), args->sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 1));
61 std::list<Widelands::Field::Height>::iterator i = args->origHights.begin();61 std::list<Widelands::Field::Height>::iterator i = args->original_heights.begin();
6262
63 do {63 do {
64 mr.location().field->set_height(*i); ++i;64 mr.location().field->set_height(*i); ++i;
@@ -75,6 +75,6 @@
75EditorActionArgs EditorDecreaseHeightTool::format_args_impl(EditorInteractive & parent)75EditorActionArgs EditorDecreaseHeightTool::format_args_impl(EditorInteractive & parent)
76{76{
77 EditorActionArgs a(parent);77 EditorActionArgs a(parent);
78 a.change_by = m_change_by;78 a.change_by = change_by_;
79 return a;79 return a;
80}80}
8181
=== modified file 'src/editor/tools/editor_decrease_height_tool.h'
--- src/editor/tools/editor_decrease_height_tool.h 2016-01-28 05:24:34 +0000
+++ src/editor/tools/editor_decrease_height_tool.h 2016-03-18 12:52:47 +0000
@@ -24,7 +24,7 @@
2424
25/// Decreases the height of a node by a value.25/// Decreases the height of a node by a value.
26struct EditorDecreaseHeightTool : public EditorTool {26struct EditorDecreaseHeightTool : public EditorTool {
27 EditorDecreaseHeightTool() : EditorTool(*this, *this), m_change_by(1) {}27 EditorDecreaseHeightTool() : EditorTool(*this, *this), change_by_(1) {}
2828
29 int32_t handle_click_impl29 int32_t handle_click_impl
30 (const Widelands::World& world,30 (const Widelands::World& world,
@@ -46,11 +46,11 @@
46 return "images/wui/editor//fsel_editor_decrease_height.png";46 return "images/wui/editor//fsel_editor_decrease_height.png";
47 }47 }
4848
49 int32_t get_change_by() const {return m_change_by;}49 int32_t get_change_by() const {return change_by_;}
50 void set_change_by(const int32_t n) {m_change_by = n;}50 void set_change_by(const int32_t n) {change_by_ = n;}
5151
52private:52private:
53 int32_t m_change_by;53 int32_t change_by_;
54};54};
5555
56#endif // end of include guard: WL_EDITOR_TOOLS_EDITOR_DECREASE_HEIGHT_TOOL_H56#endif // end of include guard: WL_EDITOR_TOOLS_EDITOR_DECREASE_HEIGHT_TOOL_H
5757
=== modified file 'src/editor/tools/editor_decrease_resources_tool.cc'
--- src/editor/tools/editor_decrease_resources_tool.cc 2016-03-17 12:14:57 +0000
+++ src/editor/tools/editor_decrease_resources_tool.cc 2016-03-18 12:52:47 +0000
@@ -50,17 +50,17 @@
50 if (amount < 0)50 if (amount < 0)
51 amount = 0;51 amount = 0;
5252
53 if (mr.location().field->get_resources() == args->cur_res &&53 if (mr.location().field->get_resources() == args->current_resource &&
54 map->is_resource_valid(world, mr.location(), args->cur_res) &&54 map->is_resource_valid(world, mr.location(), args->current_resource) &&
55 mr.location().field->get_resources_amount() != 0) {55 mr.location().field->get_resources_amount() != 0) {
5656
57 args->orgRes.push_back(EditorActionArgs::ResourceState{57 args->original_resource.push_back(EditorActionArgs::ResourceState{
58 mr.location(),58 mr.location(),
59 mr.location().field->get_resources(),59 mr.location().field->get_resources(),
60 mr.location().field->get_resources_amount()60 mr.location().field->get_resources_amount()
61 });61 });
6262
63 map->initialize_resources(mr.location(), args->cur_res, amount);63 map->initialize_resources(mr.location(), args->current_resource, amount);
64 }64 }
6565
66 } while (mr.advance(*map));66 } while (mr.advance(*map));
@@ -78,7 +78,7 @@
78EditorActionArgs EditorDecreaseResourcesTool::format_args_impl(EditorInteractive & parent)78EditorActionArgs EditorDecreaseResourcesTool::format_args_impl(EditorInteractive & parent)
79{79{
80 EditorActionArgs a(parent);80 EditorActionArgs a(parent);
81 a.change_by = m_change_by;81 a.change_by = change_by_;
82 a.cur_res = m_cur_res;82 a.current_resource = cur_res_;
83 return a;83 return a;
84}84}
8585
=== modified file 'src/editor/tools/editor_decrease_resources_tool.h'
--- src/editor/tools/editor_decrease_resources_tool.h 2016-01-28 05:24:34 +0000
+++ src/editor/tools/editor_decrease_resources_tool.h 2016-03-18 12:52:47 +0000
@@ -25,7 +25,7 @@
25/// Decreases the resources of a node by a value.25/// Decreases the resources of a node by a value.
26struct EditorDecreaseResourcesTool : public EditorTool {26struct EditorDecreaseResourcesTool : public EditorTool {
27 EditorDecreaseResourcesTool()27 EditorDecreaseResourcesTool()
28 : EditorTool(*this, *this), m_cur_res(0), m_change_by(1)28 : EditorTool(*this, *this), cur_res_(0), change_by_(1)
29 {}29 {}
3030
31 int32_t handle_click_impl(const Widelands::World& world,31 int32_t handle_click_impl(const Widelands::World& world,
@@ -46,16 +46,16 @@
46 return "images/wui/editor/fsel_editor_decrease_resources.png";46 return "images/wui/editor/fsel_editor_decrease_resources.png";
47 }47 }
4848
49 int32_t get_change_by() const {return m_change_by;}49 int32_t get_change_by() const {return change_by_;}
50 void set_change_by(const int32_t n) {m_change_by = n;}50 void set_change_by(const int32_t n) {change_by_ = n;}
51 Widelands::DescriptionIndex get_cur_res() const {return m_cur_res;}51 Widelands::DescriptionIndex get_cur_res() const {return cur_res_;}
52 void set_cur_res(Widelands::DescriptionIndex const res) {52 void set_cur_res(Widelands::DescriptionIndex const res) {
53 m_cur_res = res;53 cur_res_ = res;
54 }54 }
5555
56private:56private:
57 Widelands::DescriptionIndex m_cur_res;57 Widelands::DescriptionIndex cur_res_;
58 int32_t m_change_by;58 int32_t change_by_;
59};59};
6060
61#endif // end of include guard: WL_EDITOR_TOOLS_EDITOR_DECREASE_RESOURCES_TOOL_H61#endif // end of include guard: WL_EDITOR_TOOLS_EDITOR_DECREASE_RESOURCES_TOOL_H
6262
=== modified file 'src/editor/tools/editor_delete_bob_tool.cc'
--- src/editor/tools/editor_delete_bob_tool.cc 2016-01-16 12:55:14 +0000
+++ src/editor/tools/editor_delete_bob_tool.cc 2016-03-18 12:52:47 +0000
@@ -41,10 +41,10 @@
41 (map->get_fcoords(center.node), radius));41 (map->get_fcoords(center.node), radius));
4242
43 do if (Widelands::Bob * const bob = mr.location().field->get_first_bob()) {43 do if (Widelands::Bob * const bob = mr.location().field->get_first_bob()) {
44 args->obob_type.push_back(&bob->descr());44 args->old_bob_type.push_back(&bob->descr());
45 bob->remove(egbase);45 bob->remove(egbase);
46 } else {46 } else {
47 args->obob_type.push_back(nullptr);47 args->old_bob_type.push_back(nullptr);
48 }48 }
49 while (mr.advance(*map));49 while (mr.advance(*map));
50 return radius + 2;50 return radius + 2;
@@ -58,7 +58,7 @@
58 Widelands::Map* map) {58 Widelands::Map* map) {
5959
60 uint32_t ret = parent.tools()->place_bob.handle_undo_impl(world, center, parent, args, map);60 uint32_t ret = parent.tools()->place_bob.handle_undo_impl(world, center, parent, args, map);
61 args->obob_type.clear();61 args->old_bob_type.clear();
62 return ret;62 return ret;
63}63}
6464
6565
=== modified file 'src/editor/tools/editor_delete_immovable_tool.cc'
--- src/editor/tools/editor_delete_immovable_tool.cc 2016-01-16 12:55:14 +0000
+++ src/editor/tools/editor_delete_immovable_tool.cc 2016-03-18 12:52:47 +0000
@@ -44,10 +44,10 @@
44 immovable,44 immovable,
45 mr.location().field->get_immovable()))45 mr.location().field->get_immovable()))
46 {46 {
47 args->oimmov_types.push_back(immovable->descr().name());47 args->old_immovable_types.push_back(immovable->descr().name());
48 immovable->remove(egbase); // Delete no buildings or stuff.48 immovable->remove(egbase); // Delete no buildings or stuff.
49 } else {49 } else {
50 args->oimmov_types.push_back("");50 args->old_immovable_types.push_back("");
51 }51 }
52 while (mr.advance(*map));52 while (mr.advance(*map));
53 return mr.radius() + 2;53 return mr.radius() + 2;
5454
=== modified file 'src/editor/tools/editor_history.cc'
--- src/editor/tools/editor_history.cc 2016-03-16 21:37:47 +0000
+++ src/editor/tools/editor_history.cc 2016-03-18 12:52:47 +0000
@@ -30,9 +30,9 @@
30EditorActionArgs::EditorActionArgs(EditorInteractive & base):30EditorActionArgs::EditorActionArgs(EditorInteractive & base):
31 sel_radius(base.get_sel_radius()),31 sel_radius(base.get_sel_radius()),
32 change_by(0),32 change_by(0),
33 cur_res(0),33 current_resource(0),
34 set_to(0),34 set_to(0),
35 m_interval(0, 0),35 interval(0, 0),
36 refcount(0)36 refcount(0)
37{}37{}
3838
@@ -42,28 +42,28 @@
42 delete draw_actions.back();42 delete draw_actions.back();
43 draw_actions.pop_back();43 draw_actions.pop_back();
44 }44 }
45 nbob_type.clear();45 new_bob_type.clear();
46 obob_type.clear();46 old_bob_type.clear();
47 nimmov_types.clear();47 new_immovable_types.clear();
48 oimmov_types.clear();48 old_immovable_types.clear();
49 orgRes.clear();49 original_resource.clear();
50 origHights.clear();50 original_heights.clear();
51 origTerrainType.clear();51 original_terrain_type.clear();
52 terrainType.clear();52 terrain_type.clear();
53}53}
5454
55// === EditorHistory === //55// === EditorHistory === //
5656
57uint32_t EditorHistory::undo_action(const Widelands::World& world) {57uint32_t EditorHistory::undo_action(const Widelands::World& world) {
58 if (undo_stack.empty())58 if (undo_stack_.empty())
59 return 0;59 return 0;
6060
61 EditorToolAction uac = undo_stack.front();61 EditorToolAction uac = undo_stack_.front();
62 undo_stack.pop_front();62 undo_stack_.pop_front();
63 redo_stack.push_front(uac);63 redo_stack_.push_front(uac);
6464
65 m_undo_button.set_enabled(!undo_stack.empty());65 undo_button_.set_enabled(!undo_stack_.empty());
66 m_redo_button.set_enabled(true);66 redo_button_.set_enabled(true);
6767
68 return uac.tool.handle_undo(static_cast<EditorTool::ToolIndex>(uac.i),68 return uac.tool.handle_undo(static_cast<EditorTool::ToolIndex>(uac.i),
69 world,69 world,
@@ -74,15 +74,15 @@
74}74}
7575
76uint32_t EditorHistory::redo_action(const Widelands::World& world) {76uint32_t EditorHistory::redo_action(const Widelands::World& world) {
77 if (redo_stack.empty())77 if (redo_stack_.empty())
78 return 0;78 return 0;
7979
80 EditorToolAction rac = redo_stack.front();80 EditorToolAction rac = redo_stack_.front();
81 redo_stack.pop_front();81 redo_stack_.pop_front();
82 undo_stack.push_front(rac);82 undo_stack_.push_front(rac);
8383
84 m_undo_button.set_enabled(true);84 undo_button_.set_enabled(true);
85 m_redo_button.set_enabled(!redo_stack.empty());85 redo_button_.set_enabled(!redo_stack_.empty());
8686
87 return rac.tool.handle_click(static_cast<EditorTool::ToolIndex>(rac.i),87 return rac.tool.handle_click(static_cast<EditorTool::ToolIndex>(rac.i),
88 world,88 world,
@@ -102,33 +102,33 @@
102 EditorToolAction ac102 EditorToolAction ac
103 (tool, static_cast<uint32_t>(ind),103 (tool, static_cast<uint32_t>(ind),
104 map, center, parent, tool.format_args(ind, parent));104 map, center, parent, tool.format_args(ind, parent));
105 if (draw && tool.is_unduable()) {105 if (draw && tool.is_undoable()) {
106 if106 if
107 (undo_stack.empty() ||107 (undo_stack_.empty() ||
108 undo_stack.front().tool.get_sel_impl() != std::string(m_draw_tool.get_sel_impl()))108 undo_stack_.front().tool.get_sel_impl() != std::string(draw_tool_.get_sel_impl()))
109 {109 {
110 EditorToolAction da110 EditorToolAction da
111 (m_draw_tool, EditorTool::First,111 (draw_tool_, EditorTool::First,
112 map, center, parent,112 map, center, parent,
113 m_draw_tool.format_args(EditorTool::First, parent));113 draw_tool_.format_args(EditorTool::First, parent));
114114
115 if (!undo_stack.empty()) {115 if (!undo_stack_.empty()) {
116 m_draw_tool.add_action(undo_stack.front(), *da.args);116 draw_tool_.add_action(undo_stack_.front(), *da.args);
117 undo_stack.pop_front();117 undo_stack_.pop_front();
118 }118 }
119119
120 redo_stack.clear();120 redo_stack_.clear();
121 undo_stack.push_front(da);121 undo_stack_.push_front(da);
122 m_undo_button.set_enabled(true);122 undo_button_.set_enabled(true);
123 m_redo_button.set_enabled(false);123 redo_button_.set_enabled(false);
124 }124 }
125 dynamic_cast<EditorDrawTool *>125 dynamic_cast<EditorDrawTool *>
126 (&(undo_stack.front().tool))->add_action(ac, *undo_stack.front().args);126 (&(undo_stack_.front().tool))->add_action(ac, *undo_stack_.front().args);
127 } else if (tool.is_unduable()) {127 } else if (tool.is_undoable()) {
128 redo_stack.clear();128 redo_stack_.clear();
129 undo_stack.push_front(ac);129 undo_stack_.push_front(ac);
130 m_undo_button.set_enabled(true);130 undo_button_.set_enabled(true);
131 m_redo_button.set_enabled(false);131 redo_button_.set_enabled(false);
132 }132 }
133 return tool.handle_click(ind, world, center, parent, ac.args, &map);133 return tool.handle_click(ind, world, center, parent, ac.args, &map);
134}134}
135135
=== modified file 'src/editor/tools/editor_history.h'
--- src/editor/tools/editor_history.h 2016-01-16 12:55:14 +0000
+++ src/editor/tools/editor_history.h 2016-03-18 12:52:47 +0000
@@ -35,7 +35,7 @@
35 */35 */
36struct EditorHistory {36struct EditorHistory {
37 EditorHistory(UI::Button & undo, UI::Button & redo):37 EditorHistory(UI::Button & undo, UI::Button & redo):
38 m_undo_button(undo), m_redo_button(redo) {}38 undo_button_(undo), redo_button_(redo) {}
3939
40 uint32_t do_action(EditorTool& tool,40 uint32_t do_action(EditorTool& tool,
41 EditorTool::ToolIndex ind,41 EditorTool::ToolIndex ind,
@@ -48,13 +48,13 @@
48 uint32_t redo_action(const Widelands::World& world);48 uint32_t redo_action(const Widelands::World& world);
4949
50private:50private:
51 UI::Button & m_undo_button;51 UI::Button & undo_button_;
52 UI::Button & m_redo_button;52 UI::Button & redo_button_;
5353
54 EditorDrawTool m_draw_tool;54 EditorDrawTool draw_tool_;
5555
56 std::deque<EditorToolAction> undo_stack;56 std::deque<EditorToolAction> undo_stack_;
57 std::deque<EditorToolAction> redo_stack;57 std::deque<EditorToolAction> redo_stack_;
58};58};
5959
6060
6161
=== modified file 'src/editor/tools/editor_increase_height_tool.cc'
--- src/editor/tools/editor_increase_height_tool.cc 2016-01-04 20:50:19 +0000
+++ src/editor/tools/editor_increase_height_tool.cc 2016-03-18 12:52:47 +0000
@@ -30,14 +30,14 @@
30 EditorInteractive& /* parent */,30 EditorInteractive& /* parent */,
31 EditorActionArgs* args,31 EditorActionArgs* args,
32 Widelands::Map* map) {32 Widelands::Map* map) {
33 if (args->origHights.empty()) {33 if (args->original_heights.empty()) {
34 Widelands::MapRegion<Widelands::Area<Widelands::FCoords>> mr(34 Widelands::MapRegion<Widelands::Area<Widelands::FCoords>> mr(
35 *map,35 *map,
36 Widelands::Area<Widelands::FCoords>(36 Widelands::Area<Widelands::FCoords>(
37 map->get_fcoords(center.node),37 map->get_fcoords(center.node),
38 args->sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 1));38 args->sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 1));
39 do {39 do {
40 args->origHights.push_back(mr.location().field->get_height());40 args->original_heights.push_back(mr.location().field->get_height());
41 } while (mr.advance(*map));41 } while (mr.advance(*map));
42 }42 }
4343
@@ -52,12 +52,12 @@
52 EditorInteractive& parent,52 EditorInteractive& parent,
53 EditorActionArgs* args,53 EditorActionArgs* args,
54 Widelands::Map* map) {54 Widelands::Map* map) {
55 return m_decrease_tool.handle_undo_impl(world, center, parent, args, map);55 return decrease_tool_.handle_undo_impl(world, center, parent, args, map);
56}56}
5757
58EditorActionArgs EditorIncreaseHeightTool::format_args_impl(EditorInteractive & parent)58EditorActionArgs EditorIncreaseHeightTool::format_args_impl(EditorInteractive & parent)
59{59{
60 EditorActionArgs a(parent);60 EditorActionArgs a(parent);
61 a.change_by = m_change_by;61 a.change_by = change_by_;
62 return a;62 return a;
63}63}
6464
=== modified file 'src/editor/tools/editor_increase_height_tool.h'
--- src/editor/tools/editor_increase_height_tool.h 2016-01-28 05:24:34 +0000
+++ src/editor/tools/editor_increase_height_tool.h 2016-03-18 12:52:47 +0000
@@ -30,8 +30,8 @@
30 EditorSetHeightTool & the_set_tool)30 EditorSetHeightTool & the_set_tool)
31 :31 :
32 EditorTool(the_decrease_tool, the_set_tool),32 EditorTool(the_decrease_tool, the_set_tool),
33 m_decrease_tool(the_decrease_tool), m_set_tool(the_set_tool),33 decrease_tool_(the_decrease_tool), set_tool_(the_set_tool),
34 m_change_by(1)34 change_by_(1)
35 {}35 {}
3636
37 int32_t handle_click_impl(const Widelands::World& world,37 int32_t handle_click_impl(const Widelands::World& world,
@@ -52,18 +52,18 @@
52 return "images/wui/editor/fsel_editor_increase_height.png";52 return "images/wui/editor/fsel_editor_increase_height.png";
53 }53 }
5454
55 int32_t get_change_by() const {return m_change_by;}55 int32_t get_change_by() const {return change_by_;}
56 void set_change_by(const int32_t n) {m_change_by = n;}56 void set_change_by(const int32_t n) {change_by_ = n;}
5757
58 EditorDecreaseHeightTool & decrease_tool() const {58 EditorDecreaseHeightTool & decrease_tool() const {
59 return m_decrease_tool;59 return decrease_tool_;
60 }60 }
61 EditorSetHeightTool & set_tool() const {return m_set_tool;}61 EditorSetHeightTool & set_tool() const {return set_tool_;}
6262
63private:63private:
64 EditorDecreaseHeightTool & m_decrease_tool;64 EditorDecreaseHeightTool& decrease_tool_;
65 EditorSetHeightTool & m_set_tool;65 EditorSetHeightTool& set_tool_;
66 int32_t m_change_by;66 int32_t change_by_;
67};67};
6868
69#endif // end of include guard: WL_EDITOR_TOOLS_EDITOR_INCREASE_HEIGHT_TOOL_H69#endif // end of include guard: WL_EDITOR_TOOLS_EDITOR_INCREASE_HEIGHT_TOOL_H
7070
=== modified file 'src/editor/tools/editor_increase_resources_tool.cc'
--- src/editor/tools/editor_increase_resources_tool.cc 2016-03-17 12:14:57 +0000
+++ src/editor/tools/editor_increase_resources_tool.cc 2016-03-18 12:52:47 +0000
@@ -40,25 +40,25 @@
40 (map->get_fcoords(center.node), args->sel_radius));40 (map->get_fcoords(center.node), args->sel_radius));
41 do {41 do {
42 int32_t amount = mr.location().field->get_resources_amount();42 int32_t amount = mr.location().field->get_resources_amount();
43 int32_t max_amount = args->cur_res != Widelands::kNoResource ?43 int32_t max_amount = args->current_resource != Widelands::kNoResource ?
44 world.get_resource(args->cur_res)->max_amount() : 0;44 world.get_resource(args->current_resource)->max_amount() : 0;
4545
46 amount += args->change_by;46 amount += args->change_by;
47 if (amount > max_amount)47 if (amount > max_amount)
48 amount = max_amount;48 amount = max_amount;
4949
50 if ((mr.location().field->get_resources() == args->cur_res ||50 if ((mr.location().field->get_resources() == args->current_resource ||
51 !mr.location().field->get_resources_amount()) &&51 !mr.location().field->get_resources_amount()) &&
52 map->is_resource_valid(world, mr.location(), args->cur_res) &&52 map->is_resource_valid(world, mr.location(), args->current_resource) &&
53 mr.location().field->get_resources_amount() != max_amount) {53 mr.location().field->get_resources_amount() != max_amount) {
5454
55 args->orgRes.push_back(EditorActionArgs::ResourceState{55 args->original_resource.push_back(EditorActionArgs::ResourceState{
56 mr.location(),56 mr.location(),
57 mr.location().field->get_resources(),57 mr.location().field->get_resources(),
58 mr.location().field->get_resources_amount()58 mr.location().field->get_resources_amount()
59 });59 });
6060
61 map->initialize_resources(mr.location(), args->cur_res, amount);61 map->initialize_resources(mr.location(), args->current_resource, amount);
62 }62 }
63 } while (mr.advance(*map));63 } while (mr.advance(*map));
64 return mr.radius();64 return mr.radius();
@@ -69,13 +69,13 @@
69 EditorInteractive& parent,69 EditorInteractive& parent,
70 EditorActionArgs* args,70 EditorActionArgs* args,
71 Widelands::Map* map) {71 Widelands::Map* map) {
72 return m_set_tool.handle_undo_impl(world, center, parent, args, map);72 return set_tool_.handle_undo_impl(world, center, parent, args, map);
73}73}
7474
75EditorActionArgs EditorIncreaseResourcesTool::format_args_impl(EditorInteractive & parent)75EditorActionArgs EditorIncreaseResourcesTool::format_args_impl(EditorInteractive & parent)
76{76{
77 EditorActionArgs a(parent);77 EditorActionArgs a(parent);
78 a.change_by = m_change_by;78 a.change_by = change_by_;
79 a.cur_res = m_cur_res;79 a.current_resource = cur_res_;
80 return a;80 return a;
81}81}
8282
=== modified file 'src/editor/tools/editor_increase_resources_tool.h'
--- src/editor/tools/editor_increase_resources_tool.h 2016-01-28 05:24:34 +0000
+++ src/editor/tools/editor_increase_resources_tool.h 2016-03-18 12:52:47 +0000
@@ -29,10 +29,10 @@
29 EditorIncreaseResourcesTool(EditorDecreaseResourcesTool& the_decrease_tool,29 EditorIncreaseResourcesTool(EditorDecreaseResourcesTool& the_decrease_tool,
30 EditorSetResourcesTool& the_set_to_tool)30 EditorSetResourcesTool& the_set_to_tool)
31 : EditorTool(the_decrease_tool, the_set_to_tool),31 : EditorTool(the_decrease_tool, the_set_to_tool),
32 m_decrease_tool(the_decrease_tool),32 decrease_tool_(the_decrease_tool),
33 m_set_tool(the_set_to_tool),33 set_tool_(the_set_to_tool),
34 m_change_by(1),34 change_by_(1),
35 m_cur_res(0) {35 cur_res_(0) {
36 }36 }
3737
38 /***38 /***
@@ -57,23 +57,23 @@
57 return "images/wui/editor/fsel_editor_increase_resources.png";57 return "images/wui/editor/fsel_editor_increase_resources.png";
58 }58 }
5959
60 int32_t get_change_by() const {return m_change_by;}60 int32_t get_change_by() const {return change_by_;}
61 void set_change_by(const int32_t n) {m_change_by = n;}61 void set_change_by(const int32_t n) {change_by_ = n;}
62 Widelands::DescriptionIndex get_cur_res() const {return m_cur_res;}62 Widelands::DescriptionIndex get_cur_res() const {return cur_res_;}
63 void set_cur_res(Widelands::DescriptionIndex const res) {63 void set_cur_res(Widelands::DescriptionIndex const res) {
64 m_cur_res = res;64 cur_res_ = res;
65 }65 }
6666
67 EditorDecreaseResourcesTool & decrease_tool() const {67 EditorDecreaseResourcesTool & decrease_tool() const {
68 return m_decrease_tool;68 return decrease_tool_;
69 }69 }
70 EditorSetResourcesTool & set_tool() const {return m_set_tool;}70 EditorSetResourcesTool & set_tool() const {return set_tool_;}
7171
72private:72private:
73 EditorDecreaseResourcesTool & m_decrease_tool;73 EditorDecreaseResourcesTool& decrease_tool_;
74 EditorSetResourcesTool& m_set_tool;74 EditorSetResourcesTool& set_tool_;
75 int32_t m_change_by;75 int32_t change_by_;
76 Widelands::DescriptionIndex m_cur_res;76 Widelands::DescriptionIndex cur_res_;
77};77};
7878
7979
8080
=== modified file 'src/editor/tools/editor_make_infrastructure_tool.cc'
--- src/editor/tools/editor_make_infrastructure_tool.cc 2016-01-04 20:50:19 +0000
+++ src/editor/tools/editor_make_infrastructure_tool.cc 2016-03-18 12:52:47 +0000
@@ -52,7 +52,7 @@
52 EditorActionArgs* /* args */,52 EditorActionArgs* /* args */,
53 Widelands::Map*) {53 Widelands::Map*) {
54 show_field_action54 show_field_action
55 (&parent, parent.egbase().get_player(m_player), &m_registry);55 (&parent, parent.egbase().get_player(player_), &registry_);
5656
57 // Not really needed, since Player Immovables are taken care of while57 // Not really needed, since Player Immovables are taken care of while
58 // placing on map.58 // placing on map.
5959
=== modified file 'src/editor/tools/editor_make_infrastructure_tool.h'
--- src/editor/tools/editor_make_infrastructure_tool.h 2016-01-28 05:24:34 +0000
+++ src/editor/tools/editor_make_infrastructure_tool.h 2016-03-18 12:52:47 +0000
@@ -32,12 +32,12 @@
32 */32 */
33// TODO(unknown): Implement undo for this tool33// TODO(unknown): Implement undo for this tool
34struct EditorMakeInfrastructureTool : public EditorTool {34struct EditorMakeInfrastructureTool : public EditorTool {
35 EditorMakeInfrastructureTool() : EditorTool(*this, *this, false), m_player(0) {}35 EditorMakeInfrastructureTool() : EditorTool(*this, *this, false), player_(0) {}
3636
37 void set_player(Widelands::PlayerNumber const n)37 void set_player(Widelands::PlayerNumber const n)
38 {m_player = n;}38 {player_ = n;}
39 Widelands::PlayerNumber get_player() const39 Widelands::PlayerNumber get_player() const
40 {return m_player;}40 {return player_;}
4141
42 int32_t handle_click_impl(const Widelands::World& world,42 int32_t handle_click_impl(const Widelands::World& world,
43 Widelands::NodeAndTriangle<> center,43 Widelands::NodeAndTriangle<> center,
@@ -49,8 +49,8 @@
49 {return "images/ui_basic/fsel.png";} // Standard sel icon, most complex tool of all49 {return "images/ui_basic/fsel.png";} // Standard sel icon, most complex tool of all
5050
51private:51private:
52 Widelands::PlayerNumber m_player;52 Widelands::PlayerNumber player_;
53 UI::UniqueWindow::Registry m_registry;53 UI::UniqueWindow::Registry registry_;
54};54};
5555
56int32_t editor_make_infrastructure_tool_callback56int32_t editor_make_infrastructure_tool_callback
5757
=== modified file 'src/editor/tools/editor_noise_height_tool.cc'
--- src/editor/tools/editor_noise_height_tool.cc 2016-01-04 20:50:19 +0000
+++ src/editor/tools/editor_noise_height_tool.cc 2016-03-18 12:52:47 +0000
@@ -32,13 +32,13 @@
32 EditorInteractive& /* parent */,32 EditorInteractive& /* parent */,
33 EditorActionArgs* args,33 EditorActionArgs* args,
34 Widelands::Map* map) {34 Widelands::Map* map) {
35 if (args->origHights.empty()) {35 if (args->original_heights.empty()) {
36 Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr36 Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
37 (*map,37 (*map,
38 Widelands::Area<Widelands::FCoords>38 Widelands::Area<Widelands::FCoords>
39 (map->get_fcoords(center.node),39 (map->get_fcoords(center.node),
40 args->sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 1));40 args->sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 1));
41 do args->origHights.push_back(mr.location().field->get_height());41 do args->original_heights.push_back(mr.location().field->get_height());
42 while (mr.advance(*map));42 while (mr.advance(*map));
43 }43 }
4444
@@ -53,9 +53,9 @@
53 max,53 max,
54 map->set_height(world,54 map->set_height(world,
55 mr.location(),55 mr.location(),
56 args->m_interval.min +56 args->interval.min +
57 static_cast<int32_t>(57 static_cast<int32_t>(
58 static_cast<double>(args->m_interval.max - args->m_interval.min + 1) *58 static_cast<double>(args->interval.max - args->interval.min + 1) *
59 rand() / (RAND_MAX + 1.0))));59 rand() / (RAND_MAX + 1.0))));
60 } while (mr.advance(*map));60 } while (mr.advance(*map));
61 return mr.radius() + max;61 return mr.radius() + max;
@@ -67,12 +67,12 @@
67 EditorInteractive& parent,67 EditorInteractive& parent,
68 EditorActionArgs* args,68 EditorActionArgs* args,
69 Widelands::Map* map) {69 Widelands::Map* map) {
70 return m_set_tool.handle_undo_impl(world, center, parent, args, map);70 return set_tool_.handle_undo_impl(world, center, parent, args, map);
71}71}
7272
73EditorActionArgs EditorNoiseHeightTool::format_args_impl(EditorInteractive & parent)73EditorActionArgs EditorNoiseHeightTool::format_args_impl(EditorInteractive & parent)
74{74{
75 EditorActionArgs a(parent);75 EditorActionArgs a(parent);
76 a.m_interval = m_interval;76 a.interval = interval_;
77 return a;77 return a;
78}78}
7979
=== modified file 'src/editor/tools/editor_noise_height_tool.h'
--- src/editor/tools/editor_noise_height_tool.h 2016-01-28 05:24:34 +0000
+++ src/editor/tools/editor_noise_height_tool.h 2016-03-18 12:52:47 +0000
@@ -30,8 +30,8 @@
30 Widelands::HeightInterval(10, 14))30 Widelands::HeightInterval(10, 14))
31 :31 :
32 EditorTool(the_set_tool, the_set_tool),32 EditorTool(the_set_tool, the_set_tool),
33 m_set_tool(the_set_tool),33 set_tool_(the_set_tool),
34 m_interval(the_interval)34 interval_(the_interval)
35 {}35 {}
3636
37 int32_t handle_click_impl(const Widelands::World& world,37 int32_t handle_click_impl(const Widelands::World& world,
@@ -53,17 +53,17 @@
53 }53 }
5454
55 Widelands::HeightInterval get_interval() const {55 Widelands::HeightInterval get_interval() const {
56 return m_interval;56 return interval_;
57 }57 }
58 void set_interval(Widelands::HeightInterval const i) {58 void set_interval(Widelands::HeightInterval const i) {
59 m_interval = i;59 interval_ = i;
60 }60 }
6161
62 EditorSetHeightTool & set_tool() const {return m_set_tool;}62 EditorSetHeightTool & set_tool() const {return set_tool_;}
6363
64private:64private:
65 EditorSetHeightTool & m_set_tool;65 EditorSetHeightTool & set_tool_;
66 Widelands::HeightInterval m_interval;66 Widelands::HeightInterval interval_;
67};67};
6868
69#endif // end of include guard: WL_EDITOR_TOOLS_EDITOR_NOISE_HEIGHT_TOOL_H69#endif // end of include guard: WL_EDITOR_TOOLS_EDITOR_NOISE_HEIGHT_TOOL_H
7070
=== modified file 'src/editor/tools/editor_place_bob_tool.cc'
--- src/editor/tools/editor_place_bob_tool.cc 2016-01-06 19:11:20 +0000
+++ src/editor/tools/editor_place_bob_tool.cc 2016-03-18 12:52:47 +0000
@@ -36,25 +36,25 @@
36 EditorActionArgs* args,36 EditorActionArgs* args,
37 Widelands::Map* map) {37 Widelands::Map* map) {
3838
39 if (get_nr_enabled() && args->obob_type.empty()) {39 if (get_nr_enabled() && args->old_bob_type.empty()) {
40 Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr40 Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
41 (*map,41 (*map,
42 Widelands::Area<Widelands::FCoords>42 Widelands::Area<Widelands::FCoords>
43 (map->get_fcoords(center.node), args->sel_radius));43 (map->get_fcoords(center.node), args->sel_radius));
44 do {44 do {
45 Widelands::Bob * const mbob = mr.location().field->get_first_bob();45 Widelands::Bob * const mbob = mr.location().field->get_first_bob();
46 args->obob_type.push_back((mbob ? &mbob->descr() : nullptr));46 args->old_bob_type.push_back((mbob ? &mbob->descr() : nullptr));
47 args->nbob_type.push_back(world.get_bob_descr(get_random_enabled()));47 args->new_bob_type.push_back(world.get_bob_descr(get_random_enabled()));
48 } while (mr.advance(*map));48 } while (mr.advance(*map));
49 }49 }
5050
51 if (!args->nbob_type.empty()) {51 if (!args->new_bob_type.empty()) {
52 Widelands::EditorGameBase & egbase = parent.egbase();52 Widelands::EditorGameBase & egbase = parent.egbase();
53 Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr53 Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
54 (*map,54 (*map,
55 Widelands::Area<Widelands::FCoords>55 Widelands::Area<Widelands::FCoords>
56 (map->get_fcoords(center.node), args->sel_radius));56 (map->get_fcoords(center.node), args->sel_radius));
57 std::list< const Widelands::BobDescr * >::iterator i = args->nbob_type.begin();57 std::list< const Widelands::BobDescr * >::iterator i = args->new_bob_type.begin();
58 do {58 do {
59 const Widelands::BobDescr & descr = *(*i);59 const Widelands::BobDescr & descr = *(*i);
60 if (mr.location().field->nodecaps() & descr.movecaps()) {60 if (mr.location().field->nodecaps() & descr.movecaps()) {
@@ -75,13 +75,13 @@
75 EditorInteractive& parent,75 EditorInteractive& parent,
76 EditorActionArgs* args,76 EditorActionArgs* args,
77 Widelands::Map* map) {77 Widelands::Map* map) {
78 if (!args->nbob_type.empty()) {78 if (!args->new_bob_type.empty()) {
79 Widelands::EditorGameBase & egbase = parent.egbase();79 Widelands::EditorGameBase & egbase = parent.egbase();
80 Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr80 Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
81 (*map,81 (*map,
82 Widelands::Area<Widelands::FCoords>82 Widelands::Area<Widelands::FCoords>
83 (map->get_fcoords(center.node), args->sel_radius));83 (map->get_fcoords(center.node), args->sel_radius));
84 std::list<const Widelands::BobDescr *>::iterator i = args->obob_type.begin();84 std::list<const Widelands::BobDescr *>::iterator i = args->old_bob_type.begin();
85 do {85 do {
86 if (*i) {86 if (*i) {
87 const Widelands::BobDescr & descr = *(*i);87 const Widelands::BobDescr & descr = *(*i);
8888
=== modified file 'src/editor/tools/editor_place_immovable_tool.cc'
--- src/editor/tools/editor_place_immovable_tool.cc 2016-01-06 19:11:20 +0000
+++ src/editor/tools/editor_place_immovable_tool.cc 2016-03-18 12:52:47 +0000
@@ -41,7 +41,7 @@
41 if (!get_nr_enabled())41 if (!get_nr_enabled())
42 return radius;42 return radius;
43 Widelands::EditorGameBase & egbase = parent.egbase();43 Widelands::EditorGameBase & egbase = parent.egbase();
44 if (args->oimmov_types.empty())44 if (args->old_immovable_types.empty())
45 {45 {
46 Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr46 Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
47 (*map,47 (*map,
@@ -49,18 +49,18 @@
49 (map->get_fcoords(center.node), radius));49 (map->get_fcoords(center.node), radius));
50 do {50 do {
51 const Widelands::BaseImmovable * im = mr.location().field->get_immovable();51 const Widelands::BaseImmovable * im = mr.location().field->get_immovable();
52 args->oimmov_types.push_back((im ? im->descr().name() : ""));52 args->old_immovable_types.push_back((im ? im->descr().name() : ""));
53 args->nimmov_types.push_back(get_random_enabled());53 args->new_immovable_types.push_back(get_random_enabled());
54 } while (mr.advance(*map));54 } while (mr.advance(*map));
55 }55 }
5656
57 if (!args->nimmov_types.empty())57 if (!args->new_immovable_types.empty())
58 {58 {
59 Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr59 Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
60 (*map,60 (*map,
61 Widelands::Area<Widelands::FCoords>61 Widelands::Area<Widelands::FCoords>
62 (map->get_fcoords(center.node), radius));62 (map->get_fcoords(center.node), radius));
63 std::list<int32_t>::iterator i = args->nimmov_types.begin();63 std::list<int32_t>::iterator i = args->new_immovable_types.begin();
64 do {64 do {
65 if65 if
66 (!mr.location().field->get_immovable()66 (!mr.location().field->get_immovable()
@@ -79,7 +79,7 @@
79 EditorActionArgs* args,79 EditorActionArgs* args,
80 Widelands::Map* map) {80 Widelands::Map* map) {
81 const int32_t radius = args->sel_radius;81 const int32_t radius = args->sel_radius;
82 if (args->oimmov_types.empty())82 if (args->old_immovable_types.empty())
83 return radius;83 return radius;
8484
85 Widelands::EditorGameBase & egbase = parent.egbase();85 Widelands::EditorGameBase & egbase = parent.egbase();
@@ -87,7 +87,7 @@
87 (*map,87 (*map,
88 Widelands::Area<Widelands::FCoords>88 Widelands::Area<Widelands::FCoords>
89 (map->get_fcoords(center.node), radius));89 (map->get_fcoords(center.node), radius));
90 std::list<std::string>::iterator i = args->oimmov_types.begin();90 std::list<std::string>::iterator i = args->old_immovable_types.begin();
91 do {91 do {
92 if92 if
93 (upcast(Widelands::Immovable, immovable,93 (upcast(Widelands::Immovable, immovable,
9494
=== modified file 'src/editor/tools/editor_set_height_tool.cc'
--- src/editor/tools/editor_set_height_tool.cc 2016-01-04 20:50:19 +0000
+++ src/editor/tools/editor_set_height_tool.cc 2016-03-18 12:52:47 +0000
@@ -31,19 +31,19 @@
31 EditorInteractive& /* parent */,31 EditorInteractive& /* parent */,
32 EditorActionArgs* args,32 EditorActionArgs* args,
33 Widelands::Map* map) {33 Widelands::Map* map) {
34 if (args->origHights.empty())34 if (args->original_heights.empty())
35 {35 {
36 Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr36 Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
37 (*map,37 (*map,
38 Widelands::Area<Widelands::FCoords>38 Widelands::Area<Widelands::FCoords>
39 (map->get_fcoords(center.node), args->sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 1));39 (map->get_fcoords(center.node), args->sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 1));
40 do args->origHights.push_back(mr.location().field->get_height());40 do args->original_heights.push_back(mr.location().field->get_height());
41 while (mr.advance(*map));41 while (mr.advance(*map));
42 }42 }
43 return map->set_height(43 return map->set_height(
44 world,44 world,
45 Widelands::Area<Widelands::FCoords>(map->get_fcoords(center.node), args->sel_radius),45 Widelands::Area<Widelands::FCoords>(map->get_fcoords(center.node), args->sel_radius),
46 args->m_interval);46 args->interval);
47}47}
4848
49int32_t49int32_t
@@ -58,7 +58,7 @@
58 (map->get_fcoords(center.node),58 (map->get_fcoords(center.node),
59 args->sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 1));59 args->sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 1));
6060
61 std::list<Widelands::Field::Height>::iterator i = args->origHights.begin();61 std::list<Widelands::Field::Height>::iterator i = args->original_heights.begin();
6262
63 do {63 do {
64 mr.location().field->set_height(*i); ++i;64 mr.location().field->set_height(*i); ++i;
@@ -75,6 +75,6 @@
75EditorActionArgs EditorSetHeightTool::format_args_impl(EditorInteractive & parent)75EditorActionArgs EditorSetHeightTool::format_args_impl(EditorInteractive & parent)
76{76{
77 EditorActionArgs a(parent);77 EditorActionArgs a(parent);
78 a.m_interval = m_interval;78 a.interval = interval_;
79 return a;79 return a;
80}80}
8181
=== modified file 'src/editor/tools/editor_set_height_tool.h'
--- src/editor/tools/editor_set_height_tool.h 2016-01-28 05:24:34 +0000
+++ src/editor/tools/editor_set_height_tool.h 2016-03-18 12:52:47 +0000
@@ -27,7 +27,7 @@
27/// Ensures that the height of a node is within an interval.27/// Ensures that the height of a node is within an interval.
28struct EditorSetHeightTool : public EditorTool {28struct EditorSetHeightTool : public EditorTool {
29 EditorSetHeightTool()29 EditorSetHeightTool()
30 : EditorTool(*this, *this), m_interval(10, 10)30 : EditorTool(*this, *this), interval_(10, 10)
31 {}31 {}
3232
33 int32_t handle_click_impl(const Widelands::World& world,33 int32_t handle_click_impl(const Widelands::World& world,
@@ -49,14 +49,14 @@
49 }49 }
5050
51 Widelands::HeightInterval get_interval() const {51 Widelands::HeightInterval get_interval() const {
52 return m_interval;52 return interval_;
53 }53 }
54 void set_interval(Widelands::HeightInterval const i) {54 void set_interval(Widelands::HeightInterval const i) {
55 m_interval = i;55 interval_ = i;
56 }56 }
5757
58private:58private:
59 Widelands::HeightInterval m_interval;59 Widelands::HeightInterval interval_;
60};60};
6161
62#endif // end of include guard: WL_EDITOR_TOOLS_EDITOR_SET_HEIGHT_TOOL_H62#endif // end of include guard: WL_EDITOR_TOOLS_EDITOR_SET_HEIGHT_TOOL_H
6363
=== modified file 'src/editor/tools/editor_set_resources_tool.cc'
--- src/editor/tools/editor_set_resources_tool.cc 2016-03-17 12:14:57 +0000
+++ src/editor/tools/editor_set_resources_tool.cc 2016-03-18 12:52:47 +0000
@@ -39,23 +39,23 @@
39 (map->get_fcoords(center.node), args->sel_radius));39 (map->get_fcoords(center.node), args->sel_radius));
40 do {40 do {
41 int32_t amount = args->set_to;41 int32_t amount = args->set_to;
42 int32_t max_amount = args->cur_res != Widelands::kNoResource ?42 int32_t max_amount = args->current_resource != Widelands::kNoResource ?
43 world.get_resource(args->cur_res)->max_amount() : 0;43 world.get_resource(args->current_resource)->max_amount() : 0;
44 if (amount < 0)44 if (amount < 0)
45 amount = 0;45 amount = 0;
46 else if (amount > max_amount)46 else if (amount > max_amount)
47 amount = max_amount;47 amount = max_amount;
4848
49 if (map->is_resource_valid(world, mr.location(), args->cur_res) &&49 if (map->is_resource_valid(world, mr.location(), args->current_resource) &&
50 mr.location().field->get_resources_amount() != amount) {50 mr.location().field->get_resources_amount() != amount) {
5151
52 args->orgRes.push_back(EditorActionArgs::ResourceState{52 args->original_resource.push_back(EditorActionArgs::ResourceState{
53 mr.location(),53 mr.location(),
54 mr.location().field->get_resources(),54 mr.location().field->get_resources(),
55 mr.location().field->get_resources_amount()55 mr.location().field->get_resources_amount()
56 });56 });
5757
58 map->initialize_resources(mr.location(), args->cur_res, amount);58 map->initialize_resources(mr.location(), args->current_resource, amount);
59 }59 }
60 } while (mr.advance(*map));60 } while (mr.advance(*map));
61 return mr.radius();61 return mr.radius();
@@ -67,9 +67,9 @@
67 EditorInteractive& /* parent */,67 EditorInteractive& /* parent */,
68 EditorActionArgs* args,68 EditorActionArgs* args,
69 Widelands::Map* map) {69 Widelands::Map* map) {
70 for (const auto & res : args->orgRes) {70 for (const auto & res : args->original_resource) {
71 int32_t amount = res.amount;71 int32_t amount = res.amount;
72 int32_t max_amount = world.get_resource(args->cur_res)->max_amount();72 int32_t max_amount = world.get_resource(args->current_resource)->max_amount();
7373
74 if (amount < 0)74 if (amount < 0)
75 amount = 0;75 amount = 0;
@@ -79,14 +79,14 @@
79 map->initialize_resources(res.location, res.idx, amount);79 map->initialize_resources(res.location, res.idx, amount);
80 }80 }
8181
82 args->orgRes.clear();82 args->original_resource.clear();
83 return args->sel_radius;83 return args->sel_radius;
84}84}
8585
86EditorActionArgs EditorSetResourcesTool::format_args_impl(EditorInteractive & parent)86EditorActionArgs EditorSetResourcesTool::format_args_impl(EditorInteractive & parent)
87{87{
88 EditorActionArgs a(parent);88 EditorActionArgs a(parent);
89 a.cur_res = m_cur_res;89 a.current_resource = cur_res_;
90 a.set_to = m_set_to;90 a.set_to = set_to_;
91 return a;91 return a;
92}92}
9393
=== modified file 'src/editor/tools/editor_set_resources_tool.h'
--- src/editor/tools/editor_set_resources_tool.h 2016-01-28 05:24:34 +0000
+++ src/editor/tools/editor_set_resources_tool.h 2016-03-18 12:52:47 +0000
@@ -27,7 +27,7 @@
27/// Decreases the resources of a node by a value.27/// Decreases the resources of a node by a value.
28struct EditorSetResourcesTool : public EditorTool {28struct EditorSetResourcesTool : public EditorTool {
29 EditorSetResourcesTool()29 EditorSetResourcesTool()
30 : EditorTool(*this, *this), m_cur_res(0), m_set_to(0)30 : EditorTool(*this, *this), cur_res_(0), set_to_(0)
31 {}31 {}
3232
33 /**33 /**
@@ -51,15 +51,15 @@
51 return "images/wui/editor/fsel_editor_set_resources.png";51 return "images/wui/editor/fsel_editor_set_resources.png";
52 }52 }
5353
54 uint8_t get_set_to() const {return m_set_to;}54 uint8_t get_set_to() const {return set_to_;}
55 void set_set_to(uint8_t const n) {m_set_to = n;}55 void set_set_to(uint8_t const n) {set_to_ = n;}
56 Widelands::DescriptionIndex get_cur_res() const {return m_cur_res;}56 Widelands::DescriptionIndex get_cur_res() const {return cur_res_;}
57 void set_cur_res(Widelands::DescriptionIndex const res)57 void set_cur_res(Widelands::DescriptionIndex const res)
58 {m_cur_res = res;}58 {cur_res_ = res;}
5959
60private:60private:
61 Widelands::DescriptionIndex m_cur_res;61 Widelands::DescriptionIndex cur_res_;
62 uint8_t m_set_to;62 uint8_t set_to_;
63};63};
6464
6565
6666
=== modified file 'src/editor/tools/editor_set_starting_pos_tool.cc'
--- src/editor/tools/editor_set_starting_pos_tool.cc 2016-01-28 05:24:34 +0000
+++ src/editor/tools/editor_set_starting_pos_tool.cc 2016-03-18 12:52:47 +0000
@@ -49,7 +49,7 @@
49} // namespace49} // namespace
5050
51// global variable to pass data from callback to class51// global variable to pass data from callback to class
52static int32_t m_current_player;52static int32_t current_player_;
5353
54/*54/*
55 * static callback function for overlay calculation55 * static callback function for overlay calculation
@@ -59,7 +59,7 @@
59{59{
60 // Area around already placed players60 // Area around already placed players
61 Widelands::PlayerNumber const nr_players = map.get_nrplayers();61 Widelands::PlayerNumber const nr_players = map.get_nrplayers();
62 for (Widelands::PlayerNumber p = 1, last = m_current_player - 1;; ++p) {62 for (Widelands::PlayerNumber p = 1, last = current_player_ - 1;; ++p) {
63 for (; p <= last; ++p)63 for (; p <= last; ++p)
64 if (Widelands::Coords const sp = map.get_starting_pos(p))64 if (Widelands::Coords const sp = map.get_starting_pos(p))
65 if (map.calc_distance(sp, c) < MIN_PLACE_AROUND_PLAYERS)65 if (map.calc_distance(sp, c) < MIN_PLACE_AROUND_PLAYERS)
@@ -78,10 +78,10 @@
78}78}
7979
80EditorSetStartingPosTool::EditorSetStartingPosTool()80EditorSetStartingPosTool::EditorSetStartingPosTool()
81 : EditorTool(*this, *this, false), m_current_sel_pic(nullptr)81 : EditorTool(*this, *this, false), current_sel_pic_(nullptr)
82{82{
83 m_current_player = 0;83 current_player_ = 0;
84 fsel_picsname = "images/players/fsel_editor_set_player_01_pos.png";84 fsel_picsname_ = "images/players/fsel_editor_set_player_01_pos.png";
85}85}
8686
87int32_t EditorSetStartingPosTool::handle_click_impl(const Widelands::World&,87int32_t EditorSetStartingPosTool::handle_click_impl(const Widelands::World&,
@@ -93,18 +93,18 @@
93 assert(center.node.x < map->get_width());93 assert(center.node.x < map->get_width());
94 assert(0 <= center.node.y);94 assert(0 <= center.node.y);
95 assert(center.node.y < map->get_height());95 assert(center.node.y < map->get_height());
96 if (m_current_player) {96 if (current_player_) {
97 if (map->get_nrplayers() < m_current_player) {97 if (map->get_nrplayers() < current_player_) {
98 // Mmh, my current player is not valid. Maybe the user has loaded a98 // Mmh, my current player is not valid. Maybe the user has loaded a
99 // new map while this tool was active. We set the new player to a99 // new map while this tool was active. We set the new player to a
100 // valid one. The sel pointer is the only thing that stays wrong, but100 // valid one. The sel pointer is the only thing that stays wrong, but
101 // this is not important101 // this is not important
102 m_current_player = 1;102 current_player_ = 1;
103 }103 }
104104
105 Widelands::Coords const old_sp = map->get_starting_pos(m_current_player);105 Widelands::Coords const old_sp = map->get_starting_pos(current_player_);
106106
107 const Image* player_image = g_gr->images().get(player_pictures[m_current_player - 1]);107 const Image* player_image = g_gr->images().get(player_pictures[current_player_ - 1]);
108 assert(player_image);108 assert(player_image);
109109
110 // check if field is valid110 // check if field is valid
@@ -118,7 +118,7 @@
118 center.node, player_image, 4, Point(player_image->width() / 2, STARTING_POS_HOTSPOT_Y));118 center.node, player_image, 4, Point(player_image->width() / 2, STARTING_POS_HOTSPOT_Y));
119119
120 // set new player pos120 // set new player pos
121 map->set_starting_pos(m_current_player, center.node);121 map->set_starting_pos(current_player_, center.node);
122 }122 }
123 }123 }
124 return 1;124 return 1;
@@ -127,12 +127,12 @@
127Widelands::PlayerNumber EditorSetStartingPosTool::get_current_player127Widelands::PlayerNumber EditorSetStartingPosTool::get_current_player
128() const128() const
129{129{
130 return m_current_player;130 return current_player_;
131}131}
132132
133133
134void EditorSetStartingPosTool::set_current_player(int32_t const i) {134void EditorSetStartingPosTool::set_current_player(int32_t const i) {
135 m_current_player = i;135 current_player_ = i;
136 fsel_picsname = player_pictures_small[m_current_player - 1];136 fsel_picsname_ = player_pictures_small[current_player_ - 1];
137 m_current_sel_pic = fsel_picsname;137 current_sel_pic_ = fsel_picsname_;
138}138}
139139
=== modified file 'src/editor/tools/editor_set_starting_pos_tool.h'
--- src/editor/tools/editor_set_starting_pos_tool.h 2016-01-28 05:24:34 +0000
+++ src/editor/tools/editor_set_starting_pos_tool.h 2016-03-18 12:52:47 +0000
@@ -38,15 +38,15 @@
38 EditorActionArgs*,38 EditorActionArgs*,
39 Widelands::Map*) override;39 Widelands::Map*) override;
40 char const * get_sel_impl() const override40 char const * get_sel_impl() const override
41 {return m_current_sel_pic;}41 {return current_sel_pic_;}
4242
43 Widelands::PlayerNumber get_current_player() const;43 Widelands::PlayerNumber get_current_player() const;
44 void set_current_player(int32_t);44 void set_current_player(int32_t);
45 bool has_size_one() const override {return true;}45 bool has_size_one() const override {return true;}
4646
47private:47private:
48 char const * fsel_picsname;48 char const * fsel_picsname_;
49 char const * m_current_sel_pic;49 char const * current_sel_pic_;
50};50};
5151
52int32_t editor_tool_set_starting_pos_callback52int32_t editor_tool_set_starting_pos_callback
5353
=== modified file 'src/editor/tools/editor_set_terrain_tool.cc'
--- src/editor/tools/editor_set_terrain_tool.cc 2016-01-04 20:50:19 +0000
+++ src/editor/tools/editor_set_terrain_tool.cc 2016-03-18 12:52:47 +0000
@@ -35,7 +35,7 @@
35 uint16_t const radius = args->sel_radius;35 uint16_t const radius = args->sel_radius;
36 int32_t max = 0;36 int32_t max = 0;
3737
38 if (get_nr_enabled() && args->terrainType.empty()) {38 if (get_nr_enabled() && args->terrain_type.empty()) {
39 Widelands::MapTriangleRegion<TCoords<Widelands::FCoords> > mr39 Widelands::MapTriangleRegion<TCoords<Widelands::FCoords> > mr
40 (*map, Widelands::Area<TCoords<Widelands::FCoords> >40 (*map, Widelands::Area<TCoords<Widelands::FCoords> >
41 (TCoords<Widelands::FCoords>41 (TCoords<Widelands::FCoords>
@@ -43,21 +43,21 @@
43 static_cast<TCoords<Widelands::FCoords>::TriangleIndex>(center.triangle.t)),43 static_cast<TCoords<Widelands::FCoords>::TriangleIndex>(center.triangle.t)),
44 radius));44 radius));
45 do {45 do {
46 args->origTerrainType.push_back46 args->original_terrain_type.push_back
47 ((mr.location().t == TCoords<Widelands::FCoords>::D)47 ((mr.location().t == TCoords<Widelands::FCoords>::D)
48 ? mr.location().field->terrain_d() : mr.location().field->terrain_r());48 ? mr.location().field->terrain_d() : mr.location().field->terrain_r());
49 args->terrainType.push_back(get_random_enabled());49 args->terrain_type.push_back(get_random_enabled());
50 } while (mr.advance(*map));50 } while (mr.advance(*map));
51 }51 }
5252
53 if (!args->terrainType.empty()) {53 if (!args->terrain_type.empty()) {
54 Widelands::MapTriangleRegion<TCoords<Widelands::FCoords> > mr54 Widelands::MapTriangleRegion<TCoords<Widelands::FCoords> > mr
55 (*map, Widelands::Area<TCoords<Widelands::FCoords> >55 (*map, Widelands::Area<TCoords<Widelands::FCoords> >
56 (TCoords<Widelands::FCoords>56 (TCoords<Widelands::FCoords>
57 (Widelands::FCoords(map->get_fcoords(center.triangle)),57 (Widelands::FCoords(map->get_fcoords(center.triangle)),
58 static_cast<TCoords<Widelands::FCoords>::TriangleIndex>(center.triangle.t)),58 static_cast<TCoords<Widelands::FCoords>::TriangleIndex>(center.triangle.t)),
59 radius));59 radius));
60 std::list<Widelands::DescriptionIndex>::iterator i = args->terrainType.begin();60 std::list<Widelands::DescriptionIndex>::iterator i = args->terrain_type.begin();
61 do {61 do {
62 max = std::max62 max = std::max
63 (max, map->change_terrain(world, mr.location(), *i));63 (max, map->change_terrain(world, mr.location(), *i));
@@ -76,7 +76,7 @@
76 assert76 assert
77 (center.triangle.t == TCoords<>::D || center.triangle.t == TCoords<>::R);77 (center.triangle.t == TCoords<>::D || center.triangle.t == TCoords<>::R);
78 uint16_t const radius = args->sel_radius;78 uint16_t const radius = args->sel_radius;
79 if (!args->terrainType.empty()) {79 if (!args->terrain_type.empty()) {
80 int32_t max = 0;80 int32_t max = 0;
81 Widelands::MapTriangleRegion<TCoords<Widelands::FCoords> > mr81 Widelands::MapTriangleRegion<TCoords<Widelands::FCoords> > mr
82 (*map,82 (*map,
@@ -87,7 +87,7 @@
87 (center.triangle.t)),87 (center.triangle.t)),
88 radius));88 radius));
8989
90 std::list<Widelands::DescriptionIndex>::iterator i = args->origTerrainType.begin();90 std::list<Widelands::DescriptionIndex>::iterator i = args->original_terrain_type.begin();
91 do {91 do {
92 max = std::max92 max = std::max
93 (max, map->change_terrain(world, mr.location(), *i));93 (max, map->change_terrain(world, mr.location(), *i));
9494
=== modified file 'src/editor/tools/editor_tool.h'
--- src/editor/tools/editor_tool.h 2016-02-01 08:21:18 +0000
+++ src/editor/tools/editor_tool.h 2016-03-18 12:52:47 +0000
@@ -41,7 +41,7 @@
41class EditorTool {41class EditorTool {
42public:42public:
43 EditorTool(EditorTool & second, EditorTool & third, bool uda = true) :43 EditorTool(EditorTool & second, EditorTool & third, bool uda = true) :
44 m_second(second), m_third(third), undoable(uda)44 second_(second), third_(third), undoable_(uda)
45 {}45 {}
46 virtual ~EditorTool() {}46 virtual ~EditorTool() {}
4747
@@ -52,7 +52,7 @@
52 EditorInteractive& parent, EditorActionArgs* args, Widelands::Map* map)52 EditorInteractive& parent, EditorActionArgs* args, Widelands::Map* map)
53 {53 {
54 return54 return
55 (i == First ? *this : i == Second ? m_second : m_third)55 (i == First ? *this : i == Second ? second_ : third_)
56 .handle_click_impl(world, center, parent, args, map);56 .handle_click_impl(world, center, parent, args, map);
57 }57 }
5858
@@ -62,23 +62,23 @@
62 EditorInteractive& parent, EditorActionArgs* args, Widelands::Map* map)62 EditorInteractive& parent, EditorActionArgs* args, Widelands::Map* map)
63 {63 {
64 return64 return
65 (i == First ? *this : i == Second ? m_second : m_third)65 (i == First ? *this : i == Second ? second_ : third_)
66 .handle_undo_impl(world, center, parent, args, map);66 .handle_undo_impl(world, center, parent, args, map);
67 }67 }
6868
69 const char * get_sel(const ToolIndex i) {69 const char * get_sel(const ToolIndex i) {
70 return70 return
71 (i == First ? *this : i == Second ? m_second : m_third)71 (i == First ? *this : i == Second ? second_ : third_)
72 .get_sel_impl();72 .get_sel_impl();
73 }73 }
7474
75 EditorActionArgs format_args(const ToolIndex i, EditorInteractive & parent) {75 EditorActionArgs format_args(const ToolIndex i, EditorInteractive & parent) {
76 return76 return
77 (i == First ? *this : i == Second ? m_second : m_third)77 (i == First ? *this : i == Second ? second_ : third_)
78 .format_args_impl(parent);78 .format_args_impl(parent);
79 }79 }
8080
81 bool is_unduable() {return undoable;}81 bool is_undoable() {return undoable_;}
82 virtual bool has_size_one() const {return false;}82 virtual bool has_size_one() const {return false;}
83 virtual EditorActionArgs format_args_impl(EditorInteractive & parent) {83 virtual EditorActionArgs format_args_impl(EditorInteractive & parent) {
84 return EditorActionArgs(parent);84 return EditorActionArgs(parent);
@@ -99,8 +99,8 @@
99 virtual bool operates_on_triangles() const {return false;}99 virtual bool operates_on_triangles() const {return false;}
100100
101protected:101protected:
102 EditorTool & m_second, & m_third;102 EditorTool & second_, & third_;
103 bool undoable;103 bool undoable_;
104104
105private:105private:
106 DISALLOW_COPY_AND_ASSIGN(EditorTool);106 DISALLOW_COPY_AND_ASSIGN(EditorTool);
107107
=== modified file 'src/editor/tools/multi_select.h'
--- src/editor/tools/multi_select.h 2014-07-05 16:41:51 +0000
+++ src/editor/tools/multi_select.h 2016-03-18 12:52:47 +0000
@@ -34,28 +34,28 @@
34 * This is a helper class, no Editor Tool (might be usable in game too)34 * This is a helper class, no Editor Tool (might be usable in game too)
35*/35*/
36struct MultiSelect {36struct MultiSelect {
37 MultiSelect() : m_nr_enabled(0) {}37 MultiSelect() : nr_enabled_(0) {}
38 ~MultiSelect() {}38 ~MultiSelect() {}
3939
40 void enable(int32_t n, bool t) {40 void enable(int32_t n, bool t) {
41 if (static_cast<int32_t>(m_enabled.size()) < n + 1)41 if (static_cast<int32_t>(enabled_.size()) < n + 1)
42 m_enabled.resize(n + 1, false);42 enabled_.resize(n + 1, false);
4343
44 if (m_enabled[n] == t)44 if (enabled_[n] == t)
45 return;45 return;
46 m_enabled[n] = t;46 enabled_[n] = t;
47 if (t)47 if (t)
48 ++m_nr_enabled;48 ++nr_enabled_;
49 else49 else
50 --m_nr_enabled;50 --nr_enabled_;
51 assert(0 <= m_nr_enabled);51 assert(0 <= nr_enabled_);
52 }52 }
53 bool is_enabled(int32_t n) const {53 bool is_enabled(int32_t n) const {
54 if (static_cast<int32_t>(m_enabled.size()) < n + 1)54 if (static_cast<int32_t>(enabled_.size()) < n + 1)
55 return false;55 return false;
56 return m_enabled[n];56 return enabled_[n];
57 }57 }
58 int32_t get_nr_enabled() const {return m_nr_enabled;}58 int32_t get_nr_enabled() const {return nr_enabled_;}
59 int32_t get_random_enabled() const {59 int32_t get_random_enabled() const {
60 const int32_t rand_value =60 const int32_t rand_value =
61 static_cast<int32_t>61 static_cast<int32_t>
@@ -69,8 +69,8 @@
69 }69 }
7070
71private:71private:
72 int32_t m_nr_enabled;72 int32_t nr_enabled_;
73 std::vector<bool> m_enabled;73 std::vector<bool> enabled_;
74};74};
7575
76#endif // end of include guard: WL_EDITOR_TOOLS_MULTI_SELECT_H76#endif // end of include guard: WL_EDITOR_TOOLS_MULTI_SELECT_H
7777
=== modified file 'src/editor/ui_menus/editor_player_menu.cc'
--- src/editor/ui_menus/editor_player_menu.cc 2016-01-31 10:57:58 +0000
+++ src/editor/ui_menus/editor_player_menu.cc 2016-03-18 12:52:47 +0000
@@ -70,24 +70,24 @@
70 :70 :
71 UI::UniqueWindow71 UI::UniqueWindow
72 (&parent, "players_menu", &registry, 340, 400, _("Player Options")),72 (&parent, "players_menu", &registry, 340, 400, _("Player Options")),
73 m_add_player73 add_player_
74 (this, "add_player",74 (this, "add_player",
75 get_inner_w() - 5 - 20, 5, 20, 20,75 get_inner_w() - 5 - 20, 5, 20, 20,
76 g_gr->images().get("images/ui_basic/but1.png"),76 g_gr->images().get("images/ui_basic/but1.png"),
77 g_gr->images().get("images/ui_basic/scrollbar_up.png"),77 g_gr->images().get("images/ui_basic/scrollbar_up.png"),
78 _("Add player"),78 _("Add player"),
79 parent.egbase().map().get_nrplayers() < MAX_PLAYERS),79 parent.egbase().map().get_nrplayers() < MAX_PLAYERS),
80 m_remove_last_player80 remove_last_player_
81 (this, "remove_last_player",81 (this, "remove_last_player",
82 5, 5, 20, 20,82 5, 5, 20, 20,
83 g_gr->images().get("images/ui_basic/but1.png"),83 g_gr->images().get("images/ui_basic/but1.png"),
84 g_gr->images().get("images/ui_basic/scrollbar_down.png"),84 g_gr->images().get("images/ui_basic/scrollbar_down.png"),
85 _("Remove last player"),85 _("Remove last player"),
86 1 < parent.egbase().map().get_nrplayers()),86 1 < parent.egbase().map().get_nrplayers()),
87 m_tribenames(eia().egbase().tribes().get_all_tribenames())87 tribenames_(eia().egbase().tribes().get_all_tribenames())
88{88{
89 m_add_player.sigclicked.connect(boost::bind(&EditorPlayerMenu::clicked_add_player, boost::ref(*this)));89 add_player_.sigclicked.connect(boost::bind(&EditorPlayerMenu::clicked_add_player, boost::ref(*this)));
90 m_remove_last_player.sigclicked.connect90 remove_last_player_.sigclicked.connect
91 (boost::bind(&EditorPlayerMenu::clicked_remove_last_player, boost::ref(*this)));91 (boost::bind(&EditorPlayerMenu::clicked_remove_last_player, boost::ref(*this)));
9292
93 int32_t const spacing = 5;93 int32_t const spacing = 5;
@@ -100,19 +100,19 @@
100 ta->set_pos(Point((get_inner_w() - ta->get_w()) / 2, posy + 5));100 ta->set_pos(Point((get_inner_w() - ta->get_w()) / 2, posy + 5));
101 posy += spacing + width;101 posy += spacing + width;
102102
103 m_nr_of_players_ta = new UI::Textarea(this, 0, 0, "5");103 nr_of_players_ta_ = new UI::Textarea(this, 0, 0, "5");
104 m_nr_of_players_ta->set_pos104 nr_of_players_ta_->set_pos
105 (Point((get_inner_w() - m_nr_of_players_ta->get_w()) / 2, posy + 5));105 (Point((get_inner_w() - nr_of_players_ta_->get_w()) / 2, posy + 5));
106106
107 posy += width + spacing + spacing;107 posy += width + spacing + spacing;
108108
109 m_posy = posy;109 posy_ = posy;
110110
111 for (Widelands::PlayerNumber i = 0; i < MAX_PLAYERS; ++i) {111 for (Widelands::PlayerNumber i = 0; i < MAX_PLAYERS; ++i) {
112 m_plr_names [i] = nullptr;112 plr_names_ [i] = nullptr;
113 m_plr_set_pos_buts [i] = nullptr;113 plr_set_pos_buts_ [i] = nullptr;
114 m_plr_set_tribes_buts[i] = nullptr;114 plr_set_tribes_buts_[i] = nullptr;
115 m_plr_make_infrastructure_buts[i] = nullptr;115 plr_make_infrastructure_buts_[i] = nullptr;
116 }116 }
117 update();117 update();
118118
@@ -147,75 +147,75 @@
147 text[0] = '0' + nr_players;147 text[0] = '0' + nr_players;
148 text[1] = '\0';148 text[1] = '\0';
149 }149 }
150 m_nr_of_players_ta->set_text(text);150 nr_of_players_ta_->set_text(text);
151 }151 }
152152
153 // Now remove all the unneeded stuff.153 // Now remove all the unneeded stuff.
154 for (Widelands::PlayerNumber i = nr_players; i < MAX_PLAYERS; ++i) {154 for (Widelands::PlayerNumber i = nr_players; i < MAX_PLAYERS; ++i) {
155 delete m_plr_names [i]; m_plr_names [i] = nullptr;155 delete plr_names_ [i]; plr_names_ [i] = nullptr;
156 delete m_plr_set_pos_buts [i]; m_plr_set_pos_buts [i] = nullptr;156 delete plr_set_pos_buts_ [i]; plr_set_pos_buts_ [i] = nullptr;
157 delete m_plr_set_tribes_buts[i]; m_plr_set_tribes_buts[i] = nullptr;157 delete plr_set_tribes_buts_[i]; plr_set_tribes_buts_[i] = nullptr;
158 }158 }
159 int32_t posy = m_posy;159 int32_t posy = posy_;
160 int32_t const spacing = 5;160 int32_t const spacing = 5;
161 int32_t const size = 20;161 int32_t const size = 20;
162162
163 iterate_player_numbers(p, nr_players) {163 iterate_player_numbers(p, nr_players) {
164 int32_t posx = spacing;164 int32_t posx = spacing;
165 if (!m_plr_names[p - 1]) {165 if (!plr_names_[p - 1]) {
166 m_plr_names[p - 1] =166 plr_names_[p - 1] =
167 new UI::EditBox167 new UI::EditBox
168 (this, posx, posy, 140,168 (this, posx, posy, 140,
169 g_gr->images().get("images/ui_basic/but0.png"));169 g_gr->images().get("images/ui_basic/but0.png"));
170 m_plr_names[p - 1]->changed.connect170 plr_names_[p - 1]->changed.connect
171 (boost::bind(&EditorPlayerMenu::name_changed, this, p - 1));171 (boost::bind(&EditorPlayerMenu::name_changed, this, p - 1));
172 posx += 140 + spacing;172 posx += 140 + spacing;
173 m_plr_names[p - 1]->set_text(map.get_scenario_player_name(p));173 plr_names_[p - 1]->set_text(map.get_scenario_player_name(p));
174 }174 }
175175
176 if (!m_plr_set_tribes_buts[p - 1]) {176 if (!plr_set_tribes_buts_[p - 1]) {
177 m_plr_set_tribes_buts[p - 1] =177 plr_set_tribes_buts_[p - 1] =
178 new UI::Button178 new UI::Button
179 (this, "tribe",179 (this, "tribe",
180 posx, posy, 140, size,180 posx, posy, 140, size,
181 g_gr->images().get("images/ui_basic/but0.png"),181 g_gr->images().get("images/ui_basic/but0.png"),
182 "");182 "");
183 m_plr_set_tribes_buts[p - 1]->sigclicked.connect183 plr_set_tribes_buts_[p - 1]->sigclicked.connect
184 (boost::bind(&EditorPlayerMenu::player_tribe_clicked, boost::ref(*this), p - 1));184 (boost::bind(&EditorPlayerMenu::player_tribe_clicked, boost::ref(*this), p - 1));
185 posx += 140 + spacing;185 posx += 140 + spacing;
186 }186 }
187187
188 // Get/Set (localized) tribe names188 // Get/Set (localized) tribe names
189 if (map.get_scenario_player_tribe(p) != UNDEFINED_TRIBE_NAME) {189 if (map.get_scenario_player_tribe(p) != UNDEFINED_TRIBE_NAME) {
190 m_selected_tribes[p - 1] = map.get_scenario_player_tribe(p);190 selected_tribes_[p - 1] = map.get_scenario_player_tribe(p);
191 } else {191 } else {
192 m_selected_tribes[p - 1] = m_tribenames[0];192 selected_tribes_[p - 1] = tribenames_[0];
193 map.set_scenario_player_tribe(p, m_selected_tribes[p - 1]);193 map.set_scenario_player_tribe(p, selected_tribes_[p - 1]);
194 }194 }
195195
196 m_plr_set_tribes_buts[p - 1]196 plr_set_tribes_buts_[p - 1]
197 ->set_title(eia().egbase().tribes().tribeinfo(m_selected_tribes[p - 1]).descname);197 ->set_title(eia().egbase().tribes().tribeinfo(selected_tribes_[p - 1]).descname);
198198
199 // Set default AI and closeable to false (always default - should be changed by hand)199 // Set default AI and closeable to false (always default - should be changed by hand)
200 map.set_scenario_player_ai(p, "");200 map.set_scenario_player_ai(p, "");
201 map.set_scenario_player_closeable(p, false);201 map.set_scenario_player_closeable(p, false);
202202
203 // Set Starting pos button.203 // Set Starting pos button.
204 if (!m_plr_set_pos_buts[p - 1]) {204 if (!plr_set_pos_buts_[p - 1]) {
205 m_plr_set_pos_buts[p - 1] =205 plr_set_pos_buts_[p - 1] =
206 new UI::Button206 new UI::Button
207 (this, "starting_pos",207 (this, "starting_pos",
208 posx, posy, size, size,208 posx, posy, size, size,
209 g_gr->images().get("images/ui_basic/but0.png"),209 g_gr->images().get("images/ui_basic/but0.png"),
210 nullptr,210 nullptr,
211 "");211 "");
212 m_plr_set_pos_buts[p - 1]->sigclicked.connect212 plr_set_pos_buts_[p - 1]->sigclicked.connect
213 (boost::bind(&EditorPlayerMenu::set_starting_pos_clicked, boost::ref(*this), p));213 (boost::bind(&EditorPlayerMenu::set_starting_pos_clicked, boost::ref(*this), p));
214 }214 }
215 const Image* player_image = g_gr->images().get(player_pictures_small[p - 1]);215 const Image* player_image = g_gr->images().get(player_pictures_small[p - 1]);
216 assert(player_image);216 assert(player_image);
217217
218 m_plr_set_pos_buts[p - 1]->set_pic(player_image);218 plr_set_pos_buts_[p - 1]->set_pic(player_image);
219 posy += size + spacing;219 posy += size + spacing;
220 }220 }
221 set_inner_size(get_inner_w(), posy + spacing);221 set_inner_size(get_inner_w(), posy + spacing);
@@ -232,10 +232,10 @@
232 const std::string name = (boost::format(_("Player %u")) % static_cast<unsigned int>(nr_players)).str();232 const std::string name = (boost::format(_("Player %u")) % static_cast<unsigned int>(nr_players)).str();
233 map.set_scenario_player_name(nr_players, name);233 map.set_scenario_player_name(nr_players, name);
234 }234 }
235 map.set_scenario_player_tribe(nr_players, m_tribenames[0]);235 map.set_scenario_player_tribe(nr_players, tribenames_[0]);
236 eia().set_need_save(true);236 eia().set_need_save(true);
237 m_add_player .set_enabled(nr_players < MAX_PLAYERS);237 add_player_ .set_enabled(nr_players < MAX_PLAYERS);
238 m_remove_last_player.set_enabled(true);238 remove_last_player_.set_enabled(true);
239 update();239 update();
240}240}
241241
@@ -259,8 +259,8 @@
259 set_starting_pos_clicked(nr_players);259 set_starting_pos_clicked(nr_players);
260 }260 }
261 map.set_nrplayers(nr_players);261 map.set_nrplayers(nr_players);
262 m_add_player .set_enabled(nr_players < MAX_PLAYERS);262 add_player_ .set_enabled(nr_players < MAX_PLAYERS);
263 m_remove_last_player.set_enabled(1 < nr_players);263 remove_last_player_.set_enabled(1 < nr_players);
264264
265 update();265 update();
266 // TODO(SirVer): Take steps when the player is referenced someplace. Not266 // TODO(SirVer): Take steps when the player is referenced someplace. Not
@@ -274,18 +274,18 @@
274void EditorPlayerMenu::player_tribe_clicked(uint8_t n) {274void EditorPlayerMenu::player_tribe_clicked(uint8_t n) {
275 EditorInteractive& menu = eia();275 EditorInteractive& menu = eia();
276 if (!menu.is_player_tribe_referenced(n + 1)) {276 if (!menu.is_player_tribe_referenced(n + 1)) {
277 if (!Widelands::Tribes::tribe_exists(m_selected_tribes[n])) {277 if (!Widelands::Tribes::tribe_exists(selected_tribes_[n])) {
278 throw wexception278 throw wexception
279 ("Map defines tribe %s, but it does not exist!", m_selected_tribes[n].c_str());279 ("Map defines tribe %s, but it does not exist!", selected_tribes_[n].c_str());
280 }280 }
281 uint32_t i;281 uint32_t i;
282 for (i = 0; i < m_tribenames.size(); ++i) {282 for (i = 0; i < tribenames_.size(); ++i) {
283 if (m_tribenames[i] == m_selected_tribes[n]) {283 if (tribenames_[i] == selected_tribes_[n]) {
284 break;284 break;
285 }285 }
286 }286 }
287 m_selected_tribes[n] = i == m_tribenames.size() - 1 ? m_tribenames[0] : m_tribenames[++i];287 selected_tribes_[n] = i == tribenames_.size() - 1 ? tribenames_[0] : tribenames_[++i];
288 menu.egbase().map().set_scenario_player_tribe(n + 1, m_selected_tribes[n]);288 menu.egbase().map().set_scenario_player_tribe(n + 1, selected_tribes_[n]);
289 menu.set_need_save(true);289 menu.set_need_save(true);
290 } else {290 } else {
291 UI::WLMessageBox mmb291 UI::WLMessageBox mmb
@@ -331,15 +331,15 @@
331 */331 */
332void EditorPlayerMenu::name_changed(int32_t m) {332void EditorPlayerMenu::name_changed(int32_t m) {
333 // Player name has been changed.333 // Player name has been changed.
334 std::string text = m_plr_names[m]->text();334 std::string text = plr_names_[m]->text();
335 EditorInteractive& menu = eia();335 EditorInteractive& menu = eia();
336 Widelands::Map & map = menu.egbase().map();336 Widelands::Map & map = menu.egbase().map();
337 if (text == "") {337 if (text == "") {
338 text = map.get_scenario_player_name(m + 1);338 text = map.get_scenario_player_name(m + 1);
339 m_plr_names[m]->set_text(text);339 plr_names_[m]->set_text(text);
340 }340 }
341 map.set_scenario_player_name(m + 1, text);341 map.set_scenario_player_name(m + 1, text);
342 m_plr_names[m]->set_text(map.get_scenario_player_name(m + 1));342 plr_names_[m]->set_text(map.get_scenario_player_name(m + 1));
343 menu.set_need_save(true);343 menu.set_need_save(true);
344}344}
345345
@@ -364,8 +364,8 @@
364 // so that this tribe can not be changed364 // so that this tribe can not be changed
365 egbase.add_player365 egbase.add_player
366 (n, 0, // TODO(SirVer): initialization index makes no sense here366 (n, 0, // TODO(SirVer): initialization index makes no sense here
367 eia().egbase().tribes().tribeinfo(m_selected_tribes[n]).descname,367 eia().egbase().tribes().tribeinfo(selected_tribes_[n]).descname,
368 m_plr_names[n - 1]->text());368 plr_names_[n - 1]->text());
369369
370 p = egbase.get_player(n);370 p = egbase.get_player(n);
371 }371 }
372372
=== modified file 'src/editor/ui_menus/editor_player_menu.h'
--- src/editor/ui_menus/editor_player_menu.h 2016-01-16 12:55:14 +0000
+++ src/editor/ui_menus/editor_player_menu.h 2016-03-18 12:52:47 +0000
@@ -46,22 +46,21 @@
4646
47private:47private:
48 EditorInteractive & eia();48 EditorInteractive & eia();
49 UI::UniqueWindow::Registry m_allow_buildings_menu;49 UI::UniqueWindow::Registry allow_buildings_menu_;
50 UI::Textarea * m_nr_of_players_ta;50 UI::Textarea* nr_of_players_ta_;
51 UI::EditBox * m_plr_names[MAX_PLAYERS];51 UI::EditBox* plr_names_[MAX_PLAYERS];
52 UI::Button52 UI::Button add_player_, remove_last_player_;
53 m_add_player, m_remove_last_player;53 UI::Button
54 UI::Button54 * plr_make_infrastructure_buts_[MAX_PLAYERS],
55 * m_plr_make_infrastructure_buts[MAX_PLAYERS],55 * plr_set_pos_buts_ [MAX_PLAYERS],
56 * m_plr_set_pos_buts [MAX_PLAYERS],56 * plr_set_tribes_buts_ [MAX_PLAYERS];
57 * m_plr_set_tribes_buts [MAX_PLAYERS];
5857
59 std::vector<std::string> m_tribenames;58 std::vector<std::string> tribenames_;
6059
61 /// List of the tribes currently selected for all players60 /// List of the tribes currently selected for all players
62 std::string m_selected_tribes[MAX_PLAYERS];61 std::string selected_tribes_[MAX_PLAYERS];
6362
64 int32_t m_posy;63 int32_t posy_;
6564
66 void name_changed(int32_t);65 void name_changed(int32_t);
67 void clicked_add_player ();66 void clicked_add_player ();
6867
=== modified file 'src/editor/ui_menus/editor_tool_change_height_options_menu.cc'
--- src/editor/ui_menus/editor_tool_change_height_options_menu.cc 2016-01-29 08:37:22 +0000
+++ src/editor/ui_menus/editor_tool_change_height_options_menu.cc 2016-03-18 12:52:47 +0000
@@ -39,117 +39,117 @@
39 :39 :
40 EditorToolOptionsMenu40 EditorToolOptionsMenu
41 (parent, registry, 250, 135, _("Height Tools Options")),41 (parent, registry, 250, 135, _("Height Tools Options")),
42 m_increase_tool(increase_tool),42 increase_tool_(increase_tool),
43 m_change_by_label43 change_by_label_
44 (this,44 (this,
45 hmargin(), vmargin(), get_inner_w() - 2 * hmargin(), height,45 hmargin(), vmargin(), get_inner_w() - 2 * hmargin(), height,
46 _("Increase/Decrease Value"), UI::Align::kBottomCenter),46 _("Increase/Decrease Value"), UI::Align::kBottomCenter),
47 m_change_by_increase47 change_by_increase_
48 (this, "incr_change_by",48 (this, "incr_change_by",
49 get_inner_w() - hmargin() - width,49 get_inner_w() - hmargin() - width,
50 m_change_by_label.get_y() + m_change_by_label.get_h() + spacing(),50 change_by_label_.get_y() + change_by_label_.get_h() + spacing(),
51 width, height,51 width, height,
52 g_gr->images().get("images/ui_basic/but1.png"),52 g_gr->images().get("images/ui_basic/but1.png"),
53 g_gr->images().get("images/ui_basic/scrollbar_up.png"),53 g_gr->images().get("images/ui_basic/scrollbar_up.png"),
54 std::string(),54 std::string(),
55 increase_tool.get_change_by() < MAX_FIELD_HEIGHT_DIFF),55 increase_tool.get_change_by() < MAX_FIELD_HEIGHT_DIFF),
56 m_change_by_decrease56 change_by_decrease_
57 (this, "decr_change_by",57 (this, "decr_change_by",
58 hmargin(),58 hmargin(),
59 m_change_by_increase.get_y(),59 change_by_increase_.get_y(),
60 width, height,60 width, height,
61 g_gr->images().get("images/ui_basic/but1.png"),61 g_gr->images().get("images/ui_basic/but1.png"),
62 g_gr->images().get("images/ui_basic/scrollbar_down.png"),62 g_gr->images().get("images/ui_basic/scrollbar_down.png"),
63 std::string(),63 std::string(),
64 1 < increase_tool.get_change_by()),64 1 < increase_tool.get_change_by()),
65 m_change_by_value65 change_by_value_
66 (this,66 (this,
67 m_change_by_increase.get_x() + m_change_by_increase.get_w() +67 change_by_increase_.get_x() + change_by_increase_.get_w() +
68 hspacing(),68 hspacing(),
69 m_change_by_increase.get_y(),69 change_by_increase_.get_y(),
70 m_change_by_decrease.get_x() - hspacing()70 change_by_decrease_.get_x() - hspacing()
71 -71 -
72 (m_change_by_increase.get_x() + m_change_by_increase.get_w() +72 (change_by_increase_.get_x() + change_by_increase_.get_w() +
73 hspacing()),73 hspacing()),
74 height,74 height,
75 UI::Align::kBottomCenter),75 UI::Align::kBottomCenter),
76 m_set_to_label76 set_to_label_
77 (this,77 (this,
78 vmargin(),78 vmargin(),
79 m_change_by_increase.get_y() + m_change_by_increase.get_h() +79 change_by_increase_.get_y() + change_by_increase_.get_h() +
80 vspacing(),80 vspacing(),
81 get_inner_w() - 2 * hmargin(), height,81 get_inner_w() - 2 * hmargin(), height,
82 _("Set Value"), UI::Align::kBottomCenter),82 _("Set Value"), UI::Align::kBottomCenter),
83 m_set_to_increase83 set_to_increase_
84 (this, "incr_set_to",84 (this, "incr_set_to",
85 m_change_by_increase.get_x(),85 change_by_increase_.get_x(),
86 m_set_to_label.get_y() + m_set_to_label.get_h() + vspacing(),86 set_to_label_.get_y() + set_to_label_.get_h() + vspacing(),
87 width, height,87 width, height,
88 g_gr->images().get("images/ui_basic/but1.png"),88 g_gr->images().get("images/ui_basic/but1.png"),
89 g_gr->images().get("images/ui_basic/scrollbar_up.png"),89 g_gr->images().get("images/ui_basic/scrollbar_up.png"),
90 std::string(),90 std::string(),
91 increase_tool.set_tool().get_interval().min < MAX_FIELD_HEIGHT),91 increase_tool.set_tool().get_interval().min < MAX_FIELD_HEIGHT),
92 m_set_to_decrease92 set_to_decrease_
93 (this, "decr_set_to",93 (this, "decr_set_to",
94 hmargin(),94 hmargin(),
95 m_set_to_increase.get_y(),95 set_to_increase_.get_y(),
96 width, height,96 width, height,
97 g_gr->images().get("images/ui_basic/but1.png"),97 g_gr->images().get("images/ui_basic/but1.png"),
98 g_gr->images().get("images/ui_basic/scrollbar_down.png"),98 g_gr->images().get("images/ui_basic/scrollbar_down.png"),
99 std::string(),99 std::string(),
100 0 < increase_tool.set_tool().get_interval().min),100 0 < increase_tool.set_tool().get_interval().min),
101 m_set_to_value101 set_to_value_
102 (this,102 (this,
103 m_change_by_value.get_x(), m_set_to_increase.get_y(),103 change_by_value_.get_x(), set_to_increase_.get_y(),
104 m_change_by_value.get_w(), height,104 change_by_value_.get_w(), height,
105 UI::Align::kBottomCenter)105 UI::Align::kBottomCenter)
106{106{
107 m_change_by_increase.sigclicked.connect107 change_by_increase_.sigclicked.connect
108 (boost::bind108 (boost::bind
109 (&EditorToolChangeHeightOptionsMenu::clicked_change_by_increment, boost::ref(*this)));109 (&EditorToolChangeHeightOptionsMenu::clicked_change_by_increment, boost::ref(*this)));
110 m_change_by_decrease.sigclicked.connect110 change_by_decrease_.sigclicked.connect
111 (boost::bind111 (boost::bind
112 (&EditorToolChangeHeightOptionsMenu::clicked_change_by_decrement, boost::ref(*this)));112 (&EditorToolChangeHeightOptionsMenu::clicked_change_by_decrement, boost::ref(*this)));
113 m_set_to_increase.sigclicked.connect113 set_to_increase_.sigclicked.connect
114 (boost::bind(&EditorToolChangeHeightOptionsMenu::clicked_setto_increment, boost::ref(*this)));114 (boost::bind(&EditorToolChangeHeightOptionsMenu::clicked_setto_increment, boost::ref(*this)));
115 m_set_to_decrease.sigclicked.connect115 set_to_decrease_.sigclicked.connect
116 (boost::bind(&EditorToolChangeHeightOptionsMenu::clicked_setto_decrement, boost::ref(*this)));116 (boost::bind(&EditorToolChangeHeightOptionsMenu::clicked_setto_decrement, boost::ref(*this)));
117117
118 m_change_by_increase.set_repeating(true);118 change_by_increase_.set_repeating(true);
119 m_change_by_decrease.set_repeating(true);119 change_by_decrease_.set_repeating(true);
120 m_set_to_increase .set_repeating(true);120 set_to_increase_ .set_repeating(true);
121 m_set_to_decrease .set_repeating(true);121 set_to_decrease_ .set_repeating(true);
122 update();122 update();
123}123}
124124
125125
126void EditorToolChangeHeightOptionsMenu::clicked_change_by_decrement() {126void EditorToolChangeHeightOptionsMenu::clicked_change_by_decrement() {
127 int32_t change_by = m_increase_tool.get_change_by();127 int32_t change_by = increase_tool_.get_change_by();
128 assert(change_by == m_increase_tool.decrease_tool().get_change_by());128 assert(change_by == increase_tool_.decrease_tool().get_change_by());
129 assert(1 < change_by);129 assert(1 < change_by);
130130
131 --change_by;131 --change_by;
132132
133 m_increase_tool .set_change_by(change_by);133 increase_tool_ .set_change_by(change_by);
134 m_increase_tool.decrease_tool().set_change_by(change_by);134 increase_tool_.decrease_tool().set_change_by(change_by);
135 m_change_by_decrease.set_enabled(1 < change_by);135 change_by_decrease_.set_enabled(1 < change_by);
136 m_change_by_increase.set_enabled(true);136 change_by_increase_.set_enabled(true);
137 select_correct_tool();137 select_correct_tool();
138 update();138 update();
139}139}
140140
141141
142void EditorToolChangeHeightOptionsMenu::clicked_change_by_increment() {142void EditorToolChangeHeightOptionsMenu::clicked_change_by_increment() {
143 int32_t change_by = m_increase_tool.get_change_by();143 int32_t change_by = increase_tool_.get_change_by();
144 assert(change_by == m_increase_tool.decrease_tool().get_change_by());144 assert(change_by == increase_tool_.decrease_tool().get_change_by());
145 assert(change_by < MAX_FIELD_HEIGHT_DIFF);145 assert(change_by < MAX_FIELD_HEIGHT_DIFF);
146146
147 ++change_by;147 ++change_by;
148148
149 m_increase_tool .set_change_by(change_by);149 increase_tool_ .set_change_by(change_by);
150 m_increase_tool.decrease_tool().set_change_by(change_by);150 increase_tool_.decrease_tool().set_change_by(change_by);
151 m_change_by_decrease.set_enabled(true);151 change_by_decrease_.set_enabled(true);
152 m_change_by_increase.set_enabled(change_by < MAX_FIELD_HEIGHT_DIFF);152 change_by_increase_.set_enabled(change_by < MAX_FIELD_HEIGHT_DIFF);
153 select_correct_tool();153 select_correct_tool();
154 update();154 update();
155}155}
@@ -157,16 +157,16 @@
157157
158void EditorToolChangeHeightOptionsMenu::clicked_setto_decrement() {158void EditorToolChangeHeightOptionsMenu::clicked_setto_decrement() {
159 Widelands::Field::Height setto =159 Widelands::Field::Height setto =
160 m_increase_tool.set_tool().get_interval().min;160 increase_tool_.set_tool().get_interval().min;
161 assert(setto == m_increase_tool.set_tool().get_interval().max);161 assert(setto == increase_tool_.set_tool().get_interval().max);
162 assert(0 < setto);162 assert(0 < setto);
163163
164 --setto;164 --setto;
165165
166 m_increase_tool.set_tool().set_interval166 increase_tool_.set_tool().set_interval
167 (Widelands::HeightInterval(setto, setto));167 (Widelands::HeightInterval(setto, setto));
168 m_set_to_decrease.set_enabled(0 < setto);168 set_to_decrease_.set_enabled(0 < setto);
169 m_set_to_increase.set_enabled(true);169 set_to_increase_.set_enabled(true);
170 select_correct_tool();170 select_correct_tool();
171 update();171 update();
172}172}
@@ -174,16 +174,16 @@
174174
175void EditorToolChangeHeightOptionsMenu::clicked_setto_increment() {175void EditorToolChangeHeightOptionsMenu::clicked_setto_increment() {
176 Widelands::Field::Height setto =176 Widelands::Field::Height setto =
177 m_increase_tool.set_tool().get_interval().min;177 increase_tool_.set_tool().get_interval().min;
178 assert(setto == m_increase_tool.set_tool().get_interval().max);178 assert(setto == increase_tool_.set_tool().get_interval().max);
179 assert(setto < MAX_FIELD_HEIGHT);179 assert(setto < MAX_FIELD_HEIGHT);
180180
181 ++setto;181 ++setto;
182182
183 m_increase_tool.set_tool().set_interval183 increase_tool_.set_tool().set_interval
184 (Widelands::HeightInterval(setto, setto));184 (Widelands::HeightInterval(setto, setto));
185 m_set_to_decrease.set_enabled(true);185 set_to_decrease_.set_enabled(true);
186 m_set_to_increase.set_enabled(setto < MAX_FIELD_HEIGHT);186 set_to_increase_.set_enabled(setto < MAX_FIELD_HEIGHT);
187 select_correct_tool();187 select_correct_tool();
188 update();188 update();
189}189}
@@ -191,8 +191,8 @@
191191
192/// Update all the textareas, so that they represent the correct values.192/// Update all the textareas, so that they represent the correct values.
193void EditorToolChangeHeightOptionsMenu::update() {193void EditorToolChangeHeightOptionsMenu::update() {
194 m_change_by_value.set_text(std::to_string(m_increase_tool.get_change_by()));194 change_by_value_.set_text(std::to_string(increase_tool_.get_change_by()));
195195
196 m_set_to_value.set_text(std::to_string(196 set_to_value_.set_text(std::to_string(
197 static_cast<unsigned int>(m_increase_tool.set_tool().get_interval().min)));197 static_cast<unsigned int>(increase_tool_.set_tool().get_interval().min)));
198}198}
199199
=== modified file 'src/editor/ui_menus/editor_tool_change_height_options_menu.h'
--- src/editor/ui_menus/editor_tool_change_height_options_menu.h 2016-01-16 12:55:14 +0000
+++ src/editor/ui_menus/editor_tool_change_height_options_menu.h 2016-03-18 12:52:47 +0000
@@ -36,13 +36,13 @@
36 UI::UniqueWindow::Registry &);36 UI::UniqueWindow::Registry &);
3737
38private:38private:
39 EditorIncreaseHeightTool & m_increase_tool;39 EditorIncreaseHeightTool& increase_tool_;
40 UI::Textarea m_change_by_label;40 UI::Textarea change_by_label_;
41 UI::Button m_change_by_increase, m_change_by_decrease;41 UI::Button change_by_increase_, change_by_decrease_;
42 UI::Textarea m_change_by_value;42 UI::Textarea change_by_value_;
43 UI::Textarea m_set_to_label;43 UI::Textarea set_to_label_;
44 UI::Button m_set_to_increase, m_set_to_decrease;44 UI::Button set_to_increase_, set_to_decrease_;
45 UI::Textarea m_set_to_value;45 UI::Textarea set_to_value_;
4646
47 void clicked_change_by_decrement();47 void clicked_change_by_decrement();
48 void clicked_change_by_increment();48 void clicked_change_by_increment();
4949
=== modified file 'src/editor/ui_menus/editor_tool_change_resources_options_menu.cc'
--- src/editor/ui_menus/editor_tool_change_resources_options_menu.cc 2016-02-01 07:51:56 +0000
+++ src/editor/ui_menus/editor_tool_change_resources_options_menu.cc 2016-03-18 12:52:47 +0000
@@ -52,87 +52,87 @@
52 :52 :
53 EditorToolOptionsMenu53 EditorToolOptionsMenu
54 (parent, registry, 250, 120, _("Resources")),54 (parent, registry, 250, 120, _("Resources")),
55 m_change_by_label55 change_by_label_
56 (this,56 (this,
57 hmargin(), vmargin(), get_inner_w() - 2 * hmargin(), BUTTON_HEIGHT,57 hmargin(), vmargin(), get_inner_w() - 2 * hmargin(), BUTTON_HEIGHT,
58 _("Increase/Decrease Value"), UI::Align::kBottomCenter),58 _("Increase/Decrease Value"), UI::Align::kBottomCenter),
59 m_change_by_increase59 change_by_increase_
60 (this, "incr_change_by",60 (this, "incr_change_by",
61 get_inner_w() - hmargin() - BUTTON_WIDTH,61 get_inner_w() - hmargin() - BUTTON_WIDTH,
62 m_change_by_label.get_y() + m_change_by_label.get_h() + spacing(),62 change_by_label_.get_y() + change_by_label_.get_h() + spacing(),
63 BUTTON_WIDTH, BUTTON_HEIGHT,63 BUTTON_WIDTH, BUTTON_HEIGHT,
64 g_gr->images().get("images/ui_basic/but1.png"),64 g_gr->images().get("images/ui_basic/but1.png"),
65 g_gr->images().get("images/ui_basic/scrollbar_up.png")),65 g_gr->images().get("images/ui_basic/scrollbar_up.png")),
66 m_change_by_decrease66 change_by_decrease_
67 (this, "decr_change_by",67 (this, "decr_change_by",
68 hmargin(),68 hmargin(),
69 m_change_by_increase.get_y(),69 change_by_increase_.get_y(),
70 BUTTON_WIDTH, BUTTON_HEIGHT,70 BUTTON_WIDTH, BUTTON_HEIGHT,
71 g_gr->images().get("images/ui_basic/but1.png"),71 g_gr->images().get("images/ui_basic/but1.png"),
72 g_gr->images().get("images/ui_basic/scrollbar_down.png")),72 g_gr->images().get("images/ui_basic/scrollbar_down.png")),
73 m_change_by_value73 change_by_value_
74 (this,74 (this,
75 m_change_by_increase.get_x() + m_change_by_increase.get_w() +75 change_by_increase_.get_x() + change_by_increase_.get_w() +
76 hspacing(),76 hspacing(),
77 m_change_by_increase.get_y(),77 change_by_increase_.get_y(),
78 m_change_by_decrease.get_x() - hspacing()78 change_by_decrease_.get_x() - hspacing()
79 -79 -
80 (m_change_by_increase.get_x() + m_change_by_increase.get_w() +80 (change_by_increase_.get_x() + change_by_increase_.get_w() +
81 hspacing()),81 hspacing()),
82 BUTTON_HEIGHT,82 BUTTON_HEIGHT,
83 UI::Align::kBottomCenter),83 UI::Align::kBottomCenter),
84 m_set_to_label84 set_to_label_
85 (this,85 (this,
86 vmargin(),86 vmargin(),
87 m_change_by_increase.get_y() + m_change_by_increase.get_h() + vspacing(),87 change_by_increase_.get_y() + change_by_increase_.get_h() + vspacing(),
88 get_inner_w() - 2 * hmargin(), BUTTON_HEIGHT,88 get_inner_w() - 2 * hmargin(), BUTTON_HEIGHT,
89 _("Set Value"), UI::Align::kBottomCenter),89 _("Set Value"), UI::Align::kBottomCenter),
90 m_set_to_increase90 set_to_increase_
91 (this, "incr_set_to",91 (this, "incr_set_to",
92 m_change_by_increase.get_x(),92 change_by_increase_.get_x(),
93 m_set_to_label.get_y() + m_set_to_label.get_h() + vspacing(),93 set_to_label_.get_y() + set_to_label_.get_h() + vspacing(),
94 BUTTON_WIDTH, BUTTON_HEIGHT,94 BUTTON_WIDTH, BUTTON_HEIGHT,
95 g_gr->images().get("images/ui_basic/but1.png"),95 g_gr->images().get("images/ui_basic/but1.png"),
96 g_gr->images().get("images/ui_basic/scrollbar_up.png")),96 g_gr->images().get("images/ui_basic/scrollbar_up.png")),
97 m_set_to_decrease97 set_to_decrease_
98 (this, "decr_set_to",98 (this, "decr_set_to",
99 hmargin(),99 hmargin(),
100 m_set_to_increase.get_y(), BUTTON_WIDTH, BUTTON_HEIGHT,100 set_to_increase_.get_y(), BUTTON_WIDTH, BUTTON_HEIGHT,
101 g_gr->images().get("images/ui_basic/but1.png"),101 g_gr->images().get("images/ui_basic/but1.png"),
102 g_gr->images().get("images/ui_basic/scrollbar_down.png")),102 g_gr->images().get("images/ui_basic/scrollbar_down.png")),
103 m_set_to_value103 set_to_value_
104 (this,104 (this,
105 m_change_by_value.get_x(), m_set_to_increase.get_y(),105 change_by_value_.get_x(), set_to_increase_.get_y(),
106 m_change_by_value.get_w(), BUTTON_HEIGHT,106 change_by_value_.get_w(), BUTTON_HEIGHT,
107 UI::Align::kBottomCenter),107 UI::Align::kBottomCenter),
108 m_cur_selection(this, 0, 0, _("Current Selection"), UI::Align::kBottomCenter),108 cur_selection_(this, 0, 0, _("Current Selection"), UI::Align::kBottomCenter),
109 m_increase_tool(increase_tool)109 increase_tool_(increase_tool)
110{110{
111 m_change_by_increase.sigclicked.connect111 change_by_increase_.sigclicked.connect
112 (boost::bind112 (boost::bind
113 (&EditorToolChangeResourcesOptionsMenu::clicked_button,113 (&EditorToolChangeResourcesOptionsMenu::clicked_button,
114 boost::ref(*this),114 boost::ref(*this),
115 Change_By_Increase));115 Change_By_Increase));
116 m_change_by_decrease.sigclicked.connect116 change_by_decrease_.sigclicked.connect
117 (boost::bind117 (boost::bind
118 (&EditorToolChangeResourcesOptionsMenu::clicked_button,118 (&EditorToolChangeResourcesOptionsMenu::clicked_button,
119 boost::ref(*this),119 boost::ref(*this),
120 Change_By_Decrease));120 Change_By_Decrease));
121 m_set_to_increase.sigclicked.connect121 set_to_increase_.sigclicked.connect
122 (boost::bind122 (boost::bind
123 (&EditorToolChangeResourcesOptionsMenu::clicked_button,123 (&EditorToolChangeResourcesOptionsMenu::clicked_button,
124 boost::ref(*this),124 boost::ref(*this),
125 Set_To_Increase));125 Set_To_Increase));
126 m_set_to_decrease.sigclicked.connect126 set_to_decrease_.sigclicked.connect
127 (boost::bind127 (boost::bind
128 (&EditorToolChangeResourcesOptionsMenu::clicked_button,128 (&EditorToolChangeResourcesOptionsMenu::clicked_button,
129 boost::ref(*this),129 boost::ref(*this),
130 Set_To_Decrease));130 Set_To_Decrease));
131131
132 m_change_by_increase.set_repeating(true);132 change_by_increase_.set_repeating(true);
133 m_change_by_decrease.set_repeating(true);133 change_by_decrease_.set_repeating(true);
134 m_set_to_increase .set_repeating(true);134 set_to_increase_ .set_repeating(true);
135 m_set_to_decrease .set_repeating(true);135 set_to_decrease_ .set_repeating(true);
136 const Widelands::World & world = parent.egbase().world();136 const Widelands::World & world = parent.egbase().world();
137 Widelands::DescriptionIndex const nr_resources = world.get_nr_resources();137 Widelands::DescriptionIndex const nr_resources = world.get_nr_resources();
138138
@@ -149,14 +149,14 @@
149 /149 /
150 (resource_pic_max_width + spacing());150 (resource_pic_max_width + spacing());
151151
152 m_radiogroup.changed.connect152 radiogroup_.changed.connect
153 (boost::bind(&EditorToolChangeResourcesOptionsMenu::selected, this));153 (boost::bind(&EditorToolChangeResourcesOptionsMenu::selected, this));
154 m_radiogroup.clicked.connect154 radiogroup_.clicked.connect
155 (boost::bind(&EditorToolChangeResourcesOptionsMenu::selected, this));155 (boost::bind(&EditorToolChangeResourcesOptionsMenu::selected, this));
156156
157 uint16_t cur_x = 0;157 uint16_t cur_x = 0;
158 Point pos158 Point pos
159 (hmargin(), m_set_to_value.get_y() + m_set_to_value.get_h() + vspacing());159 (hmargin(), set_to_value_.get_y() + set_to_value_.get_h() + vspacing());
160 for160 for
161 (Widelands::DescriptionIndex i = 0;161 (Widelands::DescriptionIndex i = 0;
162 i < nr_resources;162 i < nr_resources;
@@ -167,17 +167,17 @@
167 pos.x = hmargin();167 pos.x = hmargin();
168 pos.y += resource_pic_max_height + vspacing();168 pos.y += resource_pic_max_height + vspacing();
169 }169 }
170 m_radiogroup.add_button170 radiogroup_.add_button
171 (this,171 (this,
172 pos,172 pos,
173 g_gr->images().get(world.get_resource(i)->representative_image()));173 g_gr->images().get(world.get_resource(i)->representative_image()));
174 }174 }
175 pos.y += resource_pic_max_height + vspacing();175 pos.y += resource_pic_max_height + vspacing();
176176
177 set_inner_size(get_inner_w(), pos.y + m_cur_selection.get_h() + vmargin());177 set_inner_size(get_inner_w(), pos.y + cur_selection_.get_h() + vmargin());
178 m_cur_selection.set_pos(Point(get_inner_w() / 2, pos.y + hspacing()));178 cur_selection_.set_pos(Point(get_inner_w() / 2, pos.y + hspacing()));
179179
180 m_radiogroup.set_state(m_increase_tool.get_cur_res());180 radiogroup_.set_state(increase_tool_.get_cur_res());
181181
182 update();182 update();
183}183}
@@ -186,12 +186,12 @@
186void EditorToolChangeResourcesOptionsMenu::clicked_button(Button const n)186void EditorToolChangeResourcesOptionsMenu::clicked_button(Button const n)
187{187{
188 assert188 assert
189 (m_increase_tool.get_change_by()189 (increase_tool_.get_change_by()
190 ==190 ==
191 m_increase_tool.decrease_tool().get_change_by());191 increase_tool_.decrease_tool().get_change_by());
192192
193 int32_t change_by = m_increase_tool.get_change_by();193 int32_t change_by = increase_tool_.get_change_by();
194 int32_t set_to = m_increase_tool.set_tool().get_set_to();194 int32_t set_to = increase_tool_.set_tool().get_set_to();
195195
196 switch (n) {196 switch (n) {
197 case Change_By_Increase: change_by += change_by < 63; break;197 case Change_By_Increase: change_by += change_by < 63; break;
@@ -202,9 +202,9 @@
202 NEVER_HERE();202 NEVER_HERE();
203 break;203 break;
204 }204 }
205 m_increase_tool.set_change_by(change_by);205 increase_tool_.set_change_by(change_by);
206 m_increase_tool.decrease_tool().set_change_by(change_by);206 increase_tool_.decrease_tool().set_change_by(change_by);
207 m_increase_tool.set_tool().set_set_to(set_to);207 increase_tool_.set_tool().set_set_to(set_to);
208208
209 select_correct_tool();209 select_correct_tool();
210 update();210 update();
@@ -214,11 +214,11 @@
214 * called when a resource has been selected214 * called when a resource has been selected
215 */215 */
216void EditorToolChangeResourcesOptionsMenu::selected() {216void EditorToolChangeResourcesOptionsMenu::selected() {
217 const int32_t resIx = m_radiogroup.get_state();217 const int32_t resIx = radiogroup_.get_state();
218218
219 m_increase_tool.set_tool().set_cur_res(resIx);219 increase_tool_.set_tool().set_cur_res(resIx);
220 m_increase_tool.set_cur_res(resIx);220 increase_tool_.set_cur_res(resIx);
221 m_increase_tool.decrease_tool().set_cur_res(resIx);221 increase_tool_.decrease_tool().set_cur_res(resIx);
222222
223 Widelands::EditorGameBase& egbase = eia().egbase();223 Widelands::EditorGameBase& egbase = eia().egbase();
224 Widelands::Map & map = egbase.map();224 Widelands::Map & map = egbase.map();
@@ -241,25 +241,25 @@
241*/241*/
242void EditorToolChangeResourcesOptionsMenu::update() {242void EditorToolChangeResourcesOptionsMenu::update() {
243243
244 m_change_by_value.set_text(std::to_string(m_increase_tool.get_change_by()));244 change_by_value_.set_text(std::to_string(increase_tool_.get_change_by()));
245245
246 m_set_to_value.set_text(std::to_string(246 set_to_value_.set_text(std::to_string(
247 static_cast<unsigned int>(m_increase_tool.set_tool().get_set_to())));247 static_cast<unsigned int>(increase_tool_.set_tool().get_set_to())));
248248
249 m_cur_selection.set_text249 cur_selection_.set_text
250 (eia().egbase().world().get_resource(m_increase_tool.set_tool().get_cur_res())->descname());250 (eia().egbase().world().get_resource(increase_tool_.set_tool().get_cur_res())->descname());
251 m_cur_selection.set_pos251 cur_selection_.set_pos
252 (Point252 (Point
253 ((get_inner_w() - m_cur_selection.get_w()) / 2, get_inner_h() - 20));253 ((get_inner_w() - cur_selection_.get_w()) / 2, get_inner_h() - 20));
254254
255 {255 {
256 int32_t const change_by = m_increase_tool.get_change_by();256 int32_t const change_by = increase_tool_.get_change_by();
257 m_change_by_decrease.set_enabled(1 < change_by);257 change_by_decrease_.set_enabled(1 < change_by);
258 m_change_by_increase.set_enabled (change_by < 63);258 change_by_increase_.set_enabled (change_by < 63);
259 }259 }
260 {260 {
261 int32_t const set_to = m_increase_tool.set_tool().get_set_to();261 int32_t const set_to = increase_tool_.set_tool().get_set_to();
262 m_set_to_decrease .set_enabled(0 < set_to);262 set_to_decrease_ .set_enabled(0 < set_to);
263 m_set_to_increase .set_enabled (set_to < 63);263 set_to_increase_ .set_enabled (set_to < 63);
264 }264 }
265}265}
266266
=== modified file 'src/editor/ui_menus/editor_tool_change_resources_options_menu.h'
--- src/editor/ui_menus/editor_tool_change_resources_options_menu.h 2016-01-16 12:55:14 +0000
+++ src/editor/ui_menus/editor_tool_change_resources_options_menu.h 2016-03-18 12:52:47 +0000
@@ -45,15 +45,15 @@
45 };45 };
46 void clicked_button(Button);46 void clicked_button(Button);
47 void update();47 void update();
48 UI::Textarea m_change_by_label;48 UI::Textarea change_by_label_;
49 UI::Button m_change_by_increase, m_change_by_decrease;49 UI::Button change_by_increase_, change_by_decrease_;
50 UI::Textarea m_change_by_value;50 UI::Textarea change_by_value_;
51 UI::Textarea m_set_to_label;51 UI::Textarea set_to_label_;
52 UI::Button m_set_to_increase, m_set_to_decrease;52 UI::Button set_to_increase_, set_to_decrease_;
53 UI::Textarea m_set_to_value;53 UI::Textarea set_to_value_;
54 UI::Textarea m_cur_selection;54 UI::Textarea cur_selection_;
55 UI::Radiogroup m_radiogroup;55 UI::Radiogroup radiogroup_;
56 EditorIncreaseResourcesTool & m_increase_tool;56 EditorIncreaseResourcesTool& increase_tool_;
57};57};
5858
59#endif // end of include guard: WL_EDITOR_UI_MENUS_EDITOR_TOOL_CHANGE_RESOURCES_OPTIONS_MENU_H59#endif // end of include guard: WL_EDITOR_UI_MENUS_EDITOR_TOOL_CHANGE_RESOURCES_OPTIONS_MENU_H
6060
=== modified file 'src/editor/ui_menus/editor_tool_noise_height_options_menu.cc'
--- src/editor/ui_menus/editor_tool_noise_height_options_menu.cc 2016-01-29 08:37:22 +0000
+++ src/editor/ui_menus/editor_tool_noise_height_options_menu.cc 2016-03-18 12:52:47 +0000
@@ -43,99 +43,99 @@
43 :43 :
44 EditorToolOptionsMenu44 EditorToolOptionsMenu
45 (parent, registry, 250, 3 * height + 4 * vspacing() + 2 * vmargin(), _("Noise Height Options")),45 (parent, registry, 250, 3 * height + 4 * vspacing() + 2 * vmargin(), _("Noise Height Options")),
46 m_noise_tool(noise_tool),46 noise_tool_(noise_tool),
47 m_lower_label47 lower_label_
48 (this,48 (this,
49 hmargin(),49 hmargin(),
50 vmargin(),50 vmargin(),
51 width, height,51 width, height,
52 UI::Align::kLeft),52 UI::Align::kLeft),
53 m_upper_label53 upper_label_
54 (this,54 (this,
55 hmargin(),55 hmargin(),
56 m_lower_label.get_y() + m_lower_label.get_h() + 2 * vspacing(),56 lower_label_.get_y() + lower_label_.get_h() + 2 * vspacing(),
57 width, height,57 width, height,
58 UI::Align::kLeft),58 UI::Align::kLeft),
59 m_lower_decrease59 lower_decrease_
60 (this, "decr_lower",60 (this, "decr_lower",
61 get_inner_w() - 2 * width - hspacing(),61 get_inner_w() - 2 * width - hspacing(),
62 m_lower_label.get_y(),62 lower_label_.get_y(),
63 width, height,63 width, height,
64 g_gr->images().get("images/ui_basic/but0.png"),64 g_gr->images().get("images/ui_basic/but0.png"),
65 g_gr->images().get("images/ui_basic/scrollbar_down.png"),65 g_gr->images().get("images/ui_basic/scrollbar_down.png"),
66 std::string(),66 std::string(),
67 0 < noise_tool.get_interval().min),67 0 < noise_tool.get_interval().min),
68 m_lower_increase68 lower_increase_
69 (this, "incr_lower",69 (this, "incr_lower",
70 get_inner_w() - width - hspacing(),70 get_inner_w() - width - hspacing(),
71 m_lower_label.get_y(),71 lower_label_.get_y(),
72 width, height,72 width, height,
73 g_gr->images().get("images/ui_basic/but0.png"),73 g_gr->images().get("images/ui_basic/but0.png"),
74 g_gr->images().get("images/ui_basic/scrollbar_up.png"),74 g_gr->images().get("images/ui_basic/scrollbar_up.png"),
75 std::string(),75 std::string(),
76 noise_tool.get_interval().min < MAX_FIELD_HEIGHT),76 noise_tool.get_interval().min < MAX_FIELD_HEIGHT),
77 m_upper_decrease77 upper_decrease_
78 (this, "decr_upper",78 (this, "decr_upper",
79 get_inner_w() - 2 * width - hspacing(),79 get_inner_w() - 2 * width - hspacing(),
80 m_upper_label.get_y(),80 upper_label_.get_y(),
81 width, height,81 width, height,
82 g_gr->images().get("images/ui_basic/but0.png"),82 g_gr->images().get("images/ui_basic/but0.png"),
83 g_gr->images().get("images/ui_basic/scrollbar_down.png"),83 g_gr->images().get("images/ui_basic/scrollbar_down.png"),
84 std::string(),84 std::string(),
85 0 < noise_tool.get_interval().max),85 0 < noise_tool.get_interval().max),
86 m_upper_increase86 upper_increase_
87 (this, "incr_upper",87 (this, "incr_upper",
88 get_inner_w() - width - hspacing(),88 get_inner_w() - width - hspacing(),
89 m_upper_label.get_y(),89 upper_label_.get_y(),
90 width, height,90 width, height,
91 g_gr->images().get("images/ui_basic/but0.png"),91 g_gr->images().get("images/ui_basic/but0.png"),
92 g_gr->images().get("images/ui_basic/scrollbar_up.png"),92 g_gr->images().get("images/ui_basic/scrollbar_up.png"),
93 std::string(),93 std::string(),
94 noise_tool.get_interval().max < MAX_FIELD_HEIGHT),94 noise_tool.get_interval().max < MAX_FIELD_HEIGHT),
95 m_set_label95 set_label_
96 (this,96 (this,
97 hmargin(),97 hmargin(),
98 m_upper_label.get_y() + m_upper_label.get_h() + 2 * vspacing(),98 upper_label_.get_y() + upper_label_.get_h() + 2 * vspacing(),
99 width, height,99 width, height,
100 UI::Align::kLeft),100 UI::Align::kLeft),
101 m_setto_decrease101 setto_decrease_
102 (this, "decr_set_to",102 (this, "decr_set_to",
103 get_inner_w() - 2 * width - hspacing(),103 get_inner_w() - 2 * width - hspacing(),
104 m_set_label.get_y(),104 set_label_.get_y(),
105 width, height,105 width, height,
106 g_gr->images().get("images/ui_basic/but1.png"),106 g_gr->images().get("images/ui_basic/but1.png"),
107 g_gr->images().get("images/ui_basic/scrollbar_down.png"),107 g_gr->images().get("images/ui_basic/scrollbar_down.png"),
108 std::string(),108 std::string(),
109 0 < noise_tool.set_tool().get_interval().min),109 0 < noise_tool.set_tool().get_interval().min),
110 m_setto_increase110 setto_increase_
111 (this, "incr_set_to",111 (this, "incr_set_to",
112 get_inner_w() - width - hspacing(),112 get_inner_w() - width - hspacing(),
113 m_set_label.get_y(),113 set_label_.get_y(),
114 width, height,114 width, height,
115 g_gr->images().get("images/ui_basic/but1.png"),115 g_gr->images().get("images/ui_basic/but1.png"),
116 g_gr->images().get("images/ui_basic/scrollbar_up.png"),116 g_gr->images().get("images/ui_basic/scrollbar_up.png"),
117 std::string(),117 std::string(),
118 noise_tool.set_tool().get_interval().max < MAX_FIELD_HEIGHT)118 noise_tool.set_tool().get_interval().max < MAX_FIELD_HEIGHT)
119{119{
120 m_lower_increase.sigclicked.connect120 lower_increase_.sigclicked.connect
121 (boost::bind(&EditorToolNoiseHeightOptionsMenu::clicked_lower_increase, boost::ref(*this)));121 (boost::bind(&EditorToolNoiseHeightOptionsMenu::clicked_lower_increase, boost::ref(*this)));
122 m_lower_decrease.sigclicked.connect122 lower_decrease_.sigclicked.connect
123 (boost::bind(&EditorToolNoiseHeightOptionsMenu::clicked_lower_decrease, boost::ref(*this)));123 (boost::bind(&EditorToolNoiseHeightOptionsMenu::clicked_lower_decrease, boost::ref(*this)));
124 m_upper_increase.sigclicked.connect124 upper_increase_.sigclicked.connect
125 (boost::bind(&EditorToolNoiseHeightOptionsMenu::clicked_upper_increase, boost::ref(*this)));125 (boost::bind(&EditorToolNoiseHeightOptionsMenu::clicked_upper_increase, boost::ref(*this)));
126 m_upper_decrease.sigclicked.connect126 upper_decrease_.sigclicked.connect
127 (boost::bind(&EditorToolNoiseHeightOptionsMenu::clicked_upper_decrease, boost::ref(*this)));127 (boost::bind(&EditorToolNoiseHeightOptionsMenu::clicked_upper_decrease, boost::ref(*this)));
128 m_setto_increase.sigclicked.connect128 setto_increase_.sigclicked.connect
129 (boost::bind(&EditorToolNoiseHeightOptionsMenu::clicked_setto_increase, boost::ref(*this)));129 (boost::bind(&EditorToolNoiseHeightOptionsMenu::clicked_setto_increase, boost::ref(*this)));
130 m_setto_decrease.sigclicked.connect130 setto_decrease_.sigclicked.connect
131 (boost::bind(&EditorToolNoiseHeightOptionsMenu::clicked_setto_decrease, boost::ref(*this)));131 (boost::bind(&EditorToolNoiseHeightOptionsMenu::clicked_setto_decrease, boost::ref(*this)));
132132
133 m_lower_increase.set_repeating(true);133 lower_increase_.set_repeating(true);
134 m_lower_decrease.set_repeating(true);134 lower_decrease_.set_repeating(true);
135 m_upper_increase.set_repeating(true);135 upper_increase_.set_repeating(true);
136 m_upper_decrease.set_repeating(true);136 upper_decrease_.set_repeating(true);
137 m_setto_increase.set_repeating(true);137 setto_increase_.set_repeating(true);
138 m_setto_decrease.set_repeating(true);138 setto_decrease_.set_repeating(true);
139 update();139 update();
140}140}
141141
@@ -143,23 +143,23 @@
143 * Update all textareas143 * Update all textareas
144*/144*/
145void EditorToolNoiseHeightOptionsMenu::update() {145void EditorToolNoiseHeightOptionsMenu::update() {
146 const Widelands::HeightInterval height_interval = m_noise_tool.get_interval();146 const Widelands::HeightInterval height_interval = noise_tool_.get_interval();
147147
148 m_lower_label.set_text((boost::format(_("Minimum: %u"))148 lower_label_.set_text((boost::format(_("Minimum: %u"))
149 % static_cast<unsigned int>(height_interval.min)).str());149 % static_cast<unsigned int>(height_interval.min)).str());
150150
151 m_upper_label.set_text((boost::format(_("Maximum: %u"))151 upper_label_.set_text((boost::format(_("Maximum: %u"))
152 % static_cast<unsigned int>(height_interval.max)).str());152 % static_cast<unsigned int>(height_interval.max)).str());
153153
154 m_set_label.set_text((boost::format(_("Set value: %u"))154 set_label_.set_text((boost::format(_("Set value: %u"))
155 % static_cast<unsigned int>(m_noise_tool.set_tool().get_interval().min)).str());155 % static_cast<unsigned int>(noise_tool_.set_tool().get_interval().min)).str());
156156
157 select_correct_tool();157 select_correct_tool();
158}158}
159159
160160
161void EditorToolNoiseHeightOptionsMenu::clicked_lower_decrease() {161void EditorToolNoiseHeightOptionsMenu::clicked_lower_decrease() {
162 Widelands::HeightInterval height_interval = m_noise_tool.get_interval();162 Widelands::HeightInterval height_interval = noise_tool_.get_interval();
163163
164 assert(height_interval.valid());164 assert(height_interval.valid());
165 assert(0 < height_interval.min);165 assert(0 < height_interval.min);
@@ -168,15 +168,15 @@
168168
169 assert(height_interval.valid());169 assert(height_interval.valid());
170170
171 m_noise_tool.set_interval(height_interval);171 noise_tool_.set_interval(height_interval);
172 m_lower_decrease.set_enabled(0 < height_interval.min);172 lower_decrease_.set_enabled(0 < height_interval.min);
173 m_lower_increase.set_enabled(true);173 lower_increase_.set_enabled(true);
174 update();174 update();
175}175}
176176
177177
178void EditorToolNoiseHeightOptionsMenu::clicked_lower_increase() {178void EditorToolNoiseHeightOptionsMenu::clicked_lower_increase() {
179 Widelands::HeightInterval height_interval = m_noise_tool.get_interval();179 Widelands::HeightInterval height_interval = noise_tool_.get_interval();
180180
181 assert(height_interval.valid());181 assert(height_interval.valid());
182 assert(height_interval.min < MAX_FIELD_HEIGHT);182 assert(height_interval.min < MAX_FIELD_HEIGHT);
@@ -186,55 +186,55 @@
186186
187 assert(height_interval.valid());187 assert(height_interval.valid());
188188
189 m_noise_tool.set_interval(height_interval);189 noise_tool_.set_interval(height_interval);
190 m_lower_decrease.set_enabled(true);190 lower_decrease_.set_enabled(true);
191 m_lower_increase.set_enabled(height_interval.min < MAX_FIELD_HEIGHT);191 lower_increase_.set_enabled(height_interval.min < MAX_FIELD_HEIGHT);
192 m_upper_decrease.set_enabled(true);192 upper_decrease_.set_enabled(true);
193 m_upper_increase.set_enabled(height_interval.max < MAX_FIELD_HEIGHT);193 upper_increase_.set_enabled(height_interval.max < MAX_FIELD_HEIGHT);
194194
195 update();195 update();
196}196}
197197
198198
199void EditorToolNoiseHeightOptionsMenu::clicked_upper_decrease() {199void EditorToolNoiseHeightOptionsMenu::clicked_upper_decrease() {
200 Widelands::HeightInterval height_interval = m_noise_tool.get_interval();200 Widelands::HeightInterval height_interval = noise_tool_.get_interval();
201201
202 assert(height_interval.valid());202 assert(height_interval.valid());
203 assert(0 < m_noise_tool.get_interval().max);203 assert(0 < noise_tool_.get_interval().max);
204204
205 --height_interval.max;205 --height_interval.max;
206 height_interval.min = std::min(height_interval.min, height_interval.max);206 height_interval.min = std::min(height_interval.min, height_interval.max);
207207
208 assert(height_interval.valid());208 assert(height_interval.valid());
209209
210 m_noise_tool.set_interval(height_interval);210 noise_tool_.set_interval(height_interval);
211 m_lower_decrease.set_enabled(0 < height_interval.min);211 lower_decrease_.set_enabled(0 < height_interval.min);
212 m_lower_increase.set_enabled(true);212 lower_increase_.set_enabled(true);
213 m_upper_decrease.set_enabled(0 < height_interval.max);213 upper_decrease_.set_enabled(0 < height_interval.max);
214 m_upper_increase.set_enabled(true);214 upper_increase_.set_enabled(true);
215 update();215 update();
216}216}
217217
218218
219void EditorToolNoiseHeightOptionsMenu::clicked_upper_increase() {219void EditorToolNoiseHeightOptionsMenu::clicked_upper_increase() {
220 Widelands::HeightInterval height_interval = m_noise_tool.get_interval();220 Widelands::HeightInterval height_interval = noise_tool_.get_interval();
221221
222 assert(m_noise_tool.get_interval().valid());222 assert(noise_tool_.get_interval().valid());
223 assert(m_noise_tool.get_interval().max < MAX_FIELD_HEIGHT);223 assert(noise_tool_.get_interval().max < MAX_FIELD_HEIGHT);
224224
225 ++height_interval.max;225 ++height_interval.max;
226226
227 assert(m_noise_tool.get_interval().valid());227 assert(noise_tool_.get_interval().valid());
228228
229 m_noise_tool.set_interval(height_interval);229 noise_tool_.set_interval(height_interval);
230 m_upper_decrease.set_enabled(true);230 upper_decrease_.set_enabled(true);
231 m_upper_increase.set_enabled(height_interval.max < MAX_FIELD_HEIGHT);231 upper_increase_.set_enabled(height_interval.max < MAX_FIELD_HEIGHT);
232 update();232 update();
233}233}
234234
235235
236void EditorToolNoiseHeightOptionsMenu::clicked_setto_decrease() {236void EditorToolNoiseHeightOptionsMenu::clicked_setto_decrease() {
237 EditorSetHeightTool & set_tool = m_noise_tool.set_tool();237 EditorSetHeightTool & set_tool = noise_tool_.set_tool();
238 Field::Height h = set_tool.get_interval().min;238 Field::Height h = set_tool.get_interval().min;
239239
240 assert(h == set_tool.get_interval().max);240 assert(h == set_tool.get_interval().max);
@@ -243,14 +243,14 @@
243 --h;243 --h;
244244
245 set_tool.set_interval(Widelands::HeightInterval(h, h));245 set_tool.set_interval(Widelands::HeightInterval(h, h));
246 m_setto_decrease.set_enabled(0 < h);246 setto_decrease_.set_enabled(0 < h);
247 m_setto_increase.set_enabled(true);247 setto_increase_.set_enabled(true);
248 update();248 update();
249}249}
250250
251251
252void EditorToolNoiseHeightOptionsMenu::clicked_setto_increase() {252void EditorToolNoiseHeightOptionsMenu::clicked_setto_increase() {
253 EditorSetHeightTool & set_tool = m_noise_tool.set_tool();253 EditorSetHeightTool & set_tool = noise_tool_.set_tool();
254 Field::Height h = set_tool.get_interval().min;254 Field::Height h = set_tool.get_interval().min;
255255
256 assert(h == set_tool.get_interval().max);256 assert(h == set_tool.get_interval().max);
@@ -259,7 +259,7 @@
259 ++h;259 ++h;
260260
261 set_tool.set_interval(Widelands::HeightInterval(h, h));261 set_tool.set_interval(Widelands::HeightInterval(h, h));
262 m_setto_decrease.set_enabled(true);262 setto_decrease_.set_enabled(true);
263 m_setto_increase.set_enabled(h < MAX_FIELD_HEIGHT);263 setto_increase_.set_enabled(h < MAX_FIELD_HEIGHT);
264 update();264 update();
265}265}
266266
=== modified file 'src/editor/ui_menus/editor_tool_noise_height_options_menu.h'
--- src/editor/ui_menus/editor_tool_noise_height_options_menu.h 2016-01-16 12:55:14 +0000
+++ src/editor/ui_menus/editor_tool_noise_height_options_menu.h 2016-03-18 12:52:47 +0000
@@ -34,11 +34,11 @@
34 UI::UniqueWindow::Registry &);34 UI::UniqueWindow::Registry &);
3535
36private:36private:
37 EditorNoiseHeightTool & m_noise_tool;37 EditorNoiseHeightTool& noise_tool_;
38 UI::Textarea m_lower_label, m_upper_label;38 UI::Textarea lower_label_, upper_label_;
39 UI::Button m_lower_decrease, m_lower_increase, m_upper_decrease, m_upper_increase;39 UI::Button lower_decrease_, lower_increase_, upper_decrease_, upper_increase_;
40 UI::Textarea m_set_label;40 UI::Textarea set_label_;
41 UI::Button m_setto_decrease, m_setto_increase;41 UI::Button setto_decrease_, setto_increase_;
4242
43 void clicked_lower_decrease();43 void clicked_lower_decrease();
44 void clicked_lower_increase();44 void clicked_lower_increase();
4545
=== modified file 'src/editor/ui_menus/editor_tool_options_menu.cc'
--- src/editor/ui_menus/editor_tool_options_menu.cc 2016-01-16 12:55:14 +0000
+++ src/editor/ui_menus/editor_tool_options_menu.cc 2016-03-18 12:52:47 +0000
@@ -27,7 +27,7 @@
27 :27 :
28 UI::UniqueWindow28 UI::UniqueWindow
29 (&parent, "tool_options_menu", &registry, width, height, title),29 (&parent, "tool_options_menu", &registry, width, height, title),
30 m_current_pointer(parent.tools()->current_pointer)30 current_pointer_(parent.tools()->current_pointer)
31{31{
32 if (get_usedefaultpos())32 if (get_usedefaultpos())
33 center_to_parent();33 center_to_parent();
@@ -36,5 +36,5 @@
3636
37void EditorToolOptionsMenu::select_correct_tool() {37void EditorToolOptionsMenu::select_correct_tool() {
38 dynamic_cast<EditorInteractive&>(*get_parent())38 dynamic_cast<EditorInteractive&>(*get_parent())
39 .select_tool(*m_current_pointer, EditorTool::First);39 .select_tool(*current_pointer_, EditorTool::First);
40}40}
4141
=== modified file 'src/editor/ui_menus/editor_tool_options_menu.h'
--- src/editor/ui_menus/editor_tool_options_menu.h 2014-09-10 14:08:25 +0000
+++ src/editor/ui_menus/editor_tool_options_menu.h 2016-03-18 12:52:47 +0000
@@ -27,7 +27,7 @@
27 EditorToolOptionsMenu27 EditorToolOptionsMenu
28 (EditorInteractive & parent,28 (EditorInteractive & parent,
29 UI::UniqueWindow::Registry &,29 UI::UniqueWindow::Registry &,
30 const uint32_t widht, const uint32_t height,30 const uint32_t width, const uint32_t height,
31 char const * title);31 char const * title);
3232
33 /**33 /**
@@ -43,7 +43,7 @@
43 uint32_t vmargin () const {return spacing();}43 uint32_t vmargin () const {return spacing();}
4444
45private:45private:
46 EditorTool * m_current_pointer;46 EditorTool * current_pointer_;
47};47};
4848
49#endif // end of include guard: WL_EDITOR_UI_MENUS_EDITOR_TOOL_OPTIONS_MENU_H49#endif // end of include guard: WL_EDITOR_UI_MENUS_EDITOR_TOOL_OPTIONS_MENU_H
5050
=== modified file 'src/editor/ui_menus/editor_tool_place_bob_options_menu.cc'
--- src/editor/ui_menus/editor_tool_place_bob_options_menu.cc 2016-01-29 08:37:22 +0000
+++ src/editor/ui_menus/editor_tool_place_bob_options_menu.cc 2016-03-18 12:52:47 +0000
@@ -44,9 +44,9 @@
44:44:
45EditorToolOptionsMenu(parent, registry, 100, 100, _("Animals")),45EditorToolOptionsMenu(parent, registry, 100, 100, _("Animals")),
4646
47m_tabpanel (this, 0, 0, g_gr->images().get("images/ui_basic/but1.png")),47tabpanel_ (this, 0, 0, g_gr->images().get("images/ui_basic/but1.png")),
48m_pit (pit),48pit_ (pit),
49m_click_recursion_protect(false)49click_recursion_protect_(false)
50{50{
51 int32_t const space = 5;51 int32_t const space = 5;
52 const Widelands::World & world = parent.egbase().world();52 const Widelands::World & world = parent.egbase().world();
@@ -58,7 +58,7 @@
58 24U),58 24U),
59 12U);59 12U);
6060
61 set_center_panel(&m_tabpanel);61 set_center_panel(&tabpanel_);
6262
63 uint32_t width = 0, height = 0;63 uint32_t width = 0, height = 0;
64 for (int32_t j = 0; j < nr_bobs; ++j) {64 for (int32_t j = 0; j < nr_bobs; ++j) {
@@ -81,8 +81,8 @@
81 if (cur_x == bobs_in_row) {81 if (cur_x == bobs_in_row) {
82 cur_x = 0;82 cur_x = 0;
83 pos = Point(5, 15);83 pos = Point(5, 15);
84 box = new UI::Box(&m_tabpanel, 0, 0, UI::Box::Horizontal);84 box = new UI::Box(&tabpanel_, 0, 0, UI::Box::Horizontal);
85 m_tabpanel.add("icons", tab_icon, box);85 tabpanel_.add("icons", tab_icon, box);
86 }86 }
8787
88 const Widelands::BobDescr & descr = *world.get_bob_descr(i);88 const Widelands::BobDescr & descr = *world.get_bob_descr(i);
@@ -94,9 +94,9 @@
94 critter_descr ? critter_descr->descname() : std::string());94 critter_descr ? critter_descr->descname() : std::string());
9595
96 cb.set_desired_size(width, height);96 cb.set_desired_size(width, height);
97 cb.set_state(m_pit.is_enabled(i));97 cb.set_state(pit_.is_enabled(i));
98 cb.changedto.connect(boost::bind(&EditorToolPlaceBobOptionsMenu::clicked, this, i, _1));98 cb.changedto.connect(boost::bind(&EditorToolPlaceBobOptionsMenu::clicked, this, i, _1));
99 m_checkboxes.push_back(&cb);99 checkboxes_.push_back(&cb);
100 box->add(&cb, UI::Align::kLeft);100 box->add(&cb, UI::Align::kLeft);
101 box->add_space(space);101 box->add_space(space);
102 pos.x += width + 1 + space;102 pos.x += width + 1 + space;
@@ -104,7 +104,7 @@
104 ++i;104 ++i;
105 }105 }
106106
107 m_tabpanel.activate(0);107 tabpanel_.activate(0);
108}108}
109109
110110
@@ -114,7 +114,7 @@
114void EditorToolPlaceBobOptionsMenu::clicked114void EditorToolPlaceBobOptionsMenu::clicked
115 (int32_t const n, bool const t)115 (int32_t const n, bool const t)
116{116{
117 if (m_click_recursion_protect)117 if (click_recursion_protect_)
118 return;118 return;
119119
120 // TODO(unknown): This code is erroneous. It checks the current key state. What it120 // TODO(unknown): This code is erroneous. It checks the current key state. What it
@@ -122,23 +122,23 @@
122 // TODO(unknown): usage comment for get_key_state.122 // TODO(unknown): usage comment for get_key_state.
123 const bool multiselect =123 const bool multiselect =
124 get_key_state(SDL_SCANCODE_LCTRL) | get_key_state(SDL_SCANCODE_RCTRL);124 get_key_state(SDL_SCANCODE_LCTRL) | get_key_state(SDL_SCANCODE_RCTRL);
125 if (!t && (!multiselect || m_pit.get_nr_enabled() == 1)) {125 if (!t && (!multiselect || pit_.get_nr_enabled() == 1)) {
126 m_checkboxes[n]->set_state(true);126 checkboxes_[n]->set_state(true);
127 return;127 return;
128 }128 }
129129
130 if (!multiselect) {130 if (!multiselect) {
131 for (uint32_t i = 0; m_pit.get_nr_enabled(); ++i) m_pit.enable(i, false);131 for (uint32_t i = 0; pit_.get_nr_enabled(); ++i) pit_.enable(i, false);
132132
133 // disable all checkboxes133 // disable all checkboxes
134 m_click_recursion_protect = true;134 click_recursion_protect_ = true;
135 for (uint32_t i = 0; i < m_checkboxes.size(); ++i) {135 for (uint32_t i = 0; i < checkboxes_.size(); ++i) {
136 if (i != static_cast<uint32_t>(n))136 if (i != static_cast<uint32_t>(n))
137 m_checkboxes[i]->set_state(false);137 checkboxes_[i]->set_state(false);
138 }138 }
139 m_click_recursion_protect = false;139 click_recursion_protect_ = false;
140 }140 }
141141
142 m_pit.enable(n, t);142 pit_.enable(n, t);
143 select_correct_tool();143 select_correct_tool();
144}144}
145145
=== modified file 'src/editor/ui_menus/editor_tool_place_bob_options_menu.h'
--- src/editor/ui_menus/editor_tool_place_bob_options_menu.h 2014-09-10 14:48:40 +0000
+++ src/editor/ui_menus/editor_tool_place_bob_options_menu.h 2016-03-18 12:52:47 +0000
@@ -35,11 +35,12 @@
35 UI::UniqueWindow::Registry &);35 UI::UniqueWindow::Registry &);
3636
37private:37private:
38 UI::TabPanel m_tabpanel;
39 std::vector<UI::Checkbox *> m_checkboxes;
40 EditorPlaceBobTool & m_pit;
41 void clicked(int32_t, bool);38 void clicked(int32_t, bool);
42 bool m_click_recursion_protect;39
40 UI::TabPanel tabpanel_;
41 std::vector<UI::Checkbox*> checkboxes_;
42 EditorPlaceBobTool& pit_;
43 bool click_recursion_protect_;
43};44};
4445
45#endif // end of include guard: WL_EDITOR_UI_MENUS_EDITOR_TOOL_PLACE_BOB_OPTIONS_MENU_H46#endif // end of include guard: WL_EDITOR_UI_MENUS_EDITOR_TOOL_PLACE_BOB_OPTIONS_MENU_H
4647
=== modified file 'src/editor/ui_menus/editor_toolsize_menu.cc'
--- src/editor/ui_menus/editor_toolsize_menu.cc 2016-01-29 08:37:22 +0000
+++ src/editor/ui_menus/editor_toolsize_menu.cc 2016-03-18 12:52:47 +0000
@@ -41,15 +41,15 @@
41 :41 :
42 UI::UniqueWindow42 UI::UniqueWindow
43 (&parent, "toolsize_menu", &registry, 250, 50, _("Tool Size")),43 (&parent, "toolsize_menu", &registry, 250, 50, _("Tool Size")),
44 m_textarea(this, 5, 10, 240, 10, std::string(), UI::Align::kBottomCenter),44 textarea_(this, 5, 10, 240, 10, std::string(), UI::Align::kBottomCenter),
45 m_increase45 increase_
46 (this, "incr",46 (this, "incr",
47 get_inner_w() / 2 - 10, 25, 20, 20,47 get_inner_w() / 2 - 10, 25, 20, 20,
48 g_gr->images().get("images/ui_basic/but0.png"),48 g_gr->images().get("images/ui_basic/but0.png"),
49 g_gr->images().get("images/ui_basic/scrollbar_up.png"),49 g_gr->images().get("images/ui_basic/scrollbar_up.png"),
50 std::string(),50 std::string(),
51 parent.get_sel_radius() < MAX_TOOL_AREA),51 parent.get_sel_radius() < MAX_TOOL_AREA),
52 m_decrease52 decrease_
53 (this, "decr",53 (this, "decr",
54 get_inner_w() / 2 + 10, 25, 20, 20,54 get_inner_w() / 2 + 10, 25, 20, 20,
55 g_gr->images().get("images/ui_basic/but0.png"),55 g_gr->images().get("images/ui_basic/but0.png"),
@@ -58,11 +58,11 @@
58 0 < parent.get_sel_radius()),58 0 < parent.get_sel_radius()),
59 value_(0)59 value_(0)
60{60{
61 m_increase.sigclicked.connect(boost::bind(&EditorToolsizeMenu::increase_radius, boost::ref(*this)));61 increase_.sigclicked.connect(boost::bind(&EditorToolsizeMenu::increase_radius, boost::ref(*this)));
62 m_decrease.sigclicked.connect(boost::bind(&EditorToolsizeMenu::decrease_radius, boost::ref(*this)));62 decrease_.sigclicked.connect(boost::bind(&EditorToolsizeMenu::decrease_radius, boost::ref(*this)));
6363
64 m_increase.set_repeating(true);64 increase_.set_repeating(true);
65 m_decrease.set_repeating(true);65 decrease_.set_repeating(true);
66 update(parent.get_sel_radius());66 update(parent.get_sel_radius());
6767
68 if (eia().tools()->current().has_size_one()) {68 if (eia().tools()->current().has_size_one()) {
@@ -78,12 +78,12 @@
78 value_ = val;78 value_ = val;
79 eia().set_sel_radius(val);79 eia().set_sel_radius(val);
80 set_buttons_enabled(true);80 set_buttons_enabled(true);
81 m_textarea.set_text((boost::format(_("Current Size: %u")) % (val + 1)).str());81 textarea_.set_text((boost::format(_("Current Size: %u")) % (val + 1)).str());
82}82}
8383
84void EditorToolsizeMenu::set_buttons_enabled(bool enable) {84void EditorToolsizeMenu::set_buttons_enabled(bool enable) {
85 m_decrease.set_enabled(enable && 0 < value_);85 decrease_.set_enabled(enable && 0 < value_);
86 m_increase.set_enabled(enable && value_ < MAX_TOOL_AREA);86 increase_.set_enabled(enable && value_ < MAX_TOOL_AREA);
87}87}
8888
8989
9090
=== modified file 'src/editor/ui_menus/editor_toolsize_menu.h'
--- src/editor/ui_menus/editor_toolsize_menu.h 2016-01-16 12:55:14 +0000
+++ src/editor/ui_menus/editor_toolsize_menu.h 2016-03-18 12:52:47 +0000
@@ -40,8 +40,8 @@
40 void decrease_radius();40 void decrease_radius();
41 void increase_radius();41 void increase_radius();
4242
43 UI::Textarea m_textarea;43 UI::Textarea textarea_;
44 UI::Button m_increase, m_decrease;44 UI::Button increase_, decrease_;
45 uint32_t value_;45 uint32_t value_;
46};46};
4747

Subscribers

People subscribed via source and target branches

to status/vote changes: