wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src playturn.cpp replay.cpp unit.cpp un...


From: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth/src playturn.cpp replay.cpp unit.cpp un...
Date: Fri, 29 Apr 2005 17:37:26 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    05/04/29 21:37:26

Modified files:
        src            : playturn.cpp replay.cpp unit.cpp unit.hpp 

Log message:
        A little cleanup.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.364&tr2=1.365&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/replay.cpp.diff?tr1=1.108&tr2=1.109&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit.cpp.diff?tr1=1.148&tr2=1.149&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit.hpp.diff?tr1=1.67&tr2=1.68&r1=text&r2=text

Patches:
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.364 wesnoth/src/playturn.cpp:1.365
--- wesnoth/src/playturn.cpp:1.364      Sun Apr 24 19:15:39 2005
+++ wesnoth/src/playturn.cpp    Fri Apr 29 21:37:26 2005
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.364 2005/04/24 19:15:39 isaaccp Exp $ */
+/* $Id: playturn.cpp,v 1.365 2005/04/29 21:37:26 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1952,7 +1952,7 @@
 
        //sort the available units into order by value
        //so that the most valuable units are shown first
-       std::sort(recall_list.begin(),recall_list.end(),compare_unit_values());
+       sort_units(recall_list);
 
        gui_.draw(); //clear the old menu
 
Index: wesnoth/src/replay.cpp
diff -u wesnoth/src/replay.cpp:1.108 wesnoth/src/replay.cpp:1.109
--- wesnoth/src/replay.cpp:1.108        Sat Apr 23 12:13:10 2005
+++ wesnoth/src/replay.cpp      Fri Apr 29 21:37:26 2005
@@ -1,4 +1,4 @@
-/* $Id: replay.cpp,v 1.108 2005/04/23 12:13:10 gruikya Exp $ */
+/* $Id: replay.cpp,v 1.109 2005/04/29 21:37:26 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -716,7 +716,7 @@
                                if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
 
-                       
std::sort(player->available_units.begin(),player->available_units.end(),compare_unit_values());
+                       sort_units(player->available_units);
 
                        const std::string& recall_num = (*child)["value"];
                        const int val = atoi(recall_num.c_str());
@@ -742,7 +742,7 @@
                                if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
 
-                       
std::sort(player->available_units.begin(),player->available_units.end(),compare_unit_values());
+                       sort_units(player->available_units);
                        const std::string& unit_num = (*child)["value"];
                        const int val = atoi(unit_num.c_str());
 
Index: wesnoth/src/unit.cpp
diff -u wesnoth/src/unit.cpp:1.148 wesnoth/src/unit.cpp:1.149
--- wesnoth/src/unit.cpp:1.148  Fri Apr 29 21:27:43 2005
+++ wesnoth/src/unit.cpp        Fri Apr 29 21:37:26 2005
@@ -1,4 +1,4 @@
-/* $Id: unit.cpp,v 1.148 2005/04/29 21:27:43 silene Exp $ */
+/* $Id: unit.cpp,v 1.149 2005/04/29 21:37:26 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -43,7 +43,7 @@
                                            sizeof(*ModificationTypes);
 }
 
-bool compare_unit_values::operator()(const unit& a, const unit& b) const
+static bool compare_unit_values(unit const &a, unit const &b)
 {
        const int lvla = a.type().level();
        const int lvlb = b.type().level();
@@ -58,6 +58,11 @@
                              lvla == lvlb && namea == nameb && xpa < xpb;
 }
 
+void sort_units(std::vector< unit > &units)
+{
+       std::sort(units.begin(), units.end(), compare_unit_values);
+}
+
 //constructor for reading a unit
 unit::unit(const game_data& data, const config& cfg) : 
        state_(STATE_NORMAL),
Index: wesnoth/src/unit.hpp
diff -u wesnoth/src/unit.hpp:1.67 wesnoth/src/unit.hpp:1.68
--- wesnoth/src/unit.hpp:1.67   Thu Apr  7 21:16:50 2005
+++ wesnoth/src/unit.hpp        Fri Apr 29 21:37:26 2005
@@ -1,4 +1,4 @@
-/* $Id: unit.hpp,v 1.67 2005/04/07 21:16:50 gruikya Exp $ */
+/* $Id: unit.hpp,v 1.68 2005/04/29 21:37:26 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -255,10 +255,7 @@
        int moves_;
 };
 
-struct compare_unit_values
-{
-       bool operator()(const unit& a, const unit& b) const;
-};
+void sort_units(std::vector< unit > &);
 
 int team_units(const unit_map& units, int team_num);
 int team_upkeep(const unit_map& units, int team_num);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]