summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-08-03 06:44:54 +0000
committertron <tron@openttd.org>2006-08-03 06:44:54 +0000
commitb0135b438126c090f9a00d479da5ea2b21fe3338 (patch)
treec97ab5288c58e7857825a1db757a20ad123891de
parent76ea272c9c77f50a8e7bddcdb0990636ad88a3ca (diff)
downloadopenttd-b0135b438126c090f9a00d479da5ea2b21fe3338.tar.xz
(svn r5723) - Move the declaration of DrawRoadDepotSprite() out of functions.h (but I'm not too happy with the new header)
- Use DiagDirection instead of plain int for the orientation of the depot graphics - Rename the associated data tables with sprites to something more meaningful
-rw-r--r--functions.h3
-rw-r--r--road_cmd.c8
-rw-r--r--road_cmd.h10
-rw-r--r--road_gui.c9
-rw-r--r--table/road_land.h18
5 files changed, 28 insertions, 20 deletions
diff --git a/functions.h b/functions.h
index b929f4311..f0e3f4339 100644
--- a/functions.h
+++ b/functions.h
@@ -48,9 +48,6 @@ void DrawClearLandTile(const TileInfo *ti, byte set);
void DrawClearLandFence(const TileInfo *ti);
void TileLoopClearHelper(TileIndex tile);
-/* road_land.c */
-void DrawRoadDepotSprite(int x, int y, int image);
-
/* water_land.c */
void DrawShipDepotSprite(int x, int y, int image);
void TileLoop_Water(TileIndex tile);
diff --git a/road_cmd.c b/road_cmd.c
index b2b72837d..6dd97dbea 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -793,7 +793,7 @@ static void DrawTile_Road(TileInfo *ti)
player = GetTileOwner(ti->tile);
if (player < MAX_PLAYERS) ormod = PLAYER_SPRITE_COLOR(player);
- drss = _road_display_datas[GetRoadDepotDirection(ti->tile)];
+ drss = _road_depot[GetRoadDepotDirection(ti->tile)];
DrawGroundSprite(drss++->image);
@@ -813,9 +813,9 @@ static void DrawTile_Road(TileInfo *ti)
}
}
-void DrawRoadDepotSprite(int x, int y, int image)
+void DrawRoadDepotSprite(int x, int y, DiagDirection dir)
{
- const DrawRoadSeqStruct* dtss = _road_display_datas[image];
+ const DrawRoadSeqStruct* dtss = _road_depot[dir];
uint32 ormod = PLAYER_SPRITE_COLOR(_local_player);
x += 33;
@@ -825,8 +825,8 @@ void DrawRoadDepotSprite(int x, int y, int image)
for (; dtss->image != 0; dtss++) {
Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
+ uint32 image = dtss->image;
- image = dtss->image;
if (image & PALETTE_MODIFIER_COLOR) image |= ormod;
DrawSprite(image, x + pt.x, y + pt.y);
diff --git a/road_cmd.h b/road_cmd.h
new file mode 100644
index 000000000..aeda82db1
--- /dev/null
+++ b/road_cmd.h
@@ -0,0 +1,10 @@
+/* $Id$ */
+
+#ifndef ROAD_CMD_H
+#define ROAD_CMD_H
+
+#include "direction.h"
+
+void DrawRoadDepotSprite(int x, int y, DiagDirection dir);
+
+#endif
diff --git a/road_gui.c b/road_gui.c
index fc16e46fd..91575fa08 100644
--- a/road_gui.c
+++ b/road_gui.c
@@ -2,6 +2,7 @@
#include "stdafx.h"
#include "openttd.h"
+#include "road_cmd.h"
#include "road_map.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -353,10 +354,10 @@ static void BuildRoadDepotWndProc(Window *w, WindowEvent *e)
w->click_state = (1<<3) << _road_depot_orientation;
DrawWindowWidgets(w);
- DrawRoadDepotSprite(70, 17, 0);
- DrawRoadDepotSprite(70, 69, 1);
- DrawRoadDepotSprite( 2, 69, 2);
- DrawRoadDepotSprite( 2, 17, 3);
+ DrawRoadDepotSprite(70, 17, DIAGDIR_NE);
+ DrawRoadDepotSprite(70, 69, DIAGDIR_SE);
+ DrawRoadDepotSprite( 2, 69, DIAGDIR_SW);
+ DrawRoadDepotSprite( 2, 17, DIAGDIR_NW);
break;
case WE_CLICK: {
diff --git a/table/road_land.h b/table/road_land.h
index fd01731a7..b1eec6eb7 100644
--- a/table/road_land.h
+++ b/table/road_land.h
@@ -4,37 +4,37 @@
#define TILE_SEQ_LINE(a, b, c, d, e) { a, b, c, d, e },
#define TILE_SEQ_END() { 0, 0, 0, 0, 0 }
-static const DrawRoadSeqStruct _road_display_datas_0[] = {
+static const DrawRoadSeqStruct _road_depot_NE[] = {
TILE_SEQ_BEGIN(0xA4A)
TILE_SEQ_LINE(0x584 | PALETTE_MODIFIER_COLOR, 0, 15, 16, 1)
TILE_SEQ_END()
};
-static const DrawRoadSeqStruct _road_display_datas_1[] = {
+static const DrawRoadSeqStruct _road_depot_SE[] = {
TILE_SEQ_BEGIN(0xA4A)
TILE_SEQ_LINE(0x580, 0, 0, 1, 16)
TILE_SEQ_LINE(0x581 | PALETTE_MODIFIER_COLOR, 15, 0, 1, 16)
TILE_SEQ_END()
};
-static const DrawRoadSeqStruct _road_display_datas_2[] = {
+static const DrawRoadSeqStruct _road_depot_SW[] = {
TILE_SEQ_BEGIN(0xA4A)
TILE_SEQ_LINE(0x582, 0, 0, 16, 1)
TILE_SEQ_LINE(0x583 | PALETTE_MODIFIER_COLOR, 0, 15, 16, 1)
TILE_SEQ_END()
};
-static const DrawRoadSeqStruct _road_display_datas_3[] = {
+static const DrawRoadSeqStruct _road_depot_NW[] = {
TILE_SEQ_BEGIN(0xA4A)
TILE_SEQ_LINE(0x585 | PALETTE_MODIFIER_COLOR, 15, 0, 1, 16)
TILE_SEQ_END()
};
-static const DrawRoadSeqStruct* const _road_display_datas[] = {
- _road_display_datas_0,
- _road_display_datas_1,
- _road_display_datas_2,
- _road_display_datas_3,
+static const DrawRoadSeqStruct* const _road_depot[] = {
+ _road_depot_NE,
+ _road_depot_SE,
+ _road_depot_SW,
+ _road_depot_NW
};
#undef TILE_SEQ_BEGIN