mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-28 07:46:03 +00:00
Fixed units not being recruited in retail builds.
This commit is contained in:
parent
7c3a3ae88f
commit
375bc7c3c5
@ -263,14 +263,13 @@ std::string find_recruit_location(int side, map_location &recruit_loc, bool need
|
||||
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 @@ bool place_recruit(const unit &u, const map_location &recruit_location,
|
||||
cfg["checksum"] = checksum;
|
||||
set_random_results(cfg);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
map_location under_leadership(const unit_map& units,
|
||||
|
@ -62,12 +62,8 @@ std::string find_recruit_location(int side, map_location &recruit_location,
|
||||
* 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);
|
||||
|
||||
|
@ -676,7 +676,7 @@ void recruit_result::do_execute()
|
||||
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
|
||||
|
@ -188,7 +188,7 @@ bool readwrite_context_impl::recruit(const std::string& unit_name, map_location
|
||||
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());
|
||||
|
@ -2015,7 +2015,7 @@ WML_HANDLER_FUNCTION(recall, /*event_info*/, cfg)
|
||||
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;
|
||||
}
|
||||
|
@ -787,7 +787,7 @@ private:
|
||||
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 @@ private:
|
||||
} 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 @@ private:
|
||||
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 @@ private:
|
||||
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);
|
||||
|
||||
|
@ -926,7 +926,7 @@ bool do_replay_handle(int side_num, const std::string &do_untill)
|
||||
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";
|
||||
|
Loading…
x
Reference in New Issue
Block a user