(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
--- a/functions.h Wed Aug 02 18:36:53 2006 +0000
+++ b/functions.h Thu Aug 03 06:44:54 2006 +0000
@@ -48,9 +48,6 @@
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);
--- a/road_cmd.c Wed Aug 02 18:36:53 2006 +0000
+++ b/road_cmd.c Thu Aug 03 06:44:54 2006 +0000
@@ -793,7 +793,7 @@
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 @@
}
}
-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 @@
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);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/road_cmd.h Thu Aug 03 06:44:54 2006 +0000
@@ -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
--- a/road_gui.c Wed Aug 02 18:36:53 2006 +0000
+++ b/road_gui.c Thu Aug 03 06:44:54 2006 +0000
@@ -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 @@
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: {
--- a/table/road_land.h Wed Aug 02 18:36:53 2006 +0000
+++ b/table/road_land.h Thu Aug 03 06:44:54 2006 +0000
@@ -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