Mark the currently selected time of day schedule in the menu.

This commit is contained in:
fendrin 2013-05-19 03:07:03 +02:00
parent 48fe73889f
commit 248fb95d45
2 changed files with 14 additions and 1 deletions

View file

@ -485,8 +485,15 @@ hotkey::ACTION_STATE editor_controller::get_action_state(hotkey::HOTKEY_COMMAND
return index == context_manager_->get_map_context().get_time_manager()->turn() -1
? ACTION_SELECTED : ACTION_DESELECTED;
case editor::SCHEDULE:
{
tods_map::const_iterator it = tods_.begin();
std::advance(it, index);
const std::vector<time_of_day>& times1 = it->second.second;
const std::vector<time_of_day>& times2 = context_manager_->get_map_context().get_time_manager()->times();
return (times1 == times2) ? ACTION_SELECTED : ACTION_DESELECTED;
//TODO
return ACTION_STATELESS;
//return ACTION_STATELESS;
}
}
return ACTION_ON;
default:

View file

@ -58,6 +58,12 @@ struct time_of_day
/** Construct a time of day from config */
explicit time_of_day(const config& cfg);
bool operator==(const time_of_day& o) const {
return lawful_bonus == o.lawful_bonus && bonus_modified == o.bonus_modified
&& image == o.image && name == o.name && id == o.id
&& image_mask == o.image_mask && color == o.color && sounds == o.sounds;
}
void write(config& cfg) const;
/** The % bonus lawful units receive. Chaotics receive -lawful_bonus. */