From cf06eae3bbafcb53f040393f14c62fe4e583831c Mon Sep 17 00:00:00 2001 From: maedhros Date: Sun, 21 Jan 2007 11:49:18 +0000 Subject: [PATCH] (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. --- src/graph_gui.cpp | 5 ----- src/main_gui.cpp | 2 -- src/misc_gui.cpp | 2 -- src/player.h | 2 ++ src/players.cpp | 5 +++++ src/table/sprites.h | 3 +++ src/town_gui.cpp | 1 - 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 4ba8df21e9..e0eef2763b 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -216,11 +216,6 @@ static void DrawGraph(const GraphDrawer *gw) /* 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; diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 38c269c0d1..6aa9957665 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -538,8 +538,6 @@ static void UpdatePlayerMenuHeight(Window *w) } } -extern void DrawPlayerIcon(PlayerID pid, int x, int y); - static void PlayerMenuWndProc(Window *w, WindowEvent *e) { switch (e->event) { diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 66c650cba0..823e3edbfc 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -1788,8 +1788,6 @@ static const Widget _cheat_widgets[] = { { WIDGETS_END}, }; -extern void DrawPlayerIcon(PlayerID pid, int x, int y); - static void CheatsWndProc(Window *w, WindowEvent *e) { switch (e->event) { diff --git a/src/player.h b/src/player.h index 1f91f58dee..2714b19f71 100644 --- a/src/player.h +++ b/src/player.h @@ -262,6 +262,8 @@ static inline bool IsInteractivePlayer(PlayerID pi) 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);} diff --git a/src/players.cpp b/src/players.cpp index 6301d28811..9cf74ae708 100644 --- a/src/players.cpp +++ b/src/players.cpp @@ -60,6 +60,11 @@ uint16 GetDrawStringPlayerColor(PlayerID player) 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, diff --git a/src/table/sprites.h b/src/table/sprites.h index 0cec8d193c..8ed8d19f0e 100644 --- a/src/table/sprites.h +++ b/src/table/sprites.h @@ -120,6 +120,9 @@ enum Sprites { /* 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, diff --git a/src/town_gui.cpp b/src/town_gui.cpp index f88eeb956e..ee59f44fd4 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -30,7 +30,6 @@ static const Widget _town_authority_widgets[] = { }; 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