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:
Gunter Labes 2025-02-12 09:12:05 +01:00
parent 730763f3bb
commit 52c5a457e0
No known key found for this signature in database
GPG Key ID: C0C7B971CC910216
3 changed files with 5 additions and 5 deletions

View File

@ -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);
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
current_team.set_action_bonus_count(1 + current_team.action_bonus_count());
// Do the recruiting.
synced_context::run_and_throw("recruit", replay_helper::get_recruit(name, loc, recruited_from));
return true;
} else if(!res.has_value()) {
} else if(res.empty()) {
return false;
} else {
gui2::show_transient_message("", res.value());
gui2::show_transient_message("", res);
return false;
}

View File

@ -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
// 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.
utils::optional<t_string> recruit_message(
t_string recruit_message(
const std::string& type_id,
map_location& target_hex,
map_location& recruited_from,

View File

@ -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;
otherwise, return an error message string describing the reason. */
utils::optional<t_string> recruit_message(
t_string recruit_message(
const std::string& type_id,
map_location& target_hex,
map_location& recruited_from,