unit_recruit: Pass the error strings as t_string
This commit is contained in:
parent
69f7ba660c
commit
129e53b660
4 changed files with 8 additions and 7 deletions
|
@ -42,7 +42,7 @@ namespace dialogs
|
|||
|
||||
REGISTER_DIALOG(unit_recruit)
|
||||
|
||||
unit_recruit::unit_recruit(std::map<const unit_type*, std::string>& recruit_map, team& team)
|
||||
unit_recruit::unit_recruit(std::map<const unit_type*, t_string>& recruit_map, team& team)
|
||||
: recruit_list_()
|
||||
, recruit_map_(recruit_map)
|
||||
, team_(team)
|
||||
|
@ -127,7 +127,7 @@ void unit_recruit::pre_show(window& window)
|
|||
|
||||
for(const auto& recruit : recruit_list_)
|
||||
{
|
||||
const std::string& error = recruit_map_[recruit];
|
||||
const t_string& error = recruit_map_[recruit];
|
||||
std::map<std::string, string_map> row_data;
|
||||
string_map column;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class unit_recruit : public modal_dialog
|
|||
public:
|
||||
/// @param recruit_map maps unit typs to strings. The strings are ""
|
||||
/// if the unit can be recalled and an error message string otherwise.
|
||||
unit_recruit(std::map<const unit_type*, std::string>& recruit_map, team& team);
|
||||
unit_recruit(std::map<const unit_type*, t_string>& recruit_map, team& team);
|
||||
|
||||
const unit_type *get_selected_unit_type() const
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ private:
|
|||
|
||||
/// A vector of unit types in the order listed in the UI. Used by unit_recruit::post_show.
|
||||
std::vector<const unit_type*> recruit_list_;
|
||||
std::map<const unit_type*, std::string>& recruit_map_;
|
||||
std::map<const unit_type*, t_string>& recruit_map_;
|
||||
|
||||
team& team_;
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ bool menu_handler::has_friends() const
|
|||
|
||||
void menu_handler::recruit(int side_num, const map_location& last_hex)
|
||||
{
|
||||
std::map<const unit_type*, std::string> sample_units;
|
||||
std::map<const unit_type*, t_string> sample_units;
|
||||
|
||||
std::set<std::string> recruits = actions::get_recruits(side_num, last_hex);
|
||||
|
||||
|
@ -301,7 +301,7 @@ void menu_handler::repeat_recruit(int side_num, const map_location& last_hex)
|
|||
// 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.
|
||||
std::string menu_handler::can_recruit(const std::string& name, int side_num, map_location& loc, map_location& recruited_from)
|
||||
t_string menu_handler::can_recruit(const std::string& name, int side_num, map_location& loc, map_location& recruited_from)
|
||||
{
|
||||
team& current_team = board().get_team(side_num);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ class game_board;
|
|||
class play_controller;
|
||||
class team;
|
||||
class unit_map;
|
||||
class t_string;
|
||||
|
||||
namespace events
|
||||
{
|
||||
|
@ -109,7 +110,7 @@ public:
|
|||
mouse_handler& mousehandler);
|
||||
|
||||
///@return If the recruit is possible, an empty string and set @a recruited_from; otherwise, return an error message string.
|
||||
std::string can_recruit(const std::string& name, int side_num, map_location& target_hex, map_location& recruited_from);
|
||||
t_string can_recruit(const std::string& name, int side_num, map_location& target_hex, map_location& recruited_from);
|
||||
///@return Whether or not the recruit was successful
|
||||
bool do_recruit(const std::string& name, int side_num, map_location& target_hex);
|
||||
void do_speak();
|
||||
|
|
Loading…
Add table
Reference in a new issue