changeset 5750:7ed4093af663 draft

(svn r8300) -Codechange: Add a prototype for DrawPlayerIcon to players.h and include that instead of using externs. Also move DrawPlayerIcon from graph_gui.cpp to players.cpp.
author maedhros <maedhros@openttd.org>
date Sun, 21 Jan 2007 11:49:18 +0000
parents 479def49187c
children e94b9d9f8530
files src/graph_gui.cpp src/main_gui.cpp src/misc_gui.cpp src/player.h src/players.cpp src/table/sprites.h src/town_gui.cpp
diffstat 7 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -216,11 +216,6 @@
 /* GRAPH LEGEND */
 /****************/
 
-void DrawPlayerIcon(PlayerID p, int x, int y)
-{
-	DrawSprite(0x2EB, PLAYER_SPRITE_COLOR(p), x, y);
-}
-
 static void GraphLegendWndProc(Window *w, WindowEvent *e)
 {
 	const Player* p;
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -538,8 +538,6 @@
 	}
 }
 
-extern void DrawPlayerIcon(PlayerID pid, int x, int y);
-
 static void PlayerMenuWndProc(Window *w, WindowEvent *e)
 {
 	switch (e->event) {
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -1788,8 +1788,6 @@
 {   WIDGETS_END},
 };
 
-extern void DrawPlayerIcon(PlayerID pid, int x, int y);
-
 static void CheatsWndProc(Window *w, WindowEvent *e)
 {
 	switch (e->event) {
--- a/src/player.h
+++ b/src/player.h
@@ -262,6 +262,8 @@
 	return pi == _local_player;
 }
 
+void DrawPlayerIcon(PlayerID p, int x, int y);
+
 /* Validate functions for rail building */
 static inline bool ValParamRailtype(uint32 rail) { return HASBIT(GetPlayer(_current_player)->avail_railtypes, rail);}
 
--- a/src/players.cpp
+++ b/src/players.cpp
@@ -60,6 +60,11 @@
 	return (_colour_gradient[_player_colors[player]][4]) | IS_PALETTE_COLOR;
 }
 
+void DrawPlayerIcon(PlayerID p, int x, int y)
+{
+	DrawSprite(SPR_PLAYER_ICON, PLAYER_SPRITE_COLOR(p), x, y);
+}
+
 
 static const SpriteID cheeks_table[4] = {
 	0x325, 0x326,
--- a/src/table/sprites.h
+++ b/src/table/sprites.h
@@ -120,6 +120,9 @@
 	/* Manager face sprites */
 	SPR_GRADIENT = 874, // background gradient behind manager face
 
+	/* Icon showing player colour. */
+	SPR_PLAYER_ICON = 747,
+
 	/* is itself no foundation sprite, because tileh 0 has no foundation */
 	SPR_FOUNDATION_BASE = 989,
 
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -30,7 +30,6 @@
 };
 
 extern const byte _town_action_costs[8];
-extern void DrawPlayerIcon(PlayerID pid, int x, int y);
 
 /** Get a list of available actions to do at a town.
  * @param *nump if not NULL add put the number of available actions in it