mail[Wesnoth-commits] r37317 - in /trunk/src: actions.cpp actions.hpp ai/actions.cpp ai/contexts.cpp game_events.cpp menu_events.cpp replay.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by guillaume . melquiond on July 29, 2009 - 09:14:
Author: silene
Date: Wed Jul 29 09:14:41 2009
New Revision: 37317

URL: http://svn.gna.org/viewcvs/wesnoth?rev=37317&view=rev
Log:
Fixed units not being recruited in retail builds.

Modified:
    trunk/src/actions.cpp
    trunk/src/actions.hpp
    trunk/src/ai/actions.cpp
    trunk/src/ai/contexts.cpp
    trunk/src/game_events.cpp
    trunk/src/menu_events.cpp
    trunk/src/replay.cpp

Modified: trunk/src/actions.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/actions.cpp?rev=37317&r1=37316&r2=37317&view=diff
==============================================================================
--- trunk/src/actions.cpp (original)
+++ trunk/src/actions.cpp Wed Jul 29 09:14:41 2009
@@ -263,14 +263,13 @@
        return std::string();
 }
 
-bool place_recruit(const unit &u, const map_location &recruit_location,
+void place_recruit(const unit &u, const map_location &recruit_location,
     bool is_recall, bool show, bool full_movement,
     bool wml_triggered)
 {
        LOG_NG << "placing new unit on location " << recruit_location << "\n";
 
-       if (resources::units->count(recruit_location) == 1)
-               return false;
+       assert(resources::units->count(recruit_location) == 0);
 
        unit new_unit = u;
        if (full_movement) {
@@ -348,8 +347,6 @@
                cfg["checksum"] = checksum;
                set_random_results(cfg);
        }
-
-       return true;
 }
 
 map_location under_leadership(const unit_map& units,

Modified: trunk/src/actions.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/actions.hpp?rev=37317&r1=37316&r2=37317&view=diff
==============================================================================
--- trunk/src/actions.hpp (original)
+++ trunk/src/actions.hpp Wed Jul 29 09:14:41 2009
@@ -62,12 +62,8 @@
  * Place a unit into the game.
  * The unit will be placed on @a recruit_location, which should be retrieved
  * through a call to recruit_location().
- *
- * If @a disp is not NULL, the new unit will be faded in.
- *
- * @return false if the location was already occupied. True on success.
- */
-bool place_recruit(const unit &u, const map_location &recruit_location,
+ */
+void place_recruit(const unit &u, const map_location &recruit_location,
        bool is_recall, bool show = false, bool full_movement = false,
        bool wml_triggered = false);
 

Modified: trunk/src/ai/actions.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai/actions.cpp?rev=37317&r1=37316&r2=37317&view=diff
==============================================================================
--- trunk/src/ai/actions.cpp (original)
+++ trunk/src/ai/actions.cpp Wed Jul 29 09:14:41 2009
@@ -676,7 +676,7 @@
        const std::string recruit_err = find_recruit_location(get_side(), 
loc);
        if(recruit_err.empty()) {
                const unit new_unit(&info.units, &u->second, get_side(), 
true);
-               assert(place_recruit(new_unit, loc, false, 
preferences::show_ai_moves()));
+               place_recruit(new_unit, loc, false, 
preferences::show_ai_moves());
                statistics::recruit_unit(new_unit);
                get_my_team(info).spend_gold(u->second.cost());
                // Confirm the transaction - i.e. don't undo recruitment

Modified: trunk/src/ai/contexts.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai/contexts.cpp?rev=37317&r1=37316&r2=37317&view=diff
==============================================================================
--- trunk/src/ai/contexts.cpp (original)
+++ trunk/src/ai/contexts.cpp Wed Jul 29 09:14:41 2009
@@ -188,7 +188,7 @@
        const std::string recruit_err = find_recruit_location(get_side(), 
loc);
        if(recruit_err.empty()) {
                const unit new_unit(&get_info().units, &u->second, 
get_side(), true);
-               assert(place_recruit(new_unit, loc, false, 
preferences::show_ai_moves()));
+               place_recruit(new_unit, loc, false, 
preferences::show_ai_moves());
 
                statistics::recruit_unit(new_unit);
                current_team_w().spend_gold(u->second.cost());

Modified: trunk/src/game_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=37317&r1=37316&r2=37317&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Wed Jul 29 09:14:41 2009
@@ -2015,7 +2015,7 @@
                                        unit to_recruit(*u);
                                        avail.erase(u); // Erase before 
recruiting, since recruiting can fire more events
                                        find_recruit_location(index + 1, loc, 
false);
-                                       assert(place_recruit(to_recruit, loc, 
true, utils::string_bool(cfg["show"], true), true, true));
+                                       place_recruit(to_recruit, loc, true, 
utils::string_bool(cfg["show"], true), true, true);
                                        unit_recalled = true;
                                        break;
                                }

Modified: trunk/src/menu_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/menu_events.cpp?rev=37317&r1=37316&r2=37317&view=diff
==============================================================================
--- trunk/src/menu_events.cpp (original)
+++ trunk/src/menu_events.cpp Wed Jul 29 09:14:41 2009
@@ -787,7 +787,7 @@
                        const std::string &msg = 
find_recruit_location(side_num, loc);
                        if(msg.empty()) {
                                const unit new_unit(&units_, &u_type->second, 
side_num, true);
-                               assert(place_recruit(new_unit, loc, false, 
gui_ != NULL));
+                               place_recruit(new_unit, loc, false, true);
                                
current_team.spend_gold(u_type->second.cost());
                                statistics::recruit_unit(new_unit);
 
@@ -947,7 +947,7 @@
                                        } else {
                                                unit& un = 
recall_list_team[res];
                                                un.set_game_context(&units_);
-                                               assert(place_recruit(un, loc, 
true, gui_ != NULL));
+                                               place_recruit(un, loc, true, 
true);
                                                statistics::recall_unit(un);
                                                
current_team.spend_gold(game_config::recall_cost);
 
@@ -1116,7 +1116,7 @@
                                if(msg.empty()) {
                                        unit un = 
current_team.recall_list()[action.recall_pos];
                                        un.set_game_context(&units_);
-                                       assert(place_recruit(un, loc, true, 
gui_ != NULL));
+                                       place_recruit(un, loc, true, true);
                                        statistics::recall_unit(un);
                                        
current_team.spend_gold(game_config::recall_cost);
                                        
current_team.recall_list().erase(current_team.recall_list().begin()+action.recall_pos);
@@ -1156,7 +1156,7 @@
                        if(msg.empty()) {
                                const unit new_unit = action.affected_unit;
                                //unit 
new_unit(action.affected_unit.type(),team_num_,true);
-                               assert(place_recruit(new_unit, loc, false, 
gui_ != NULL));
+                               place_recruit(new_unit, loc, false, true);
                                
current_team.spend_gold(new_unit.type()->cost());
                                statistics::recruit_unit(new_unit);
 

Modified: trunk/src/replay.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/replay.cpp?rev=37317&r1=37316&r2=37317&view=diff
==============================================================================
--- trunk/src/replay.cpp (original)
+++ trunk/src/replay.cpp Wed Jul 29 09:14:41 2009
@@ -926,7 +926,7 @@
                        const std::string res = 
find_recruit_location(side_num, loc);
                        const unit new_unit(resources::units, 
&u_type->second, side_num, true, false);
                        if (res.empty()) {
-                               assert(place_recruit(new_unit, loc, false, 
!get_replay_source().is_skipping()));
+                               place_recruit(new_unit, loc, false, 
!get_replay_source().is_skipping());
                        } else {
                                std::stringstream errbuf;
                                errbuf << "cannot recruit unit: " << res << 
"\n";




Related Messages


Powered by MHonArc, Updated Wed Jul 29 11:21:30 2009