[Wesnoth-commits] r9980 - in /trunk: ./ data/themes/ src/ (February 05, 2006 - 01:34)

Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Headers

 

Author: boucman
Date: Sun Feb  5 01:34:03 2006
New Revision: 9980

URL: http://svn.gna.org/viewcvs/wesnoth?rev=9980&view=rev
Log:
add a command to clear all labels in mp games

Modified:
    trunk/changelog
    trunk/data/themes/default.cfg
    trunk/data/themes/dfool.cfg
    trunk/data/themes/experimental.cfg
    trunk/src/hotkeys.cpp
    trunk/src/hotkeys.hpp
    trunk/src/map_label.cpp
    trunk/src/map_label.hpp
    trunk/src/playturn.cpp
    trunk/src/playturn.hpp
    trunk/src/replay.cpp
    trunk/src/replay.hpp

Modified: trunk/changelog
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=9980&r1=9979&r2=9980&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Sun Feb  5 01:34:03 2006
@@ -131,6 +131,7 @@
    * 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

Modified: trunk/data/themes/default.cfg
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/data/themes/default.cfg?rev=9980&r1=9979&r2=9980&view=diff
==============================================================================
--- trunk/data/themes/default.cfg (original)
+++ trunk/data/themes/default.cfg Sun Feb  5 01:34:03 2006
@@ -98,7 +98,7 @@
 
 	[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

Modified: trunk/data/themes/dfool.cfg
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/data/themes/dfool.cfg?rev=9980&r1=9979&r2=9980&view=diff
==============================================================================
--- trunk/data/themes/dfool.cfg (original)
+++ trunk/data/themes/dfool.cfg Sun Feb  5 01:34:03 2006
@@ -119,7 +119,7 @@
 
 	[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]

Modified: trunk/data/themes/experimental.cfg
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/data/themes/experimental.cfg?rev=9980&r1=9979&r2=9980&view=diff
==============================================================================
--- trunk/data/themes/experimental.cfg (original)
+++ trunk/data/themes/experimental.cfg Sun Feb  5 01:34:03 2006
@@ -89,7 +89,7 @@
 
 	[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

Modified: trunk/src/hotkeys.cpp
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/src/hotkeys.cpp?rev=9980&r1=9979&r2=9980&view=diff
==============================================================================
--- trunk/src/hotkeys.cpp (original)
+++ trunk/src/hotkeys.cpp Sun Feb  5 01:34:03 2006
@@ -76,6 +76,7 @@
 	{ 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 },
@@ -595,6 +596,10 @@
 		case HOTKEY_LABEL_TERRAIN:
 			if(executor)
 				executor->label_terrain();
+			break;
+		case HOTKEY_CLEAR_LABELS:
+			if(executor)
+				executor->clear_labels();
 			break;
 		case HOTKEY_SHOW_ENEMY_MOVES:
 			if(executor)

Modified: trunk/src/hotkeys.hpp
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/src/hotkeys.hpp?rev=9980&r1=9979&r2=9980&view=diff
==============================================================================
--- trunk/src/hotkeys.hpp (original)
+++ trunk/src/hotkeys.hpp Sun Feb  5 01:34:03 2006
@@ -38,7 +38,7 @@
 	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 @@
 	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() {}

Modified: trunk/src/map_label.cpp
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/src/map_label.cpp?rev=9980&r1=9979&r2=9980&view=diff
==============================================================================
--- trunk/src/map_label.cpp (original)
+++ trunk/src/map_label.cpp Sun Feb  5 01:34:03 2006
@@ -86,7 +86,7 @@
 	}
 }
 
-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 @@
 		return;
 	}
 
-	SDL_Color colour = font::NORMAL_COLOUR;
 
 
 	const gamemap::location loc_nextx(loc.x+1,loc.y);

Modified: trunk/src/map_label.hpp
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/src/map_label.hpp?rev=9980&r1=9979&r2=9980&view=diff
==============================================================================
--- trunk/src/map_label.hpp (original)
+++ trunk/src/map_label.hpp Sun Feb  5 01:34:03 2006
@@ -16,6 +16,7 @@
 
 class config;
 #include "map.hpp"
+#include "font.hpp"
 
 #include <map>
 #include <string>
@@ -36,7 +37,7 @@
 	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);

Modified: trunk/src/playturn.cpp
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/src/playturn.cpp?rev=9980&r1=9979&r2=9980&view=diff
==============================================================================
--- trunk/src/playturn.cpp (original)
+++ trunk/src/playturn.cpp Sun Feb  5 01:34:03 2006
@@ -1162,6 +1162,7 @@
 	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::clear_labels()
+{
+	gui_.labels().clear();
+	recorder.clear_labels();
+}
 // Returns true if any enemy units are visible.
 bool turn_info::enemies_visible() const
 {

Modified: trunk/src/playturn.hpp
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/src/playturn.hpp?rev=9980&r1=9979&r2=9980&view=diff
==============================================================================
--- trunk/src/playturn.hpp (original)
+++ trunk/src/playturn.hpp Sun Feb  5 01:34:03 2006
@@ -152,6 +152,7 @@
 	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();

Modified: trunk/src/replay.cpp
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/src/replay.cpp?rev=9980&r1=9979&r2=9980&view=diff
==============================================================================
--- trunk/src/replay.cpp (original)
+++ trunk/src/replay.cpp Sun Feb  5 01:34:03 2006
@@ -335,6 +335,16 @@
 	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 @@
 			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) {

Modified: trunk/src/replay.hpp
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/src/replay.hpp?rev=9980&r1=9979&r2=9980&view=diff
==============================================================================
--- trunk/src/replay.hpp (original)
+++ trunk/src/replay.hpp Sun Feb  5 01:34:03 2006
@@ -54,6 +54,7 @@
 	                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();
 



Related Mails




Powered by MHonArc, Updated Sun Feb 05 03:20:14 2006