(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
pull/155/head
tron 20 years ago
parent 9a900c0f30
commit ecf1c35849

@ -1936,7 +1936,7 @@ static bool AiCheckRailPathBetter(AiRailFinder *arf, const byte *p)
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 AiCheckBuildRailBridgeHere(AiRailFinder *arf, TileIndex
}
}
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 @@ static bool AiBuildRoadHelper(uint tile, int flags, int type)
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 AiCheckBuildRoadBridgeHere(AiRoadFinder *arf, TileIndex
}
}
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);

@ -37,13 +37,20 @@ enum {
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);

@ -728,7 +728,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
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 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
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;
}

@ -154,7 +154,7 @@ static void *FindVehicleCallb(Vehicle *v, FindVehS *f)
Vehicle *GetVehicleOnTile(TileIndex tile, byte owner)
{
FindVehS fs = {tile, owner};
FindVehS fs = {tile, owner, 0};
return VehicleFromPos(tile, &fs, (VehicleFromPosProc*)FindVehicleCallb);
}

@ -434,7 +434,7 @@ typedef struct {
// 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 @@ static void inline HeapifyUp(NewTrackPathFinder *tpf)
}
// 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;

@ -173,22 +173,22 @@ static uint SlGetGammaLength(uint i) {
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);
}

@ -288,7 +288,7 @@ static const GameSettingData _game_setting_info[] = {
{0,2,1,STR_6839_PERMISSIVE},
};
static bool FORCEINLINE GetBitAndShift(uint32 *b)
static inline bool GetBitAndShift(uint32 *b)
{
uint32 x = *b;
*b >>= 1;

@ -682,7 +682,7 @@ static bool CanExpandRailroadStation(Station *st, uint *fin, int direction)
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 @@ static byte FORCEINLINE *CreateSingle(byte *layout, int n)
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);

@ -127,10 +127,10 @@ static inline uint16 FROM_LE16(uint16 x) { return BSWAP16(x); }
#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 @@ enum {
#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);

@ -24,7 +24,7 @@ typedef struct {
#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 AiDefaultRoadBlock * const _road_default_block_data[] = {
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[] = {

@ -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 },

@ -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},
};

Loading…
Cancel
Save