mirror of https://github.com/OpenTTD/OpenTTD
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
- change a lot of byte player types to PlayerID - beautify header files, same "#endif /* filename */" endingrelease/0.4.5
parent
3097ee2429
commit
8e6a911700
|
@ -700,7 +700,7 @@ static void DrawAircraftDepotWindow(Window *w)
|
|||
}
|
||||
}
|
||||
|
||||
static int GetVehicleFromAircraftDepotWndPt(Window *w, int x, int y, Vehicle **veh) {
|
||||
static int GetVehicleFromAircraftDepotWndPt(const Window *w, int x, int y, Vehicle **veh) {
|
||||
uint xt,row,xm,ym;
|
||||
Vehicle *v;
|
||||
TileIndex tile;
|
||||
|
@ -951,7 +951,7 @@ void ShowAircraftDepotWindow(TileIndex tile)
|
|||
}
|
||||
}
|
||||
|
||||
static void DrawSmallOrderList(Vehicle *v, int x, int y) {
|
||||
static void DrawSmallOrderList(const Vehicle *v, int x, int y) {
|
||||
const Order *order;
|
||||
int sel, i = 0;
|
||||
|
||||
|
|
2
aystar.h
2
aystar.h
|
@ -182,4 +182,4 @@ void AyStarMain_Clear(AyStar *aystar);
|
|||
void init_AyStar(AyStar* aystar, Hash_HashProc hash, uint num_buckets);
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* AYSTAR_H */
|
||||
|
|
|
@ -8,4 +8,4 @@
|
|||
extern CommandCallback *_callback_table[];
|
||||
extern const int _callback_table_count;
|
||||
|
||||
#endif
|
||||
#endif /* CALLBACK_TABLE_H */
|
||||
|
|
|
@ -483,12 +483,12 @@ int32 CmdSellLandArea(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|||
#include "table/clear_land.h"
|
||||
|
||||
|
||||
void DrawClearLandTile(TileInfo *ti, byte set)
|
||||
void DrawClearLandTile(const TileInfo *ti, byte set)
|
||||
{
|
||||
DrawGroundSprite(0xF54 + _tileh_to_sprite[ti->tileh] + set * 19);
|
||||
}
|
||||
|
||||
void DrawHillyLandTile(TileInfo *ti)
|
||||
void DrawHillyLandTile(const TileInfo *ti)
|
||||
{
|
||||
if (ti->tileh != 0) {
|
||||
DrawGroundSprite(0xFA0 + _tileh_to_sprite[ti->tileh]);
|
||||
|
@ -553,7 +553,7 @@ static uint GetSlopeZ_Clear(TileInfo *ti)
|
|||
return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z;
|
||||
}
|
||||
|
||||
static uint GetSlopeTileh_Clear(TileInfo *ti)
|
||||
static uint GetSlopeTileh_Clear(const TileInfo *ti)
|
||||
{
|
||||
return ti->tileh;
|
||||
}
|
||||
|
@ -831,7 +831,7 @@ static void GetTileDesc_Clear(TileIndex tile, TileDesc *td)
|
|||
td->owner = GetTileOwner(tile);
|
||||
}
|
||||
|
||||
static void ChangeTileOwner_Clear(TileIndex tile, byte old_player, byte new_player)
|
||||
static void ChangeTileOwner_Clear(TileIndex tile, PlayerID old_player, PlayerID new_player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -26,4 +26,4 @@ uint GetMaskOfAllowedCurrencies(void);
|
|||
uint GetCurrentCurrencyRate(void);
|
||||
void CheckSwitchToEuro(void);
|
||||
|
||||
#endif
|
||||
#endif /* CURRENCY_H */
|
||||
|
|
2
debug.h
2
debug.h
|
@ -34,4 +34,4 @@ const char *GetDebugString(void);
|
|||
void gpmi_debug_openttd(int level, char *s);
|
||||
#endif /* GPMI */
|
||||
|
||||
#endif
|
||||
#endif /* DEBUG_H */
|
||||
|
|
2
driver.h
2
driver.h
|
@ -10,4 +10,4 @@ int GetDriverParamInt(const char* const* parm, const char* name, int def);
|
|||
|
||||
void GetDriverList(char* p);
|
||||
|
||||
#endif
|
||||
#endif /* DRIVER_H */
|
||||
|
|
|
@ -17,7 +17,7 @@ static uint GetSlopeZ_Dummy(TileInfo *ti) {
|
|||
return GetPartialZ(ti->x&0xF, ti->y&0xF, ti->tileh) + ti->z;
|
||||
}
|
||||
|
||||
static uint GetSlopeTileh_Dummy(TileInfo *ti) {
|
||||
static uint GetSlopeTileh_Dummy(const TileInfo *ti) {
|
||||
return ti->tileh;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ static void ClickTile_Dummy(TileIndex tile)
|
|||
/* not used */
|
||||
}
|
||||
|
||||
static void ChangeTileOwner_Dummy(TileIndex tile, byte old_player, byte new_player)
|
||||
static void ChangeTileOwner_Dummy(TileIndex tile, PlayerID old_player, PlayerID new_player)
|
||||
{
|
||||
/* not used */
|
||||
}
|
||||
|
|
|
@ -555,11 +555,11 @@ void DrawNewsBankrupcy(Window *w)
|
|||
}
|
||||
}
|
||||
|
||||
StringID GetNewsStringBankrupcy(NewsItem *ni)
|
||||
StringID GetNewsStringBankrupcy(const NewsItem *ni)
|
||||
{
|
||||
Player *p = GetPlayer(ni->string_id & 0xF);
|
||||
const Player *p = GetPlayer(ni->string_id & 0xF);
|
||||
|
||||
switch(ni->string_id >> 4) {
|
||||
switch (ni->string_id >> 4) {
|
||||
case 1:
|
||||
SetDParam(0, STR_7056_TRANSPORT_COMPANY_IN_TROUBLE);
|
||||
SetDParam(1, STR_7057_WILL_BE_SOLD_OFF_OR_DECLARED);
|
||||
|
|
2
engine.h
2
engine.h
|
@ -271,4 +271,4 @@ static inline RoadVehicleInfo *RoadVehInfo(uint e)
|
|||
return &_road_vehicle_info[e - ROAD_ENGINES_INDEX];
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* ENGINE_H */
|
||||
|
|
|
@ -165,7 +165,7 @@ void DrawNewsNewTrainAvail(Window *w)
|
|||
DrawTrainEngineInfo(engine, w->width >> 1, 129, w->width - 52);
|
||||
}
|
||||
|
||||
StringID GetNewsStringNewTrainAvail(NewsItem *ni)
|
||||
StringID GetNewsStringNewTrainAvail(const NewsItem *ni)
|
||||
{
|
||||
int engine = ni->string_id;
|
||||
SetDParam(0, STR_8859_NEW_NOW_AVAILABLE);
|
||||
|
@ -205,7 +205,7 @@ void DrawNewsNewAircraftAvail(Window *w)
|
|||
DrawAircraftEngineInfo(engine, w->width >> 1, 131, w->width - 52);
|
||||
}
|
||||
|
||||
StringID GetNewsStringNewAircraftAvail(NewsItem *ni)
|
||||
StringID GetNewsStringNewAircraftAvail(const NewsItem *ni)
|
||||
{
|
||||
int engine = ni->string_id;
|
||||
SetDParam(0, STR_A02C_NEW_AIRCRAFT_NOW_AVAILABLE);
|
||||
|
@ -245,7 +245,7 @@ void DrawNewsNewRoadVehAvail(Window *w)
|
|||
DrawRoadVehEngineInfo(engine, w->width >> 1, 129, w->width - 52);
|
||||
}
|
||||
|
||||
StringID GetNewsStringNewRoadVehAvail(NewsItem *ni)
|
||||
StringID GetNewsStringNewRoadVehAvail(const NewsItem *ni)
|
||||
{
|
||||
int engine = ni->string_id;
|
||||
SetDParam(0, STR_9028_NEW_ROAD_VEHICLE_NOW_AVAILABLE);
|
||||
|
@ -283,7 +283,7 @@ void DrawNewsNewShipAvail(Window *w)
|
|||
DrawShipEngineInfo(engine, w->width >> 1, 131, w->width - 52);
|
||||
}
|
||||
|
||||
StringID GetNewsStringNewShipAvail(NewsItem *ni)
|
||||
StringID GetNewsStringNewShipAvail(const NewsItem *ni)
|
||||
{
|
||||
int engine = ni->string_id;
|
||||
SetDParam(0, STR_982C_NEW_SHIP_NOW_AVAILABLE);
|
||||
|
|
12
functions.h
12
functions.h
|
@ -50,8 +50,8 @@ static inline Point RemapCoords2(int x, int y)
|
|||
|
||||
|
||||
/* clear_land.c */
|
||||
void DrawHillyLandTile(TileInfo *ti);
|
||||
void DrawClearLandTile(TileInfo *ti, byte set);
|
||||
void DrawHillyLandTile(const TileInfo *ti);
|
||||
void DrawClearLandTile(const TileInfo *ti, byte set);
|
||||
void DrawClearLandFence(const TileInfo *ti);
|
||||
void TileLoopClearHelper(TileIndex tile);
|
||||
|
||||
|
@ -72,10 +72,10 @@ void TileLoop_Water(TileIndex tile);
|
|||
/* players.c */
|
||||
bool CheckPlayerHasMoney(int32 cost);
|
||||
void SubtractMoneyFromPlayer(int32 cost);
|
||||
void SubtractMoneyFromPlayerFract(byte player, int32 cost);
|
||||
bool CheckOwnership(byte owner);
|
||||
void SubtractMoneyFromPlayerFract(PlayerID player, int32 cost);
|
||||
bool CheckOwnership(PlayerID owner);
|
||||
bool CheckTileOwnership(TileIndex tile);
|
||||
StringID GetPlayerNameString(byte player, byte index);
|
||||
StringID GetPlayerNameString(PlayerID player, PlayerID index);
|
||||
|
||||
/* standard */
|
||||
void ShowInfo(const char *str);
|
||||
|
@ -229,7 +229,7 @@ Town *ClosestTownFromTile(TileIndex tile, uint threshold);
|
|||
void ChangeTownRating(Town *t, int add, int max);
|
||||
|
||||
uint GetRoadBitsByTile(TileIndex tile);
|
||||
int GetTownRadiusGroup(Town *t, TileIndex tile);
|
||||
int GetTownRadiusGroup(const Town *t, TileIndex tile);
|
||||
void ShowNetworkChatQueryWindow(byte desttype, byte dest);
|
||||
void ShowNetworkGiveMoneyWindow(byte player);
|
||||
void ShowNetworkNeedGamePassword(void);
|
||||
|
|
2
gfx.c
2
gfx.c
|
@ -1991,7 +1991,7 @@ void SortResolutions(int count)
|
|||
qsort(_resolutions, count, sizeof(_resolutions[0]), compare_res);
|
||||
}
|
||||
|
||||
uint16 GetDrawStringPlayerColor(byte player)
|
||||
uint16 GetDrawStringPlayerColor(PlayerID player)
|
||||
{
|
||||
// Get the color for DrawString-subroutines which matches the color
|
||||
// of the player
|
||||
|
|
4
gfx.h
4
gfx.h
|
@ -64,7 +64,7 @@ void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, u
|
|||
void GfxFillRect(int left, int top, int right, int bottom, int color);
|
||||
void GfxDrawLine(int left, int top, int right, int bottom, int color);
|
||||
void DrawFrameRect(int left, int top, int right, int bottom, int color, int flags);
|
||||
uint16 GetDrawStringPlayerColor(byte player);
|
||||
uint16 GetDrawStringPlayerColor(PlayerID player);
|
||||
|
||||
int GetStringWidth(const char *str);
|
||||
void LoadStringWidthTable(void);
|
||||
|
@ -124,4 +124,4 @@ typedef enum StringColorFlags {
|
|||
IS_PALETTE_COLOR = 0x100, // color value is already a real palette color index, not an index of a StringColor
|
||||
} StringColorFlags;
|
||||
|
||||
#endif
|
||||
#endif /* GFX_H */
|
||||
|
|
|
@ -44,7 +44,7 @@ typedef struct GraphDrawer {
|
|||
|
||||
#define INVALID_VALUE 0x80000000
|
||||
|
||||
static void DrawGraph(GraphDrawer *gw)
|
||||
static void DrawGraph(const GraphDrawer *gw)
|
||||
{
|
||||
|
||||
int i,j,k;
|
||||
|
@ -52,7 +52,7 @@ static void DrawGraph(GraphDrawer *gw)
|
|||
int color;
|
||||
int right, bottom;
|
||||
int num_x, num_dataset;
|
||||
uint64 *row_ptr, *col_ptr;
|
||||
const uint64 *row_ptr, *col_ptr;
|
||||
int64 mx;
|
||||
int adj_height;
|
||||
uint64 y_scaling, tmp;
|
||||
|
|
|
@ -107,4 +107,4 @@ enum {
|
|||
IT_SUGAR_MINE = 36,
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif /* INDUSTRY_H */
|
||||
|
|
|
@ -255,7 +255,7 @@ static const StringID _industry_close_strings[] = {
|
|||
};
|
||||
|
||||
|
||||
static void IndustryDrawTileProc1(TileInfo *ti)
|
||||
static void IndustryDrawTileProc1(const TileInfo *ti)
|
||||
{
|
||||
const DrawIndustrySpec1Struct *d;
|
||||
uint32 image;
|
||||
|
@ -275,7 +275,7 @@ static void IndustryDrawTileProc1(TileInfo *ti)
|
|||
_drawtile_proc1_x[image-1], _drawtile_proc1_y[image-1]);
|
||||
}
|
||||
|
||||
static void IndustryDrawTileProc2(TileInfo *ti)
|
||||
static void IndustryDrawTileProc2(const TileInfo *ti)
|
||||
{
|
||||
int x = 0;
|
||||
|
||||
|
@ -289,7 +289,7 @@ static void IndustryDrawTileProc2(TileInfo *ti)
|
|||
AddChildSpriteScreen(0x129E, 6, 0xE);
|
||||
}
|
||||
|
||||
static void IndustryDrawTileProc3(TileInfo *ti)
|
||||
static void IndustryDrawTileProc3(const TileInfo *ti)
|
||||
{
|
||||
if (_m[ti->tile].m1 & 0x80) {
|
||||
AddChildSpriteScreen(0x128B, 5,
|
||||
|
@ -298,7 +298,7 @@ static void IndustryDrawTileProc3(TileInfo *ti)
|
|||
AddChildSpriteScreen(4746, 3, 67);
|
||||
}
|
||||
|
||||
static void IndustryDrawTileProc4(TileInfo *ti)
|
||||
static void IndustryDrawTileProc4(const TileInfo *ti)
|
||||
{
|
||||
const DrawIndustrySpec4Struct *d;
|
||||
|
||||
|
@ -316,7 +316,7 @@ static void IndustryDrawTileProc4(TileInfo *ti)
|
|||
AddChildSpriteScreen(0x126D, 0, 42);
|
||||
}
|
||||
|
||||
static void DrawCoalPlantSparkles(TileInfo *ti)
|
||||
static void DrawCoalPlantSparkles(const TileInfo *ti)
|
||||
{
|
||||
int image = _m[ti->tile].m1;
|
||||
if (image & 0x80) {
|
||||
|
@ -330,7 +330,7 @@ static void DrawCoalPlantSparkles(TileInfo *ti)
|
|||
}
|
||||
}
|
||||
|
||||
typedef void IndustryDrawTileProc(TileInfo *ti);
|
||||
typedef void IndustryDrawTileProc(const TileInfo *ti);
|
||||
static IndustryDrawTileProc * const _industry_draw_tile_procs[5] = {
|
||||
IndustryDrawTileProc1,
|
||||
IndustryDrawTileProc2,
|
||||
|
@ -402,7 +402,7 @@ static uint GetSlopeZ_Industry(TileInfo *ti) {
|
|||
return GetPartialZ(ti->x&0xF, ti->y&0xF, ti->tileh) + ti->z;
|
||||
}
|
||||
|
||||
static uint GetSlopeTileh_Industry(TileInfo *ti) {
|
||||
static uint GetSlopeTileh_Industry(const TileInfo *ti) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -866,7 +866,7 @@ static void GetProducedCargo_Industry(TileIndex tile, byte *b)
|
|||
b[1] = i->produced_cargo[1];
|
||||
}
|
||||
|
||||
static void ChangeTileOwner_Industry(TileIndex tile, byte old_player, byte new_player)
|
||||
static void ChangeTileOwner_Industry(TileIndex tile, PlayerID old_player, PlayerID new_player)
|
||||
{
|
||||
/* not used */
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef __LZOCONF_H
|
||||
#define __LZOCONF_H
|
||||
#ifndef LZOCONF_H
|
||||
#define LZOCONF_H
|
||||
|
||||
#define LZO_VERSION 0x1080
|
||||
#define LZO_VERSION_STRING "1.08"
|
||||
|
@ -449,5 +449,5 @@ LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size);
|
|||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* already included */
|
||||
#endif /* LZOCONF_H */
|
||||
|
||||
|
|
|
@ -2170,7 +2170,7 @@ static const WindowDesc _toolb_scen_desc = {
|
|||
extern GetNewsStringCallbackProc * const _get_news_string_callback[];
|
||||
|
||||
|
||||
static bool DrawScrollingStatusText(NewsItem *ni, int pos)
|
||||
static bool DrawScrollingStatusText(const NewsItem *ni, int pos)
|
||||
{
|
||||
char buf[512];
|
||||
StringID str;
|
||||
|
|
2
map.h
2
map.h
|
@ -177,4 +177,4 @@ static inline TileIndexDiff TileOffsByDir(uint dir)
|
|||
* This value should be sqrt(2)/2 ~ 0.7071 */
|
||||
#define STRAIGHT_TRACK_LENGTH 7071/10000
|
||||
|
||||
#endif
|
||||
#endif /* MAP_H */
|
||||
|
|
6
md5.h
6
md5.h
|
@ -49,8 +49,8 @@
|
|||
1999-05-03 lpd Original version.
|
||||
*/
|
||||
|
||||
#ifndef md5_INCLUDED
|
||||
# define md5_INCLUDED
|
||||
#ifndef MD5_INCLUDED
|
||||
#define MD5_INCLUDED
|
||||
|
||||
/*
|
||||
* This package supports both compile-time and run-time determination of CPU
|
||||
|
@ -90,4 +90,4 @@ void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
|
|||
} /* end extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* md5_INCLUDED */
|
||||
#endif /* MD5_INCLUDED */
|
||||
|
|
|
@ -40,8 +40,8 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef __MINILZO_H
|
||||
#define __MINILZO_H
|
||||
#ifndef MINILZO_H
|
||||
#define MINILZO_H
|
||||
|
||||
#define MINILZO_VERSION 0x1080
|
||||
|
||||
|
@ -98,5 +98,5 @@ lzo1x_decompress_safe ( const lzo_byte *src, lzo_uint src_len,
|
|||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* already included */
|
||||
#endif /* MINILZO_H */
|
||||
|
||||
|
|
2
mixer.h
2
mixer.h
|
@ -23,4 +23,4 @@ void MxSetChannelRawSrc(MixerChannel *mc, int8 *mem, uint size, uint rate, uint
|
|||
void MxSetChannelVolume(MixerChannel *mc, uint left, uint right);
|
||||
void MxActivateChannel(MixerChannel*);
|
||||
|
||||
#endif
|
||||
#endif /* MIXER_H */
|
||||
|
|
|
@ -7,4 +7,4 @@ typedef byte TownNameGenerator(char *buf, uint32 seed);
|
|||
|
||||
extern TownNameGenerator * const _town_name_generators[];
|
||||
|
||||
#endif
|
||||
#endif /* NAMEGEN_H */
|
||||
|
|
|
@ -22,4 +22,4 @@ void NetworkClient_Connected(void);
|
|||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif // NETWORK_CLIENT_H
|
||||
#endif /* NETWORK_CLIENT_H */
|
||||
|
|
|
@ -231,4 +231,4 @@ unsigned long NetworkResolveHost(const char *hostname);
|
|||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif // NETWORK_DATA_H
|
||||
#endif /* NETWORK_DATA_H */
|
||||
|
|
|
@ -22,4 +22,4 @@ void NetworkServerYearlyLoop(void);
|
|||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif // NETWORK_SERVER_H
|
||||
#endif /* NETWORK_SERVER_H */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* $Id$ */
|
||||
|
||||
#ifndef NETWORK_LAN_H
|
||||
#define NETWORK_LAN_H
|
||||
#ifndef NETWORK_UDP_H
|
||||
#define NETWORK_UDP_H
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
|
@ -16,4 +16,4 @@ void NetworkUDPRemoveAdvertise(void);
|
|||
|
||||
#endif
|
||||
|
||||
#endif /* NETWORK_LAN_H */
|
||||
#endif /* NETWORK_UDP_H */
|
||||
|
|
2
npf.h
2
npf.h
|
@ -121,4 +121,4 @@ static inline void NPFSetFlag(AyStarNode* node, NPFNodeFlag flag, bool value)
|
|||
CLRBIT(node->user_data[NPF_NODE_FLAGS], flag);
|
||||
}
|
||||
|
||||
#endif // NPF_H
|
||||
#endif /* NPF_H */
|
||||
|
|
|
@ -319,14 +319,14 @@ typedef void GetProducedCargoProc(TileIndex tile, byte *b);
|
|||
typedef void ClickTileProc(TileIndex tile);
|
||||
typedef void AnimateTileProc(TileIndex tile);
|
||||
typedef void TileLoopProc(TileIndex tile);
|
||||
typedef void ChangeTileOwnerProc(TileIndex tile, byte old_player, byte new_player);
|
||||
typedef void ChangeTileOwnerProc(TileIndex tile, PlayerID old_player, PlayerID new_player);
|
||||
/* Return value has bit 0x2 set, when the vehicle enters a station. Then,
|
||||
* result << 8 contains the id of the station entered. If the return value has
|
||||
* bit 0x8 set, the vehicle could not and did not enter the tile. Are there
|
||||
* other bits that can be set? */
|
||||
typedef uint32 VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y);
|
||||
typedef void VehicleLeaveTileProc(Vehicle *v, TileIndex tile, int x, int y);
|
||||
typedef uint GetSlopeTilehProc(TileInfo *ti);
|
||||
typedef uint GetSlopeTilehProc(const TileInfo *ti);
|
||||
|
||||
typedef struct {
|
||||
DrawTileProc *draw_tile_proc;
|
||||
|
|
|
@ -186,7 +186,7 @@ static void DrawOrdersWindow(Window *w)
|
|||
}
|
||||
}
|
||||
|
||||
static Order GetOrderCmdFromTile(Vehicle *v, TileIndex tile)
|
||||
static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
||||
{
|
||||
Order order;
|
||||
Station *st;
|
||||
|
|
2
pbs.h
2
pbs.h
|
@ -83,4 +83,4 @@ bool PBSIsPbsSegment(uint tile, Trackdir trackdir);
|
|||
* @return True when the depot is inside a pbs block
|
||||
*/
|
||||
|
||||
#endif
|
||||
#endif /* PBS_H */
|
||||
|
|
14
player.h
14
player.h
|
@ -169,7 +169,7 @@ typedef struct Player {
|
|||
TileIndex location_of_house;
|
||||
TileIndex last_build_coordinate;
|
||||
|
||||
byte share_owners[4];
|
||||
PlayerID share_owners[4];
|
||||
|
||||
byte inaugurated_year;
|
||||
byte num_valid_stat_ent;
|
||||
|
@ -193,8 +193,8 @@ typedef struct Player {
|
|||
uint32 engine_renew_money;
|
||||
} Player;
|
||||
|
||||
void ChangeOwnershipOfPlayerItems(byte old_player, byte new_player);
|
||||
void GetNameOfOwner(byte owner, TileIndex tile);
|
||||
void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player);
|
||||
void GetNameOfOwner(PlayerID owner, TileIndex tile);
|
||||
int64 CalculateCompanyValue(Player *p);
|
||||
void InvalidatePlayerWindows(Player *p);
|
||||
void AiDoGameLoop(Player *p);
|
||||
|
@ -209,7 +209,7 @@ VARDEF Player _players[MAX_PLAYERS];
|
|||
// NOSAVE: can be determined from player structs
|
||||
VARDEF byte _player_colors[MAX_PLAYERS];
|
||||
|
||||
static inline Player* GetPlayer(uint i)
|
||||
static inline Player* GetPlayer(PlayerID i)
|
||||
{
|
||||
assert(i < lengthof(_players));
|
||||
return &_players[i];
|
||||
|
@ -223,7 +223,7 @@ static inline bool IsLocalPlayer(void)
|
|||
/** Returns the number of rail types the player can build
|
||||
* @param *p Player in question
|
||||
*/
|
||||
static inline int GetNumRailtypes(Player *p)
|
||||
static inline int GetNumRailtypes(const Player *p)
|
||||
{
|
||||
int num = 0;
|
||||
int i;
|
||||
|
@ -239,7 +239,7 @@ byte GetPlayerRailtypes(int p);
|
|||
|
||||
/** Finds out if a Player has a certain railtype available
|
||||
*/
|
||||
static inline bool HasRailtypeAvail(Player *p, RailType Railtype)
|
||||
static inline bool HasRailtypeAvail(const Player *p, RailType Railtype)
|
||||
{
|
||||
return HASBIT(p->avail_railtypes, Railtype);
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ static inline bool ValParamRailtype(uint32 rail) { return HASBIT(GetPlayer(_curr
|
|||
* @param p the player "in action"
|
||||
* @return The "best" railtype a player has available
|
||||
*/
|
||||
static inline byte GetBestRailtype(Player *p)
|
||||
static inline byte GetBestRailtype(const Player *p)
|
||||
{
|
||||
if (HasRailtypeAvail(p, RAILTYPE_MAGLEV)) return RAILTYPE_MAGLEV;
|
||||
if (HasRailtypeAvail(p, RAILTYPE_MONO)) return RAILTYPE_MONO;
|
||||
|
|
11
player_gui.c
11
player_gui.c
|
@ -24,10 +24,11 @@
|
|||
static void DoShowPlayerFinances(int player, bool show_small, bool show_stickied);
|
||||
|
||||
|
||||
static void DrawPlayerEconomyStats(Player *p, byte mode)
|
||||
static void DrawPlayerEconomyStats(const Player *p, byte mode)
|
||||
{
|
||||
int x,y,i,j,year;
|
||||
int64 (*tbl)[13], sum,cost;
|
||||
const int64 (*tbl)[13];
|
||||
int64 sum, cost;
|
||||
StringID str;
|
||||
|
||||
if (!(mode & 1)) { // normal sized economics window (mode&1) is minimized status
|
||||
|
@ -415,7 +416,7 @@ static const Widget _my_player_company_bh_widgets[] = {
|
|||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static void DrawPlayerVehiclesAmount(int player)
|
||||
static void DrawPlayerVehiclesAmount(PlayerID player)
|
||||
{
|
||||
const int x = 110;
|
||||
int y = 72;
|
||||
|
@ -470,7 +471,7 @@ static void DrawPlayerVehiclesAmount(int player)
|
|||
}
|
||||
}
|
||||
|
||||
int GetAmountOwnedBy(Player *p, byte owner)
|
||||
int GetAmountOwnedBy(const Player *p, PlayerID owner)
|
||||
{
|
||||
return (p->share_owners[0] == owner) +
|
||||
(p->share_owners[1] == owner) +
|
||||
|
@ -478,7 +479,7 @@ int GetAmountOwnedBy(Player *p, byte owner)
|
|||
(p->share_owners[3] == owner);
|
||||
}
|
||||
|
||||
static void DrawCompanyOwnerText(Player *p)
|
||||
static void DrawCompanyOwnerText(const Player *p)
|
||||
{
|
||||
int num = -1;
|
||||
Player *p2;
|
||||
|
|
|
@ -228,7 +228,7 @@ void SubtractMoneyFromPlayer(int32 cost)
|
|||
SubtractMoneyFromAnyPlayer(GetPlayer(pid), cost);
|
||||
}
|
||||
|
||||
void SubtractMoneyFromPlayerFract(byte player, int32 cost)
|
||||
void SubtractMoneyFromPlayerFract(PlayerID player, int32 cost)
|
||||
{
|
||||
Player *p = GetPlayer(player);
|
||||
byte m = p->player_money_fraction;
|
||||
|
@ -251,7 +251,7 @@ void UpdatePlayerMoney32(Player *p)
|
|||
p->player_money = (int32)p->money64;
|
||||
}
|
||||
|
||||
void GetNameOfOwner(byte owner, TileIndex tile)
|
||||
void GetNameOfOwner(PlayerID owner, TileIndex tile)
|
||||
{
|
||||
SetDParam(2, owner);
|
||||
|
||||
|
@ -271,7 +271,7 @@ void GetNameOfOwner(byte owner, TileIndex tile)
|
|||
}
|
||||
|
||||
|
||||
bool CheckOwnership(byte owner)
|
||||
bool CheckOwnership(PlayerID owner)
|
||||
{
|
||||
assert(owner <= OWNER_WATER);
|
||||
|
||||
|
@ -568,7 +568,7 @@ void OnTick_Players(void)
|
|||
}
|
||||
|
||||
// index is the next parameter in _decode_parameters to set up
|
||||
StringID GetPlayerNameString(byte player, byte index)
|
||||
StringID GetPlayerNameString(PlayerID player, PlayerID index)
|
||||
{
|
||||
if (IS_HUMAN_PLAYER(player) && player < MAX_PLAYERS) {
|
||||
SetDParam(index, player+1);
|
||||
|
|
2
pool.h
2
pool.h
|
@ -46,7 +46,7 @@ bool AddBlockToPool(MemoryPool *array);
|
|||
*/
|
||||
bool AddBlockIfNeeded(MemoryPool *array, uint index);
|
||||
|
||||
static inline byte *GetItemFromPool(MemoryPool *pool, uint index)
|
||||
static inline byte *GetItemFromPool(const MemoryPool *pool, uint index)
|
||||
{
|
||||
assert(index < pool->total_items);
|
||||
return (pool->blocks[index >> pool->block_size_bits] + (index & ((1 << pool->block_size_bits) - 1)) * pool->item_size);
|
||||
|
|
2
rail.h
2
rail.h
|
@ -576,4 +576,4 @@ static inline bool IsCompatibleRail(RailType enginetype, RailType tiletype)
|
|||
return HASBIT(GetRailTypeInfo(enginetype)->compatible_railtypes, tiletype);
|
||||
}
|
||||
|
||||
#endif // RAIL_H
|
||||
#endif /* RAIL_H */
|
||||
|
|
30
rail_cmd.c
30
rail_cmd.c
|
@ -1209,7 +1209,7 @@ static const byte _signal_position[24] = {
|
|||
0x1E,0xAC,0x64,0xE1,0x4A,0x10,0xEE,0xC5,0xDB,0x34,0x4D,0xB3
|
||||
};
|
||||
|
||||
static void DrawSignalHelper(TileInfo *ti, byte condition, uint32 image_and_pos)
|
||||
static void DrawSignalHelper(const TileInfo *ti, byte condition, uint32 image_and_pos)
|
||||
{
|
||||
bool otherside = _opt.road_side & _patches.signal_side;
|
||||
|
||||
|
@ -1223,7 +1223,7 @@ static void DrawSignalHelper(TileInfo *ti, byte condition, uint32 image_and_pos)
|
|||
static uint32 _drawtile_track_palette;
|
||||
|
||||
|
||||
static void DrawTrackFence_NW(TileInfo *ti)
|
||||
static void DrawTrackFence_NW(const TileInfo *ti)
|
||||
{
|
||||
uint32 image = 0x515;
|
||||
if (ti->tileh != 0) {
|
||||
|
@ -1236,7 +1236,7 @@ static void DrawTrackFence_NW(TileInfo *ti)
|
|||
ti->x, ti->y+1, 16, 1, 4, ti->z);
|
||||
}
|
||||
|
||||
static void DrawTrackFence_SE(TileInfo *ti)
|
||||
static void DrawTrackFence_SE(const TileInfo *ti)
|
||||
{
|
||||
uint32 image = 0x515;
|
||||
if (ti->tileh != 0) {
|
||||
|
@ -1249,13 +1249,13 @@ static void DrawTrackFence_SE(TileInfo *ti)
|
|||
ti->x, ti->y+15, 16, 1, 4, ti->z);
|
||||
}
|
||||
|
||||
static void DrawTrackFence_NW_SE(TileInfo *ti)
|
||||
static void DrawTrackFence_NW_SE(const TileInfo *ti)
|
||||
{
|
||||
DrawTrackFence_NW(ti);
|
||||
DrawTrackFence_SE(ti);
|
||||
}
|
||||
|
||||
static void DrawTrackFence_NE(TileInfo *ti)
|
||||
static void DrawTrackFence_NE(const TileInfo *ti)
|
||||
{
|
||||
uint32 image = 0x516;
|
||||
if (ti->tileh != 0) {
|
||||
|
@ -1268,7 +1268,7 @@ static void DrawTrackFence_NE(TileInfo *ti)
|
|||
ti->x+1, ti->y, 1, 16, 4, ti->z);
|
||||
}
|
||||
|
||||
static void DrawTrackFence_SW(TileInfo *ti)
|
||||
static void DrawTrackFence_SW(const TileInfo *ti)
|
||||
{
|
||||
uint32 image = 0x516;
|
||||
if (ti->tileh != 0) {
|
||||
|
@ -1281,13 +1281,13 @@ static void DrawTrackFence_SW(TileInfo *ti)
|
|||
ti->x+15, ti->y, 1, 16, 4, ti->z);
|
||||
}
|
||||
|
||||
static void DrawTrackFence_NE_SW(TileInfo *ti)
|
||||
static void DrawTrackFence_NE_SW(const TileInfo *ti)
|
||||
{
|
||||
DrawTrackFence_NE(ti);
|
||||
DrawTrackFence_SW(ti);
|
||||
}
|
||||
|
||||
static void DrawTrackFence_NS_1(TileInfo *ti)
|
||||
static void DrawTrackFence_NS_1(const TileInfo *ti)
|
||||
{
|
||||
int z = ti->z;
|
||||
if (ti->tileh & 1)
|
||||
|
@ -1296,7 +1296,7 @@ static void DrawTrackFence_NS_1(TileInfo *ti)
|
|||
ti->x + 8, ti->y + 8, 1, 1, 4, z);
|
||||
}
|
||||
|
||||
static void DrawTrackFence_NS_2(TileInfo *ti)
|
||||
static void DrawTrackFence_NS_2(const TileInfo *ti)
|
||||
{
|
||||
int z = ti->z;
|
||||
if (ti->tileh & 4)
|
||||
|
@ -1305,7 +1305,7 @@ static void DrawTrackFence_NS_2(TileInfo *ti)
|
|||
ti->x + 8, ti->y + 8, 1, 1, 4, z);
|
||||
}
|
||||
|
||||
static void DrawTrackFence_WE_1(TileInfo *ti)
|
||||
static void DrawTrackFence_WE_1(const TileInfo *ti)
|
||||
{
|
||||
int z = ti->z;
|
||||
if (ti->tileh & 8)
|
||||
|
@ -1314,7 +1314,7 @@ static void DrawTrackFence_WE_1(TileInfo *ti)
|
|||
ti->x + 8, ti->y + 8, 1, 1, 4, z);
|
||||
}
|
||||
|
||||
static void DrawTrackFence_WE_2(TileInfo *ti)
|
||||
static void DrawTrackFence_WE_2(const TileInfo *ti)
|
||||
{
|
||||
int z = ti->z;
|
||||
if (ti->tileh & 2)
|
||||
|
@ -1323,12 +1323,12 @@ static void DrawTrackFence_WE_2(TileInfo *ti)
|
|||
ti->x + 8, ti->y + 8, 1, 1, 4, z);
|
||||
}
|
||||
|
||||
static void DetTrackDrawProc_Null(TileInfo *ti)
|
||||
static void DetTrackDrawProc_Null(const TileInfo *ti)
|
||||
{
|
||||
/* nothing should be here */
|
||||
}
|
||||
|
||||
typedef void DetailedTrackProc(TileInfo *ti);
|
||||
typedef void DetailedTrackProc(const TileInfo *ti);
|
||||
DetailedTrackProc * const _detailed_track_proc[16] = {
|
||||
DetTrackDrawProc_Null,
|
||||
DetTrackDrawProc_Null,
|
||||
|
@ -1943,7 +1943,7 @@ static uint GetSlopeZ_Track(TileInfo *ti)
|
|||
return z;
|
||||
}
|
||||
|
||||
static uint GetSlopeTileh_Track(TileInfo *ti)
|
||||
static uint GetSlopeTileh_Track(const TileInfo *ti)
|
||||
{
|
||||
// check if it's a foundation
|
||||
if (ti->tileh != 0) {
|
||||
|
@ -2146,7 +2146,7 @@ static void GetTileDesc_Track(TileIndex tile, TileDesc *td)
|
|||
}
|
||||
}
|
||||
|
||||
static void ChangeTileOwner_Track(TileIndex tile, byte old_player, byte new_player)
|
||||
static void ChangeTileOwner_Track(TileIndex tile, PlayerID old_player, PlayerID new_player)
|
||||
{
|
||||
if (!IsTileOwner(tile, old_player)) return;
|
||||
|
||||
|
|
|
@ -936,7 +936,7 @@ static uint GetSlopeZ_Road(TileInfo *ti)
|
|||
return z; // normal Z if no slope
|
||||
}
|
||||
|
||||
static uint GetSlopeTileh_Road(TileInfo *ti)
|
||||
static uint GetSlopeTileh_Road(const TileInfo *ti)
|
||||
{
|
||||
// check if it's a foundation
|
||||
if (ti->tileh != 0) {
|
||||
|
@ -1166,7 +1166,7 @@ static void VehicleLeave_Road(Vehicle *v, TileIndex tile, int x, int y)
|
|||
}
|
||||
}
|
||||
|
||||
static void ChangeTileOwner_Road(TileIndex tile, byte old_player, byte new_player)
|
||||
static void ChangeTileOwner_Road(TileIndex tile, PlayerID old_player, PlayerID new_player)
|
||||
{
|
||||
byte b;
|
||||
|
||||
|
|
|
@ -597,7 +597,7 @@ static void DrawRoadDepotWindow(Window *w)
|
|||
}
|
||||
}
|
||||
|
||||
static int GetVehicleFromRoadDepotWndPt(Window *w, int x, int y, Vehicle **veh)
|
||||
static int GetVehicleFromRoadDepotWndPt(const Window *w, int x, int y, Vehicle **veh)
|
||||
{
|
||||
uint xt,row,xm;
|
||||
TileIndex tile;
|
||||
|
|
|
@ -15,4 +15,4 @@ extern char _screenshot_format_name[8];
|
|||
extern uint _num_screenshot_formats;
|
||||
extern uint _cur_screenshot_format;
|
||||
|
||||
#endif
|
||||
#endif /* SCREENSHOT_H */
|
||||
|
|
2
sdl.h
2
sdl.h
|
@ -50,4 +50,4 @@ void SdlClose(uint32 x);
|
|||
#define SDL_CALL
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* SDL_H */
|
||||
|
|
|
@ -673,7 +673,7 @@ static void DrawShipDepotWindow(Window *w)
|
|||
}
|
||||
}
|
||||
|
||||
static int GetVehicleFromShipDepotWndPt(Window *w, int x, int y, Vehicle **veh)
|
||||
static int GetVehicleFromShipDepotWndPt(const Window *w, int x, int y, Vehicle **veh)
|
||||
{
|
||||
uint xt,row,xm,ym;
|
||||
TileIndex tile;
|
||||
|
@ -928,7 +928,7 @@ void ShowShipDepotWindow(TileIndex tile)
|
|||
}
|
||||
|
||||
|
||||
static void DrawSmallOrderList(Vehicle *v, int x, int y) {
|
||||
static void DrawSmallOrderList(const Vehicle *v, int x, int y) {
|
||||
const Order *order;
|
||||
int sel, i = 0;
|
||||
|
||||
|
|
2
signs.h
2
signs.h
|
@ -22,7 +22,7 @@ extern MemoryPool _sign_pool;
|
|||
/**
|
||||
* Check if a Sign really exists.
|
||||
*/
|
||||
static inline bool IsValidSign(SignStruct* ss)
|
||||
static inline bool IsValidSign(const SignStruct* ss)
|
||||
{
|
||||
return ss->str != 0;
|
||||
}
|
||||
|
|
2
sprite.h
2
sprite.h
|
@ -153,4 +153,4 @@ SpriteGroup *EvalRandomizedSpriteGroup(const RandomizedSpriteGroup *rsg, byte ra
|
|||
* (then they are |ed to @waiting_triggers instead). */
|
||||
byte RandomizedSpriteGroupTriggeredBits(const RandomizedSpriteGroup *rsg, byte triggers, byte *waiting_triggers);
|
||||
|
||||
#endif
|
||||
#endif /* SPRITE_H */
|
||||
|
|
|
@ -31,4 +31,4 @@ bool LoadNextSprite(int load_index, byte file_index);
|
|||
void DupSprite(SpriteID old, SpriteID new);
|
||||
void SkipSprites(uint count);
|
||||
|
||||
#endif
|
||||
#endif /* SPRITECACHE_H */
|
||||
|
|
|
@ -190,7 +190,7 @@ VARDEF bool _global_station_sort_dirty;
|
|||
|
||||
void GetProductionAroundTiles(AcceptedCargo produced, TileIndex tile, int w, int h, int rad);
|
||||
void GetAcceptanceAroundTiles(AcceptedCargo accepts, TileIndex tile, int w, int h, int rad);
|
||||
uint GetStationPlatforms(Station *st, TileIndex tile);
|
||||
uint GetStationPlatforms(const Station *st, TileIndex tile);
|
||||
|
||||
|
||||
/* Station layout for given dimensions - it is a two-dimensional array
|
||||
|
@ -267,7 +267,7 @@ StationSpec *GetCustomStation(StationClass sclass, byte stid);
|
|||
/* Get sprite offset for a given custom station and station structure (may be
|
||||
* NULL if ctype is set - that means we are in a build dialog). The station
|
||||
* structure is used for variational sprite groups. */
|
||||
uint32 GetCustomStationRelocation(StationSpec *spec, Station *stat, byte ctype);
|
||||
uint32 GetCustomStationRelocation(const StationSpec *spec, const Station *st, byte ctype);
|
||||
int GetCustomStationsCount(StationClass sclass);
|
||||
|
||||
RoadStop * GetRoadStopByTile(TileIndex tile, RoadStopType type);
|
||||
|
|
|
@ -1090,7 +1090,7 @@ int32 CmdBuildRailroadStation(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|||
return cost;
|
||||
}
|
||||
|
||||
static bool TileBelongsToRailStation(Station *st, TileIndex tile)
|
||||
static bool TileBelongsToRailStation(const Station *st, TileIndex tile)
|
||||
{
|
||||
return IsTileType(tile, MP_STATION) && _m[tile].m2 == st->index && _m[tile].m5 < 8;
|
||||
}
|
||||
|
@ -1188,7 +1188,7 @@ int32 CmdRemoveFromRailroadStation(int x, int y, uint32 flags, uint32 p1, uint32
|
|||
}
|
||||
|
||||
// determine the number of platforms for the station
|
||||
uint GetStationPlatforms(Station *st, TileIndex tile)
|
||||
uint GetStationPlatforms(const Station *st, TileIndex tile)
|
||||
{
|
||||
uint t;
|
||||
int dir,delta;
|
||||
|
@ -1264,14 +1264,14 @@ StationSpec *GetCustomStation(StationClass sclass, byte stid)
|
|||
return &_station_spec[sclass][stid];
|
||||
}
|
||||
|
||||
static RealSpriteGroup *ResolveStationSpriteGroup(SpriteGroup *spritegroup, Station *stat)
|
||||
static const RealSpriteGroup *ResolveStationSpriteGroup(const SpriteGroup *spg, const Station *st)
|
||||
{
|
||||
switch (spritegroup->type) {
|
||||
switch (spg->type) {
|
||||
case SGT_REAL:
|
||||
return &spritegroup->g.real;
|
||||
return &spg->g.real;
|
||||
|
||||
case SGT_DETERMINISTIC: {
|
||||
DeterministicSpriteGroup *dsg = &spritegroup->g.determ;
|
||||
const DeterministicSpriteGroup *dsg = &spg->g.determ;
|
||||
SpriteGroup *target;
|
||||
int value = -1;
|
||||
|
||||
|
@ -1280,7 +1280,7 @@ static RealSpriteGroup *ResolveStationSpriteGroup(SpriteGroup *spritegroup, Stat
|
|||
value = GetDeterministicSpriteValue(dsg->variable);
|
||||
|
||||
} else {
|
||||
if (stat == NULL) {
|
||||
if (st == NULL) {
|
||||
/* We are in a build dialog of something,
|
||||
* and we are checking for something undefined.
|
||||
* That means we should get the first target
|
||||
|
@ -1308,25 +1308,25 @@ static RealSpriteGroup *ResolveStationSpriteGroup(SpriteGroup *spritegroup, Stat
|
|||
// Variable is 0x70 + offset in the TTD's station structure
|
||||
switch (dsg->variable - 0x70) {
|
||||
case 0x80:
|
||||
value = stat->facilities;
|
||||
value = st->facilities;
|
||||
break;
|
||||
case 0x81:
|
||||
value = stat->airport_type;
|
||||
value = st->airport_type;
|
||||
break;
|
||||
case 0x82:
|
||||
value = stat->truck_stops->status;
|
||||
value = st->truck_stops->status;
|
||||
break;
|
||||
case 0x83:
|
||||
value = stat->bus_stops->status;
|
||||
value = st->bus_stops->status;
|
||||
break;
|
||||
case 0x86:
|
||||
value = stat->airport_flags & 0xFFFF;
|
||||
value = st->airport_flags & 0xFFFF;
|
||||
break;
|
||||
case 0x87:
|
||||
value = stat->airport_flags & 0xFF;
|
||||
value = st->airport_flags & 0xFF;
|
||||
break;
|
||||
case 0x8A:
|
||||
value = stat->build_date;
|
||||
value = st->build_date;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1334,7 +1334,7 @@ static RealSpriteGroup *ResolveStationSpriteGroup(SpriteGroup *spritegroup, Stat
|
|||
}
|
||||
|
||||
target = value != -1 ? EvalDeterministicSpriteGroup(dsg, value) : dsg->default_group;
|
||||
return ResolveStationSpriteGroup(target, stat);
|
||||
return ResolveStationSpriteGroup(target, st);
|
||||
}
|
||||
|
||||
default:
|
||||
|
@ -1344,18 +1344,14 @@ static RealSpriteGroup *ResolveStationSpriteGroup(SpriteGroup *spritegroup, Stat
|
|||
}
|
||||
}
|
||||
|
||||
uint32 GetCustomStationRelocation(StationSpec *spec, Station *stat, byte ctype)
|
||||
uint32 GetCustomStationRelocation(const StationSpec *spec, const Station *st, byte ctype)
|
||||
{
|
||||
RealSpriteGroup *rsg;
|
||||
|
||||
rsg = ResolveStationSpriteGroup(&spec->spritegroup[ctype], stat);
|
||||
const RealSpriteGroup *rsg = ResolveStationSpriteGroup(&spec->spritegroup[ctype], st);
|
||||
|
||||
if (rsg->sprites_per_set != 0) {
|
||||
if (rsg->loading_count != 0) {
|
||||
return rsg->loading[0];
|
||||
} else if (rsg->loaded_count != 0) {
|
||||
return rsg->loaded[0];
|
||||
}
|
||||
if (rsg->loading_count != 0) return rsg->loading[0];
|
||||
|
||||
if (rsg->loaded_count != 0) return rsg->loaded[0];
|
||||
}
|
||||
|
||||
error("Custom station 0x%08x::0x%02x has no sprites associated.",
|
||||
|
@ -2237,7 +2233,7 @@ static uint GetSlopeZ_Station(TileInfo *ti)
|
|||
return z;
|
||||
}
|
||||
|
||||
static uint GetSlopeTileh_Station(TileInfo *ti)
|
||||
static uint GetSlopeTileh_Station(const TileInfo *ti)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -2952,7 +2948,7 @@ void DeleteOilRig(TileIndex tile)
|
|||
DeleteStation(st);
|
||||
}
|
||||
|
||||
static void ChangeTileOwner_Station(TileIndex tile, byte old_player, byte new_player)
|
||||
static void ChangeTileOwner_Station(TileIndex tile, PlayerID old_player, PlayerID new_player)
|
||||
{
|
||||
if (!IsTileOwner(tile, old_player)) return;
|
||||
|
||||
|
|
30
stdafx.h
30
stdafx.h
|
@ -1,22 +1,22 @@
|
|||
/* $Id$ */
|
||||
|
||||
#if !defined(_STDAFX_H)
|
||||
#define _STDAFX_H
|
||||
#ifndef STDAFX_H
|
||||
#define STDAFX_H
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#pragma warning(disable: 4100) // parameter not used
|
||||
#pragma warning(disable: 4244) // conversion
|
||||
#pragma warning(disable: 4245) // conversion
|
||||
#pragma warning(disable: 4305) // 'initializing' : truncation from 'const int ' to 'char '
|
||||
#pragma warning(disable: 4018) // warning C4018: '==' : signed/unsigned mismatch
|
||||
#pragma warning(disable: 4201) // nameless union
|
||||
#pragma warning(disable: 4514) // removed unref inline
|
||||
#pragma warning(disable: 4127) // constant conditional expression
|
||||
#pragma warning(disable: 4276) // MSVC BUG??? Complains about function body not declared when using function pointers
|
||||
#pragma warning(disable: 4761) // warning C4761: integral size mismatch in argument; conversion supplied
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#pragma warning(disable: 4018) // 'expression' : signed/unsigned mismatch
|
||||
#pragma warning(disable: 4100) // 'identifier' : unreferenced formal parameter
|
||||
#pragma warning(disable: 4127) // conditional expression is constant
|
||||
#pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
|
||||
#pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data
|
||||
#pragma warning(disable: 4245) // 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch
|
||||
#pragma warning(disable: 4276) // 'fucntion' : no prototype provided; assumed no parameters (MSVC BUG???)
|
||||
#pragma warning(disable: 4305) // 'identifier' : truncation from 'type1' to 'type2'
|
||||
#pragma warning(disable: 4514) // 'function' : unreferenced inline function has been removed
|
||||
#pragma warning(disable: 4761) // integral size mismatch in argument : conversion supplied
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -252,4 +252,4 @@ assert_compile(sizeof(uint8) == 1);
|
|||
#define Point OTTD_AMIGA_POINT
|
||||
#endif
|
||||
|
||||
#endif // !defined(_STDAFX_H)
|
||||
#endif /* STDAFX_H */
|
||||
|
|
2
string.h
2
string.h
|
@ -25,4 +25,4 @@ char* strecpy(char* dst, const char* src, const char* last);
|
|||
|
||||
char* CDECL str_fmt(const char* str, ...);
|
||||
|
||||
#endif
|
||||
#endif /* STRING_H */
|
||||
|
|
|
@ -19,4 +19,4 @@ extern char _userstring[128];
|
|||
void InjectDParam(int amount);
|
||||
int32 GetParamInt32(void);
|
||||
|
||||
#endif
|
||||
#endif /* STRINGS_H */
|
||||
|
|
2
tile.h
2
tile.h
|
@ -127,4 +127,4 @@ static inline bool IsTileOwner(TileIndex tile, Owner owner)
|
|||
return GetTileOwner(tile) == owner;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* TILE_H */
|
||||
|
|
2
town.h
2
town.h
|
@ -138,7 +138,7 @@ extern MemoryPool _town_pool;
|
|||
/**
|
||||
* Check if a Town really exists.
|
||||
*/
|
||||
static inline bool IsValidTown(Town* town)
|
||||
static inline bool IsValidTown(const Town* town)
|
||||
{
|
||||
return town->xy != 0; /* XXX: Replace by INVALID_TILE someday */
|
||||
}
|
||||
|
|
12
town_cmd.c
12
town_cmd.c
|
@ -76,12 +76,12 @@ typedef struct DrawTownTileStruct {
|
|||
#include "table/town_land.h"
|
||||
|
||||
|
||||
static void TownDrawHouseLift(TileInfo *ti)
|
||||
static void TownDrawHouseLift(const TileInfo *ti)
|
||||
{
|
||||
AddChildSpriteScreen(0x5A3, 0xE, 0x3C - (_m[ti->tile].m1 & 0x7F));
|
||||
}
|
||||
|
||||
typedef void TownDrawTileProc(TileInfo *ti);
|
||||
typedef void TownDrawTileProc(const TileInfo *ti);
|
||||
static TownDrawTileProc * const _town_draw_tile_procs[1] = {
|
||||
TownDrawHouseLift
|
||||
};
|
||||
|
@ -150,7 +150,7 @@ static uint GetSlopeZ_Town(TileInfo *ti)
|
|||
return (uint16) z;
|
||||
}
|
||||
|
||||
static uint GetSlopeTileh_Town(TileInfo *ti)
|
||||
static uint GetSlopeTileh_Town(const TileInfo *ti)
|
||||
{
|
||||
return ti->tileh;
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ static uint32 GetTileTrackStatus_Town(TileIndex tile, TransportType mode)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void ChangeTileOwner_Town(TileIndex tile, byte old_player, byte new_player)
|
||||
static void ChangeTileOwner_Town(TileIndex tile, PlayerID old_player, PlayerID new_player)
|
||||
{
|
||||
/* not used */
|
||||
}
|
||||
|
@ -1155,7 +1155,7 @@ static bool CheckBuildHouseMode(Town *t1, TileIndex tile, uint tileh, int mode)
|
|||
return DoCommandByTile(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR) != CMD_ERROR;
|
||||
}
|
||||
|
||||
int GetTownRadiusGroup(Town *t, TileIndex tile)
|
||||
int GetTownRadiusGroup(const Town *t, TileIndex tile)
|
||||
{
|
||||
uint dist;
|
||||
int i,smallest;
|
||||
|
@ -1165,7 +1165,7 @@ int GetTownRadiusGroup(Town *t, TileIndex tile)
|
|||
return 4;
|
||||
|
||||
smallest = 0;
|
||||
for(i=0; i!=lengthof(t->radius); i++) {
|
||||
for (i = 0; i != lengthof(t->radius); i++) {
|
||||
if (dist < t->radius[i])
|
||||
smallest = i;
|
||||
}
|
||||
|
|
|
@ -2407,14 +2407,14 @@ static int GetNewVehicleDirectionByTile(TileIndex new_tile, TileIndex old_tile)
|
|||
return _new_vehicle_direction_table[offs];
|
||||
}
|
||||
|
||||
static int GetNewVehicleDirection(Vehicle *v, int x, int y)
|
||||
static int GetNewVehicleDirection(const Vehicle *v, int x, int y)
|
||||
{
|
||||
uint offs = (y - v->y_pos + 1) * 4 + (x - v->x_pos + 1);
|
||||
assert(offs < 11);
|
||||
return _new_vehicle_direction_table[offs];
|
||||
}
|
||||
|
||||
static int GetDirectionToVehicle(Vehicle *v, int x, int y)
|
||||
static int GetDirectionToVehicle(const Vehicle *v, int x, int y)
|
||||
{
|
||||
byte offs;
|
||||
|
||||
|
|
|
@ -466,7 +466,7 @@ typedef struct GetDepotVehiclePtData {
|
|||
Vehicle *wagon;
|
||||
} GetDepotVehiclePtData;
|
||||
|
||||
static int GetVehicleFromTrainDepotWndPt(Window *w, int x, int y, GetDepotVehiclePtData *d)
|
||||
static int GetVehicleFromTrainDepotWndPt(const Window *w, int x, int y, GetDepotVehiclePtData *d)
|
||||
{
|
||||
int row;
|
||||
int skip = 0;
|
||||
|
|
|
@ -343,7 +343,7 @@ static uint GetSlopeZ_Trees(TileInfo *ti) {
|
|||
return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z;
|
||||
}
|
||||
|
||||
static uint GetSlopeTileh_Trees(TileInfo *ti) {
|
||||
static uint GetSlopeTileh_Trees(const TileInfo *ti) {
|
||||
return ti->tileh;
|
||||
}
|
||||
|
||||
|
@ -617,7 +617,7 @@ static uint32 GetTileTrackStatus_Trees(TileIndex tile, TransportType mode)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void ChangeTileOwner_Trees(TileIndex tile, byte old_player, byte new_player)
|
||||
static void ChangeTileOwner_Trees(TileIndex tile, PlayerID old_player, PlayerID new_player)
|
||||
{
|
||||
/* not used */
|
||||
}
|
||||
|
|
|
@ -956,7 +956,7 @@ static const byte _bridge_foundations[2][16] = {
|
|||
|
||||
extern const byte _road_sloped_sprites[14];
|
||||
|
||||
static void DrawBridgePillars(TileInfo *ti, int x, int y, int z)
|
||||
static void DrawBridgePillars(const TileInfo *ti, int x, int y, int z)
|
||||
{
|
||||
const uint32 *b;
|
||||
uint32 image;
|
||||
|
@ -1229,7 +1229,7 @@ static uint GetSlopeZ_TunnelBridge(TileInfo *ti) {
|
|||
// make sure that the slope is not inclined foundation
|
||||
if (IS_BYTE_INSIDE(f, 1, 15)) return z;
|
||||
|
||||
// change foundation type?
|
||||
// change foundation type? XXX - should be const; accessor function!
|
||||
if (f) ti->tileh = _inclined_tileh[f - 15];
|
||||
}
|
||||
|
||||
|
@ -1252,7 +1252,7 @@ static uint GetSlopeZ_TunnelBridge(TileInfo *ti) {
|
|||
return GetPartialZ(ti->x&0xF, ti->y&0xF, ti->tileh) + z;
|
||||
}
|
||||
|
||||
static uint GetSlopeTileh_TunnelBridge(TileInfo *ti) {
|
||||
static uint GetSlopeTileh_TunnelBridge(const TileInfo *ti) {
|
||||
// not accurate, but good enough for slope graphics drawing
|
||||
return 0;
|
||||
}
|
||||
|
@ -1397,7 +1397,7 @@ static uint32 GetTileTrackStatus_TunnelBridge(TileIndex tile, TransportType mode
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void ChangeTileOwner_TunnelBridge(TileIndex tile, byte old_player, byte new_player)
|
||||
static void ChangeTileOwner_TunnelBridge(TileIndex tile, PlayerID old_player, PlayerID new_player)
|
||||
{
|
||||
if (!IsTileOwner(tile, old_player)) return;
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ static uint GetSlopeZ_Unmovable(TileInfo *ti)
|
|||
return GetPartialZ(ti->x&0xF, ti->y&0xF, ti->tileh) + ti->z;
|
||||
}
|
||||
|
||||
static uint GetSlopeTileh_Unmovable(TileInfo *ti)
|
||||
static uint GetSlopeTileh_Unmovable(const TileInfo *ti)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ restart:
|
|||
} while (--i);
|
||||
}
|
||||
|
||||
static void ChangeTileOwner_Unmovable(TileIndex tile, byte old_player, byte new_player)
|
||||
static void ChangeTileOwner_Unmovable(TileIndex tile, PlayerID old_player, PlayerID new_player)
|
||||
{
|
||||
if (!IsTileOwner(tile, old_player)) return;
|
||||
|
||||
|
|
|
@ -556,7 +556,7 @@ bool CanRefitTo(const Vehicle *v, CargoID cid_to)
|
|||
return true;
|
||||
}
|
||||
|
||||
static void DoDrawVehicle(Vehicle *v)
|
||||
static void DoDrawVehicle(const Vehicle *v)
|
||||
{
|
||||
uint32 image = v->cur_image;
|
||||
|
||||
|
@ -1819,7 +1819,7 @@ void EndVehicleMove(Vehicle *v)
|
|||
}
|
||||
|
||||
/* returns true if staying in the same tile */
|
||||
bool GetNewVehiclePos(Vehicle *v, GetNewVehiclePosResult *gp)
|
||||
bool GetNewVehiclePos(const Vehicle *v, GetNewVehiclePosResult *gp)
|
||||
{
|
||||
static const int8 _delta_coord[16] = {
|
||||
-1,-1,-1, 0, 1, 1, 1, 0, /* x */
|
||||
|
@ -1842,7 +1842,7 @@ static const byte _new_direction_table[9] = {
|
|||
2, 3, 4,
|
||||
};
|
||||
|
||||
byte GetDirectionTowards(Vehicle *v, int x, int y)
|
||||
byte GetDirectionTowards(const Vehicle *v, int x, int y)
|
||||
{
|
||||
byte dirdiff, dir;
|
||||
int i = 0;
|
||||
|
|
|
@ -350,8 +350,8 @@ typedef struct GetNewVehiclePosResult {
|
|||
Trackdir GetVehicleTrackdir(const Vehicle* v);
|
||||
|
||||
/* returns true if staying in the same tile */
|
||||
bool GetNewVehiclePos(Vehicle *v, GetNewVehiclePosResult *gp);
|
||||
byte GetDirectionTowards(Vehicle *v, int x, int y);
|
||||
bool GetNewVehiclePos(const Vehicle *v, GetNewVehiclePosResult *gp);
|
||||
byte GetDirectionTowards(const Vehicle *v, int x, int y);
|
||||
|
||||
#define BEGIN_ENUM_WAGONS(v) do {
|
||||
#define END_ENUM_WAGONS(v) } while ( (v=v->next) != NULL);
|
||||
|
|
|
@ -165,7 +165,7 @@ void InitializeVehiclesGuiList(void)
|
|||
}
|
||||
|
||||
// draw the vehicle profit button in the vehicle list window.
|
||||
void DrawVehicleProfitButton(Vehicle *v, int x, int y)
|
||||
void DrawVehicleProfitButton(const Vehicle *v, int x, int y)
|
||||
{
|
||||
uint32 ormod;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
struct vehiclelist_d;
|
||||
|
||||
void DrawVehicleProfitButton(Vehicle *v, int x, int y);
|
||||
void DrawVehicleProfitButton(const Vehicle *v, int x, int y);
|
||||
CargoID DrawVehicleRefitWindow(const Vehicle *v, int sel);
|
||||
void InitializeVehiclesGuiList(void);
|
||||
|
||||
|
|
|
@ -388,7 +388,7 @@ typedef struct LocksDrawTileStruct {
|
|||
|
||||
#include "table/water_land.h"
|
||||
|
||||
static void DrawWaterStuff(TileInfo *ti, const WaterDrawTileStruct *wdts,
|
||||
static void DrawWaterStuff(const TileInfo *ti, const WaterDrawTileStruct *wdts,
|
||||
uint32 palette, uint base
|
||||
)
|
||||
{
|
||||
|
@ -451,7 +451,7 @@ static uint GetSlopeZ_Water(TileInfo *ti)
|
|||
return GetPartialZ(ti->x&0xF, ti->y&0xF, ti->tileh) + ti->z;
|
||||
}
|
||||
|
||||
static uint GetSlopeTileh_Water(TileInfo *ti)
|
||||
static uint GetSlopeTileh_Water(const TileInfo *ti)
|
||||
{
|
||||
return ti->tileh;
|
||||
}
|
||||
|
@ -693,7 +693,7 @@ static void ClickTile_Water(TileIndex tile)
|
|||
}
|
||||
}
|
||||
|
||||
static void ChangeTileOwner_Water(TileIndex tile, byte old_player, byte new_player)
|
||||
static void ChangeTileOwner_Water(TileIndex tile, PlayerID old_player, PlayerID new_player)
|
||||
{
|
||||
if (!IsTileOwner(tile, old_player)) return;
|
||||
|
||||
|
|
8
widget.c
8
widget.c
|
@ -10,7 +10,7 @@
|
|||
#include "gfx.h"
|
||||
#include "viewport.h"
|
||||
|
||||
static Point HandleScrollbarHittest(Scrollbar *sb, int top, int bottom)
|
||||
static Point HandleScrollbarHittest(const Scrollbar *sb, int top, int bottom)
|
||||
{
|
||||
Point pt;
|
||||
int height, count, pos, cap;
|
||||
|
@ -135,7 +135,7 @@ void ScrollbarClickHandler(Window *w, const Widget *wi, int x, int y)
|
|||
* @param x,y Window client coordinates
|
||||
* @return A widget index, or -1 if no widget was found.
|
||||
*/
|
||||
int GetWidgetFromPos(Window *w, int x, int y)
|
||||
int GetWidgetFromPos(const Window *w, int x, int y)
|
||||
{
|
||||
const Widget *wi;
|
||||
int index, found_index = -1;
|
||||
|
@ -156,7 +156,7 @@ int GetWidgetFromPos(Window *w, int x, int y)
|
|||
}
|
||||
|
||||
|
||||
void DrawWindowWidgets(Window *w)
|
||||
void DrawWindowWidgets(const Window *w)
|
||||
{
|
||||
const Widget *wi;
|
||||
DrawPixelInfo *dpi = _cur_dpi;
|
||||
|
@ -457,7 +457,7 @@ static const Widget _dropdown_menu_widgets[] = {
|
|||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static int GetDropdownItem(Window *w)
|
||||
static int GetDropdownItem(const Window *w)
|
||||
{
|
||||
uint item;
|
||||
int y;
|
||||
|
|
2
win32.h
2
win32.h
|
@ -8,4 +8,4 @@ bool MyShowCursor(bool show);
|
|||
typedef void (*Function)(int);
|
||||
bool LoadLibraryList(Function proc[], const char* dll);
|
||||
|
||||
#endif
|
||||
#endif /* WIN32_H */
|
||||
|
|
2
window.c
2
window.c
|
@ -1529,7 +1529,7 @@ void UpdateWindows(void)
|
|||
}
|
||||
|
||||
|
||||
int GetMenuItemIndex(Window *w, int x, int y)
|
||||
int GetMenuItemIndex(const Window *w, int x, int y)
|
||||
{
|
||||
if ((x -= w->left) >= 0 && x < w->width && (y -= w->top + 1) >= 0) {
|
||||
y /= 10;
|
||||
|
|
6
window.h
6
window.h
|
@ -602,7 +602,7 @@ void DrawWindowViewport(Window *w);
|
|||
void InitWindowSystem(void);
|
||||
void UnInitWindowSystem(void);
|
||||
void ResetWindowSystem(void);
|
||||
int GetMenuItemIndex(Window *w, int x, int y);
|
||||
int GetMenuItemIndex(const Window *w, int x, int y);
|
||||
void InputLoop(void);
|
||||
void UpdateWindows(void);
|
||||
void InvalidateWidget(Window *w, byte widget_index);
|
||||
|
@ -615,8 +615,8 @@ void RelocateAllWindows(int neww, int newh);
|
|||
int PositionMainToolbar(Window *w);
|
||||
|
||||
/* widget.c */
|
||||
int GetWidgetFromPos(Window *w, int x, int y);
|
||||
void DrawWindowWidgets(Window *w);
|
||||
int GetWidgetFromPos(const Window *w, int x, int y);
|
||||
void DrawWindowWidgets(const Window *w);
|
||||
void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int button, uint32 disabled_mask, bool remove_filtered_strings);
|
||||
|
||||
void HandleButtonClick(Window *w, byte widget);
|
||||
|
|
Loading…
Reference in New Issue