mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-10 15:35:25 +00:00
Fix building with xcode
No viable conversion from returned value of type 'basic_string<char, char_traits<char>, allocator<char>>' to function return type 'utils::optional<t_string>'
This commit is contained in:
parent
730763f3bb
commit
52c5a457e0
@ -317,17 +317,17 @@ bool menu_handler::do_recruit(const std::string& name, int side_num, map_locatio
|
|||||||
team& current_team = board().get_team(side_num);
|
team& current_team = board().get_team(side_num);
|
||||||
const auto& res = unit_helper::recruit_message(name, loc, recruited_from, current_team);
|
const auto& res = unit_helper::recruit_message(name, loc, recruited_from, current_team);
|
||||||
|
|
||||||
if(!res.has_value() && (!pc_.get_whiteboard() || !pc_.get_whiteboard()->save_recruit(name, side_num, loc))) {
|
if(res.empty() && (!pc_.get_whiteboard() || !pc_.get_whiteboard()->save_recruit(name, side_num, loc))) {
|
||||||
// MP_COUNTDOWN grant time bonus for recruiting
|
// MP_COUNTDOWN grant time bonus for recruiting
|
||||||
current_team.set_action_bonus_count(1 + current_team.action_bonus_count());
|
current_team.set_action_bonus_count(1 + current_team.action_bonus_count());
|
||||||
|
|
||||||
// Do the recruiting.
|
// Do the recruiting.
|
||||||
synced_context::run_and_throw("recruit", replay_helper::get_recruit(name, loc, recruited_from));
|
synced_context::run_and_throw("recruit", replay_helper::get_recruit(name, loc, recruited_from));
|
||||||
return true;
|
return true;
|
||||||
} else if(!res.has_value()) {
|
} else if(res.empty()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
gui2::show_transient_message("", res.value());
|
gui2::show_transient_message("", res);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ std::string format_movement_string(const int moves_left, const int moves_max)
|
|||||||
// TODO: Return multiple strings here, in case more than one error applies? For
|
// TODO: Return multiple strings here, in case more than one error applies? For
|
||||||
// example, if you start AOI S5 with 0GP and recruit a Mage, two reasons apply,
|
// example, if you start AOI S5 with 0GP and recruit a Mage, two reasons apply,
|
||||||
// leader not on keep (extrarecruit=Mage) and not enough gold.
|
// leader not on keep (extrarecruit=Mage) and not enough gold.
|
||||||
utils::optional<t_string> recruit_message(
|
t_string recruit_message(
|
||||||
const std::string& type_id,
|
const std::string& type_id,
|
||||||
map_location& target_hex,
|
map_location& target_hex,
|
||||||
map_location& recruited_from,
|
map_location& recruited_from,
|
||||||
|
@ -101,7 +101,7 @@ std::string format_movement_string(const int moves_left, const int moves_max);
|
|||||||
|
|
||||||
/** @return If the recruit is possible, an empty optional and set @a recruited_from;
|
/** @return If the recruit is possible, an empty optional and set @a recruited_from;
|
||||||
otherwise, return an error message string describing the reason. */
|
otherwise, return an error message string describing the reason. */
|
||||||
utils::optional<t_string> recruit_message(
|
t_string recruit_message(
|
||||||
const std::string& type_id,
|
const std::string& type_id,
|
||||||
map_location& target_hex,
|
map_location& target_hex,
|
||||||
map_location& recruited_from,
|
map_location& recruited_from,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user