summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-10-22 06:39:32 +0000
committertron <tron@openttd.org>2005-10-22 06:39:32 +0000
commit0b936c3222b3945f738885c6c7db3b46363ec6fe (patch)
tree646e010d91defd66326958b9e15c3eb36077760c
parent4642ac94a903d1a358ac795240a6b800372b9020 (diff)
downloadopenttd-0b936c3222b3945f738885c6c7db3b46363ec6fe.tar.xz
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
nothing spectacular, just some stuff, which piled up
-rw-r--r--ai/ai.c2
-rw-r--r--aircraft_gui.c5
-rw-r--r--bridge_gui.c10
-rw-r--r--disaster_cmd.c1
-rw-r--r--dock_gui.c6
-rw-r--r--dummy_land.c4
-rw-r--r--economy.c2
-rw-r--r--engine.c3
-rw-r--r--fileio.c2
-rw-r--r--gfx.c10
-rw-r--r--gfx.h2
-rw-r--r--industry_cmd.c8
-rw-r--r--landscape.c10
-rw-r--r--lzoconf.h1
-rw-r--r--main_gui.c4
-rw-r--r--map.c7
-rw-r--r--map.h2
-rw-r--r--mersenne.c1
-rw-r--r--minilzo.c2
-rw-r--r--minilzo.h1
-rw-r--r--misc.c2
-rw-r--r--music/os2_m.c1
-rw-r--r--music/qtmidi.c2
-rw-r--r--music/qtmidi.h1
-rw-r--r--music/win32_m.c3
-rw-r--r--network_server.h5
-rw-r--r--newgrf.h1
-rw-r--r--openttd.c2
-rw-r--r--order_gui.c5
-rw-r--r--os2.c1
-rw-r--r--pathfind.c1
-rw-r--r--players.c1
-rw-r--r--rail.c1
-rw-r--r--rail.h93
-rw-r--r--rail_cmd.c27
-rw-r--r--railtypes.h1
-rw-r--r--road_cmd.c3
-rw-r--r--roadveh_gui.c4
-rw-r--r--saveload.c10
-rw-r--r--screenshot.c2
-rw-r--r--settings_gui.c2
-rw-r--r--ship_gui.c9
-rw-r--r--smallmap_gui.c6
-rw-r--r--sprite.h2
-rw-r--r--spritecache.c3
-rw-r--r--station.h3
-rw-r--r--station_cmd.c1
-rw-r--r--strings.c1
-rw-r--r--table/ai_rail.h2
-rw-r--r--table/bridge_land.h2
-rw-r--r--table/clear_land.h1
-rw-r--r--table/landscape_sprite.h1
-rw-r--r--table/sprites.h48
-rw-r--r--table/track_land.h1
-rw-r--r--table/tree_land.h1
-rw-r--r--texteff.c16
-rw-r--r--town_cmd.c2
-rw-r--r--town_gui.c6
-rw-r--r--train_gui.c4
-rw-r--r--tree_cmd.c3
-rw-r--r--vehicle.h8
-rw-r--r--vehicle_gui.h6
-rw-r--r--water_cmd.c1
-rw-r--r--widget.c2
64 files changed, 169 insertions, 211 deletions
diff --git a/ai/ai.c b/ai/ai.c
index f9dc01daa..5b09d43d9 100644
--- a/ai/ai.c
+++ b/ai/ai.c
@@ -118,7 +118,7 @@ int32 AI_DoCommand(uint tile, uint32 p1, uint32 p2, uint32 flags, uint procc)
/**
* Run 1 tick of the AI. Don't overdo it, keep it realistic.
*/
-void AI_RunTick(byte player)
+static void AI_RunTick(byte player)
{
extern void AiNewDoGameLoop(Player *p);
diff --git a/aircraft_gui.c b/aircraft_gui.c
index 4ae5dbfbb..522a6535b 100644
--- a/aircraft_gui.c
+++ b/aircraft_gui.c
@@ -436,14 +436,13 @@ do_change_service_int:
DeleteWindow(w);
break;
- case WE_ON_EDIT_TEXT: {
+ case WE_ON_EDIT_TEXT:
if (e->edittext.str[0] != '\0') {
_cmd_text = e->edittext.str;
DoCommandP(0, w->window_number, 0, NULL,
CMD_NAME_VEHICLE | CMD_MSG(STR_A031_CAN_T_NAME_AIRCRAFT));
}
- } break;
-
+ break;
}
}
diff --git a/bridge_gui.c b/bridge_gui.c
index 1dccbd5f7..ddcc620cb 100644
--- a/bridge_gui.c
+++ b/bridge_gui.c
@@ -68,7 +68,7 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e)
}
case WE_CLICK:
- if (e->click.widget == 2) {
+ if (e->click.widget == 2) {
uint ind = ((int)e->click.pt.y - 14) / 22;
if (ind < 4 && (ind += w->vscroll.pos) < _bridgedata.count)
BuildBridge(w, ind);
@@ -126,14 +126,13 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, byte bridge_type)
errmsg = INVALID_STRING_ID;
// only query bridge building possibility once, result is the same for all bridges!
- // returns CMD_ERROR on failure, and priCe on success
+ // returns CMD_ERROR on failure, and price on success
ret = DoCommandByTile(end, start, (bridge_type << 8), DC_AUTO | DC_QUERY_COST, CMD_BUILD_BRIDGE);
if (ret == CMD_ERROR) {
errmsg = _error_message;
- }
- // check which bridges can be built
- else {
+ } else {
+ // check which bridges can be built
int bridge_len; // length of the middle parts of the bridge
int tot_bridgedata_len; // total length of bridge
@@ -144,7 +143,6 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, byte bridge_type)
tot_bridgedata_len = CalcBridgeLenCostFactor(tot_bridgedata_len);
for (bridge_type = 0; bridge_type != MAX_BRIDGES; bridge_type++) { // loop for all bridgetypes
-
if (CheckBridge_Stuff(bridge_type, bridge_len)) {
const Bridge *b = &_bridge[bridge_type];
// bridge is accepted, add to list
diff --git a/disaster_cmd.c b/disaster_cmd.c
index c9cc78db2..a826bd6f0 100644
--- a/disaster_cmd.c
+++ b/disaster_cmd.c
@@ -1001,4 +1001,3 @@ void StartupDisasters(void)
{
ResetDisasterDelay();
}
-
diff --git a/dock_gui.c b/dock_gui.c
index d708b6427..98fcfe865 100644
--- a/dock_gui.c
+++ b/dock_gui.c
@@ -105,7 +105,7 @@ typedef void OnButtonClick(Window *w);
static OnButtonClick * const _build_docks_button_proc[] = {
BuildDocksClick_Canal,
BuildDocksClick_Lock,
- 0,
+ NULL,
BuildDocksClick_Demolish,
BuildDocksClick_Depot,
BuildDocksClick_Dock,
@@ -120,9 +120,9 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
DrawWindowWidgets(w);
break;
- case WE_CLICK: {
+ case WE_CLICK:
if (e->click.widget - 3 >= 0 && e->click.widget != 5) _build_docks_button_proc[e->click.widget - 3](w);
- } break;
+ break;
case WE_KEYPRESS: {
switch(e->keypress.keycode) {
diff --git a/dummy_land.c b/dummy_land.c
index 66be1c42f..97b9a05d4 100644
--- a/dummy_land.c
+++ b/dummy_land.c
@@ -19,7 +19,8 @@ static uint GetSlopeZ_Dummy(const TileInfo* ti)
return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z;
}
-static uint GetSlopeTileh_Dummy(const TileInfo *ti) {
+static uint GetSlopeTileh_Dummy(const TileInfo* ti)
+{
return ti->tileh;
}
@@ -81,4 +82,3 @@ const TileTypeProcs _tile_type_dummy_procs = {
NULL, /* vehicle_leave_tile_proc */
GetSlopeTileh_Dummy, /* get_slope_tileh_proc */
};
-
diff --git a/economy.c b/economy.c
index cc29314cf..16111d826 100644
--- a/economy.c
+++ b/economy.c
@@ -673,7 +673,7 @@ static void AddInflation(void)
static void PlayersPayInterest(void)
{
- Player *p;
+ const Player* p;
int interest = _economy.interest_rate * 54;
FOR_ALL_PLAYERS(p) {
diff --git a/engine.c b/engine.c
index 2825c7c9f..acb4df082 100644
--- a/engine.c
+++ b/engine.c
@@ -632,7 +632,8 @@ int GetCustomEngineSprite(EngineID engine, const Vehicle *v, byte direction)
* @param v The wagon to check
* @return true if it is using an override, false otherwise
*/
-bool UsesWagonOverride(const Vehicle *v) {
+bool UsesWagonOverride(const Vehicle* v)
+{
assert(v->type == VEH_Train);
return GetWagonOverrideSpriteSet(v->engine_type, v->u.rail.first_engine) != NULL;
}
diff --git a/fileio.c b/fileio.c
index 25bda0b29..d8adac9fb 100644
--- a/fileio.c
+++ b/fileio.c
@@ -180,5 +180,3 @@ void FioOpenFile(int slot, const char *filename)
_fio.handles[slot] = f;
FioSeekToFile(slot << 24);
}
-
-
diff --git a/gfx.c b/gfx.c
index e9f8ee98d..c26e4b536 100644
--- a/gfx.c
+++ b/gfx.c
@@ -115,7 +115,7 @@ void GfxScroll(int left, int top, int width, int height, int xo, int yo)
void GfxFillRect(int left, int top, int right, int bottom, int color)
{
- DrawPixelInfo *dpi = _cur_dpi;
+ const DrawPixelInfo* dpi = _cur_dpi;
Pixel *dst;
const int otop = top;
const int oleft = left;
@@ -167,7 +167,7 @@ void GfxFillRect(int left, int top, int right, int bottom, int color)
static void GfxSetPixel(int x, int y, int color)
{
- DrawPixelInfo *dpi = _cur_dpi;
+ const DrawPixelInfo* dpi = _cur_dpi;
if ((x-=dpi->left) < 0 || x>=dpi->width || (y-=dpi->top)<0 || y>=dpi->height)
return;
dpi->dst_ptr[y * dpi->pitch + x] = color;
@@ -426,7 +426,7 @@ static uint32 FormatStringLinebreaks(char *str, int maxw)
}
num++;
- str[-1] = 0;
+ str[-1] = '\0';
}
}
@@ -1361,7 +1361,7 @@ typedef void (*BlitZoomFunc)(BlitterParams *bp);
static void GfxMainBlitter(const Sprite* sprite, int x, int y, int mode)
{
- DrawPixelInfo *dpi = _cur_dpi;
+ const DrawPixelInfo* dpi = _cur_dpi;
int start_x, start_y;
byte info;
BlitterParams bp;
@@ -1871,7 +1871,7 @@ void MarkWholeScreenDirty(void)
SetDirtyBlocks(0, 0, _screen.width, _screen.height);
}
-bool FillDrawPixelInfo(DrawPixelInfo *n, DrawPixelInfo *o, int left, int top, int width, int height)
+bool FillDrawPixelInfo(DrawPixelInfo* n, const DrawPixelInfo* o, int left, int top, int width, int height)
{
int t;
diff --git a/gfx.h b/gfx.h
index c5c962315..1a2e436f1 100644
--- a/gfx.h
+++ b/gfx.h
@@ -76,7 +76,7 @@ void MarkWholeScreenDirty(void);
void GfxInitPalettes(void);
-bool FillDrawPixelInfo(DrawPixelInfo *n, DrawPixelInfo *o, int left, int top, int width, int height);
+bool FillDrawPixelInfo(DrawPixelInfo* n, const DrawPixelInfo* o, int left, int top, int width, int height);
/* window.c */
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
diff --git a/industry_cmd.c b/industry_cmd.c
index 385c10ace..f08b68515 100644
--- a/industry_cmd.c
+++ b/industry_cmd.c
@@ -403,7 +403,8 @@ static uint GetSlopeZ_Industry(const TileInfo* ti)
return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z;
}
-static uint GetSlopeTileh_Industry(const TileInfo *ti) {
+static uint GetSlopeTileh_Industry(const TileInfo* ti)
+{
return 0;
}
@@ -1008,7 +1009,7 @@ static void PlantFarmField(TileIndex tile)
SetupFarmFieldFence(tile + TileDiffXY(0, size_y - 1), size_x, type, 0);
}
-static void MaybePlantFarmField(Industry *i)
+static void MaybePlantFarmField(const Industry* i)
{
TileIndex tile;
@@ -1402,7 +1403,7 @@ do_clear:
static bool CheckIfTooCloseToIndustry(TileIndex tile, int type)
{
- Industry *i;
+ const Industry* i;
const IndustrySpec *spec;
spec = &_industry_spec[type];
@@ -2022,4 +2023,3 @@ static void Load_INDY(void)
const ChunkHandler _industry_chunk_handlers[] = {
{ 'INDY', Save_INDY, Load_INDY, CH_ARRAY | CH_LAST},
};
-
diff --git a/landscape.c b/landscape.c
index 8bdd289d2..8309b18d1 100644
--- a/landscape.c
+++ b/landscape.c
@@ -186,21 +186,21 @@ uint GetSlopeZ(int x, int y)
// direction=true: check for foundation in east and south corner
// direction=false: check for foundation in west and south corner
-static bool hasFoundation(TileInfo *ti, bool direction)
+static bool hasFoundation(const TileInfo* ti, bool direction)
{
bool south, other; // southern corner and east/west corner
uint slope = _tile_type_procs[ti->type]->get_slope_tileh_proc(ti);
uint tileh = ti->tileh;
- if(slope==0 && slope!=tileh) tileh=15;
+ if (slope == 0 && slope != tileh) tileh = 15;
south = (tileh & 2) != (slope & 2);
- if(direction)
+ if (direction) {
other = (tileh & 4) != (slope & 4);
- else
+ } else {
other = (tileh & 1) != (slope & 1);
+ }
return south || other;
-
}
void DrawFoundation(TileInfo *ti, uint f)
diff --git a/lzoconf.h b/lzoconf.h
index 5cc37bb30..b79bc141a 100644
--- a/lzoconf.h
+++ b/lzoconf.h
@@ -450,4 +450,3 @@ LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size);
#endif
#endif /* LZOCONF_H */
-
diff --git a/main_gui.c b/main_gui.c
index 5f151b219..6bb72b1c4 100644
--- a/main_gui.c
+++ b/main_gui.c
@@ -71,7 +71,7 @@ void HandleOnEditText(WindowEvent *e)
DoCommandP(0, id, 0, NULL, CMD_RENAME_SIGN | CMD_MSG(STR_280C_CAN_T_CHANGE_SIGN_NAME));
break;
case 1: /* Rename a waypoint */
- if (*b == 0) return;
+ if (*b == '\0') return;
DoCommandP(0, id, 0, NULL, CMD_RENAME_WAYPOINT | CMD_MSG(STR_CANT_CHANGE_WAYPOINT_NAME));
break;
#ifdef ENABLE_NETWORK
@@ -944,7 +944,7 @@ static void ToolbarZoomOutClick(Window *w)
static void ToolbarBuildRailClick(Window *w)
{
- Player *p = GetPlayer(_local_player);
+ const Player* p = GetPlayer(_local_player);
Window *w2;
w2 = PopupMainToolbMenu(w, 457, 19, STR_1015_RAILROAD_CONSTRUCTION, RAILTYPE_END, ~p->avail_railtypes);
WP(w2,menu_d).sel_index = _last_built_railtype;
diff --git a/map.c b/map.c
index f63204767..81b23637f 100644
--- a/map.c
+++ b/map.c
@@ -39,7 +39,6 @@ void AllocateMap(uint size_x, uint size_y)
_map_size = size_x * size_y;
_map_tile_mask = _map_size - 1;
- // free/malloc uses less memory than realloc.
free(_m);
_m = malloc(_map_size * sizeof(*_m));
@@ -111,9 +110,8 @@ uint ScaleByMapSize1D(uint n)
// the result will be tile + TileDiffXY(addx, addy)
uint TileAddWrap(TileIndex tile, int addx, int addy)
{
- uint x, y;
- x = TileX(tile) + addx;
- y = TileY(tile) + addy;
+ uint x = TileX(tile) + addx;
+ uint y = TileY(tile) + addy;
// Are we about to wrap?
if (x < MapMaxX() && y < MapMaxY())
@@ -170,4 +168,3 @@ uint DistanceFromEdge(TileIndex tile)
const uint minh = xh < yh ? xh : yh;
return minl < minh ? minl : minh;
}
-
diff --git a/map.h b/map.h
index 7d76c700c..2907d2eac 100644
--- a/map.h
+++ b/map.h
@@ -29,8 +29,6 @@ typedef struct Tile {
extern Tile* _m;
-void InitMap(uint log_x, uint log_y);
-
void AllocateMap(uint size_x, uint size_y);
// binary logarithm of the map size, try to avoid using this one
diff --git a/mersenne.c b/mersenne.c
index e7178af5d..0c0ceb719 100644
--- a/mersenne.c
+++ b/mersenne.c
@@ -72,4 +72,3 @@ uint32 RandomMT(void)
void SeedMT(uint32 seed) {}
#endif /* MERSENNE_TWISTER */
-
diff --git a/minilzo.c b/minilzo.c
index 7f5be1494..ab26b0a02 100644
--- a/minilzo.c
+++ b/minilzo.c
@@ -1969,5 +1969,3 @@ lookbehind_overrun:
#endif
/***** End of minilzo.c *****/
-
-
diff --git a/minilzo.h b/minilzo.h
index 3b9807f75..4b36660e3 100644
--- a/minilzo.h
+++ b/minilzo.h
@@ -99,4 +99,3 @@ lzo1x_decompress_safe ( const lzo_byte *src, lzo_uint src_len,
#endif
#endif /* MINILZO_H */
-
diff --git a/misc.c b/misc.c
index 9ac16b00f..25db8cc63 100644
--- a/misc.c
+++ b/misc.c
@@ -4,6 +4,7 @@
#include "openttd.h"
#include "currency.h"
#include "functions.h"
+#include "news.h"
#include "player.h"
#include "string.h"
#include "table/strings.h"
@@ -19,7 +20,6 @@
#include "variables.h"
extern void StartupEconomy(void);
-extern void InitNewsItemStructs(void);
char _name_array[512][32];
diff --git a/music/os2_m.c b/music/os2_m.c
index ef2559260..75df60c8d 100644
--- a/music/os2_m.c
+++ b/music/os2_m.c
@@ -75,4 +75,3 @@ const HalMusicDriver _os2_music_driver = {
OS2MidiIsSongPlaying,
OS2MidiSetVolume,
};
-
diff --git a/music/qtmidi.c b/music/qtmidi.c
index be20f1cb0..b245b538d 100644
--- a/music/qtmidi.c
+++ b/music/qtmidi.c
@@ -375,5 +375,3 @@ const HalMusicDriver _qtime_music_driver = {
SongIsPlaying,
SetVolume,
};
-
-
diff --git a/music/qtmidi.h b/music/qtmidi.h
index c640ab34b..ecb7a0b19 100644
--- a/music/qtmidi.h
+++ b/music/qtmidi.h
@@ -12,4 +12,3 @@
extern const HalMusicDriver _qtime_music_driver;
#endif /* !MUSIC_MACOSX_QUICKTIME_H */
-
diff --git a/music/win32_m.c b/music/win32_m.c
index 5e9dfbca9..36b79b30b 100644
--- a/music/win32_m.c
+++ b/music/win32_m.c
@@ -44,7 +44,8 @@ static void Win32MidiSetVolume(byte vol)
SetEvent(_midi.wait_obj);
}
-static MCIERROR CDECL MidiSendCommand(const char *cmd, ...) {
+static MCIERROR CDECL MidiSendCommand(const char* cmd, ...)
+{
va_list va;
char buf[512];
diff --git a/network_server.h b/network_server.h
index 2c14b8c4e..8d09c4c36 100644
--- a/network_server.h
+++ b/network_server.h
@@ -20,7 +20,10 @@ void NetworkServer_Tick(bool send_frame);
void NetworkServerMonthlyLoop(void);
void NetworkServerYearlyLoop(void);
-static inline const char* GetPlayerIP(const NetworkClientInfo *ci) {return inet_ntoa(*(struct in_addr *)&ci->client_ip);}
+static inline const char* GetPlayerIP(const NetworkClientInfo* ci)
+{
+ return inet_ntoa(*(const struct in_addr*)&ci->client_ip);
+}
#endif /* ENABLE_NETWORK */
diff --git a/newgrf.h b/newgrf.h
index 599cbad4f..5abc5c95f 100644
--- a/newgrf.h
+++ b/newgrf.h
@@ -46,4 +46,3 @@ extern GRFFile *_first_grffile;
void LoadNewGRF(uint load_index, uint file_index);
#endif /* NEWGRF_H */
-
diff --git a/openttd.c b/openttd.c
index 2ecd53a11..33e1018af 100644
--- a/openttd.c
+++ b/openttd.c
@@ -225,7 +225,7 @@ md_continue_here:;
}
-static void ParseResolution(int res[2], char *s)
+static void ParseResolution(int res[2], const char* s)
{
char *t = strchr(s, 'x');
if (t == NULL) {
diff --git a/order_gui.c b/order_gui.c
index 686ed7b91..17936adc4 100644
--- a/order_gui.c
+++ b/order_gui.c
@@ -18,9 +18,9 @@
#include "depot.h"
#include "waypoint.h"
-static int OrderGetSel(Window *w)
+static int OrderGetSel(const Window* w)
{
- Vehicle *v = GetVehicle(w->window_number);
+ const Vehicle* v = GetVehicle(w->window_number);
int num = WP(w,order_d).sel;
if (num < 0 || num > v->num_orders)
@@ -113,7 +113,6 @@ static void DrawOrdersWindow(Window *w)
SETBIT(w->disabled_state, 8); /* full load */
SETBIT(w->disabled_state, 9); /* unload */
SETBIT(w->disabled_state, 10); /* transfer */
-
}
SetDParam(0, v->string_id);
diff --git a/os2.c b/os2.c
index f414a4a1c..cd835156a 100644
--- a/os2.c
+++ b/os2.c
@@ -633,4 +633,3 @@ void CSleep(int milliseconds)
{
delay(milliseconds);
}
-
diff --git a/pathfind.c b/pathfind.c
index d806e3dff..a359a75a4 100644
--- a/pathfind.c
+++ b/pathfind.c
@@ -915,4 +915,3 @@ void NewTrainPathfind(TileIndex tile, TileIndex dest, byte direction, NTPEnumPro
NTPEnum(&tpf, tile, direction);
}
-
diff --git a/players.c b/players.c
index 7de4c13a7..b03314f3f 100644
--- a/players.c
+++ b/players.c
@@ -1263,4 +1263,3 @@ static void Load_PLYR(void)
const ChunkHandler _player_chunk_handlers[] = {
{ 'PLYR', Save_PLYR, Load_PLYR, CH_ARRAY | CH_LAST},
};
-
diff --git a/rail.c b/rail.c
index 44996a8d0..7435411b2 100644
--- a/rail.c
+++ b/rail.c
@@ -143,4 +143,3 @@ RailType GetTileRailType(TileIndex tile, Trackdir trackdir)
}
return type;
}
-
diff --git a/rail.h b/rail.h
index 96203e5ab..3c88d1c71 100644
--- a/rail.h
+++ b/rail.h
@@ -43,10 +43,10 @@ typedef enum RailTileSubtypes {
typedef enum SignalTypes {
/* Stored in m4[0..1] for MP_RAILWAY */
- SIGTYPE_NORMAL = 0, // normal signal
- SIGTYPE_ENTRY = 1, // presignal block entry
- SIGTYPE_EXIT = 2, // presignal block exit
- SIGTYPE_COMBO = 3, // presignal inter-block
+ SIGTYPE_NORMAL = 0, // normal signal
+ SIGTYPE_ENTRY = 1, // presignal block entry
+ SIGTYPE_EXIT = 2, // presignal block exit
+ SIGTYPE_COMBO = 3, // presignal inter-block
SIGTYPE_PBS = 4, // pbs signal
SIGTYPE_END,
SIGTYPE_MASK = 7,
@@ -68,66 +68,66 @@ enum {
/** These are used to specify a single track. Can be translated to a trackbit
* with TrackToTrackbit */
typedef enum Tracks {
- TRACK_DIAG1 = 0,
- TRACK_DIAG2 = 1,
- TRACK_UPPER = 2,
- TRACK_LOWER = 3,
- TRACK_LEFT = 4,
- TRACK_RIGHT = 5,
- TRACK_END,
- INVALID_TRACK = 0xFF,
+ TRACK_DIAG1 = 0,
+ TRACK_DIAG2 = 1,
+ TRACK_UPPER = 2,
+ TRACK_LOWER = 3,
+ TRACK_LEFT = 4,
+ TRACK_RIGHT = 5,
+ TRACK_END,
+ INVALID_TRACK = 0xFF,
} Track;
/** These are the bitfield variants of the above */
typedef enum TrackBits {
- TRACK_BIT_DIAG1 = 1, // 0
- TRACK_BIT_DIAG2 = 2, // 1
- TRACK_BIT_UPPER = 4, // 2
- TRACK_BIT_LOWER = 8, // 3
- TRACK_BIT_LEFT = 16, // 4
- TRACK_BIT_RIGHT = 32, // 5
+ TRACK_BIT_DIAG1 = 1, // 0
+ TRACK_BIT_DIAG2 = 2, // 1
+ TRACK_BIT_UPPER = 4, // 2
+ TRACK_BIT_LOWER = 8, // 3
+ TRACK_BIT_LEFT = 16, // 4
+ TRACK_BIT_RIGHT = 32, // 5
TRACK_BIT_MASK = 0x3F,
} TrackBits;
/** These are a combination of tracks and directions. Values are 0-5 in one
direction (corresponding to the Track enum) and 8-13 in the other direction. */
typedef enum Trackdirs {
- TRACKDIR_DIAG1_NE = 0,
- TRACKDIR_DIAG2_SE = 1,
- TRACKDIR_UPPER_E = 2,
- TRACKDIR_LOWER_E = 3,
- TRACKDIR_LEFT_S = 4,
- TRACKDIR_RIGHT_S = 5,
+ TRACKDIR_DIAG1_NE = 0,
+ TRACKDIR_DIAG2_SE = 1,
+ TRACKDIR_UPPER_E = 2,
+ TRACKDIR_LOWER_E = 3,
+ TRACKDIR_LEFT_S = 4,
+ TRACKDIR_RIGHT_S = 5,
/* Note the two missing values here. This enables trackdir -> track
* conversion by doing (trackdir & 7) */
- TRACKDIR_DIAG1_SW = 8,
- TRACKDIR_DIAG2_NW = 9,
- TRACKDIR_UPPER_W = 10,
- TRACKDIR_LOWER_W = 11,
- TRACKDIR_LEFT_N = 12,
- TRACKDIR_RIGHT_N = 13,
- TRACKDIR_END,
- INVALID_TRACKDIR = 0xFF,
+ TRACKDIR_DIAG1_SW = 8,
+ TRACKDIR_DIAG2_NW = 9,
+ TRACKDIR_UPPER_W = 10,
+ TRACKDIR_LOWER_W = 11,
+ TRACKDIR_LEFT_N = 12,
+ TRACKDIR_RIGHT_N = 13,
+ TRACKDIR_END,
+ INVALID_TRACKDIR = 0xFF,
} Trackdir;
/** These are a combination of tracks and directions. Values are 0-5 in one
direction (corresponding to the Track enum) and 8-13 in the other direction. */
typedef enum TrackdirBits {
- TRACKDIR_BIT_DIAG1_NE = 0x1,
- TRACKDIR_BIT_DIAG2_SE = 0x2,
- TRACKDIR_BIT_UPPER_E = 0x4,
- TRACKDIR_BIT_LOWER_E = 0x8,
- TRACKDIR_BIT_LEFT_S = 0x10,
- TRACKDIR_BIT_RIGHT_S = 0x20,
+ TRACKDIR_BIT_DIAG1_NE = 0x1,
+ TRACKDIR_BIT_DIAG2_SE = 0x2,
+ TRACKDIR_BIT_UPPER_E = 0x4,
+ TRACKDIR_BIT_LOWER_E = 0x8,
+ TRACKDIR_BIT_LEFT_S = 0x10,
+ TRACKDIR_BIT_RIGHT_S = 0x20,
/* Again, note the two missing values here. This enables trackdir -> track conversion by doing (trackdir & 0xFF) */
- TRACKDIR_BIT_DIAG1_SW = 0x0100,
- TRACKDIR_BIT_DIAG2_NW = 0x0200,
- TRACKDIR_BIT_UPPER_W = 0x0400,
- TRACKDIR_BIT_LOWER_W = 0x0800,
- TRACKDIR_BIT_LEFT_N = 0x1000,
- TRACKDIR_BIT_RIGHT_N = 0x2000,
+ TRACKDIR_BIT_DIAG1_SW = 0x0100,
+ TRACKDIR_BIT_DIAG2_NW = 0x0200,
+ TRACKDIR_BIT_UPPER_W = 0x0400,
+ TRACKDIR_BIT_LOWER_W = 0x0800,
+ TRACKDIR_BIT_LEFT_N = 0x1000,
+ TRACKDIR_BIT_RIGHT_N = 0x2000,
TRACKDIR_BIT_MASK = 0x3F3F,
- INVALID_TRACKDIR_BIT = 0xFFFF,
+ INVALID_TRACKDIR_BIT = 0xFFFF,
} TrackdirBits;
/** These are states in which a signal can be. Currently these are only two, so
@@ -270,7 +270,7 @@ static inline byte SignalOnTrack(Track track) {
static inline RailTileType GetRailTileType(TileIndex tile)
{
assert(IsTileType(tile, MP_RAILWAY));
- return (_m[tile].m5 & RAIL_TILE_TYPE_MASK);
+ return _m[tile].m5 & RAIL_TILE_TYPE_MASK;
}
/**
@@ -598,4 +598,3 @@ void DrawTrackBits(TileInfo *ti, TrackBits track, bool earth, bool snow, bool fl
void DrawTrainDepotSprite(int x, int y, int image, RailType railtype);
void DrawDefaultWaypointSprite(int x, int y, RailType railtype);
#endif /* RAIL_H */
-
diff --git a/rail_cmd.c b/rail_cmd.c
index 6e46999e3..1e96b329a 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -448,9 +448,10 @@ int32 CmdRemoveSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (!(flags & DC_EXEC))
return _price.remove_rail;
- SetTileOwner(tile, OWNER_NONE);
+ SetTileOwner(tile, OWNER_NONE);
_m[tile].m5 = _m[tile].m5 & 0xC7;
break;
+
case MP_STREET:
if (!IsLevelCrossing(tile)) return CMD_ERROR;
@@ -472,8 +473,8 @@ int32 CmdRemoveSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2)
SetTileOwner(tile, _m[tile].m3);
_m[tile].m2 = 0;
break;
- case MP_RAILWAY:
+ case MP_RAILWAY:
if (!IsPlainRailTile(tile))
return CMD_ERROR;
@@ -502,6 +503,7 @@ int32 CmdRemoveSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2)
goto skip_mark_dirty;
}
break;
+
default:
assert(0);
}
@@ -673,13 +675,12 @@ int32 CmdBuildTrainDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
*/
if (tileh != 0 && (
- _is_old_ai_player ||
- !_patches.build_on_slopes ||
- IsSteepTileh(tileh) ||
- !CanBuildDepotByTileh(p2, tileh)
- )
- ) {
- return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
+ _is_old_ai_player ||
+ !_patches.build_on_slopes ||
+ IsSteepTileh(tileh) ||
+ !CanBuildDepotByTileh(p2, tileh)
+ )) {
+ return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
}
ret = DoCommandByTile(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
@@ -1783,7 +1784,7 @@ bool SignalVehicleCheck(TileIndex tile, uint track)
static void SetSignalsAfterProc(TrackPathFinder *tpf)
{
SetSignalsData *ssd = tpf->userdata;
- TrackPathFinderLink *link;
+ const TrackPathFinderLink* link;
uint offs;
uint i;
@@ -2125,11 +2126,11 @@ static uint32 GetTileTrackStatus_Track(TileIndex tile, TransportType mode)
static void ClickTile_Track(TileIndex tile)
{
- if (IsTileDepotType(tile, TRANSPORT_RAIL))
+ if (IsTileDepotType(tile, TRANSPORT_RAIL)) {
ShowTrainDepotWindow(tile);
- else if (IsRailWaypoint(_m[tile].m5))
+ } else if (IsRailWaypoint(_m[tile].m5)) {
ShowRenameWaypointWindow(GetWaypointByTile(tile));
-
+ }
}
static void GetTileDesc_Track(TileIndex tile, TileDesc *td)
diff --git a/railtypes.h b/railtypes.h
index be097383c..3fb00178a 100644
--- a/railtypes.h
+++ b/railtypes.h
@@ -124,4 +124,3 @@ const RailtypeInfo _railtypes[] = {
24,
},
};
-
diff --git a/road_cmd.c b/road_cmd.c
index 3137e2fd0..5275d461b 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -745,7 +745,8 @@ typedef struct DrawRoadSeqStruct {
#include "table/road_land.h"
-uint GetRoadFoundation(uint tileh, uint bits) {
+uint GetRoadFoundation(uint tileh, uint bits)
+{
int i;
// normal level sloped building
if ((~_valid_tileh_slopes_road[1][tileh] & bits) == 0)
diff --git a/roadveh_gui.c b/roadveh_gui.c
index 0bc85c357..be6928989 100644
--- a/roadveh_gui.c
+++ b/roadveh_gui.c
@@ -487,13 +487,13 @@ static void NewRoadVehWndProc(Window *w, WindowEvent *e)
}
break;
- case WE_ON_EDIT_TEXT: {
+ case WE_ON_EDIT_TEXT:
if (e->edittext.str[0] != '\0') {
_cmd_text = e->edittext.str;
DoCommandP(0, WP(w, buildtrain_d).rename_engine, 0, NULL,
CMD_RENAME_ENGINE | CMD_MSG(STR_9037_CAN_T_RENAME_ROAD_VEHICLE));
}
- } break;
+ break;
case WE_RESIZE: {
if (e->sizing.diff.y == 0)
diff --git a/saveload.c b/saveload.c
index 70d77eabc..499bd3006 100644
--- a/saveload.c
+++ b/saveload.c
@@ -1111,11 +1111,11 @@ static uint ReferenceToInt(const void *obj, SLRefType rt)
switch (rt) {
case REF_VEHICLE_OLD: // Old vehicles we save as new onces
- case REF_VEHICLE: return ((Vehicle *)obj)->index + 1;
- case REF_STATION: return ((Station *)obj)->index + 1;
- case REF_TOWN: return ((Town *)obj)->index + 1;
- case REF_ORDER: return ((Order *)obj)->index + 1;
- case REF_ROADSTOPS: return ((RoadStop *)obj)->index + 1;
+ case REF_VEHICLE: return ((const Vehicle*)obj)->index + 1;
+ case REF_STATION: return ((const Station*)obj)->index + 1;
+ case REF_TOWN: return ((const Town*)obj)->index + 1;
+ case REF_ORDER: return ((const Order*)obj)->index + 1;
+ case REF_ROADSTOPS: return ((const RoadStop*)obj)->index + 1;
default: NOT_REACHED();
}
diff --git a/screenshot.c b/screenshot.c
index ac9a4433f..4b6281821 100644
--- a/screenshot.c
+++ b/screenshot.c
@@ -486,7 +486,7 @@ static char *MakeScreenshotName(const char *ext)
if (_game_mode == GM_EDITOR || _local_player == OWNER_SPECTATOR) {
sprintf(_screenshot_name, "screenshot");
} else {
- Player *p = &_players[_local_player];
+ const Player* p = GetPlayer(_local_player);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
SetDParam(2, _date);
diff --git a/settings_gui.c b/settings_gui.c
index 2c245f468..cc7a5b5f9 100644
--- a/settings_gui.c
+++ b/settings_gui.c
@@ -690,7 +690,6 @@ static const PatchEntry _patches_construction[] = {
{PE_BOOL, 0, STR_CONFIG_PATCHES_SMALL_AIRPORTS, "always_small_airport", &_patches.always_small_airport, 0, 0, 0, NULL},
{PE_UINT8, PF_PLAYERBASED, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY, "drag_signals_density", &_patches.drag_signals_density, 1, 20, 1, NULL},
{PE_BOOL, 0, STR_CONFIG_AUTO_PBS_PLACEMENT, "auto_pbs_placement", &_patches.auto_pbs_placement, 1, 20, 1, NULL},
-
};
static const PatchEntry _patches_vehicles[] = {
@@ -734,7 +733,6 @@ static const PatchEntry _patches_stations[] = {
{PE_UINT8, 0, STR_CONFIG_PATCHES_STATION_SPREAD, "station_spread", &_patches.station_spread, 4, 64, 1, &InvalidateStationBuildWindow},
{PE_BOOL, 0, STR_CONFIG_PATCHES_SERVICEATHELIPAD, "service_at_helipad", &_patches.serviceathelipad, 0, 0, 0, NULL},
{PE_BOOL, 0, STR_CONFIG_PATCHES_CATCHMENT, "modified_catchment", &_patches.modified_catchment, 0, 0, 0, NULL},
-
};
static const PatchEntry _patches_economy[] = {
diff --git a/ship_gui.c b/ship_gui.c
index 1be633b4b..c2486fd9e 100644
--- a/ship_gui.c
+++ b/ship_gui.c
@@ -256,14 +256,13 @@ do_change_service_int:
DeleteWindow(w);
break;
- case WE_ON_EDIT_TEXT: {
+ case WE_ON_EDIT_TEXT:
if (e->edittext.str[0] != '\0') {
_cmd_text = e->edittext.str;
DoCommandP(0, w->window_number, 0, NULL,
CMD_NAME_VEHICLE | CMD_MSG(STR_9832_CAN_T_NAME_SHIP));
}
- } break;
-
+ break;
}
}
@@ -406,13 +405,13 @@ static void NewShipWndProc(Window *w, WindowEvent *e)
}
break;
- case WE_ON_EDIT_TEXT: {
+ case WE_ON_EDIT_TEXT:
if (e->edittext.str[0] != '\0') {
_cmd_text = e->edittext.str;
DoCommandP(0, WP(w, buildtrain_d).rename_engine, 0, NULL,
CMD_RENAME_ENGINE | CMD_MSG(STR_9839_CAN_T_RENAME_SHIP_TYPE));
}
- } break;
+ break;
case WE_RESIZE:
w->vscroll.cap += e->sizing.diff.y / 24;
diff --git a/smallmap_gui.c b/smallmap_gui.c
index 232bfb493..4d7107680 100644
--- a/smallmap_gui.c
+++ b/smallmap_gui.c
@@ -968,9 +968,9 @@ static void ExtraViewPortWndProc(Window *w, WindowEvent *e)
WP(w2, vp_d).scrollpos_y = y - (w2->viewport->virtual_height - w->viewport->virtual_height) / 2;
} break;
case 8: { /* inverse location button (move this view to same spot as main view) 'Copy Location' */
- const Window *w2 = FindWindowById(WC_MAIN_WINDOW, 0);
- int x = WP(w2, vp_d).scrollpos_x;
- int y = WP(w2, vp_d).scrollpos_y;
+ const Window* w2 = FindWindowById(WC_MAIN_WINDOW, 0);
+ int x = WP(w2, const vp_d).scrollpos_x;
+ int y = WP(w2, const vp_d).scrollpos_y;
WP(w, vp_d).scrollpos_x = x + (w2->viewport->virtual_width - w->viewport->virtual_width) / 2;
WP(w, vp_d).scrollpos_y = y + (w2->viewport->virtual_height - w->viewport->virtual_height) / 2;
diff --git a/sprite.h b/sprite.h
index 45f14a271..877e3c9e8 100644
--- a/sprite.h
+++ b/sprite.h
@@ -19,7 +19,7 @@ typedef struct DrawTileSeqStruct {
typedef struct DrawTileSprites {
SpriteID ground_sprite;
- DrawTileSeqStruct const *seq;
+ const DrawTileSeqStruct* seq;
} DrawTileSprites;
// Iterate through all DrawTileSeqStructs in DrawTileSprites.
diff --git a/spritecache.c b/spritecache.c
index df64970fa..d7357f7f2 100644
--- a/spritecache.c
+++ b/spritecache.c
@@ -4,6 +4,7 @@
#include "openttd.h"
#include "debug.h"
#include "functions.h"
+#include "macros.h"
#include "spritecache.h"
#include "table/sprites.h"
#include "fileio.h"
@@ -334,7 +335,7 @@ static void* AllocSprite(size_t mem_req)
/* Align this to an uint32 boundary. This also makes sure that the 2 least
* bits are not used, so we could use those for other things. */
- mem_req = (mem_req + sizeof(uint32) - 1) & ~(sizeof(uint32) - 1);
+ mem_req = ALIGN(mem_req, sizeof(uint32));
for (;;) {
MemBlock* s;
diff --git a/station.h b/station.h
index 1483981f2..7b72ab29d 100644
--- a/station.h
+++ b/station.h
@@ -315,7 +315,8 @@ static inline bool IsBuoy(const Station* st)
return st->had_vehicle_of_type & HVOT_BUOY; /* XXX: We should really ditch this ugly coding and switch to something sane... */
}
-static inline bool IsBuoyTile(TileIndex tile) {
+static inline bool IsBuoyTile(TileIndex tile)
+{
return IsTileType(tile, MP_STATION) && _m[tile].m5 == 0x52;
}
diff --git a/station_cmd.c b/station_cmd.c
index e73abce06..b5acc6d0b 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -3222,4 +3222,3 @@ const ChunkHandler _station_chunk_handlers[] = {
{ 'STNS', Save_STNS, Load_STNS, CH_ARRAY },
{ 'ROAD', Save_ROADSTOP, Load_ROADSTOP, CH_ARRAY | CH_LAST},
};
-
diff --git a/strings.c b/strings.c
index a3fc3f1b1..d732c9ea1 100644
--- a/strings.c
+++ b/strings.c
@@ -1122,4 +1122,3 @@ void InitializeLanguagePacks(void)
if (!ReadLanguagePack(def))
error("can't read language pack '%s'", dl->ent[def].file);
}
-
diff --git a/table/ai_rail.h b/table/ai_rail.h
index ecc7bc2e9..4226f3945 100644
--- a/table/ai_rail.h
+++ b/table/ai_rail.h
@@ -478,5 +478,3 @@ static const AiDefaultBlockData * const _airport_default_block_data[] = {
_airportdata_ai_1, // country airport
NULL
};
-
-
diff --git a/table/bridge_land.h b/table/bridge_land.h
index 5de4c1acd..d3e35c231 100644
--- a/table/bridge_land.h
+++ b/table/bridge_land.h
@@ -773,5 +773,3 @@ static const uint32 * const _bridge_poles_table[] = {
_bridge_sprite_table_11_poles,
_bridge_sprite_table_12_poles
};
-
-
diff --git a/table/clear_land.h b/table/clear_land.h
index 3d9f38485..e2d167faa 100644
--- a/table/clear_land.h
+++ b/table/clear_land.h
@@ -60,4 +60,3 @@ static const SpriteID _clear_land_sprites_3[8] = {
0x11B3,
0x11C6,
};
-
diff --git a/table/landscape_sprite.h b/table/landscape_sprite.h
index 196fead50..abff2cc66 100644
--- a/table/landscape_sprite.h
+++ b/table/landscape_sprite.h
@@ -165,4 +165,3 @@ static const SpriteID _slopes_spriteindexes_3[] = {
SPR_SLOPES_BASE, SPR_SLOPES_BASE+73,
0xffff,
};
-
diff --git a/table/sprites.h b/table/sprites.h
index 600f29f93..f520f96a9 100644
--- a/table/sprites.h
+++ b/table/sprites.h
@@ -37,7 +37,7 @@
enum Sprites {
- SPR_SELECT_TILE = 752,
+ SPR_SELECT_TILE = 752,
SPR_DOT = 774, // corner marker for lower/raise land
SPR_DOT_SMALL = 4078,
SPR_WHITE_POINT = 4079,
@@ -48,10 +48,10 @@ enum Sprites {
SPR_ASCII_SPACE_BIG = 450,
/* Extra graphic spritenumbers */
- SPR_CANALS_BASE = 5382,
- SPR_SLOPES_BASE = SPR_CANALS_BASE + 70,
- SPR_AUTORAIL_BASE = SPR_SLOPES_BASE + 78,
- SPR_OPENTTD_BASE = SPR_AUTORAIL_BASE + 55, // can be lowered once autorail.grf is finalized
+ SPR_CANALS_BASE = 5382,
+ SPR_SLOPES_BASE = SPR_CANALS_BASE + 70,
+ SPR_AUTORAIL_BASE = SPR_SLOPES_BASE + 78,
+ SPR_OPENTTD_BASE = SPR_AUTORAIL_BASE + 55, // can be lowered once autorail.grf is finalized
SPR_BLOT = SPR_OPENTTD_BASE + 32, // colored circle (mainly used as vehicle profit marker and for sever compatibility)
@@ -87,7 +87,7 @@ enum Sprites {
SPR_SHADOW_CELL = 1004,
/* Sliced view shadow cells */
- /* Maybe we have differen ones in the future */
+ /* Maybe we have different ones in the future */
SPR_MAX_SLICE = SPR_OPENTTD_BASE + 71,
SPR_MIN_SLICE = SPR_OPENTTD_BASE + 71,
@@ -133,11 +133,11 @@ enum Sprites {
SPR_MGLV_SNOW_OFFSET = 26,
SPR_RAIL_SINGLE_Y = 1005,
- SPR_RAIL_SINGLE_X = 1006,
- SPR_RAIL_SINGLE_NORTH = 1007,
- SPR_RAIL_SINGLE_SOUTH = 1008,
- SPR_RAIL_SINGLE_EAST = 1009,
- SPR_RAIL_SINGLE_WEST = 1010,
+ SPR_RAIL_SINGLE_X = 1006,
+ SPR_RAIL_SINGLE_NORTH = 1007,
+ SPR_RAIL_SINGLE_SOUTH = 1008,
+ SPR_RAIL_SINGLE_EAST = 1009,
+ SPR_RAIL_SINGLE_WEST = 1010,
SPR_RAIL_TRACK_Y = 1011,
SPR_RAIL_TRACK_X = 1012,
SPR_RAIL_TRACK_BASE = 1018,
@@ -169,23 +169,23 @@ enum Sprites {
SPR_RAIL_ROOF_GLASS_X_TILE_B = 1085, //second half of the roof glass
SPR_RAIL_ROOF_GLASS_Y_TILE_B = 1086,
SPR_MONO_SINGLE_Y = 1087,
- SPR_MONO_SINGLE_X = 1088,
- SPR_MONO_SINGLE_NORTH = 1089,
- SPR_MONO_SINGLE_SOUTH = 1090,
- SPR_MONO_SINGLE_EAST = 1091,
- SPR_MONO_SINGLE_WEST = 1092,
+ SPR_MONO_SINGLE_X = 1088,
+ SPR_MONO_SINGLE_NORTH = 1089,
+ SPR_MONO_SINGLE_SOUTH = 1090,
+ SPR_MONO_SINGLE_EAST = 1091,
+ SPR_MONO_SINGLE_WEST = 1092,
SPR_MONO_TRACK_Y = 1093,
SPR_MONO_TRACK_BASE = 1100,
- SPR_MONO_TRACK_N_S = 1117,
+ SPR_MONO_TRACK_N_S = 1117,
SPR_MGLV_SINGLE_Y = 1169,
- SPR_MGLV_SINGLE_X = 1170,
- SPR_MGLV_SINGLE_NORTH = 1171,
- SPR_MGLV_SINGLE_SOUTH = 1172,
- SPR_MGLV_SINGLE_EAST = 1173,
- SPR_MGLV_SINGLE_WEST = 1174,
+ SPR_MGLV_SINGLE_X = 1170,
+ SPR_MGLV_SINGLE_NORTH = 1171,
+ SPR_MGLV_SINGLE_SOUTH = 1172,
+ SPR_MGLV_SINGLE_EAST = 1173,
+ SPR_MGLV_SINGLE_WEST = 1174,
SPR_MGLV_TRACK_Y = 1175,
SPR_MGLV_TRACK_BASE = 1182,
- SPR_MGLV_TRACK_N_S = 1199,
+ SPR_MGLV_TRACK_N_S = 1199,
SPR_WAYPOINT_X_1 = SPR_OPENTTD_BASE + 18,
SPR_WAYPOINT_X_2 = SPR_OPENTTD_BASE + 19,
SPR_WAYPOINT_Y_1 = SPR_OPENTTD_BASE + 20,
@@ -425,7 +425,7 @@ enum Sprites {
SPR_CROSSING_OFF_X_MONO = 1382,
SPR_CROSSING_OFF_X_MAGLEV = 1394,
- /* bridge type sprites */
+ /* bridge type sprites */
/* Wooden bridge (type 0) */
SPR_BTWDN_RAIL_Y_REAR = 2545,
diff --git a/table/track_land.h b/table/track_land.h
index 4a5a975bc..6c535bf69 100644
--- a/table/track_land.h
+++ b/table/track_land.h
@@ -62,4 +62,3 @@ static const DrawTrackSeqStruct* const _track_depot_layout_table[] = {
_track_waypoint_table_0,
_track_waypoint_table_1,
};
-
diff --git a/table/tree_land.h b/table/tree_land.h
index 916ea5668..1dd1409d8 100644
--- a/table/tree_land.h
+++ b/table/tree_land.h
@@ -221,4 +221,3 @@ static const PalSpriteID _tree_layout_sprite[164+(79-48+1)][4] = {
};
#endif /* TREE_LAND_H */
-
diff --git a/texteff.c b/texteff.c
index 02428527c..2492fb5bf 100644
--- a/texteff.c
+++ b/texteff.c
@@ -39,14 +39,14 @@ static TextMessage _text_message_list[MAX_CHAT_MESSAGES];
TileIndex _animated_tile_list[256];
-int _textmessage_width = 0;
-bool _textmessage_dirty = true;
-bool _textmessage_visible = false;
+static int _textmessage_width = 0;
+static bool _textmessage_dirty = true;
+static bool _textmessage_visible = false;
-const int _textmessage_box_left = 10; // Pixels from left
-const int _textmessage_box_y = 150; // Height of box
-const int _textmessage_box_bottom = 30; // Pixels from bottom
-const int _textmessage_box_max_width = 400; // Max width of box
+static const int _textmessage_box_left = 10; // Pixels from left
+static const int _textmessage_box_y = 150; // Height of box
+static const int _textmessage_box_bottom = 30; // Pixels from bottom
+static const int _textmessage_box_max_width = 400; // Max width of box
static Pixel _textmessage_backup[150 * 400]; // (y * max_width)
@@ -379,5 +379,3 @@ static void SaveLoad_ANIT(void)
const ChunkHandler _animated_tile_chunk_handlers[] = {
{ 'ANIT', SaveLoad_ANIT, SaveLoad_ANIT, CH_RIFF | CH_LAST},
};
-
-
diff --git a/town_cmd.c b/town_cmd.c
index 3db23ece7..b265057c0 100644
--- a/town_cmd.c
+++ b/town_cmd.c
@@ -1561,7 +1561,7 @@ static void TownActionAdvertise(Town *t, int action)
static void TownActionRoadRebuild(Town *t, int action)
{
- Player *p;
+ const Player* p;
t->road_build_months = 6;
diff --git a/town_gui.c b/town_gui.c
index 89d7d889a..f5d6e9a57 100644
--- a/town_gui.c
+++ b/town_gui.c
@@ -273,13 +273,13 @@ static void TownViewWndProc(Window *w, WindowEvent *e)
}
break;
- case WE_ON_EDIT_TEXT: {
+ case WE_ON_EDIT_TEXT:
if (e->edittext.str[0] != '\0') {
_cmd_text = e->edittext.str;
DoCommandP(0, w->window_number, 0, NULL,
CMD_RENAME_TOWN | CMD_MSG(STR_2008_CAN_T_RENAME_TOWN));
}
- } break;
+ break;
}
}
@@ -525,5 +525,3 @@ void ShowTownDirectory(void)
w->resize.height = w->height - 10 * 6; // minimum of 10 items in the list, each item 10 high
}
}
-
-
diff --git a/train_gui.c b/train_gui.c
index 8655725df..c3dde82f2 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -1283,13 +1283,13 @@ do_change_service_int:
DeleteWindow(w);
break;
- case WE_ON_EDIT_TEXT: {
+ case WE_ON_EDIT_TEXT:
if (e->edittext.str[0] != '\0') {
_cmd_text = e->edittext.str;
DoCommandP(0, w->window_number, 0, NULL,
CMD_NAME_VEHICLE | CMD_MSG(STR_8866_CAN_T_NAME_TRAIN));
}
- } break;
+ break;
}
}
diff --git a/tree_cmd.c b/tree_cmd.c
index 6623ac501..0505ef957 100644
--- a/tree_cmd.c
+++ b/tree_cmd.c
@@ -344,7 +344,8 @@ static uint GetSlopeZ_Trees(const TileInfo* ti)
return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z;
}
-static uint GetSlopeTileh_Trees(const TileInfo *ti) {
+static uint GetSlopeTileh_Trees(const TileInfo* ti)
+{
return ti->tileh;
}
diff --git a/vehicle.h b/vehicle.h
index 443e0773b..1d91e04f4 100644
--- a/vehicle.h
+++ b/vehicle.h
@@ -305,7 +305,6 @@ bool UpdateSignalsOnSegment(TileIndex tile, byte direction);
void SetSignalsOnBothDir(TileIndex tile, byte track);
Vehicle *CheckClickOnVehicle(const ViewPort *vp, int x, int y);
-//uint GetVehicleWeight(Vehicle *v);
void DecreaseVehicleValue(Vehicle *v);
void CheckVehicleBreakdown(Vehicle *v);
@@ -395,9 +394,7 @@ static inline bool IsValidVehicle(const Vehicle *v)
*/
static inline bool IsVehicleIndex(uint index)
{
- if (index < GetVehiclePoolSize()) return true;
-
- return false;
+ return index < GetVehiclePoolSize();
}
/* Returns order 'index' of a vehicle or NULL when it doesn't exists */
@@ -448,9 +445,6 @@ VARDEF VehicleID _new_roadveh_id;
VARDEF uint16 _aircraft_refit_capacity;
VARDEF byte _cmd_build_rail_veh_score;
-// for each player, for each vehicle type, keep a list of the vehicles.
-//VARDEF Vehicle *_vehicle_arr[8][4];
-
#define INVALID_VEHICLE 0xFFFF
#define INVALID_ENGINE 0xFFFF
diff --git a/vehicle_gui.h b/vehicle_gui.h
index f6929fe2f..5a37df8be 100644
--- a/vehicle_gui.h
+++ b/vehicle_gui.h
@@ -47,9 +47,9 @@ typedef struct Sorting {
extern Sorting _sorting;
enum {
- PLY_WND_PRC__OFFSET_TOP_WIDGET = 26,
- PLY_WND_PRC__SIZE_OF_ROW_SMALL = 26,
- PLY_WND_PRC__SIZE_OF_ROW_BIG = 36,
+ PLY_WND_PRC__OFFSET_TOP_WIDGET = 26,
+ PLY_WND_PRC__SIZE_OF_ROW_SMALL = 26,
+ PLY_WND_PRC__SIZE_OF_ROW_BIG = 36,
};
void ShowReplaceVehicleWindow(byte vehicletype);
diff --git a/water_cmd.c b/water_cmd.c
index a74807fba..c61abdbd5 100644
--- a/water_cmd.c
+++ b/water_cmd.c
@@ -744,4 +744,3 @@ const TileTypeProcs _tile_type_water_procs = {
NULL, /* vehicle_leave_tile_proc */
GetSlopeTileh_Water, /* get_slope_tileh_proc */
};
-
diff --git a/widget.c b/widget.c
index 64a225440..d80137bfe 100644
--- a/widget.c
+++ b/widget.c
@@ -159,7 +159,7 @@ int GetWidgetFromPos(const Window *w, int x, int y)
void DrawWindowWidgets(const Window *w)
{
const Widget *wi;
- DrawPixelInfo *dpi = _cur_dpi;
+ const DrawPixelInfo* dpi = _cur_dpi;
Rect r;
uint32 cur_click, cur_disabled, cur_hidden;