add a command to clear all labels in mp games
This commit is contained in:
parent
6ddaa52645
commit
d5db8ede04
12 changed files with 34 additions and 7 deletions
|
@ -131,6 +131,7 @@ SVN trunk (1.1+svn):
|
|||
* new utils: codecomp codeextract codeglyphs codelist, for font analysis
|
||||
* login names in MP is now limited to 18 characters
|
||||
* added {RANDOM_SIDE} and {DEFAULT_SCHEDULE} macros
|
||||
* added a hotkey to clear all labels in MP games
|
||||
|
||||
Version 1.1:
|
||||
* campaign server
|
||||
|
|
|
@ -98,7 +98,7 @@ height=768
|
|||
|
||||
[menu]
|
||||
is_context_menu=true
|
||||
items=undo,redo,describeunit,renameunit,createunit,changeside,labelterrain,speak,continue,recruit,recall,delayshroud,updateshroud,cycle,endturn
|
||||
items=undo,redo,describeunit,renameunit,createunit,changeside,labelterrain,clearlabels,speak,continue,recruit,recall,delayshroud,updateshroud,cycle,endturn
|
||||
[/menu]
|
||||
[mini_map]
|
||||
id=mini-map
|
||||
|
|
|
@ -119,7 +119,7 @@ height=768
|
|||
|
||||
[menu]
|
||||
is_context_menu=true
|
||||
items=undo,redo,describeunit,renameunit,createunit,changeside,labelterrain,speak,continue,recruit,recall,delayshroud,updateshroud,cycle,endturn
|
||||
items=undo,redo,describeunit,renameunit,createunit,changeside,labelterrain,clearlabels,speak,continue,recruit,recall,delayshroud,updateshroud,cycle,endturn
|
||||
[/menu]
|
||||
|
||||
[menu]
|
||||
|
|
|
@ -89,7 +89,7 @@ height=768
|
|||
|
||||
[menu]
|
||||
is_context_menu=true
|
||||
items=undo,redo,describeunit,renameunit,createunit,changeside,labelterrain,speak,continue,recruit,recall,delayshroud,updateshroud,cycle,endturn
|
||||
items=undo,redo,describeunit,renameunit,createunit,changeside,labelterrain,clearlables,speak,continue,recruit,recall,delayshroud,updateshroud,cycle,endturn
|
||||
[/menu]
|
||||
[mini_map]
|
||||
id=mini-map
|
||||
|
|
|
@ -76,6 +76,7 @@ const struct {
|
|||
{ hotkey::HOTKEY_STATISTICS, "statistics", N_("Statistics"), false },
|
||||
{ hotkey::HOTKEY_QUIT_GAME, "quit", N_("Quit Game"), false },
|
||||
{ hotkey::HOTKEY_LABEL_TERRAIN, "labelterrain", N_("Set Label"), false },
|
||||
{ hotkey::HOTKEY_CLEAR_LABELS, "clearlabels", N_("Clear Labels"), false },
|
||||
{ hotkey::HOTKEY_SHOW_ENEMY_MOVES, "showenemymoves", N_("Show Enemy Moves"), false },
|
||||
{ hotkey::HOTKEY_BEST_ENEMY_MOVES, "bestenemymoves", N_("Best Possible Enemy Moves"), false },
|
||||
{ hotkey::HOTKEY_PLAY_REPLAY, "playreplay", N_("Play"), false },
|
||||
|
@ -596,6 +597,10 @@ void execute_command(display& disp, HOTKEY_COMMAND command, command_executor* ex
|
|||
if(executor)
|
||||
executor->label_terrain();
|
||||
break;
|
||||
case HOTKEY_CLEAR_LABELS:
|
||||
if(executor)
|
||||
executor->clear_labels();
|
||||
break;
|
||||
case HOTKEY_SHOW_ENEMY_MOVES:
|
||||
if(executor)
|
||||
executor->show_enemy_moves(false);
|
||||
|
|
|
@ -38,7 +38,7 @@ enum HOTKEY_COMMAND {
|
|||
HOTKEY_TOGGLE_GRID, HOTKEY_STATUS_TABLE, HOTKEY_MUTE,
|
||||
HOTKEY_SPEAK, HOTKEY_CREATE_UNIT, HOTKEY_CHANGE_UNIT_SIDE, HOTKEY_PREFERENCES,
|
||||
HOTKEY_OBJECTIVES, HOTKEY_UNIT_LIST, HOTKEY_STATISTICS, HOTKEY_QUIT_GAME,
|
||||
HOTKEY_LABEL_TERRAIN, HOTKEY_SHOW_ENEMY_MOVES, HOTKEY_BEST_ENEMY_MOVES,
|
||||
HOTKEY_LABEL_TERRAIN, HOTKEY_CLEAR_LABELS,HOTKEY_SHOW_ENEMY_MOVES, HOTKEY_BEST_ENEMY_MOVES,
|
||||
HOTKEY_DELAY_SHROUD, HOTKEY_UPDATE_SHROUD, HOTKEY_CONTINUE_MOVE,
|
||||
HOTKEY_SEARCH, HOTKEY_SPEAK_ALLY, HOTKEY_SPEAK_ALL, HOTKEY_HELP,
|
||||
HOTKEY_CHAT_LOG, HOTKEY_LANGUAGE,
|
||||
|
@ -174,6 +174,7 @@ public:
|
|||
virtual void unit_list() {}
|
||||
virtual void show_statistics() {}
|
||||
virtual void label_terrain() {}
|
||||
virtual void clear_labels() {}
|
||||
virtual void show_enemy_moves(bool /*ignore_units*/) {}
|
||||
virtual void toggle_shroud_updates() {}
|
||||
virtual void update_shroud_now() {}
|
||||
|
|
|
@ -86,7 +86,7 @@ const std::string& map_labels::get_label(const gamemap::location& loc) const
|
|||
}
|
||||
}
|
||||
|
||||
void map_labels::set_label(const gamemap::location& loc, const std::string& str)
|
||||
void map_labels::set_label(const gamemap::location& loc, const std::string& str, const SDL_Color colour)
|
||||
{
|
||||
std::string text = str;
|
||||
if(text.size() > max_label_size) {
|
||||
|
@ -103,7 +103,6 @@ void map_labels::set_label(const gamemap::location& loc, const std::string& str)
|
|||
return;
|
||||
}
|
||||
|
||||
SDL_Color colour = font::NORMAL_COLOUR;
|
||||
|
||||
|
||||
const gamemap::location loc_nextx(loc.x+1,loc.y);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
class config;
|
||||
#include "map.hpp"
|
||||
#include "font.hpp"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
@ -36,7 +37,7 @@ public:
|
|||
static int get_max_chars();
|
||||
|
||||
const std::string& get_label(const gamemap::location& loc) const;
|
||||
void set_label(const gamemap::location& loc, const std::string& text);
|
||||
void set_label(const gamemap::location& loc, const std::string& text, const SDL_Color colour = font::NORMAL_COLOUR);
|
||||
void clear();
|
||||
|
||||
void scroll(double xmove, double ymove);
|
||||
|
|
|
@ -1162,6 +1162,7 @@ bool turn_info::can_execute_command(hotkey::HOTKEY_COMMAND command) const
|
|||
case hotkey::HOTKEY_SPEAK_ALLY:
|
||||
case hotkey::HOTKEY_SPEAK_ALL:
|
||||
case hotkey::HOTKEY_CHAT_LOG:
|
||||
case hotkey::HOTKEY_CLEAR_LABELS:
|
||||
return network::nconnections() > 0;
|
||||
|
||||
case hotkey::HOTKEY_REDO:
|
||||
|
@ -2700,6 +2701,11 @@ void turn_info::label_terrain()
|
|||
}
|
||||
}
|
||||
|
||||
void turn_info::clear_labels()
|
||||
{
|
||||
gui_.labels().clear();
|
||||
recorder.clear_labels();
|
||||
}
|
||||
// Returns true if any enemy units are visible.
|
||||
bool turn_info::enemies_visible() const
|
||||
{
|
||||
|
|
|
@ -152,6 +152,7 @@ private:
|
|||
virtual void unit_list();
|
||||
virtual void show_statistics();
|
||||
virtual void label_terrain();
|
||||
virtual void clear_labels();
|
||||
virtual void show_enemy_moves(bool ignore_units);
|
||||
virtual void toggle_shroud_updates();
|
||||
virtual void update_shroud_now();
|
||||
|
|
|
@ -335,6 +335,16 @@ void replay::add_label(const std::string& text, const gamemap::location& loc)
|
|||
cmd->add_child("label",val);
|
||||
}
|
||||
|
||||
void replay::clear_labels()
|
||||
{
|
||||
config* const cmd = add_command(false);
|
||||
|
||||
(*cmd)["undo"] = "no";
|
||||
|
||||
|
||||
cmd->add_child("clear_labels");
|
||||
}
|
||||
|
||||
void replay::add_rename(const std::string& name, const gamemap::location& loc)
|
||||
{
|
||||
config* const cmd = add_command(false);
|
||||
|
@ -628,6 +638,8 @@ bool do_replay(display& disp, const gamemap& map, const game_data& gameinfo,
|
|||
if (!replayer.is_skipping()){
|
||||
disp.labels().set_label(loc,text);
|
||||
}
|
||||
} else if((child = cfg->child("clear_labels")) != NULL) {
|
||||
disp.labels().clear();
|
||||
}
|
||||
|
||||
else if((child = cfg->child("rename")) != NULL) {
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
int weapon);
|
||||
void choose_option(int index);
|
||||
void add_label(const std::string& text, const gamemap::location& loc);
|
||||
void clear_labels();
|
||||
void add_rename(const std::string& name, const gamemap::location& loc);
|
||||
void end_turn();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue