summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-01-21 11:49:18 +0000
committermaedhros <maedhros@openttd.org>2007-01-21 11:49:18 +0000
commitcf06eae3bbafcb53f040393f14c62fe4e583831c (patch)
tree99a62ac7806ee2a7216d9998af847326bf5b249c /src
parent9e7b06652251bbb00a9bbcad9c224260ef6217d5 (diff)
downloadopenttd-cf06eae3bbafcb53f040393f14c62fe4e583831c.tar.xz
(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.
Diffstat (limited to 'src')
-rw-r--r--src/graph_gui.cpp5
-rw-r--r--src/main_gui.cpp2
-rw-r--r--src/misc_gui.cpp2
-rw-r--r--src/player.h2
-rw-r--r--src/players.cpp5
-rw-r--r--src/table/sprites.h3
-rw-r--r--src/town_gui.cpp1
7 files changed, 10 insertions, 10 deletions
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index 4ba8df21e..e0eef2763 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 38c269c0d..6aa995766 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 66c650cba..823e3edbf 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 1f91f58de..2714b19f7 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 6301d2881..9cf74ae70 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 0cec8d193..8ed8d19f0 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 f88eeb956..ee59f44fd 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