mirror of https://github.com/OpenTTD/OpenTTD
(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 semicolonrelease/0.4.5
parent
b7f0b278fb
commit
c00258237e
8
ai.c
8
ai.c
|
@ -1936,7 +1936,7 @@ static bool AiCheckRailPathBetter(AiRailFinder *arf, const byte *p)
|
||||||
return better;
|
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;
|
TileIndex tile_new;
|
||||||
bool flag;
|
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);
|
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;
|
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;
|
TileIndex tile_new;
|
||||||
bool flag;
|
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);
|
FindLandscapeHeightByTile(&arf->ti, tile);
|
||||||
|
|
||||||
|
|
13
functions.h
13
functions.h
|
@ -37,13 +37,20 @@ enum {
|
||||||
|
|
||||||
bool IsValidTile(uint tile);
|
bool IsValidTile(uint tile);
|
||||||
|
|
||||||
|
static inline Point RemapCoords(int x, int y, int z)
|
||||||
|
{
|
||||||
#if !defined(NEW_ROTATION)
|
#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
|
#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
|
#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 */
|
/* game.c */
|
||||||
byte *GetString(byte *buffr, uint16 string);
|
byte *GetString(byte *buffr, uint16 string);
|
||||||
|
|
4
newgrf.c
4
newgrf.c
|
@ -728,7 +728,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
|
||||||
|
|
||||||
dts->ground_sprite = grf_load_dword(&buf);
|
dts->ground_sprite = grf_load_dword(&buf);
|
||||||
if (!dts->ground_sprite) {
|
if (!dts->ground_sprite) {
|
||||||
static const DrawTileSeqStruct empty = {0x80};
|
static const DrawTileSeqStruct empty = {0x80, 0, 0, 0, 0, 0, 0};
|
||||||
dts->seq = ∅
|
dts->seq = ∅
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -771,7 +771,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
|
||||||
|
|
||||||
dts->ground_sprite = sdts->ground_sprite;
|
dts->ground_sprite = sdts->ground_sprite;
|
||||||
if (!dts->ground_sprite) {
|
if (!dts->ground_sprite) {
|
||||||
static const DrawTileSeqStruct empty = {0x80};
|
static const DrawTileSeqStruct empty = {0x80, 0, 0, 0, 0, 0, 0};
|
||||||
dts->seq = ∅
|
dts->seq = ∅
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ static void *FindVehicleCallb(Vehicle *v, FindVehS *f)
|
||||||
|
|
||||||
Vehicle *GetVehicleOnTile(TileIndex tile, byte owner)
|
Vehicle *GetVehicleOnTile(TileIndex tile, byte owner)
|
||||||
{
|
{
|
||||||
FindVehS fs = {tile, owner};
|
FindVehS fs = {tile, owner, 0};
|
||||||
return VehicleFromPos(tile, &fs, (VehicleFromPosProc*)FindVehicleCallb);
|
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.
|
// called after a new element was added in the queue at the last index.
|
||||||
// move it down to the proper position
|
// move it down to the proper position
|
||||||
static void inline HeapifyUp(NewTrackPathFinder *tpf)
|
static inline void HeapifyUp(NewTrackPathFinder *tpf)
|
||||||
{
|
{
|
||||||
StackedItem si;
|
StackedItem si;
|
||||||
int i = ++tpf->nstack;
|
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
|
// 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;
|
StackedItem si;
|
||||||
int i = 1, j;
|
int i = 1, j;
|
||||||
|
|
|
@ -173,22 +173,22 @@ static uint SlGetGammaLength(uint i) {
|
||||||
return (i>=0x80) ? 2 : 1;
|
return (i>=0x80) ? 2 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int inline SlReadSparseIndex()
|
inline int SlReadSparseIndex()
|
||||||
{
|
{
|
||||||
return SlReadSimpleGamma();
|
return SlReadSimpleGamma();
|
||||||
}
|
}
|
||||||
|
|
||||||
void inline SlWriteSparseIndex(uint index)
|
inline void SlWriteSparseIndex(uint index)
|
||||||
{
|
{
|
||||||
SlWriteSimpleGamma(index);
|
SlWriteSimpleGamma(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
int inline SlReadArrayLength()
|
inline int SlReadArrayLength()
|
||||||
{
|
{
|
||||||
return SlReadSimpleGamma();
|
return SlReadSimpleGamma();
|
||||||
}
|
}
|
||||||
|
|
||||||
void inline SlWriteArrayLength(uint length)
|
inline void SlWriteArrayLength(uint length)
|
||||||
{
|
{
|
||||||
SlWriteSimpleGamma(length);
|
SlWriteSimpleGamma(length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,7 +288,7 @@ static const GameSettingData _game_setting_info[] = {
|
||||||
{0,2,1,STR_6839_PERMISSIVE},
|
{0,2,1,STR_6839_PERMISSIVE},
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool FORCEINLINE GetBitAndShift(uint32 *b)
|
static inline bool GetBitAndShift(uint32 *b)
|
||||||
{
|
{
|
||||||
uint32 x = *b;
|
uint32 x = *b;
|
||||||
*b >>= 1;
|
*b >>= 1;
|
||||||
|
|
|
@ -682,7 +682,7 @@ static bool CanExpandRailroadStation(Station *st, uint *fin, int direction)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static byte FORCEINLINE *CreateSingle(byte *layout, int n)
|
static inline byte *CreateSingle(byte *layout, int n)
|
||||||
{
|
{
|
||||||
int i = n;
|
int i = n;
|
||||||
do *layout++ = 0; while (--i);
|
do *layout++ = 0; while (--i);
|
||||||
|
@ -690,7 +690,7 @@ static byte FORCEINLINE *CreateSingle(byte *layout, int n)
|
||||||
return layout;
|
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;
|
int i = n;
|
||||||
do *layout++ = b; while (--i);
|
do *layout++ = b; while (--i);
|
||||||
|
|
10
stdafx.h
10
stdafx.h
|
@ -127,10 +127,10 @@ static inline uint16 FROM_LE16(uint16 x) { return BSWAP16(x); }
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static uint32 FORCEINLINE TO_BE32(uint32 x) { return BSWAP32(x); }
|
static inline uint32 TO_BE32(uint32 x) { return BSWAP32(x); }
|
||||||
static uint16 FORCEINLINE TO_BE16(uint16 x) { return BSWAP16(x); }
|
static inline uint16 TO_BE16(uint16 x) { return BSWAP16(x); }
|
||||||
static uint32 FORCEINLINE FROM_BE32(uint32 x) { return BSWAP32(x); }
|
static inline uint32 FROM_BE32(uint32 x) { return BSWAP32(x); }
|
||||||
static uint16 FORCEINLINE FROM_BE16(uint16 x) { return BSWAP16(x); }
|
static inline uint16 FROM_BE16(uint16 x) { return BSWAP16(x); }
|
||||||
#define TO_LE32(x) x
|
#define TO_LE32(x) x
|
||||||
#define TO_LE16(x) x
|
#define TO_LE16(x) x
|
||||||
#define TO_BE32X(x) BSWAP32(x)
|
#define TO_BE32X(x) BSWAP32(x)
|
||||||
|
@ -157,7 +157,7 @@ enum {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Compile time assertions
|
// 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(uint32) == 4);
|
||||||
assert_compile(sizeof(uint16) == 2);
|
assert_compile(sizeof(uint16) == 2);
|
||||||
|
|
|
@ -24,7 +24,7 @@ typedef struct {
|
||||||
#define MKSTATION(a,b) {1,a,b}
|
#define MKSTATION(a,b) {1,a,b}
|
||||||
#define MKRAIL(a,b) {2,a,b}
|
#define MKRAIL(a,b) {2,a,b}
|
||||||
#define MKCLRRAIL(a,b) {3,a,b}
|
#define MKCLRRAIL(a,b) {3,a,b}
|
||||||
#define MKEND {4}}
|
#define MKEND {4, 0, 0}}
|
||||||
|
|
||||||
static const AiDefaultRailBlock _raildata_ai_0 = {
|
static const AiDefaultRailBlock _raildata_ai_0 = {
|
||||||
MKHDR(1,2,1,0,1)
|
MKHDR(1,2,1,0,1)
|
||||||
|
@ -463,12 +463,12 @@ static const AiDefaultRoadBlock * const _road_default_block_data[] = {
|
||||||
|
|
||||||
static const AiDefaultBlockData _airportdata_ai_0[] = {
|
static const AiDefaultBlockData _airportdata_ai_0[] = {
|
||||||
MKAIR(1, 0),
|
MKAIR(1, 0),
|
||||||
{1},
|
{1, 0, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const AiDefaultBlockData _airportdata_ai_1[] = {
|
static const AiDefaultBlockData _airportdata_ai_1[] = {
|
||||||
MKAIR(0, 0),
|
MKAIR(0, 0),
|
||||||
{1}
|
{1, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const AiDefaultBlockData * const _airport_default_block_data[] = {
|
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[] = {
|
static const DrawTileSeqStruct _station_display_datas_0[] = {
|
||||||
{ 0, 0, 0, 16, 5, 2, 0x842E },
|
{ 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[] = {
|
static const DrawTileUnmovableStruct _draw_tile_unmovable_data[] = {
|
||||||
{0xA29, 7,7, 2,2, 70},
|
{0xA29, 7,7, 2,2, 70, 0},
|
||||||
{0xA2A, 4,4, 7,7, 61},
|
{0xA2A, 4,4, 7,7, 61, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue