Author: fendrin
Date: Mon Mar 14 21:27:14 2011
New Revision: 48911

URL: http://svn.gna.org/viewcvs/wesnoth?rev=48911&view=rev
Log:
Code cleanups.

Modified:
    branches/editor/src/editor/action.cpp

Modified: branches/editor/src/editor/action.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/editor/src/editor/action.cpp?rev=48911&r1=48910&r2=48911&view=diff
==============================================================================
--- branches/editor/src/editor/action.cpp (original)
+++ branches/editor/src/editor/action.cpp Mon Mar 14 21:27:14 2011
@@ -375,10 +375,12 @@
        u.set_standing();
        mc.set_needs_labels_reset();
 
-       //TODO
-//     if (mc.get_map().is_village(new_loc_)) {
-//             (*(resources::teams))[u.side()].get_village(new_loc_);
-//     }
+       /* @todo
+         if (mc.get_map().is_village(new_loc_)) {
+               (*(resources::teams))[u.side()].get_village(new_loc_);
+       }
+       */
+
 //TODO check if that is useful
 //     resources::screen->invalidate_unit_after_move(loc_, new_loc_);
 //     resources::screen->draw();
@@ -389,9 +391,6 @@
        mc.get_map().get_game_labels().set_label(loc_,text_);
        mc.set_needs_labels_reset();
 }
-
-
-
 
 editor_action* editor_action_village::perform(map_context& mc) const
 {
@@ -417,26 +416,23 @@
 
        return undo.release();
 }
+
 void editor_action_village::perform_without_undo(map_context& mc) const
 {
        std::vector<team>& teams = mc.get_map().get_teams();
        for(std::vector<team>::iterator i = teams.begin(); i != teams.end(); 
++i) {
                        i->lose_village(loc_);
        }
-       //TODO remove debug output
-       //ERR_ED << teams[0].to_config().debug();
-       ERR_ED << side_number_;
+
        teams[side_number_].get_village(loc_);
 }
 
-
 editor_action* editor_action_village_delete::perform(map_context& mc) const
 {
        std::auto_ptr<editor_action> undo;
 
-       //TODO can teams be const?
-       std::vector<team>& teams = mc.get_map().get_teams();
-       for(std::vector<team>::iterator i = teams.begin(); i != teams.end(); 
++i) {
+       const std::vector<team>& teams = mc.get_map().get_teams();
+       for(std::vector<team>::const_iterator i = teams.begin(); i != 
teams.end(); ++i) {
                if (i->owns_village(loc_)) {
                        perform_without_undo(mc);
                        undo.reset(new editor_action_village(loc_, i->side() 
-1));
@@ -469,6 +465,7 @@
        }
        return undo.release();
 }
+
 void editor_action_unit_delete::perform_without_undo(map_context& mc) const
 {
        unit_map& units = mc.get_units();
@@ -478,27 +475,21 @@
        mc.set_needs_labels_reset();
 }
 
-
-
-
-
-
 editor_action* editor_action_unit::perform(map_context& mc) const
 {
        std::auto_ptr<editor_action> undo(new editor_action_unit_delete(loc_));
        perform_without_undo(mc);
        return undo.release();
 }
+
 void editor_action_unit::perform_without_undo(map_context& mc) const
 {
        mc.get_units().add(loc_,u_);
        mc.get_units().find(loc_)->set_location(loc_);
-       //TODO may be useful
-       //      chosen.new_turn();
+
        mc.set_needs_labels_reset();
 }
 
-
 editor_action_unit_delete* editor_action_unit_delete::clone() const
 {
        return new editor_action_unit_delete(*this);
@@ -508,6 +499,7 @@
 {
        return new editor_action_select(*this);
 }
+
 void editor_action_select::extend(const editor_map& map, const 
std::set<map_location>& locs)
 {
        foreach (const map_location& loc, locs) {
@@ -518,6 +510,7 @@
                }
        }
 }
+
 editor_action* editor_action_select::perform(map_context& mc) const
 {
        std::set<map_location> undo_locs;
@@ -530,6 +523,7 @@
        perform_without_undo(mc);
        return new editor_action_deselect(undo_locs);
 }
+
 void editor_action_select::perform_without_undo(map_context& mc) const
 {
        foreach (const map_location& loc, area_) {
@@ -542,6 +536,7 @@
 {
        return new editor_action_deselect(*this);
 }
+
 void editor_action_deselect::extend(const editor_map& map, const 
std::set<map_location>& locs)
 {
        foreach (const map_location& loc, locs) {
@@ -552,6 +547,7 @@
                }
        }
 }
+
 editor_action* editor_action_deselect::perform(map_context& mc) const
 {
        std::set<map_location> undo_locs;
@@ -564,6 +560,7 @@
        perform_without_undo(mc);
        return new editor_action_select(undo_locs);
 }
+
 void editor_action_deselect::perform_without_undo(map_context& mc) const
 {
        foreach (const map_location& loc, area_) {
@@ -576,6 +573,7 @@
 {
        return new editor_action_select_all(*this);
 }
+
 editor_action_deselect* editor_action_select_all::perform(map_context& mc) 
const
 {
        std::set<map_location> current = mc.get_map().selection();
@@ -588,6 +586,7 @@
        mc.set_everything_changed();
        return new editor_action_deselect(undo_locs);
 }
+
 void editor_action_select_all::perform_without_undo(map_context& mc) const
 {
        mc.get_map().select_all();
@@ -598,6 +597,7 @@
 {
        return new editor_action_select_none(*this);
 }
+
 editor_action_select* editor_action_select_none::perform(map_context& mc) const
 {
        std::set<map_location> current = mc.get_map().selection();
@@ -605,6 +605,7 @@
        mc.set_everything_changed();
        return new editor_action_select(current);
 }
+
 void editor_action_select_none::perform_without_undo(map_context& mc) const
 {
        mc.get_map().clear_selection();
@@ -615,11 +616,13 @@
 {
        return new editor_action_select_inverse(*this);
 }
+
 editor_action_select_inverse* 
editor_action_select_inverse::perform(map_context& mc) const
 {
        perform_without_undo(mc);
        return new editor_action_select_inverse();
 }
+
 void editor_action_select_inverse::perform_without_undo(map_context& mc) const
 {
        mc.get_map().invert_selection();
@@ -630,6 +633,7 @@
 {
        return new editor_action_resize_map(*this);
 }
+
 void editor_action_resize_map::perform_without_undo(map_context& mc) const
 {
        mc.get_map().resize(x_size_, y_size_, x_offset_, y_offset_, fill_);
@@ -640,6 +644,7 @@
 {
        return new editor_action_apply_mask(*this);
 }
+
 void editor_action_apply_mask::perform_without_undo(map_context& mc) const
 {
        mc.get_map().overlay(mask_, config(), 0, 0, true);
@@ -650,6 +655,7 @@
 {
        return new editor_action_create_mask(*this);
 }
+
 void editor_action_create_mask::perform_without_undo(map_context& mc) const
 {
        //TODO


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to