widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #00659
[Merge] lp:~gamag/widelands/EditorUndo into lp:widelands
G. Margiani has proposed merging lp:~gamag/widelands/EditorUndo into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~gamag/widelands/EditorUndo/+merge/93804
Reformatted editor code to pass quiet through code checker.
Only whitespace changes!
Sorry, I should have done this earlier.
--
https://code.launchpad.net/~gamag/widelands/EditorUndo/+merge/93804
Your team Widelands Developers is requested to review the proposed merge of lp:~gamag/widelands/EditorUndo into lp:widelands.
=== modified file 'src/editor/editorinteractive.cc'
--- src/editor/editorinteractive.cc 2012-02-14 11:24:20 +0000
+++ src/editor/editorinteractive.cc 2012-02-20 11:31:27 +0000
@@ -81,17 +81,16 @@
("editor_undo", "undo", _("Undo"))),
m_redo
(INIT_BUTTON
- ("editor_redo", "redo", _("Redo"))) {
+ ("editor_redo", "redo", _("Redo")))
+{
m_toggle_main_menu.sigclicked.connect(boost::bind(&Editor_Interactive::toggle_mainmenu, this));
m_toggle_tool_menu.sigclicked.connect(boost::bind(&Editor_Interactive::tool_menu_btn, this));
m_toggle_toolsize_menu.sigclicked.connect(boost::bind(&Editor_Interactive::toolsize_menu_btn, this));
m_toggle_minimap.sigclicked.connect(boost::bind(&Editor_Interactive::toggle_minimap, this));
m_toggle_buildhelp.sigclicked.connect(boost::bind(&Editor_Interactive::toggle_buildhelp, this));
m_toggle_player_menu.sigclicked.connect(boost::bind(&Editor_Interactive::toggle_playermenu, this));
- m_undo.sigclicked.connect(boost::bind(&Editor_History::undo_action, &m_history
- ));
- m_redo.sigclicked.connect(boost::bind(&Editor_History::redo_action, &m_history
- ));
+ m_undo.sigclicked.connect(boost::bind(&Editor_History::undo_action, &m_history));
+ m_redo.sigclicked.connect(boost::bind(&Editor_History::redo_action, &m_history));
m_toolbar.set_layout_toplevel(true);
m_toolbar.add(&m_toggle_main_menu, UI::Box::AlignLeft);
@@ -163,8 +162,7 @@
// TODO: get rid of cleanup_for_load, it tends to be very messy
// Instead, delete and re-create the egbase.
egbase().cleanup_for_load(true, false);
- m_history
- .reset();
+ m_history.reset();
std::auto_ptr<Widelands::Map_Loader> const ml
(map.get_correct_loader(filename.c_str()));
@@ -270,9 +268,10 @@
}
void Editor_Interactive::map_clicked(bool draw) {
- m_history
- .do_action(tools.current(), tools.use_tool, egbase().map(),
- get_sel_pos(), *this, draw);
+ m_history.do_action
+ (tools.current(),
+ tools.use_tool, egbase().map(),
+ get_sel_pos(), *this, draw);
need_complete_redraw();
set_need_save(true);
}
@@ -451,17 +450,14 @@
case SDLK_z:
if ((code.mod & (KMOD_LCTRL | KMOD_RCTRL)) && (code.mod & (KMOD_LSHIFT | KMOD_RSHIFT)))
- m_history
- .redo_action();
+ m_history.redo_action();
else if (code.mod & (KMOD_LCTRL | KMOD_RCTRL))
- m_history
- .undo_action();
+ m_history.undo_action();
handled = true;
break;
case SDLK_y:
if (code.mod & (KMOD_LCTRL | KMOD_RCTRL))
- m_history
- .redo_action();
+ m_history.redo_action();
handled = true;
break;
default:
@@ -564,8 +560,7 @@
void Editor_Interactive::change_world() {
- m_history
- .reset();
+ m_history.reset();
delete m_terrainmenu .window;
delete m_immovablemenu.window;
delete m_bobmenu .window;
=== modified file 'src/editor/editorinteractive.h'
--- src/editor/editorinteractive.h 2012-02-13 21:39:56 +0000
+++ src/editor/editorinteractive.h 2012-02-20 11:31:27 +0000
@@ -81,7 +81,7 @@
set_port_space(unset_port_space)
{}
- Editor_Tool & current() const throw() {return *current_pointer;}
+ Editor_Tool & current() const throw () {return *current_pointer;}
typedef std::vector<Editor_Tool *> Tool_Vector;
typedef Tool_Vector::size_type Index;
//Tool_Vector tools;
@@ -109,7 +109,7 @@
void select_tool(Editor_Tool &, Editor_Tool::Tool_Index);
- Widelands::Player * get_player() const throw() {return 0;}
+ Widelands::Player * get_player() const throw () {return 0;}
// action functions
void exit();
=== modified file 'src/editor/tools/editor_action_args.h'
--- src/editor/tools/editor_action_args.h 2012-02-13 21:39:56 +0000
+++ src/editor/tools/editor_action_args.h 2012-02-20 11:31:27 +0000
@@ -40,7 +40,7 @@
std::list<Widelands::Field::Height> origHights; // change hight tool
uint8_t cur_res, set_to; // resources change tools
std::list<uint8_t> orgRes, orgResT; // resources set tool
- std::list< const Widelands::Bob::Descr * > obob_type, nbob_type;// bob change tools
+ std::list<const Widelands::Bob::Descr *> obob_type, nbob_type; // bob change tools
std::list<std::string> oimmov_types; // immovable change tools
std::list<int32_t> nimmov_types; // immovable change tools
interval<Widelands::Field::Height> m_interval; // noise hight tool
@@ -53,4 +53,4 @@
uint32_t refcount;
};
-#endif
\ No newline at end of file
+#endif
=== modified file 'src/editor/tools/editor_decrease_height_tool.cc'
--- src/editor/tools/editor_decrease_height_tool.cc 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_decrease_height_tool.cc 2012-02-20 11:31:27 +0000
@@ -28,10 +28,11 @@
/// Decreases the heights by a value. Chages surrounding nodes if necessary.
int32_t Editor_Decrease_Height_Tool::handle_click_impl
-(Widelands::Map & map,
- Widelands::Node_and_Triangle<> center,
- Editor_Interactive & parent,
- Editor_Action_Args & args) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent,
+ Editor_Action_Args & args)
+{
if (args.origHights.empty()) {
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
(map,
@@ -49,10 +50,11 @@
}
int32_t Editor_Decrease_Height_Tool::handle_undo_impl
-(Widelands::Map & map,
- Widelands::Node_and_Triangle<> center,
- Editor_Interactive & parent,
- Editor_Action_Args & args) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent,
+ Editor_Action_Args & args)
+{
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
(map,
Widelands::Area<Widelands::FCoords>
@@ -63,13 +65,16 @@
mr.location().field->set_height(*i); i++;
} while (mr.advance(map));
- map.recalc_for_field_area(Widelands::Area<Widelands::FCoords>
- (map.get_fcoords(center.node), args.sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 2));
+ map.recalc_for_field_area
+ (Widelands::Area<Widelands::FCoords>
+ (map.get_fcoords(center.node),
+ args.sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 2));
return mr.radius() + 1;
}
-Editor_Action_Args Editor_Decrease_Height_Tool::format_args_impl(Editor_Interactive & parent) {
+Editor_Action_Args Editor_Decrease_Height_Tool::format_args_impl(Editor_Interactive & parent)
+{
Editor_Action_Args a(parent);
a.change_by = m_change_by;
return a;
=== modified file 'src/editor/tools/editor_decrease_height_tool.h'
--- src/editor/tools/editor_decrease_height_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_decrease_height_tool.h 2012-02-20 11:31:27 +0000
@@ -27,10 +27,12 @@
Editor_Decrease_Height_Tool() : Editor_Tool(*this, *this), m_change_by(1) {}
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
int32_t handle_undo_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
Editor_Action_Args format_args_impl(Editor_Interactive & parent);
@@ -38,8 +40,8 @@
return "pics/fsel_editor_decrease_height.png";
}
- int32_t get_change_by() const throw() {return m_change_by;}
- void set_change_by(const int32_t n) throw() {m_change_by = n;}
+ int32_t get_change_by() const throw () {return m_change_by;}
+ void set_change_by(const int32_t n) throw () {m_change_by = n;}
private:
int32_t m_change_by;
=== modified file 'src/editor/tools/editor_decrease_resources_tool.cc'
--- src/editor/tools/editor_decrease_resources_tool.cc 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_decrease_resources_tool.cc 2012-02-20 11:31:27 +0000
@@ -35,15 +35,15 @@
* there is not already another resource there.
*/
int32_t Editor_Decrease_Resources_Tool::handle_click_impl
-(Widelands::Map & map,
- Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent,
- Editor_Action_Args & args
-) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle<> const center,
+ Editor_Interactive & parent,
+ Editor_Action_Args & args)
+{
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
(map,
- Widelands::Area<Widelands::FCoords>
- (map.get_fcoords(center.node), args.sel_radius));
+ Widelands::Area<Widelands::FCoords>
+ (map.get_fcoords(center.node), args.sel_radius));
do {
int32_t res = mr.location().field->get_resources();
int32_t amount = mr.location().field->get_resources_amount();
@@ -58,7 +58,8 @@
if
(res == args.cur_res
and
- Editor_Change_Resource_Tool_Callback(mr.location(), &map, args.cur_res)) {
+ Editor_Change_Resource_Tool_Callback(mr.location(), &map, args.cur_res))
+ {
PictureID picid;
// Ok, we're doing something. First remove the current overlays.
std::string str =
@@ -85,15 +86,17 @@
}
int32_t Editor_Decrease_Resources_Tool::handle_undo_impl
-(Widelands::Map & map,
- Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent,
- Editor_Action_Args & args) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle< Widelands::Coords > center,
+ Editor_Interactive & parent,
+ Editor_Action_Args & args)
+{
return parent.tools.set_resources.handle_undo_impl(map, center, parent, args);
return 0;
}
-Editor_Action_Args Editor_Decrease_Resources_Tool::format_args_impl(Editor_Interactive & parent) {
+Editor_Action_Args Editor_Decrease_Resources_Tool::format_args_impl(Editor_Interactive & parent)
+{
Editor_Action_Args a(parent);
a.change_by = m_change_by;
a.cur_res = m_cur_res;
=== modified file 'src/editor/tools/editor_decrease_resources_tool.h'
--- src/editor/tools/editor_decrease_resources_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_decrease_resources_tool.h 2012-02-20 11:31:27 +0000
@@ -31,10 +31,12 @@
{}
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
int32_t handle_undo_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
Editor_Action_Args format_args_impl(Editor_Interactive & parent);
@@ -42,10 +44,10 @@
return "pics/fsel_editor_decrease_resources.png";
}
- int32_t get_change_by() const throw() {return m_change_by;}
- void set_change_by(const int32_t n) throw() {m_change_by = n;}
+ int32_t get_change_by() const throw () {return m_change_by;}
+ void set_change_by(const int32_t n) throw () {m_change_by = n;}
Widelands::Resource_Index get_cur_res() const {return m_cur_res;}
- void set_cur_res(Widelands::Resource_Index const res) throw() {
+ void set_cur_res(Widelands::Resource_Index const res) throw () {
m_cur_res = res;
}
=== modified file 'src/editor/tools/editor_delete_bob_tool.cc'
--- src/editor/tools/editor_delete_bob_tool.cc 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_delete_bob_tool.cc 2012-02-20 11:31:27 +0000
@@ -28,8 +28,9 @@
* Deletes the bob at the given location
*/
int32_t Editor_Delete_Bob_Tool::handle_click_impl
-(Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
+ (Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+{
Widelands::Editor_Game_Base & egbase = parent.egbase();
const int32_t radius = args.sel_radius;
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
@@ -48,15 +49,17 @@
}
int32_t Editor_Delete_Bob_Tool::handle_undo_impl
-(Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
+ (Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+{
uint32_t ret = parent.tools.place_bob.handle_undo_impl(map, center, parent, args);
args.obob_type.clear();
return ret;
}
-Editor_Action_Args Editor_Delete_Bob_Tool::format_args_impl(Editor_Interactive & parent) {
+Editor_Action_Args Editor_Delete_Bob_Tool::format_args_impl(Editor_Interactive & parent)
+{
return Editor_Tool::format_args_impl(parent);
}
=== modified file 'src/editor/tools/editor_delete_bob_tool.h'
--- src/editor/tools/editor_delete_bob_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_delete_bob_tool.h 2012-02-20 11:31:27 +0000
@@ -27,10 +27,12 @@
Editor_Delete_Bob_Tool() : Editor_Tool(*this, *this) {}
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
int32_t handle_undo_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
Editor_Action_Args format_args_impl(Editor_Interactive & parent);
=== modified file 'src/editor/tools/editor_delete_immovable_tool.cc'
--- src/editor/tools/editor_delete_immovable_tool.cc 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_delete_immovable_tool.cc 2012-02-20 11:31:27 +0000
@@ -30,10 +30,11 @@
* Deletes the immovable at the given location
*/
int32_t Editor_Delete_Immovable_Tool::handle_click_impl
-(Widelands::Map & map,
- Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent,
- Editor_Action_Args & args) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle<> const center,
+ Editor_Interactive & parent,
+ Editor_Action_Args & args)
+{
Widelands::Editor_Game_Base & egbase = parent.egbase();
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
(map,
@@ -43,7 +44,8 @@
(upcast
(Widelands::Immovable,
immovable,
- mr.location().field->get_immovable())) {
+ mr.location().field->get_immovable()))
+ {
args.oimmov_types.push_back(immovable->descr().name());
immovable->remove(egbase); // Delete no buildings or stuff.
} else {
@@ -54,13 +56,14 @@
}
int32_t Editor_Delete_Immovable_Tool::handle_undo_impl
-(Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
- Widelands::Editor_Game_Base & egbase = parent.egbase();
+ (Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+{
return parent.tools.place_immovable.handle_undo_impl(map, center, parent, args);
}
-Editor_Action_Args Editor_Delete_Immovable_Tool::format_args_impl(Editor_Interactive & parent) {
+Editor_Action_Args Editor_Delete_Immovable_Tool::format_args_impl(Editor_Interactive & parent)
+{
return Editor_Tool::format_args_impl(parent);
}
=== modified file 'src/editor/tools/editor_delete_immovable_tool.h'
--- src/editor/tools/editor_delete_immovable_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_delete_immovable_tool.h 2012-02-20 11:31:27 +0000
@@ -27,10 +27,12 @@
Editor_Delete_Immovable_Tool() : Editor_Tool(*this, *this) {}
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
int32_t handle_undo_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
Editor_Action_Args format_args_impl(Editor_Interactive & parent);
=== modified file 'src/editor/tools/editor_draw_tool.cc'
--- src/editor/tools/editor_draw_tool.cc 2012-02-14 11:24:20 +0000
+++ src/editor/tools/editor_draw_tool.cc 2012-02-20 11:31:27 +0000
@@ -31,35 +31,45 @@
*/
void Editor_Draw_Tool::add_action
-(Editor_Tool_Action ac, Editor_Action_Args & args) {
+(Editor_Tool_Action ac, Editor_Action_Args & args)
+{
args.draw_actions.push_back(new Editor_Tool_Action(ac));
}
int32_t Editor_Draw_Tool::handle_click_impl
-(Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
+ (Widelands::Map & map, Widelands::Node_and_Triangle<Widelands::Coords> center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+{
- for (std::list<Editor_Tool_Action *>::iterator i = args.draw_actions.begin();
+ for
+ (std::list<Editor_Tool_Action *>::iterator i = args.draw_actions.begin();
i != args.draw_actions.end();
- i++) {
- (*i)->tool.handle_click(
- static_cast<Editor_Tool::Tool_Index>((*i)->i), (*i)->map, (*i)->center, (*i)->parent, *((*i)->args));
+ i++)
+ {
+ (*i)->tool.handle_click
+ (static_cast<Editor_Tool::Tool_Index>((*i)->i),
+ (*i)->map, (*i)->center, (*i)->parent, *((*i)->args));
}
return args.draw_actions.size();
}
int32_t Editor_Draw_Tool::handle_undo_impl
-(Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
- for (std::list<Editor_Tool_Action *>::reverse_iterator i = args.draw_actions.rbegin();
+ (Widelands::Map & map, Widelands::Node_and_Triangle<Widelands::Coords> center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+{
+ for
+ (std::list<Editor_Tool_Action *>::reverse_iterator i = args.draw_actions.rbegin();
i != args.draw_actions.rend();
- i++) {
- (*i)->tool.handle_undo(
- static_cast<Editor_Tool::Tool_Index>((*i)->i), (*i)->map, (*i)->center, (*i)->parent, *((*i)->args));
+ i++)
+ {
+ (*i)->tool.handle_undo
+ (static_cast<Editor_Tool::Tool_Index>((*i)->i),
+ (*i)->map, (*i)->center, (*i)->parent, *((*i)->args));
}
return args.draw_actions.size();
}
-Editor_Action_Args Editor_Draw_Tool::format_args_impl(Editor_Interactive & parent) {
+Editor_Action_Args Editor_Draw_Tool::format_args_impl(Editor_Interactive & parent)
+{
return Editor_Tool::format_args_impl(parent);
}
=== modified file 'src/editor/tools/editor_draw_tool.h'
--- src/editor/tools/editor_draw_tool.h 2012-02-13 21:39:56 +0000
+++ src/editor/tools/editor_draw_tool.h 2012-02-20 11:31:27 +0000
@@ -29,10 +29,12 @@
Editor_Draw_Tool() : Editor_Tool(*this, *this) {}
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
int32_t handle_undo_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
Editor_Action_Args format_args_impl(Editor_Interactive & parent);
=== modified file 'src/editor/tools/editor_history.cc'
--- src/editor/tools/editor_history.cc 2012-02-13 21:39:56 +0000
+++ src/editor/tools/editor_history.cc 2012-02-20 11:31:27 +0000
@@ -31,7 +31,8 @@
refcount(0)
{}
-Editor_Action_Args::~Editor_Action_Args() {
+Editor_Action_Args::~Editor_Action_Args()
+{
while (not draw_actions.empty()) {
delete draw_actions.back();
draw_actions.pop_back();
@@ -49,7 +50,8 @@
// === Editor_History === //
-uint32_t Editor_History::undo_action() {
+uint32_t Editor_History::undo_action()
+{
if (undo_stack.empty())
return 0;
@@ -60,11 +62,14 @@
m_undo_button.set_enabled(!undo_stack.empty());
m_redo_button.set_enabled(true);
- return uac.tool.handle_undo(
- static_cast<Editor_Tool::Tool_Index>(uac.i), uac.map, uac.center, uac.parent, *uac.args);
+ return
+ uac.tool.handle_undo
+ (static_cast<Editor_Tool::Tool_Index>(uac.i),
+ uac.map, uac.center, uac.parent, *uac.args);
}
-uint32_t Editor_History::redo_action() {
+uint32_t Editor_History::redo_action()
+{
if (redo_stack.empty())
return 0;
@@ -75,27 +80,38 @@
m_undo_button.set_enabled(true);
m_redo_button.set_enabled(!redo_stack.empty());
- return rac.tool.handle_click(
- static_cast<Editor_Tool::Tool_Index>(rac.i), rac.map, rac.center, rac.parent, *rac.args);
+ return
+ rac.tool.handle_click
+ (static_cast<Editor_Tool::Tool_Index>(rac.i),
+ rac.map, rac.center, rac.parent, *rac.args);
}
-uint32_t Editor_History::do_action(Editor_Tool & tool,
- Editor_Tool::Tool_Index ind,
- Widelands::Map & map,
- const Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent,
- bool draw) {
- Editor_Tool_Action ac(tool, static_cast<uint32_t>(ind), map, center, parent, tool.format_args(ind, parent));
+uint32_t Editor_History::do_action
+ (Editor_Tool & tool,
+ Editor_Tool::Tool_Index ind,
+ Widelands::Map & map,
+ const Widelands::Node_and_Triangle< Widelands::Coords > center,
+ Editor_Interactive & parent,
+ bool draw)
+{
+ Editor_Tool_Action ac
+ (tool, static_cast<uint32_t>(ind),
+ map, center, parent, tool.format_args(ind, parent));
if (draw && tool.is_unduable()) {
- if (undo_stack.front().tool.get_sel_impl() != std::string(m_draw_tool.get_sel_impl())) {
- Editor_Tool_Action da(m_draw_tool, Editor_Tool::First,
- map, center, parent,
- m_draw_tool.format_args(Editor_Tool::First, parent));
+ if
+ (undo_stack.front().tool.get_sel_impl() !=
+ std::string(m_draw_tool.get_sel_impl()))
+ {
+ Editor_Tool_Action da
+ (m_draw_tool, Editor_Tool::First,
+ map, center, parent,
+ m_draw_tool.format_args(Editor_Tool::First, parent));
m_draw_tool.add_action(undo_stack.front(), *da.args);
undo_stack.pop_front();
undo_stack.push_front(da);
}
- dynamic_cast<Editor_Draw_Tool *>(&(undo_stack.front().tool))->add_action(ac, *undo_stack.front().args);
+ dynamic_cast<Editor_Draw_Tool *>
+ (&(undo_stack.front().tool))->add_action(ac, *undo_stack.front().args);
} else if (tool.is_unduable()) {
redo_stack.clear();
undo_stack.push_front(ac);
@@ -106,7 +122,8 @@
}
-void Editor_History::reset() {
+void Editor_History::reset()
+{
undo_stack.clear();
redo_stack.clear();
m_undo_button.set_enabled(false);
=== modified file 'src/editor/tools/editor_history.h'
--- src/editor/tools/editor_history.h 2012-02-13 21:39:56 +0000
+++ src/editor/tools/editor_history.h 2012-02-20 11:31:27 +0000
@@ -27,7 +27,7 @@
//struct Editor_Action_Args;
struct Editor_Interactive;
-namespace UI { struct Button; }
+namespace UI {struct Button;}
/**
* The all actions done with an editor tool are saved on a stack to
@@ -36,10 +36,13 @@
*/
struct Editor_History {
- Editor_History(UI::Button & undo, UI::Button & redo): m_undo_button(undo), m_redo_button(redo) {};
+ Editor_History(UI::Button & undo, UI::Button & redo):
+ m_undo_button(undo), m_redo_button(redo) {};
- uint32_t do_action(Editor_Tool & tool, Editor_Tool::Tool_Index ind, Widelands::Map & map,
- Widelands::Node_and_Triangle<> const center, Editor_Interactive & parent, bool draw = false);
+ uint32_t do_action
+ (Editor_Tool & tool, Editor_Tool::Tool_Index ind, Widelands::Map & map,
+ Widelands::Node_and_Triangle<> const center,
+ Editor_Interactive & parent, bool draw = false);
uint32_t undo_action();
uint32_t redo_action();
=== modified file 'src/editor/tools/editor_increase_height_tool.cc'
--- src/editor/tools/editor_increase_height_tool.cc 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_increase_height_tool.cc 2012-02-20 11:31:27 +0000
@@ -26,10 +26,11 @@
/// Increases the heights by a value. Chages surrounding nodes if necessary.
int32_t Editor_Increase_Height_Tool::handle_click_impl
-(Widelands::Map & map,
- Widelands::Node_and_Triangle<> center,
- Editor_Interactive & parent,
- Editor_Action_Args & args) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent,
+ Editor_Action_Args & args)
+{
if (args.origHights.empty()) {
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
(map,
@@ -48,15 +49,17 @@
}
int32_t Editor_Increase_Height_Tool::handle_undo_impl
-(Widelands::Map & map,
- Widelands::Node_and_Triangle<> center,
- Editor_Interactive & parent,
- Editor_Action_Args & args) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent,
+ Editor_Action_Args & args)
+{
return m_decrease_tool.handle_undo_impl(map, center, parent, args);
}
-Editor_Action_Args Editor_Increase_Height_Tool::format_args_impl(Editor_Interactive & parent) {
+Editor_Action_Args Editor_Increase_Height_Tool::format_args_impl(Editor_Interactive & parent)
+{
Editor_Action_Args a(parent);
a.change_by = m_change_by;
return a;
-}
\ No newline at end of file
+}
=== modified file 'src/editor/tools/editor_increase_height_tool.h'
--- src/editor/tools/editor_increase_height_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_increase_height_tool.h 2012-02-20 11:31:27 +0000
@@ -35,10 +35,12 @@
{}
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
int32_t handle_undo_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
Editor_Action_Args format_args_impl(Editor_Interactive & parent);
@@ -46,8 +48,8 @@
return "pics/fsel_editor_increase_height.png";
}
- int32_t get_change_by() const throw() {return m_change_by;}
- void set_change_by(const int32_t n) throw() {m_change_by = n;}
+ int32_t get_change_by() const throw () {return m_change_by;}
+ void set_change_by(const int32_t n) throw () {m_change_by = n;}
Editor_Decrease_Height_Tool & decrease_tool() const {
return m_decrease_tool;
@@ -56,8 +58,8 @@
private:
Editor_Decrease_Height_Tool & m_decrease_tool;
- Editor_Set_Height_Tool & m_set_tool;
- int32_t m_change_by;
+ Editor_Set_Height_Tool & m_set_tool;
+ int32_t m_change_by;
};
#endif
=== modified file 'src/editor/tools/editor_increase_resources_tool.cc'
--- src/editor/tools/editor_increase_resources_tool.cc 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_increase_resources_tool.cc 2012-02-20 11:31:27 +0000
@@ -30,9 +30,10 @@
using Widelands::TCoords;
int32_t Editor_Change_Resource_Tool_Callback
-(TCoords<Widelands::FCoords> const c,
- void * const data,
- int32_t const curres) {
+ (TCoords<Widelands::FCoords> const c,
+ void * const data,
+ int32_t const curres)
+{
assert(data);
Widelands::Map & map = *static_cast<Widelands::Map *>(data);
Widelands::World & world = map.world();
@@ -72,16 +73,17 @@
===========
*/
int32_t Editor_Increase_Resources_Tool::handle_click_impl
-(Widelands::Map & map,
- Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent,
- Editor_Action_Args & args) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle<> const center,
+ Editor_Interactive & parent,
+ Editor_Action_Args & args)
+{
Widelands::World const & world = map.world();
Overlay_Manager & overlay_manager = map.overlay_manager();
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
- (map,
- Widelands::Area<Widelands::FCoords>
- (map.get_fcoords(center.node), args.sel_radius));
+ (map,
+ Widelands::Area<Widelands::FCoords>
+ (map.get_fcoords(center.node), args.sel_radius));
do {
int32_t res = mr.location().field->get_resources();
int32_t amount = mr.location().field->get_resources_amount();
@@ -98,7 +100,8 @@
if
((res == args.cur_res or not res)
and
- Editor_Change_Resource_Tool_Callback(mr.location(), &map, args.cur_res)) {
+ Editor_Change_Resource_Tool_Callback(mr.location(), &map, args.cur_res))
+ {
// Ok, we're doing something. First remove the current overlays.
PictureID picid =
g_gr->get_picture
@@ -127,13 +130,16 @@
}
int32_t Editor_Increase_Resources_Tool::handle_undo_impl
-(Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle< Widelands::Coords > center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+{
return m_set_tool.handle_undo_impl(map, center, parent, args);
return 0;
}
-Editor_Action_Args Editor_Increase_Resources_Tool::format_args_impl(Editor_Interactive & parent) {
+Editor_Action_Args Editor_Increase_Resources_Tool::format_args_impl(Editor_Interactive & parent)
+{
Editor_Action_Args a(parent);
a.change_by = m_change_by;
a.cur_res = m_cur_res;
=== modified file 'src/editor/tools/editor_increase_resources_tool.h'
--- src/editor/tools/editor_increase_resources_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_increase_resources_tool.h 2012-02-20 11:31:27 +0000
@@ -36,10 +36,12 @@
{}
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
int32_t handle_undo_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
Editor_Action_Args format_args_impl(Editor_Interactive & parent);
@@ -47,10 +49,10 @@
return "pics/fsel_editor_increase_resources.png";
}
- int32_t get_change_by() const throw() {return m_change_by;}
- void set_change_by(const int32_t n) throw() {m_change_by = n;}
+ int32_t get_change_by() const throw () {return m_change_by;}
+ void set_change_by(const int32_t n) throw () {m_change_by = n;}
Widelands::Resource_Index get_cur_res() const {return m_cur_res;}
- void set_cur_res(Widelands::Resource_Index const res) throw() {
+ void set_cur_res(Widelands::Resource_Index const res) throw () {
m_cur_res = res;
}
@@ -67,6 +69,6 @@
};
int32_t Editor_Change_Resource_Tool_Callback
-(Widelands::TCoords<Widelands::FCoords>, void *, int32_t);
+ (Widelands::TCoords<Widelands::FCoords>, void *, int32_t);
#endif
=== modified file 'src/editor/tools/editor_info_tool.cc'
--- src/editor/tools/editor_info_tool.cc 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_info_tool.cc 2012-02-20 11:31:27 +0000
@@ -32,10 +32,11 @@
/// Show a window with information about the pointed at node and triangle.
int32_t Editor_Info_Tool::handle_click_impl
-(Widelands::Map & map,
- Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent,
- Editor_Action_Args & args) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle<> const center,
+ Editor_Interactive & parent,
+ Editor_Action_Args & args)
+{
Widelands::World const & world = map.world();
UI::Window * const w =
new UI::Window
=== modified file 'src/editor/tools/editor_info_tool.h'
--- src/editor/tools/editor_info_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_info_tool.h 2012-02-20 11:31:27 +0000
@@ -27,7 +27,8 @@
Editor_Info_Tool() : Editor_Tool(*this, *this, false) {}
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
char const * get_sel_impl() const {return "pics/fsel_editor_info.png";}
};
=== modified file 'src/editor/tools/editor_make_infrastructure_tool.cc'
--- src/editor/tools/editor_make_infrastructure_tool.cc 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_make_infrastructure_tool.cc 2012-02-20 11:31:27 +0000
@@ -31,9 +31,10 @@
* Callback function to calculate correct overlays
*/
int32_t Editor_Make_Infrastructure_Tool_Callback
-(Widelands::TCoords<Widelands::FCoords> const c,
- void * data,
- int32_t const player) {
+ (Widelands::TCoords<Widelands::FCoords> const c,
+ void * data,
+ int32_t const player)
+{
return
static_cast<Widelands::Editor_Game_Base const *>(data)->player(player)
.get_buildcaps(c);
@@ -47,10 +48,11 @@
* Obviously, this function ignores the sel radius
*/
int32_t Editor_Make_Infrastructure_Tool::handle_click_impl
-(Widelands::Map &,
- Widelands::Node_and_Triangle<> const,
- Editor_Interactive & parent,
- Editor_Action_Args & args) {
+ (Widelands::Map &,
+ Widelands::Node_and_Triangle<> const,
+ Editor_Interactive & parent,
+ Editor_Action_Args & args)
+{
show_field_action
(&parent, parent.egbase().get_player(m_player), &m_registry);
=== modified file 'src/editor/tools/editor_make_infrastructure_tool.h'
--- src/editor/tools/editor_make_infrastructure_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_make_infrastructure_tool.h 2012-02-20 11:31:27 +0000
@@ -31,15 +31,17 @@
struct Editor_Make_Infrastructure_Tool : public Editor_Tool {
Editor_Make_Infrastructure_Tool() : Editor_Tool(*this, *this, false) {}
- void set_player(Widelands::Player_Number const n) throw()
- {m_player = n;}
- Widelands::Player_Number get_player() const throw() {return m_player;}
+ void set_player(Widelands::Player_Number const n) throw ()
+ {m_player = n;}
+ Widelands::Player_Number get_player() const throw ()
+ {return m_player;}
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
- const char * get_sel_impl() const throw()
- {return "pics/fsel.png";} // Standard sel icon, most complex tool of all
+ const char * get_sel_impl() const throw ()
+ {return "pics/fsel.png";} // Standard sel icon, most complex tool of all
private:
Widelands::Player_Number m_player;
@@ -47,6 +49,6 @@
};
int32_t Editor_Make_Infrastructure_Tool_Callback
-(Widelands::TCoords<Widelands::FCoords>, void *, int32_t);
+ (Widelands::TCoords<Widelands::FCoords>, void *, int32_t);
#endif
=== modified file 'src/editor/tools/editor_noise_height_tool.cc'
--- src/editor/tools/editor_noise_height_tool.cc 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_noise_height_tool.cc 2012-02-20 11:31:27 +0000
@@ -28,15 +28,17 @@
/// Sets the heights to random values. Changes surrounding nodes if necessary.
int32_t Editor_Noise_Height_Tool::handle_click_impl
-(Widelands::Map & map,
- Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent,
- Editor_Action_Args & args) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle<> const center,
+ Editor_Interactive & parent,
+ Editor_Action_Args & args)
+{
if (args.origHights.empty()) {
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
(map,
Widelands::Area<Widelands::FCoords>
- (map.get_fcoords(center.node), args.sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 1));
+ (map.get_fcoords(center.node),
+ args.sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 1));
do args.origHights.push_back(mr.location().field->get_height());
while (mr.advance(map));
}
@@ -59,19 +61,20 @@
(static_cast<double>
(args.m_interval.max - args.m_interval.min + 1) * rand()
/
- (RAND_MAX + 1.0)))
- );
+ (RAND_MAX + 1.0))));
} while (mr.advance(map));
return mr.radius() + max;
}
int32_t Editor_Noise_Height_Tool::handle_undo_impl
-(Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
+ (Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+{
return m_set_tool.handle_undo_impl(map, center, parent, args);
}
-Editor_Action_Args Editor_Noise_Height_Tool::format_args_impl(Editor_Interactive & parent) {
+Editor_Action_Args Editor_Noise_Height_Tool::format_args_impl(Editor_Interactive & parent)
+{
Editor_Action_Args a(parent);
a.m_interval = m_interval;
return a;
=== modified file 'src/editor/tools/editor_noise_height_tool.h'
--- src/editor/tools/editor_noise_height_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_noise_height_tool.h 2012-02-20 11:31:27 +0000
@@ -35,10 +35,12 @@
{}
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
int32_t handle_undo_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
Editor_Action_Args format_args_impl(Editor_Interactive & parent);
@@ -53,7 +55,7 @@
m_interval = i;
}
- Editor_Set_Height_Tool & set_tool() const throw() {return m_set_tool;}
+ Editor_Set_Height_Tool & set_tool() const throw () {return m_set_tool;}
private:
Editor_Set_Height_Tool & m_set_tool;
=== modified file 'src/editor/tools/editor_place_bob_tool.cc'
--- src/editor/tools/editor_place_bob_tool.cc 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_place_bob_tool.cc 2012-02-20 11:31:27 +0000
@@ -31,13 +31,13 @@
* and places this on the current field
*/
int32_t Editor_Place_Bob_Tool::handle_click_impl
-(Widelands::Map & map,
- Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent,
- Editor_Action_Args & args) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle<> const center,
+ Editor_Interactive & parent,
+ Editor_Action_Args & args)
+{
if (get_nr_enabled() && args.obob_type.empty()) {
- Widelands::Editor_Game_Base & egbase = parent.egbase();
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
(map,
Widelands::Area<Widelands::FCoords>
@@ -71,15 +71,16 @@
}
int32_t Editor_Place_Bob_Tool::handle_undo_impl
-(Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
+ (Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+{
if (not args.nbob_type.empty()) {
Widelands::Editor_Game_Base & egbase = parent.egbase();
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
(map,
Widelands::Area<Widelands::FCoords>
(map.get_fcoords(center.node), args.sel_radius));
- std::list< const Bob::Descr * >::iterator i = args.obob_type.begin();
+ std::list<const Bob::Descr *>::iterator i = args.obob_type.begin();
do {
if (*i) {
Bob::Descr const & descr = *(*i);
@@ -98,7 +99,8 @@
return 0;
}
-Editor_Action_Args Editor_Place_Bob_Tool::format_args_impl(Editor_Interactive & parent) {
+Editor_Action_Args Editor_Place_Bob_Tool::format_args_impl(Editor_Interactive & parent)
+{
return Editor_Tool::format_args_impl(parent);
}
=== modified file 'src/editor/tools/editor_place_bob_tool.h'
--- src/editor/tools/editor_place_bob_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_place_bob_tool.h 2012-02-20 11:31:27 +0000
@@ -30,10 +30,12 @@
{}
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
int32_t handle_undo_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
Editor_Action_Args format_args_impl(Editor_Interactive & parent);
=== modified file 'src/editor/tools/editor_place_immovable_tool.cc'
--- src/editor/tools/editor_place_immovable_tool.cc 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_place_immovable_tool.cc 2012-02-20 11:31:27 +0000
@@ -34,14 +34,17 @@
* and places this on the current field
*/
int32_t Editor_Place_Immovable_Tool::handle_click_impl
-(Widelands::Map & map,
- Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle<> const center,
+ Editor_Interactive & parent,
+ Editor_Action_Args & args)
+{
const int32_t radius = args.sel_radius;
if (not get_nr_enabled())
return radius;
Widelands::Editor_Game_Base & egbase = parent.egbase();
- if (args.oimmov_types.empty()) {
+ if (args.oimmov_types.empty())
+ {
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
(map,
Widelands::Area<Widelands::FCoords>
@@ -53,7 +56,8 @@
} while (mr.advance(map));
}
- if (not args.nimmov_types.empty()) {
+ if (not args.nimmov_types.empty())
+ {
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
(map,
Widelands::Area<Widelands::FCoords>
@@ -72,8 +76,9 @@
}
int32_t Editor_Place_Immovable_Tool::handle_undo_impl
-(Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
+ (Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+{
const int32_t radius = args.sel_radius;
if (args.oimmov_types.empty())
return radius;
@@ -85,8 +90,10 @@
(map.get_fcoords(center.node), radius));
std::list<std::string>::iterator i = args.oimmov_types.begin();
do {
- if (upcast(Widelands::Immovable, immovable,
- mr.location().field->get_immovable())) {
+ if
+ (upcast(Widelands::Immovable, immovable,
+ mr.location().field->get_immovable()))
+ {
immovable->remove(egbase);
}
if (!i->empty())
@@ -97,7 +104,8 @@
return radius + 2;
}
-Editor_Action_Args Editor_Place_Immovable_Tool::format_args_impl(Editor_Interactive & parent) {
+Editor_Action_Args Editor_Place_Immovable_Tool::format_args_impl(Editor_Interactive & parent)
+{
return Editor_Tool::format_args_impl(parent);
}
=== modified file 'src/editor/tools/editor_place_immovable_tool.h'
--- src/editor/tools/editor_place_immovable_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_place_immovable_tool.h 2012-02-20 11:31:27 +0000
@@ -32,10 +32,12 @@
{}
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
int32_t handle_undo_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
Editor_Action_Args format_args_impl(Editor_Interactive & parent);
=== modified file 'src/editor/tools/editor_set_height_tool.cc'
--- src/editor/tools/editor_set_height_tool.cc 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_set_height_tool.cc 2012-02-20 11:31:27 +0000
@@ -28,10 +28,12 @@
int32_t Editor_Set_Height_Tool::handle_click_impl
-(Widelands::Map & map,
- Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
- if (args.origHights.empty()) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle<> const center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+{
+ if (args.origHights.empty())
+ {
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
(map,
Widelands::Area<Widelands::FCoords>
@@ -47,12 +49,14 @@
}
int32_t Editor_Set_Height_Tool::handle_undo_impl
-(Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
+ (Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+{
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
(map,
- Widelands::Area<Widelands::FCoords>
- (map.get_fcoords(center.node), args.sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 1));
+ Widelands::Area<Widelands::FCoords>
+ (map.get_fcoords(center.node),
+ args.sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 1));
std::list<Widelands::Field::Height>::iterator i = args.origHights.begin();
@@ -60,13 +64,16 @@
mr.location().field->set_height(*i); i++;
} while (mr.advance(map));
- map.recalc_for_field_area(Widelands::Area<Widelands::FCoords>
- (map.get_fcoords(center.node), args.sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 2));
+ map.recalc_for_field_area
+ (Widelands::Area<Widelands::FCoords>
+ (map.get_fcoords(center.node),
+ args.sel_radius + MAX_FIELD_HEIGHT / MAX_FIELD_HEIGHT_DIFF + 2));
return mr.radius() + 1;
}
-Editor_Action_Args Editor_Set_Height_Tool::format_args_impl(Editor_Interactive & parent) {
+Editor_Action_Args Editor_Set_Height_Tool::format_args_impl(Editor_Interactive & parent)
+{
Editor_Action_Args a(parent);
a.m_interval = m_interval;
return a;
=== modified file 'src/editor/tools/editor_set_height_tool.h'
--- src/editor/tools/editor_set_height_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_set_height_tool.h 2012-02-20 11:31:27 +0000
@@ -31,10 +31,12 @@
{}
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
int32_t handle_undo_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
Editor_Action_Args format_args_impl(Editor_Interactive & parent);
@@ -42,7 +44,7 @@
return "pics/fsel_editor_set_height.png";
}
- interval<Widelands::Field::Height> get_interval() const throw() {
+ interval<Widelands::Field::Height> get_interval() const throw () {
return m_interval;
}
void set_interval(interval<Widelands::Field::Height> const i) {
=== modified file 'src/editor/tools/editor_set_origin_tool.cc'
--- src/editor/tools/editor_set_origin_tool.cc 2012-02-13 21:39:56 +0000
+++ src/editor/tools/editor_set_origin_tool.cc 2012-02-20 11:31:27 +0000
@@ -25,25 +25,29 @@
#include "wui/overlay_manager.h"
int32_t Editor_Set_Origin_Tool::handle_click_impl
-(Widelands::Map & map,
- Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & eia, Editor_Action_Args & args) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle<> const center,
+ Editor_Interactive & eia,
+ Editor_Action_Args & args)
+{
map.set_origin(center.node);
map.overlay_manager().reset();
eia.register_overlays();
eia.set_rel_viewpoint
(Point
- (-(center.node.x * 2 + (center.node.y & 1)) *(TRIANGLE_WIDTH / 2),
+ (-(center.node.x * 2 + (center.node.y & 1)) * (TRIANGLE_WIDTH / 2),
- center.node.y * TRIANGLE_HEIGHT),
true);
return 0;
}
int32_t Editor_Set_Origin_Tool::handle_undo_impl
-(Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
- Widelands::Coords nc(map.get_width() - center.node.x,
- map.get_height() - center.node.y);
+ (Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+{
+ Widelands::Coords nc
+ (map.get_width() - center.node.x,
+ map.get_height() - center.node.y);
map.set_origin(nc);
map.overlay_manager().reset();
parent.register_overlays();
@@ -55,7 +59,8 @@
return 0;
}
-Editor_Action_Args Editor_Set_Origin_Tool::format_args_impl(Editor_Interactive & parent) {
+Editor_Action_Args Editor_Set_Origin_Tool::format_args_impl(Editor_Interactive & parent)
+{
return Editor_Tool::format_args_impl(parent);
}
=== modified file 'src/editor/tools/editor_set_origin_tool.h'
--- src/editor/tools/editor_set_origin_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_set_origin_tool.h 2012-02-20 11:31:27 +0000
@@ -29,10 +29,12 @@
Editor_Set_Origin_Tool() : Editor_Tool(*this, *this) {}
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & eia, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & eia, Editor_Action_Args & args);
int32_t handle_undo_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
Editor_Action_Args format_args_impl(Editor_Interactive & parent);
=== modified file 'src/editor/tools/editor_set_port_space_tool.cc'
--- src/editor/tools/editor_set_port_space_tool.cc 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_set_port_space_tool.cc 2012-02-20 11:31:27 +0000
@@ -31,7 +31,8 @@
/// static callback function for overlay calculation
int32_t Editor_Tool_Set_Port_Space_Callback
-(Widelands::TCoords<Widelands::FCoords> const c, void * const data, int32_t) {
+ (Widelands::TCoords<Widelands::FCoords> const c, void * const data, int32_t)
+{
assert(data);
Map const & map = *static_cast<Map const *>(data);
NodeCaps const caps = c.field->nodecaps();
@@ -62,9 +63,10 @@
int32_t Editor_Set_Port_Space_Tool::handle_click_impl
-(Map & map,
- Widelands::Node_and_Triangle<> const center,
- Editor_Interactive &, Editor_Action_Args &) {
+ (Map & map,
+ Widelands::Node_and_Triangle<> const center,
+ Editor_Interactive &, Editor_Action_Args &)
+{
assert(0 <= center.node.x);
assert(center.node.x < map.get_width());
assert(0 <= center.node.y);
@@ -81,15 +83,18 @@
}
int32_t Editor_Set_Port_Space_Tool::handle_undo_impl
-(Map & map, Node_and_Triangle< Coords > center, Editor_Interactive & parent, Editor_Action_Args & args) {
+ (Map & map, Node_and_Triangle< Coords > center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+{
return parent.tools.unset_port_space.handle_click_impl(map, center, parent, args);
}
int32_t Editor_Unset_Port_Space_Tool::handle_click_impl
-(Map & map,
- Node_and_Triangle<> const center,
- Editor_Interactive &, Editor_Action_Args &) {
+ (Map & map,
+ Node_and_Triangle<> const center,
+ Editor_Interactive &, Editor_Action_Args &)
+{
assert(0 <= center.node.x);
assert(center.node.x < map.get_width());
assert(0 <= center.node.y);
@@ -97,7 +102,8 @@
// check if field is valid
// check if field is valid
- if (Editor_Tool_Set_Port_Space_Callback(map.get_fcoords(center.node), &map, 0)) {
+ if (Editor_Tool_Set_Port_Space_Callback(map.get_fcoords(center.node), &map, 0))
+ {
map.set_port_space(map.get_fcoords(center.node), false);
Area<FCoords> a(map.get_fcoords(center.node), 0);
map.recalc_for_field_area(a);
@@ -107,6 +113,8 @@
}
int32_t Editor_Unset_Port_Space_Tool::handle_undo_impl
-(Map & map, Node_and_Triangle< Coords > center, Editor_Interactive & parent, Editor_Action_Args & args) {
+ (Map & map, Node_and_Triangle< Coords > center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+{
return parent.tools.set_port_space.handle_click_impl(map, center, parent, args);
}
=== modified file 'src/editor/tools/editor_set_port_space_tool.h'
--- src/editor/tools/editor_set_port_space_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_set_port_space_tool.h 2012-02-20 11:31:27 +0000
@@ -32,10 +32,12 @@
Editor_Unset_Port_Space_Tool();
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
int32_t handle_undo_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
char const * get_sel_impl() const {return FSEL_EUPS_FILENAME;}
};
@@ -46,10 +48,12 @@
Editor_Set_Port_Space_Tool(Editor_Unset_Port_Space_Tool &);
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
int32_t handle_undo_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
char const * get_sel_impl() const {return FSEL_ESPS_FILENAME;}
@@ -58,6 +62,6 @@
};
int32_t Editor_Tool_Set_Port_Space_Callback
-(Widelands::TCoords<Widelands::FCoords>, void *, int32_t);
+ (Widelands::TCoords<Widelands::FCoords>, void *, int32_t);
#endif
=== modified file 'src/editor/tools/editor_set_resources_tool.cc'
--- src/editor/tools/editor_set_resources_tool.cc 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_set_resources_tool.cc 2012-02-20 11:31:27 +0000
@@ -32,9 +32,11 @@
* Sets the resources of the current to a fixed value
*/
int32_t Editor_Set_Resources_Tool::handle_click_impl
-(Widelands::Map & map,
- Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle<> const center,
+ Editor_Interactive & parent,
+ Editor_Action_Args & args)
+{
Widelands::World const & world = map.world();
Overlay_Manager & overlay_manager = map.overlay_manager();
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
@@ -85,8 +87,9 @@
}
int32_t Editor_Set_Resources_Tool::handle_undo_impl
-(Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
+ (Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+{
Widelands::World const & world = map.world();
Overlay_Manager & overlay_manager = map.overlay_manager();
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
@@ -135,7 +138,8 @@
return mr.radius();
}
-Editor_Action_Args Editor_Set_Resources_Tool::format_args_impl(Editor_Interactive & parent) {
+Editor_Action_Args Editor_Set_Resources_Tool::format_args_impl(Editor_Interactive & parent)
+{
Editor_Action_Args a(parent);
a.cur_res = m_cur_res;
a.set_to = m_set_to;
=== modified file 'src/editor/tools/editor_set_resources_tool.h'
--- src/editor/tools/editor_set_resources_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_set_resources_tool.h 2012-02-20 11:31:27 +0000
@@ -30,10 +30,12 @@
{}
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
int32_t handle_undo_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
Editor_Action_Args format_args_impl(Editor_Interactive & parent);
@@ -41,16 +43,15 @@
return "pics/fsel_editor_set_resources.png";
}
- uint8_t get_set_to() const throw() {return m_set_to;}
- void set_set_to(uint8_t const n) throw() {m_set_to = n;}
- Widelands::Resource_Index get_cur_res() const throw() {return m_cur_res;}
- void set_cur_res(Widelands::Resource_Index const res) throw() {
- m_cur_res = res;
- }
+ uint8_t get_set_to() const throw () {return m_set_to;}
+ void set_set_to(uint8_t const n) throw () {m_set_to = n;}
+ Widelands::Resource_Index get_cur_res() const throw () {return m_cur_res;}
+ void set_cur_res(Widelands::Resource_Index const res) throw ()
+ {m_cur_res = res;}
private:
Widelands::Resource_Index m_cur_res;
- uint8_t m_set_to;
+ uint8_t m_set_to;
};
#endif
=== modified file 'src/editor/tools/editor_set_starting_pos_tool.cc'
--- src/editor/tools/editor_set_starting_pos_tool.cc 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_set_starting_pos_tool.cc 2012-02-20 11:31:27 +0000
@@ -33,7 +33,8 @@
* static callback function for overlay calculation
*/
int32_t Editor_Tool_Set_Starting_Pos_Callback
-(Widelands::TCoords<Widelands::FCoords> const c, void * const data, int32_t) {
+ (Widelands::TCoords<Widelands::FCoords> const c, void * const data, int32_t)
+{
assert(data);
Widelands::Map const & map = *static_cast<Widelands::Map const *>(data);
@@ -58,16 +59,18 @@
}
Editor_Set_Starting_Pos_Tool::Editor_Set_Starting_Pos_Tool()
- : Editor_Tool(*this, *this, false), m_current_sel_pic(0) {
+ : Editor_Tool(*this, *this, false), m_current_sel_pic(0)
+{
m_current_player = 0;
strcpy(fsel_picsname, FSEL_PIC_FILENAME);
}
int32_t Editor_Set_Starting_Pos_Tool::handle_click_impl
-(Widelands::Map & map,
- Widelands::Node_and_Triangle<> const center,
- Editor_Interactive &, Editor_Action_Args &) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle<> const center,
+ Editor_Interactive &, Editor_Action_Args &)
+{
assert(0 <= center.node.x);
assert(center.node.x < map.get_width());
assert(0 <= center.node.y);
@@ -93,7 +96,8 @@
// check if field is valid
if
(Editor_Tool_Set_Starting_Pos_Callback
- (map.get_fcoords(center.node), &map, 0)) {
+ (map.get_fcoords(center.node), &map, 0))
+ {
Overlay_Manager & overlay_manager = map.overlay_manager();
// remove old overlay if any
overlay_manager.remove_overlay(old_sp, picid);
@@ -112,7 +116,8 @@
Widelands::Player_Number Editor_Set_Starting_Pos_Tool::get_current_player
() const
-throw() {
+throw()
+{
return m_current_player;
}
=== modified file 'src/editor/tools/editor_set_starting_pos_tool.h'
--- src/editor/tools/editor_set_starting_pos_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_set_starting_pos_tool.h 2012-02-20 11:31:27 +0000
@@ -36,10 +36,12 @@
Editor_Set_Starting_Pos_Tool();
int32_t handle_click_impl
- (Widelands::Map &, Widelands::Node_and_Triangle<>, Editor_Interactive &, Editor_Action_Args &);
- char const * get_sel_impl() const {return m_current_sel_pic;}
+ (Widelands::Map &, Widelands::Node_and_Triangle<>,
+ Editor_Interactive &, Editor_Action_Args &);
+ char const * get_sel_impl() const
+ {return m_current_sel_pic;}
- Widelands::Player_Number get_current_player() const throw();
+ Widelands::Player_Number get_current_player() const throw ();
void set_current_player(int32_t);
private:
@@ -48,6 +50,6 @@
};
int32_t Editor_Tool_Set_Starting_Pos_Callback
-(Widelands::TCoords<Widelands::FCoords>, void *, int32_t);
+ (Widelands::TCoords<Widelands::FCoords>, void *, int32_t);
#endif
=== modified file 'src/editor/tools/editor_set_terrain_tool.cc'
--- src/editor/tools/editor_set_terrain_tool.cc 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_set_terrain_tool.cc 2012-02-20 11:31:27 +0000
@@ -26,9 +26,10 @@
using Widelands::TCoords;
int32_t Editor_Set_Terrain_Tool::handle_click_impl
-(Widelands::Map & map,
- Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
+ (Widelands::Map & map,
+ Widelands::Node_and_Triangle<> const center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+{
assert
(center.triangle.t == TCoords<>::D or center.triangle.t == TCoords<>::R);
uint16_t const radius = args.sel_radius;
@@ -37,12 +38,14 @@
if (get_nr_enabled() && args.terrainType.empty()) {
Widelands::MapTriangleRegion<TCoords<Widelands::FCoords> > mr
(map, Widelands::Area<TCoords<Widelands::FCoords> >
- (TCoords<Widelands::FCoords>(Widelands::FCoords(map.get_fcoords(center.triangle)),
- static_cast<TCoords<Widelands::FCoords>::TriangleIndex>(center.triangle.t)), radius));
+ (TCoords<Widelands::FCoords>
+ (Widelands::FCoords(map.get_fcoords(center.triangle)),
+ static_cast<TCoords<Widelands::FCoords>::TriangleIndex>(center.triangle.t)),
+ radius));
do {
- args.origTerrainType.push_back(
- (mr.location().t == TCoords<Widelands::FCoords>::D)
- ? mr.location().field->terrain_d() : mr.location().field->terrain_r());
+ args.origTerrainType.push_back
+ ((mr.location().t == TCoords<Widelands::FCoords>::D)
+ ? mr.location().field->terrain_d() : mr.location().field->terrain_r());
args.terrainType.push_back(get_random_enabled());
} while (mr.advance(map));
}
@@ -50,8 +53,10 @@
if (not args.terrainType.empty()) {
Widelands::MapTriangleRegion<TCoords<Widelands::FCoords> > mr
(map, Widelands::Area<TCoords<Widelands::FCoords> >
- (TCoords<Widelands::FCoords>(Widelands::FCoords(map.get_fcoords(center.triangle)),
- static_cast<TCoords<Widelands::FCoords>::TriangleIndex>(center.triangle.t)), radius));
+ (TCoords<Widelands::FCoords>
+ (Widelands::FCoords(map.get_fcoords(center.triangle)),
+ static_cast<TCoords<Widelands::FCoords>::TriangleIndex>(center.triangle.t)),
+ radius));
std::list<Widelands::Terrain_Index>::iterator i = args.terrainType.begin();
do {
max = std::max
@@ -63,8 +68,9 @@
}
int32_t Editor_Set_Terrain_Tool::handle_undo_impl
-(Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
+ (Widelands::Map & map, Widelands::Node_and_Triangle< Widelands::Coords > center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+{
assert
(center.triangle.t == TCoords<>::D or center.triangle.t == TCoords<>::R);
uint16_t const radius = args.sel_radius;
@@ -89,6 +95,7 @@
} else return radius;
}
-Editor_Action_Args Editor_Set_Terrain_Tool::format_args_impl(Editor_Interactive & parent) {
+Editor_Action_Args Editor_Set_Terrain_Tool::format_args_impl(Editor_Interactive & parent)
+{
return Editor_Tool::format_args_impl(parent);
-}
\ No newline at end of file
+}
=== modified file 'src/editor/tools/editor_set_terrain_tool.h'
--- src/editor/tools/editor_set_terrain_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_set_terrain_tool.h 2012-02-20 11:31:27 +0000
@@ -27,15 +27,17 @@
Editor_Set_Terrain_Tool() : Editor_Tool(*this, *this) {}
int32_t handle_click_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
int32_t handle_undo_impl
- (Widelands::Map & map, Widelands::Node_and_Triangle<> center, Editor_Interactive & parent, Editor_Action_Args & args);
+ (Widelands::Map & map, Widelands::Node_and_Triangle<> center,
+ Editor_Interactive & parent, Editor_Action_Args & args);
Editor_Action_Args format_args_impl(Editor_Interactive & parent);
char const * get_sel_impl() const {return "pics/fsel.png";}
- bool operates_on_triangles() const throw() {return true;};
+ bool operates_on_triangles() const throw () {return true;};
};
#endif
=== modified file 'src/editor/tools/editor_tool.h'
--- src/editor/tools/editor_tool.h 2012-02-12 00:19:00 +0000
+++ src/editor/tools/editor_tool.h 2012-02-20 11:31:27 +0000
@@ -44,18 +44,20 @@
enum Tool_Index {First, Second, Third};
int32_t handle_click
- (const Tool_Index i,
- Widelands::Map & map, Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
+ (const Tool_Index i,
+ Widelands::Map & map, Widelands::Node_and_Triangle<> const center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+ {
return
(i == First ? *this : i == Second ? m_second : m_third)
.handle_click_impl(map, center, parent, args);
}
int32_t handle_undo
- (const Tool_Index i,
- Widelands::Map & map, Widelands::Node_and_Triangle<> const center,
- Editor_Interactive & parent, Editor_Action_Args & args) {
+ (const Tool_Index i,
+ Widelands::Map & map, Widelands::Node_and_Triangle<> const center,
+ Editor_Interactive & parent, Editor_Action_Args & args)
+ {
return
(i == First ? *this : i == Second ? m_second : m_third)
.handle_undo_impl(map, center, parent, args);
@@ -73,7 +75,7 @@
.format_args_impl(parent);
}
- bool is_unduable() { return undoable; }
+ bool is_unduable() {return undoable;}
virtual Editor_Action_Args format_args_impl(Editor_Interactive & parent) {
return Editor_Action_Args(parent);
}
@@ -82,7 +84,7 @@
= 0;
virtual int32_t handle_undo_impl
(Widelands::Map &, Widelands::Node_and_Triangle<>, Editor_Interactive &, Editor_Action_Args &)
- { return 0; } // non unduable tools don't need to implement this.
+ {return 0;} // non unduable tools don't need to implement this.
virtual const char * get_sel_impl() const = 0;
virtual bool operates_on_triangles() const {return false;};
=== modified file 'src/editor/tools/editor_tool_action.h'
--- src/editor/tools/editor_tool_action.h 2012-02-13 21:39:56 +0000
+++ src/editor/tools/editor_tool_action.h 2012-02-20 11:31:27 +0000
@@ -24,7 +24,7 @@
#include "editor_action_args.h"
struct Editor_Tool;
-namespace Widelands { class map; }
+namespace Widelands {class map;}
struct Editor_Interactive;
@@ -41,23 +41,26 @@
Editor_Action_Args * args;
Editor_Tool_Action
- (Editor_Tool & t, uint32_t ind,
- Widelands::Map & m, Widelands::Node_and_Triangle<> c,
- Editor_Interactive & p, Editor_Action_Args nargs):
- tool(t), i(ind), map(m), center(c), parent(p) {
+ (Editor_Tool & t, uint32_t ind,
+ Widelands::Map & m, Widelands::Node_and_Triangle<> c,
+ Editor_Interactive & p, Editor_Action_Args nargs)
+ : tool(t), i(ind), map(m), center(c), parent(p)
+ {
args = new Editor_Action_Args(parent);
*args = nargs;
args->refcount++;
}
~Editor_Tool_Action() {
- if (args->refcount <= 1) delete args;
+ if (args->refcount <= 1)
+ delete args;
else args->refcount--;
}
Editor_Tool_Action(const Editor_Tool_Action & b):
- tool(b.tool), i(b.i), map(b.map), center(b.center), parent(b.parent), args(b.args)
- { args->refcount++; }
+ tool(b.tool), i(b.i), map(b.map),
+ center(b.center), parent(b.parent), args(b.args)
+ {args->refcount++;}
};
-#endif
\ No newline at end of file
+#endif
Follow ups