(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.
--- a/src/graph_gui.cpp Sun Jan 21 08:04:14 2007 +0000
+++ b/src/graph_gui.cpp Sun Jan 21 11:49:18 2007 +0000
@@ -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 Sun Jan 21 08:04:14 2007 +0000
+++ b/src/main_gui.cpp Sun Jan 21 11:49:18 2007 +0000
@@ -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 Sun Jan 21 08:04:14 2007 +0000
+++ b/src/misc_gui.cpp Sun Jan 21 11:49:18 2007 +0000
@@ -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 Sun Jan 21 08:04:14 2007 +0000
+++ b/src/player.h Sun Jan 21 11:49:18 2007 +0000
@@ -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 Sun Jan 21 08:04:14 2007 +0000
+++ b/src/players.cpp Sun Jan 21 11:49:18 2007 +0000
@@ -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 Sun Jan 21 08:04:14 2007 +0000
+++ b/src/table/sprites.h Sun Jan 21 11:49:18 2007 +0000
@@ -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 Sun Jan 21 08:04:14 2007 +0000
+++ b/src/town_gui.cpp Sun Jan 21 11:49:18 2007 +0000
@@ -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