(svn r907) Sprinkle holy ANSI water:
authortron
Fri, 03 Dec 2004 07:43:00 +0000
changeset 536 aef4753985d3
parent 535 bd5c17ae9447
child 537 88d71dbdcd13
(svn r907) Sprinkle holy ANSI water:
- "inline" must before the return type (and after "static")
- Initialise all struct members, not just some of them
- Remove (one) spurious semicolon
ai.c
functions.h
newgrf.c
order_gui.c
pathfind.c
saveload.c
settings_gui.c
station_cmd.c
stdafx.h
table/ai_rail.h
table/station_land.h
table/unmovable_land.h
--- a/ai.c	Fri Dec 03 05:59:26 2004 +0000
+++ b/ai.c	Fri Dec 03 07:43:00 2004 +0000
@@ -1936,7 +1936,7 @@
 	return better;
 }
 
-static void FORCEINLINE AiCheckBuildRailBridgeHere(AiRailFinder *arf, TileIndex tile, const byte *p)
+static inline void AiCheckBuildRailBridgeHere(AiRailFinder *arf, TileIndex tile, const byte *p)
 {
 	TileIndex tile_new;
 	bool flag;
@@ -1976,7 +1976,7 @@
 	}
 }
 
-static void FORCEINLINE AiCheckBuildRailTunnelHere(AiRailFinder *arf, TileIndex tile, const byte *p)
+static inline void AiCheckBuildRailTunnelHere(AiRailFinder *arf, TileIndex tile, const byte *p)
 {
 	FindLandscapeHeightByTile(&arf->ti, tile);
 
@@ -2813,7 +2813,7 @@
 	return DoCommandByTile(tile, _road_bits[type], 0, flags, CMD_BUILD_ROAD) != CMD_ERROR;
 }
 
-static void FORCEINLINE AiCheckBuildRoadBridgeHere(AiRoadFinder *arf, TileIndex tile, const byte *p)
+static inline void AiCheckBuildRoadBridgeHere(AiRoadFinder *arf, TileIndex tile, const byte *p)
 {
 	TileIndex tile_new;
 	bool flag;
@@ -2853,7 +2853,7 @@
 	}
 }
 
-static void FORCEINLINE AiCheckBuildRoadTunnelHere(AiRoadFinder *arf, TileIndex tile, const byte *p)
+static inline void AiCheckBuildRoadTunnelHere(AiRoadFinder *arf, TileIndex tile, const byte *p)
 {
 	FindLandscapeHeightByTile(&arf->ti, tile);
 
--- a/functions.h	Fri Dec 03 05:59:26 2004 +0000
+++ b/functions.h	Fri Dec 03 07:43:00 2004 +0000
@@ -37,13 +37,20 @@
 
 bool IsValidTile(uint tile);
 
+static inline Point RemapCoords(int x, int y, int z)
+{
 #if !defined(NEW_ROTATION)
-static Point FORCEINLINE RemapCoords(int x, int y, int z) { Point pt = { (y-x)*2, y + x -z }; return pt; }
+	Point pt = { (y - x) * 2, y + x - z };
 #else
-static Point FORCEINLINE RemapCoords(int x, int y, int z) { Point pt = { (x + y)*2, x - y -z }; return pt; }
+	Point pt = { (x + y) * 2, x - y - z };
 #endif
+	return pt;
+}
 
-static Point FORCEINLINE RemapCoords2(int x, int y) { return RemapCoords(x, y, GetSlopeZ(x, y)); }
+static inline Point RemapCoords2(int x, int y)
+{
+	return RemapCoords(x, y, GetSlopeZ(x, y));
+}
 
 /* game.c */
 byte *GetString(byte *buffr, uint16 string);
--- a/newgrf.c	Fri Dec 03 05:59:26 2004 +0000
+++ b/newgrf.c	Fri Dec 03 07:43:00 2004 +0000
@@ -728,7 +728,7 @@
 
 					dts->ground_sprite = grf_load_dword(&buf);
 					if (!dts->ground_sprite) {
-						static const DrawTileSeqStruct empty = {0x80};
+						static const DrawTileSeqStruct empty = {0x80, 0, 0, 0, 0, 0, 0};
 						dts->seq = ∅
 						continue;
 					}
@@ -771,7 +771,7 @@
 
 					dts->ground_sprite = sdts->ground_sprite;
 					if (!dts->ground_sprite) {
-						static const DrawTileSeqStruct empty = {0x80};
+						static const DrawTileSeqStruct empty = {0x80, 0, 0, 0, 0, 0, 0};
 						dts->seq = ∅
 						continue;
 					}
--- a/order_gui.c	Fri Dec 03 05:59:26 2004 +0000
+++ b/order_gui.c	Fri Dec 03 07:43:00 2004 +0000
@@ -154,7 +154,7 @@
 
 Vehicle *GetVehicleOnTile(TileIndex tile, byte owner)
 {
-	FindVehS fs = {tile, owner};
+	FindVehS fs = {tile, owner, 0};
 	return VehicleFromPos(tile, &fs, (VehicleFromPosProc*)FindVehicleCallb);
 }
 
--- a/pathfind.c	Fri Dec 03 05:59:26 2004 +0000
+++ b/pathfind.c	Fri Dec 03 07:43:00 2004 +0000
@@ -434,7 +434,7 @@
 
 // called after a new element was added in the queue at the last index.
 // move it down to the proper position
-static void inline HeapifyUp(NewTrackPathFinder *tpf)
+static inline void HeapifyUp(NewTrackPathFinder *tpf)
 {
 	StackedItem si;
 	int i = ++tpf->nstack;
@@ -448,7 +448,7 @@
 }
 
 // called after the element 0 was eaten. fill it with a new element
-static void inline HeapifyDown(NewTrackPathFinder *tpf)
+static inline void HeapifyDown(NewTrackPathFinder *tpf)
 {
 	StackedItem si;
 	int i = 1, j;
--- a/saveload.c	Fri Dec 03 05:59:26 2004 +0000
+++ b/saveload.c	Fri Dec 03 07:43:00 2004 +0000
@@ -173,22 +173,22 @@
 	return (i>=0x80) ? 2 : 1;
 }
 
-int inline SlReadSparseIndex()
+inline int SlReadSparseIndex()
 {
 	return SlReadSimpleGamma();
 }
 
-void inline SlWriteSparseIndex(uint index)
+inline void SlWriteSparseIndex(uint index)
 {
 	SlWriteSimpleGamma(index);
 }
 
-int inline SlReadArrayLength()
+inline int SlReadArrayLength()
 {
 	return SlReadSimpleGamma();
 }
 
-void inline SlWriteArrayLength(uint length)
+inline void SlWriteArrayLength(uint length)
 {
 	SlWriteSimpleGamma(length);
 }
--- a/settings_gui.c	Fri Dec 03 05:59:26 2004 +0000
+++ b/settings_gui.c	Fri Dec 03 07:43:00 2004 +0000
@@ -288,7 +288,7 @@
 	{0,2,1,STR_6839_PERMISSIVE},
 };
 
-static bool FORCEINLINE GetBitAndShift(uint32 *b)
+static inline bool GetBitAndShift(uint32 *b)
 {
 	uint32 x = *b;
 	*b >>= 1;
--- a/station_cmd.c	Fri Dec 03 05:59:26 2004 +0000
+++ b/station_cmd.c	Fri Dec 03 07:43:00 2004 +0000
@@ -682,7 +682,7 @@
 	return true;
 }
 
-static byte FORCEINLINE *CreateSingle(byte *layout, int n)
+static inline byte *CreateSingle(byte *layout, int n)
 {
 	int i = n;
 	do *layout++ = 0; while (--i);
@@ -690,7 +690,7 @@
 	return layout;
 }
 
-static byte FORCEINLINE *CreateMulti(byte *layout, int n, byte b)
+static inline byte *CreateMulti(byte *layout, int n, byte b)
 {
 	int i = n;
 	do *layout++ = b; while (--i);
--- a/stdafx.h	Fri Dec 03 05:59:26 2004 +0000
+++ b/stdafx.h	Fri Dec 03 07:43:00 2004 +0000
@@ -127,10 +127,10 @@
 
 #else
 
-static uint32 FORCEINLINE TO_BE32(uint32 x) { return BSWAP32(x); }
-static uint16 FORCEINLINE TO_BE16(uint16 x) { return BSWAP16(x); }
-static uint32 FORCEINLINE FROM_BE32(uint32 x) { return BSWAP32(x); }
-static uint16 FORCEINLINE FROM_BE16(uint16 x) { return BSWAP16(x); }
+static inline uint32 TO_BE32(uint32 x) { return BSWAP32(x); }
+static inline uint16 TO_BE16(uint16 x) { return BSWAP16(x); }
+static inline uint32 FROM_BE32(uint32 x) { return BSWAP32(x); }
+static inline uint16 FROM_BE16(uint16 x) { return BSWAP16(x); }
 #define TO_LE32(x) x
 #define TO_LE16(x) x
 #define TO_BE32X(x) BSWAP32(x)
@@ -157,7 +157,7 @@
 #endif
 
 // Compile time assertions
-#define assert_compile(expr) void __ct_assert__(int a[1 - 2 * !(expr)]);
+#define assert_compile(expr) void __ct_assert__(int a[1 - 2 * !(expr)])
 
 assert_compile(sizeof(uint32) == 4);
 assert_compile(sizeof(uint16) == 2);
--- a/table/ai_rail.h	Fri Dec 03 05:59:26 2004 +0000
+++ b/table/ai_rail.h	Fri Dec 03 07:43:00 2004 +0000
@@ -24,7 +24,7 @@
 #define MKSTATION(a,b) {1,a,b}
 #define MKRAIL(a,b) {2,a,b}
 #define MKCLRRAIL(a,b) {3,a,b}
-#define MKEND {4}}
+#define MKEND {4, 0, 0}}
 
 static const AiDefaultRailBlock _raildata_ai_0 = {
 	MKHDR(1,2,1,0,1)
@@ -463,12 +463,12 @@
 
 static const AiDefaultBlockData _airportdata_ai_0[] = {
 	MKAIR(1, 0),
-	{1},
+	{1, 0, 0},
 };
 
 static const AiDefaultBlockData _airportdata_ai_1[] = {
 	MKAIR(0, 0),
-	{1}
+	{1, 0, 0}
 };
 
 static const AiDefaultBlockData * const _airport_default_block_data[] = {
--- a/table/station_land.h	Fri Dec 03 05:59:26 2004 +0000
+++ b/table/station_land.h	Fri Dec 03 07:43:00 2004 +0000
@@ -1,4 +1,4 @@
-#define TILE_SEQ_END()	{ 0x80 }
+#define TILE_SEQ_END()	{ 0x80, 0, 0, 0, 0, 0, 0 }
 
 static const DrawTileSeqStruct _station_display_datas_0[] = {
 	{ 0,  0,  0, 16,  5,  2, 0x842E },
--- a/table/unmovable_land.h	Fri Dec 03 05:59:26 2004 +0000
+++ b/table/unmovable_land.h	Fri Dec 03 07:43:00 2004 +0000
@@ -1,8 +1,8 @@
-#define TILE_SEQ_END() { 0x80 }
+#define TILE_SEQ_END() { 0x80, 0, 0, 0, 0, 0, 0 }
 
 static const DrawTileUnmovableStruct _draw_tile_unmovable_data[] = {
-	{0xA29, 7,7, 2,2, 70},
-	{0xA2A, 4,4, 7,7, 61},
+	{0xA29, 7,7, 2,2, 70, 0},
+	{0xA2A, 4,4, 7,7, 61, 0},
 };