(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
replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
tron 19 years ago
parent 0163870006
commit 2cc2154ad2

@ -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);

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

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

@ -1001,4 +1001,3 @@ void StartupDisasters(void)
{
ResetDisasterDelay();
}

@ -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) {

@ -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 */
};

@ -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) {

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

@ -180,5 +180,3 @@ void FioOpenFile(int slot, const char *filename)
_fio.handles[slot] = f;
FioSeekToFile(slot << 24);
}

10
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;

@ -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);

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

@ -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)

@ -450,4 +450,3 @@ LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size);
#endif
#endif /* LZOCONF_H */

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

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

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

@ -72,4 +72,3 @@ uint32 RandomMT(void)
void SeedMT(uint32 seed) {}
#endif /* MERSENNE_TWISTER */

@ -1969,5 +1969,3 @@ lookbehind_overrun:
#endif
/***** End of minilzo.c *****/

@ -99,4 +99,3 @@ lzo1x_decompress_safe ( const lzo_byte *src, lzo_uint src_len,
#endif
#endif /* MINILZO_H */

@ -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];

@ -75,4 +75,3 @@ const HalMusicDriver _os2_music_driver = {
OS2MidiIsSongPlaying,
OS2MidiSetVolume,
};

@ -375,5 +375,3 @@ const HalMusicDriver _qtime_music_driver = {
SongIsPlaying,
SetVolume,
};

@ -12,4 +12,3 @@
extern const HalMusicDriver _qtime_music_driver;
#endif /* !MUSIC_MACOSX_QUICKTIME_H */

@ -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];

@ -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 */

@ -46,4 +46,3 @@ extern GRFFile *_first_grffile;
void LoadNewGRF(uint load_index, uint file_index);
#endif /* NEWGRF_H */

@ -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) {

@ -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);

@ -633,4 +633,3 @@ void CSleep(int milliseconds)
{
delay(milliseconds);
}

@ -915,4 +915,3 @@ void NewTrainPathfind(TileIndex tile, TileIndex dest, byte direction, NTPEnumPro
NTPEnum(&tpf, tile, direction);
}

@ -1263,4 +1263,3 @@ static void Load_PLYR(void)
const ChunkHandler _player_chunk_handlers[] = {
{ 'PLYR', Save_PLYR, Load_PLYR, CH_ARRAY | CH_LAST},
};

@ -143,4 +143,3 @@ RailType GetTileRailType(TileIndex tile, Trackdir trackdir)
}
return type;
}

@ -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 */

@ -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)

@ -124,4 +124,3 @@ const RailtypeInfo _railtypes[] = {
24,
},
};

@ -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)

@ -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)

@ -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();
}

@ -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);

@ -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[] = {

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

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

@ -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.

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

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

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

@ -1122,4 +1122,3 @@ void InitializeLanguagePacks(void)
if (!ReadLanguagePack(def))
error("can't read language pack '%s'", dl->ent[def].file);
}

@ -478,5 +478,3 @@ static const AiDefaultBlockData * const _airport_default_block_data[] = {
_airportdata_ai_1, // country airport
NULL
};

@ -773,5 +773,3 @@ static const uint32 * const _bridge_poles_table[] = {
_bridge_sprite_table_11_poles,
_bridge_sprite_table_12_poles
};

@ -60,4 +60,3 @@ static const SpriteID _clear_land_sprites_3[8] = {
0x11B3,
0x11C6,
};

@ -165,4 +165,3 @@ static const SpriteID _slopes_spriteindexes_3[] = {
SPR_SLOPES_BASE, SPR_SLOPES_BASE+73,
0xffff,
};

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

@ -62,4 +62,3 @@ static const DrawTrackSeqStruct* const _track_depot_layout_table[] = {
_track_waypoint_table_0,
_track_waypoint_table_1,
};

@ -221,4 +221,3 @@ static const PalSpriteID _tree_layout_sprite[164+(79-48+1)][4] = {
};
#endif /* TREE_LAND_H */

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

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

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

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

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

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

@ -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);

@ -744,4 +744,3 @@ const TileTypeProcs _tile_type_water_procs = {
NULL, /* vehicle_leave_tile_proc */
GetSlopeTileh_Water, /* get_slope_tileh_proc */
};

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

Loading…
Cancel
Save