Hotkey for the minimap team&movement/side color coding feature.
This commit is contained in:
parent
6fae698757
commit
2bec0b28e9
6 changed files with 40 additions and 20 deletions
|
@ -1847,30 +1847,30 @@ void display::draw_minimap_units()
|
|||
}
|
||||
|
||||
int side = u->side();
|
||||
//bool new_encoding = true;
|
||||
SDL_Color col = team::get_minimap_color(side);
|
||||
|
||||
if ((*teams_)[currentTeam_].is_enemy(side)) {
|
||||
col = team::get_minimap_color(5);
|
||||
} else {
|
||||
|
||||
if (currentTeam_ +1 == static_cast<unsigned>(side)) {
|
||||
|
||||
//movement_left() == total_movement()
|
||||
|
||||
if (u->movement_left() == u->total_movement()) {
|
||||
col = team::get_minimap_color(3);
|
||||
} else {
|
||||
|
||||
if (u->movement_left() == 0) {
|
||||
col = team::get_minimap_color(1);
|
||||
} else {
|
||||
col = team::get_minimap_color(7);
|
||||
}
|
||||
}
|
||||
if (preferences::minimap_movement_coding()) {
|
||||
|
||||
if ((*teams_)[currentTeam_].is_enemy(side)) {
|
||||
col = team::get_minimap_color(5);
|
||||
} else {
|
||||
col = team::get_minimap_color(2);
|
||||
|
||||
if (currentTeam_ +1 == static_cast<unsigned>(side)) {
|
||||
|
||||
if (u->movement_left() == u->total_movement()) {
|
||||
col = team::get_minimap_color(3);
|
||||
} else {
|
||||
|
||||
if (u->movement_left() == 0) {
|
||||
col = team::get_minimap_color(1);
|
||||
} else {
|
||||
col = team::get_minimap_color(7);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
col = team::get_minimap_color(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -182,6 +182,7 @@ const hotkey_command hotkey_list_[] = {
|
|||
{ hotkey::HOTKEY_EDITOR_UNIT_CHANGE_ID, "editor-change-unitid", N_("Change Unit ID"), false, hotkey::SCOPE_EDITOR, NULL },
|
||||
{ hotkey::HOTKEY_EDITOR_UNIT_TOGGLE_LOYAL, "editor-unit-toggle-loyal", N_("Loyal"), false, hotkey::SCOPE_EDITOR, NULL },
|
||||
|
||||
{ hotkey::HOTKEY_MINIMAP_COLOR_CODING, "minimap-color-coding", N_("Toggle Minimap color coding"), false, hotkey::SCOPE_GENERAL, NULL },
|
||||
|
||||
{ hotkey::HOTKEY_EDITOR_BRUSH_NEXT, "editor-brush-next", N_("Next Brush"), false, hotkey::SCOPE_EDITOR, NULL },
|
||||
{ hotkey::HOTKEY_EDITOR_BRUSH_DEFAULT, "editor-brush-default", N_("Default Brush"), false, hotkey::SCOPE_EDITOR, NULL },
|
||||
|
@ -1163,6 +1164,10 @@ void execute_command(display& disp, HOTKEY_COMMAND command, command_executor* ex
|
|||
}
|
||||
}
|
||||
switch (command) {
|
||||
case HOTKEY_MINIMAP_COLOR_CODING:
|
||||
preferences::toggle_minimap_color_coding();
|
||||
disp.redraw_minimap();
|
||||
break;
|
||||
case HOTKEY_ZOOM_IN:
|
||||
disp.set_zoom(zoom_amount);
|
||||
break;
|
||||
|
|
|
@ -127,6 +127,7 @@ enum HOTKEY_COMMAND {
|
|||
HOTKEY_CUSTOM_CMD,
|
||||
HOTKEY_AI_FORMULA,
|
||||
HOTKEY_CLEAR_MSG,
|
||||
HOTKEY_MINIMAP_COLOR_CODING,
|
||||
|
||||
/* Gui2 specific hotkeys. */
|
||||
TITLE_SCREEN__RELOAD_WML,
|
||||
|
|
|
@ -868,6 +868,7 @@ bool play_controller::can_execute_command(hotkey::HOTKEY_COMMAND command, int in
|
|||
case hotkey::HOTKEY_CLEAR_MSG:
|
||||
case hotkey::HOTKEY_LEFT_MOUSE_CLICK:
|
||||
case hotkey::HOTKEY_RIGHT_MOUSE_CLICK:
|
||||
case hotkey::HOTKEY_MINIMAP_COLOR_CODING:
|
||||
return true;
|
||||
|
||||
// Commands that have some preconditions:
|
||||
|
|
|
@ -674,6 +674,16 @@ bool animate_map()
|
|||
return preferences::get("animate_map", true);
|
||||
}
|
||||
|
||||
bool minimap_movement_coding()
|
||||
{
|
||||
return preferences::get("minimap_movement_coding", false);
|
||||
}
|
||||
|
||||
void toggle_minimap_color_coding()
|
||||
{
|
||||
set("minimap_movement_coding", !minimap_movement_coding());
|
||||
}
|
||||
|
||||
void set_animate_map(bool value)
|
||||
{
|
||||
set("animate_map", value);
|
||||
|
|
|
@ -172,6 +172,9 @@ namespace preferences {
|
|||
bool animate_map();
|
||||
void set_animate_map(bool value);
|
||||
|
||||
bool minimap_movement_coding();
|
||||
void toggle_minimap_color_coding();
|
||||
|
||||
bool show_standing_animations();
|
||||
void set_show_standing_animations(bool value);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue