mirror of https://github.com/OpenTTD/OpenTTD
(svn r3172) static, const
parent
59e885c2bf
commit
ee15e3de13
|
@ -1905,7 +1905,8 @@ static const byte _dir_table_1[] = {3, 9, 12, 6};
|
||||||
static const byte _dir_table_2[] = {12, 6, 3, 9};
|
static const byte _dir_table_2[] = {12, 6, 3, 9};
|
||||||
|
|
||||||
|
|
||||||
static bool AiIsTileBanned(Player *p, TileIndex tile, byte val) {
|
static bool AiIsTileBanned(const Player* p, TileIndex tile, byte val)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0; i!=p->ai.banned_tile_count; i++)
|
for(i=0; i!=p->ai.banned_tile_count; i++)
|
||||||
|
|
|
@ -544,7 +544,7 @@ void HandleClickOnAircraft(Vehicle *v)
|
||||||
|
|
||||||
static void CheckIfAircraftNeedsService(Vehicle *v)
|
static void CheckIfAircraftNeedsService(Vehicle *v)
|
||||||
{
|
{
|
||||||
Station *st;
|
const Station* st;
|
||||||
|
|
||||||
if (_patches.servint_aircraft == 0)
|
if (_patches.servint_aircraft == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -1269,7 +1269,7 @@ static void AircraftEntersTerminal(Vehicle *v)
|
||||||
|
|
||||||
static bool ValidateAircraftInHangar( uint data_a, uint data_b )
|
static bool ValidateAircraftInHangar( uint data_a, uint data_b )
|
||||||
{
|
{
|
||||||
Vehicle *v = GetVehicle(data_a);
|
const Vehicle* v = GetVehicle(data_a);
|
||||||
|
|
||||||
return (IsAircraftHangarTile(v->tile) && (v->vehstatus & VS_STOPPED));
|
return (IsAircraftHangarTile(v->tile) && (v->vehstatus & VS_STOPPED));
|
||||||
}
|
}
|
||||||
|
@ -1324,7 +1324,7 @@ static void AircraftLandAirplane(Vehicle *v)
|
||||||
// set the right pos when heading to other airports after takeoff
|
// set the right pos when heading to other airports after takeoff
|
||||||
static void AircraftNextAirportPos_and_Order(Vehicle *v)
|
static void AircraftNextAirportPos_and_Order(Vehicle *v)
|
||||||
{
|
{
|
||||||
Station *st;
|
const Station* st;
|
||||||
const AirportFTAClass *Airport;
|
const AirportFTAClass *Airport;
|
||||||
|
|
||||||
if (v->current_order.type == OT_GOTO_STATION ||
|
if (v->current_order.type == OT_GOTO_STATION ||
|
||||||
|
@ -1634,7 +1634,7 @@ static AircraftStateHandler * const _aircraft_state_handlers[] = {
|
||||||
AircraftEventHandler_HeliEndLanding,// HELIENDLANDING = 18
|
AircraftEventHandler_HeliEndLanding,// HELIENDLANDING = 18
|
||||||
};
|
};
|
||||||
|
|
||||||
static void AirportClearBlock(Vehicle *v, const AirportFTAClass *Airport)
|
static void AirportClearBlock(const Vehicle* v, const AirportFTAClass* Airport)
|
||||||
{
|
{
|
||||||
Station *st;
|
Station *st;
|
||||||
// we have left the previous block, and entered the new one. Free the previous block
|
// we have left the previous block, and entered the new one. Free the previous block
|
||||||
|
@ -1706,16 +1706,14 @@ static bool AirportMove(Vehicle *v, const AirportFTAClass *Airport)
|
||||||
// returns true if the road ahead is busy, eg. you must wait before proceeding
|
// returns true if the road ahead is busy, eg. you must wait before proceeding
|
||||||
static bool AirportHasBlock(Vehicle *v, AirportFTA *current_pos, const AirportFTAClass *Airport)
|
static bool AirportHasBlock(Vehicle *v, AirportFTA *current_pos, const AirportFTAClass *Airport)
|
||||||
{
|
{
|
||||||
Station *st;
|
const AirportFTA* reference = &Airport->layout[v->u.air.pos];
|
||||||
uint32 airport_flags;
|
const AirportFTA* next = &Airport->layout[current_pos->next_position];
|
||||||
AirportFTA *next, *reference;
|
|
||||||
reference = &Airport->layout[v->u.air.pos];
|
|
||||||
next = &Airport->layout[current_pos->next_position];
|
|
||||||
|
|
||||||
// same block, then of course we can move
|
// same block, then of course we can move
|
||||||
if (Airport->layout[current_pos->position].block != next->block) {
|
if (Airport->layout[current_pos->position].block != next->block) {
|
||||||
airport_flags = next->block;
|
const Station* st = GetStation(v->u.air.targetairport);
|
||||||
st = GetStation(v->u.air.targetairport);
|
uint32 airport_flags = next->block;
|
||||||
|
|
||||||
// check additional possible extra blocks
|
// check additional possible extra blocks
|
||||||
if (current_pos != reference && current_pos->block != NOTHING_block) {
|
if (current_pos != reference && current_pos->block != NOTHING_block) {
|
||||||
airport_flags |= current_pos->block;
|
airport_flags |= current_pos->block;
|
||||||
|
|
|
@ -77,10 +77,9 @@ static void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selectio
|
||||||
|
|
||||||
void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||||
{
|
{
|
||||||
Vehicle *v;
|
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
v = GetVehicle(_new_aircraft_id);
|
const Vehicle* v = GetVehicle(_new_aircraft_id);
|
||||||
|
|
||||||
if (v->tile == _backup_orders_tile) {
|
if (v->tile == _backup_orders_tile) {
|
||||||
_backup_orders_tile = 0;
|
_backup_orders_tile = 0;
|
||||||
RestoreVehicleOrders(v, _backup_orders_data);
|
RestoreVehicleOrders(v, _backup_orders_data);
|
||||||
|
@ -508,7 +507,7 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch(e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
Vehicle *v = GetVehicle(w->window_number);
|
const Vehicle* v = GetVehicle(w->window_number);
|
||||||
uint32 disabled = 1<<8;
|
uint32 disabled = 1<<8;
|
||||||
StringID str;
|
StringID str;
|
||||||
|
|
||||||
|
|
|
@ -825,7 +825,7 @@ void StartupEconomy(void)
|
||||||
_economy.fluct = GB(Random(), 0, 8) + 168;
|
_economy.fluct = GB(Random(), 0, 8) + 168;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pair SetupSubsidyDecodeParam(Subsidy *s, bool mode)
|
Pair SetupSubsidyDecodeParam(const Subsidy* s, bool mode)
|
||||||
{
|
{
|
||||||
TileIndex tile;
|
TileIndex tile;
|
||||||
TileIndex tile2;
|
TileIndex tile2;
|
||||||
|
@ -983,7 +983,7 @@ static void FindSubsidyCargoRoute(FoundRoute *fr)
|
||||||
|
|
||||||
static bool CheckSubsidyDuplicate(Subsidy *s)
|
static bool CheckSubsidyDuplicate(Subsidy *s)
|
||||||
{
|
{
|
||||||
Subsidy *ss;
|
const Subsidy* ss;
|
||||||
|
|
||||||
for(ss=_subsidies; ss != endof(_subsidies); ss++) {
|
for(ss=_subsidies; ss != endof(_subsidies); ss++) {
|
||||||
if (s != ss &&
|
if (s != ss &&
|
||||||
|
|
|
@ -60,7 +60,7 @@ void UpdatePlayerHouse(Player *p, uint score);
|
||||||
|
|
||||||
|
|
||||||
VARDEF Subsidy _subsidies[MAX_PLAYERS];
|
VARDEF Subsidy _subsidies[MAX_PLAYERS];
|
||||||
Pair SetupSubsidyDecodeParam(Subsidy *s, bool mode);
|
Pair SetupSubsidyDecodeParam(const Subsidy* s, bool mode);
|
||||||
void DeleteSubsidyWithIndustry(uint16 index);
|
void DeleteSubsidyWithIndustry(uint16 index);
|
||||||
void DeleteSubsidyWithStation(uint16 index);
|
void DeleteSubsidyWithStation(uint16 index);
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ struct Industry {
|
||||||
TileIndex xy;
|
TileIndex xy;
|
||||||
byte width; /* swapped order of w/h with town */
|
byte width; /* swapped order of w/h with town */
|
||||||
byte height;
|
byte height;
|
||||||
Town *town;
|
const Town* town;
|
||||||
byte produced_cargo[2];
|
byte produced_cargo[2];
|
||||||
uint16 cargo_waiting[2];
|
uint16 cargo_waiting[2];
|
||||||
byte production_rate[2];
|
byte production_rate[2];
|
||||||
|
|
|
@ -38,8 +38,8 @@ void IndustryPoolNewBlock(uint start_item)
|
||||||
/* Initialize the industry-pool */
|
/* Initialize the industry-pool */
|
||||||
MemoryPool _industry_pool = { "Industry", INDUSTRY_POOL_MAX_BLOCKS, INDUSTRY_POOL_BLOCK_SIZE_BITS, sizeof(Industry), &IndustryPoolNewBlock, 0, 0, NULL };
|
MemoryPool _industry_pool = { "Industry", INDUSTRY_POOL_MAX_BLOCKS, INDUSTRY_POOL_BLOCK_SIZE_BITS, sizeof(Industry), &IndustryPoolNewBlock, 0, 0, NULL };
|
||||||
|
|
||||||
byte _industry_sound_ctr;
|
static byte _industry_sound_ctr;
|
||||||
TileIndex _industry_sound_tile;
|
static TileIndex _industry_sound_tile;
|
||||||
|
|
||||||
void ShowIndustryViewWindow(int industry);
|
void ShowIndustryViewWindow(int industry);
|
||||||
void BuildOilRig(TileIndex tile);
|
void BuildOilRig(TileIndex tile);
|
||||||
|
@ -341,7 +341,7 @@ static IndustryDrawTileProc * const _industry_draw_tile_procs[5] = {
|
||||||
|
|
||||||
static void DrawTile_Industry(TileInfo *ti)
|
static void DrawTile_Industry(TileInfo *ti)
|
||||||
{
|
{
|
||||||
Industry *ind;
|
const Industry* ind;
|
||||||
const DrawIndustryTileStruct *dits;
|
const DrawIndustryTileStruct *dits;
|
||||||
byte z;
|
byte z;
|
||||||
uint32 image, ormod;
|
uint32 image, ormod;
|
||||||
|
@ -425,7 +425,7 @@ static void GetAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac)
|
||||||
|
|
||||||
static void GetTileDesc_Industry(TileIndex tile, TileDesc *td)
|
static void GetTileDesc_Industry(TileIndex tile, TileDesc *td)
|
||||||
{
|
{
|
||||||
Industry *i = GetIndustry(_m[tile].m2);
|
const Industry* i = GetIndustry(_m[tile].m2);
|
||||||
|
|
||||||
td->owner = i->owner;
|
td->owner = i->owner;
|
||||||
td->str = STR_4802_COAL_MINE + i->type;
|
td->str = STR_4802_COAL_MINE + i->type;
|
||||||
|
@ -863,7 +863,8 @@ static uint32 GetTileTrackStatus_Industry(TileIndex tile, TransportType mode)
|
||||||
|
|
||||||
static void GetProducedCargo_Industry(TileIndex tile, byte *b)
|
static void GetProducedCargo_Industry(TileIndex tile, byte *b)
|
||||||
{
|
{
|
||||||
Industry *i = GetIndustry(_m[tile].m2);
|
const Industry* i = GetIndustry(_m[tile].m2);
|
||||||
|
|
||||||
b[0] = i->produced_cargo[0];
|
b[0] = i->produced_cargo[0];
|
||||||
b[1] = i->produced_cargo[1];
|
b[1] = i->produced_cargo[1];
|
||||||
}
|
}
|
||||||
|
@ -1262,10 +1263,10 @@ static bool CheckSuitableIndustryPos(TileIndex tile)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Town *CheckMultipleIndustryInTown(TileIndex tile, int type)
|
static const Town* CheckMultipleIndustryInTown(TileIndex tile, int type)
|
||||||
{
|
{
|
||||||
Town *t;
|
const Town* t;
|
||||||
Industry *i;
|
const Industry* i;
|
||||||
|
|
||||||
t = ClosestTownFromTile(tile, (uint)-1);
|
t = ClosestTownFromTile(tile, (uint)-1);
|
||||||
|
|
||||||
|
@ -1309,7 +1310,7 @@ static const byte _industry_map5_bits[] = {
|
||||||
16, 16, 16, 16, 16, 16, 16,
|
16, 16, 16, 16, 16, 16, 16,
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable *it, int type, Town *t)
|
static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable* it, int type, const Town* t)
|
||||||
{
|
{
|
||||||
TileInfo ti;
|
TileInfo ti;
|
||||||
|
|
||||||
|
@ -1451,7 +1452,7 @@ static Industry *AllocateIndustry(void)
|
||||||
return AddBlockToPool(&_industry_pool) ? AllocateIndustry() : NULL;
|
return AddBlockToPool(&_industry_pool) ? AllocateIndustry() : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const IndustryTileTable *it, Town *t, byte owner)
|
static void DoCreateNewIndustry(Industry* i, TileIndex tile, int type, const IndustryTileTable* it, const Town* t, byte owner)
|
||||||
{
|
{
|
||||||
const IndustrySpec *spec;
|
const IndustrySpec *spec;
|
||||||
uint32 r;
|
uint32 r;
|
||||||
|
@ -1547,7 +1548,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind
|
||||||
*/
|
*/
|
||||||
int32 CmdBuildIndustry(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
int32 CmdBuildIndustry(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||||
{
|
{
|
||||||
Town *t;
|
const Town* t;
|
||||||
Industry *i;
|
Industry *i;
|
||||||
TileIndex tile = TileVirtXY(x, y);
|
TileIndex tile = TileVirtXY(x, y);
|
||||||
int num;
|
int num;
|
||||||
|
@ -1601,7 +1602,7 @@ int32 CmdBuildIndustry(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
Industry *CreateNewIndustry(TileIndex tile, int type)
|
Industry *CreateNewIndustry(TileIndex tile, int type)
|
||||||
{
|
{
|
||||||
Town *t;
|
const Town* t;
|
||||||
const IndustryTileTable *it;
|
const IndustryTileTable *it;
|
||||||
Industry *i;
|
Industry *i;
|
||||||
|
|
||||||
|
|
19
main_gui.c
19
main_gui.c
|
@ -566,9 +566,9 @@ static const Widget _player_menu_widgets[] = {
|
||||||
|
|
||||||
static int GetPlayerIndexFromMenu(int index)
|
static int GetPlayerIndexFromMenu(int index)
|
||||||
{
|
{
|
||||||
Player *p;
|
|
||||||
|
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
|
const Player* p;
|
||||||
|
|
||||||
FOR_ALL_PLAYERS(p) {
|
FOR_ALL_PLAYERS(p) {
|
||||||
if (p->is_active) {
|
if (p->is_active) {
|
||||||
if (--index < 0)
|
if (--index < 0)
|
||||||
|
@ -582,7 +582,7 @@ static int GetPlayerIndexFromMenu(int index)
|
||||||
static void UpdatePlayerMenuHeight(Window *w)
|
static void UpdatePlayerMenuHeight(Window *w)
|
||||||
{
|
{
|
||||||
int num = 0;
|
int num = 0;
|
||||||
Player *p;
|
const Player* p;
|
||||||
|
|
||||||
FOR_ALL_PLAYERS(p) {
|
FOR_ALL_PLAYERS(p) {
|
||||||
if (p->is_active)
|
if (p->is_active)
|
||||||
|
@ -822,7 +822,7 @@ static void ToolbarIndustryClick(Window *w)
|
||||||
|
|
||||||
static void ToolbarTrainClick(Window *w)
|
static void ToolbarTrainClick(Window *w)
|
||||||
{
|
{
|
||||||
Vehicle *v;
|
const Vehicle* v;
|
||||||
int dis = -1;
|
int dis = -1;
|
||||||
FOR_ALL_VEHICLES(v)
|
FOR_ALL_VEHICLES(v)
|
||||||
if (v->type == VEH_Train && v->subtype == TS_Front_Engine) CLRBIT(dis, v->owner);
|
if (v->type == VEH_Train && v->subtype == TS_Front_Engine) CLRBIT(dis, v->owner);
|
||||||
|
@ -831,7 +831,7 @@ static void ToolbarTrainClick(Window *w)
|
||||||
|
|
||||||
static void ToolbarRoadClick(Window *w)
|
static void ToolbarRoadClick(Window *w)
|
||||||
{
|
{
|
||||||
Vehicle *v;
|
const Vehicle* v;
|
||||||
int dis = -1;
|
int dis = -1;
|
||||||
FOR_ALL_VEHICLES(v)
|
FOR_ALL_VEHICLES(v)
|
||||||
if (v->type == VEH_Road) CLRBIT(dis, v->owner);
|
if (v->type == VEH_Road) CLRBIT(dis, v->owner);
|
||||||
|
@ -840,7 +840,7 @@ static void ToolbarRoadClick(Window *w)
|
||||||
|
|
||||||
static void ToolbarShipClick(Window *w)
|
static void ToolbarShipClick(Window *w)
|
||||||
{
|
{
|
||||||
Vehicle *v;
|
const Vehicle* v;
|
||||||
int dis = -1;
|
int dis = -1;
|
||||||
FOR_ALL_VEHICLES(v)
|
FOR_ALL_VEHICLES(v)
|
||||||
if (v->type == VEH_Ship) CLRBIT(dis, v->owner);
|
if (v->type == VEH_Ship) CLRBIT(dis, v->owner);
|
||||||
|
@ -849,7 +849,7 @@ static void ToolbarShipClick(Window *w)
|
||||||
|
|
||||||
static void ToolbarAirClick(Window *w)
|
static void ToolbarAirClick(Window *w)
|
||||||
{
|
{
|
||||||
Vehicle *v;
|
const Vehicle* v;
|
||||||
int dis = -1;
|
int dis = -1;
|
||||||
FOR_ALL_VEHICLES(v)
|
FOR_ALL_VEHICLES(v)
|
||||||
if (v->type == VEH_Aircraft) CLRBIT(dis, v->owner);
|
if (v->type == VEH_Aircraft) CLRBIT(dis, v->owner);
|
||||||
|
@ -1651,11 +1651,11 @@ static const Widget _scenedit_industry_candy_widgets[] = {
|
||||||
{ WIDGETS_END},
|
{ WIDGETS_END},
|
||||||
};
|
};
|
||||||
|
|
||||||
int _industry_type_to_place;
|
|
||||||
|
|
||||||
static bool AnyTownExists(void)
|
static bool AnyTownExists(void)
|
||||||
{
|
{
|
||||||
Town *t;
|
const Town* t;
|
||||||
|
|
||||||
FOR_ALL_TOWNS(t) {
|
FOR_ALL_TOWNS(t) {
|
||||||
if (t->xy)
|
if (t->xy)
|
||||||
return true;
|
return true;
|
||||||
|
@ -1697,6 +1697,7 @@ static const byte _industry_type_list[4][16] = {
|
||||||
{26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36},
|
{26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int _industry_type_to_place;
|
||||||
bool _ignore_restrictions;
|
bool _ignore_restrictions;
|
||||||
|
|
||||||
static void ScenEditIndustryWndProc(Window *w, WindowEvent *e)
|
static void ScenEditIndustryWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
10
misc_gui.c
10
misc_gui.c
|
@ -29,7 +29,7 @@
|
||||||
static bool _fios_path_changed;
|
static bool _fios_path_changed;
|
||||||
static bool _savegame_sort_dirty;
|
static bool _savegame_sort_dirty;
|
||||||
|
|
||||||
bool _query_string_active;
|
static bool _query_string_active;
|
||||||
|
|
||||||
typedef struct LandInfoData {
|
typedef struct LandInfoData {
|
||||||
Town *town;
|
Town *town;
|
||||||
|
@ -41,10 +41,9 @@ typedef struct LandInfoData {
|
||||||
|
|
||||||
static void LandInfoWndProc(Window *w, WindowEvent *e)
|
static void LandInfoWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
LandInfoData *lid;
|
|
||||||
StringID str;
|
|
||||||
|
|
||||||
if (e->event == WE_PAINT) {
|
if (e->event == WE_PAINT) {
|
||||||
|
const LandInfoData* lid;
|
||||||
|
StringID str;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
DrawWindowWidgets(w);
|
DrawWindowWidgets(w);
|
||||||
|
@ -883,7 +882,8 @@ bool MoveTextBufferPos(Textbuf *tb, int navmode)
|
||||||
*/
|
*/
|
||||||
void UpdateTextBufferSize(Textbuf *tb)
|
void UpdateTextBufferSize(Textbuf *tb)
|
||||||
{
|
{
|
||||||
char *buf;
|
const char* buf;
|
||||||
|
|
||||||
tb->length = 0;
|
tb->length = 0;
|
||||||
tb->width = 0;
|
tb->width = 0;
|
||||||
|
|
||||||
|
|
|
@ -206,9 +206,9 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch(e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
|
const byte* p;
|
||||||
uint i;
|
uint i;
|
||||||
int y;
|
int y;
|
||||||
byte *p;
|
|
||||||
|
|
||||||
w->disabled_state = (msf.playlist <= 3) ? (1 << 11) : 0;
|
w->disabled_state = (msf.playlist <= 3) ? (1 << 11) : 0;
|
||||||
w->click_state |= 0x18;
|
w->click_state |= 0x18;
|
||||||
|
|
|
@ -79,8 +79,9 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e)
|
||||||
_selected_field = 3;
|
_selected_field = 3;
|
||||||
_selected_item = NULL;
|
_selected_item = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
NetworkGameList *sel = _selected_item;
|
const NetworkGameList* sel = _selected_item;
|
||||||
|
|
||||||
w->disabled_state = 0;
|
w->disabled_state = 0;
|
||||||
|
|
||||||
|
@ -891,9 +892,10 @@ static WindowDesc _client_list_desc = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Finds the Xth client-info that is active
|
// Finds the Xth client-info that is active
|
||||||
static NetworkClientInfo *NetworkFindClientInfo(byte client_no)
|
static const NetworkClientInfo* NetworkFindClientInfo(byte client_no)
|
||||||
{
|
{
|
||||||
NetworkClientInfo *ci;
|
const NetworkClientInfo* ci;
|
||||||
|
|
||||||
for (ci = _network_client_info; ci != &_network_client_info[MAX_CLIENT_INFO]; ci++) {
|
for (ci = _network_client_info; ci != &_network_client_info[MAX_CLIENT_INFO]; ci++) {
|
||||||
// Skip non-active items
|
// Skip non-active items
|
||||||
if (ci->client_index == NETWORK_EMPTY_INDEX) continue;
|
if (ci->client_index == NETWORK_EMPTY_INDEX) continue;
|
||||||
|
@ -1012,7 +1014,7 @@ static uint ClientListPopupHeigth(void) {
|
||||||
static Window *PopupClientList(Window *w, int client_no, int x, int y)
|
static Window *PopupClientList(Window *w, int client_no, int x, int y)
|
||||||
{
|
{
|
||||||
int i, h;
|
int i, h;
|
||||||
NetworkClientInfo *ci;
|
const NetworkClientInfo* ci;
|
||||||
DeleteWindowById(WC_TOOLBAR_MENU, 0);
|
DeleteWindowById(WC_TOOLBAR_MENU, 0);
|
||||||
|
|
||||||
// Clean the current actions
|
// Clean the current actions
|
||||||
|
|
4
order.h
4
order.h
|
@ -168,7 +168,7 @@ static inline Order UnpackOrder(uint32 packed)
|
||||||
|
|
||||||
/* Functions */
|
/* Functions */
|
||||||
void BackupVehicleOrders(const Vehicle *v, BackuppedOrders *order);
|
void BackupVehicleOrders(const Vehicle *v, BackuppedOrders *order);
|
||||||
void RestoreVehicleOrders(Vehicle *v, BackuppedOrders *order);
|
void RestoreVehicleOrders(const Vehicle* v, const BackuppedOrders* order);
|
||||||
void DeleteDestinationFromVehicleOrder(Order dest);
|
void DeleteDestinationFromVehicleOrder(Order dest);
|
||||||
void InvalidateVehicleOrder(const Vehicle *v);
|
void InvalidateVehicleOrder(const Vehicle *v);
|
||||||
bool VehicleHasDepotOrders(const Vehicle *v);
|
bool VehicleHasDepotOrders(const Vehicle *v);
|
||||||
|
@ -176,7 +176,7 @@ bool CheckOrders(uint data_a, uint data_b);
|
||||||
void DeleteVehicleOrders(Vehicle *v);
|
void DeleteVehicleOrders(Vehicle *v);
|
||||||
bool IsOrderListShared(const Vehicle *v);
|
bool IsOrderListShared(const Vehicle *v);
|
||||||
void AssignOrder(Order *order, Order data);
|
void AssignOrder(Order *order, Order data);
|
||||||
bool CheckForValidOrders(Vehicle *v);
|
bool CheckForValidOrders(const Vehicle* v);
|
||||||
|
|
||||||
Order UnpackVersion4Order(uint16 packed);
|
Order UnpackVersion4Order(uint16 packed);
|
||||||
Order UnpackOldOrder(uint16 packed);
|
Order UnpackOldOrder(uint16 packed);
|
||||||
|
|
|
@ -785,7 +785,7 @@ void BackupVehicleOrders(const Vehicle *v, BackuppedOrders *bak)
|
||||||
* Restore vehicle orders that are backupped via BackupVehicleOrders
|
* Restore vehicle orders that are backupped via BackupVehicleOrders
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void RestoreVehicleOrders(Vehicle *v, BackuppedOrders *bak)
|
void RestoreVehicleOrders(const Vehicle* v, const BackuppedOrders* bak)
|
||||||
{
|
{
|
||||||
uint i;
|
uint i;
|
||||||
|
|
||||||
|
@ -1100,7 +1100,7 @@ bool IsOrderListShared(const Vehicle *v)
|
||||||
* @return false if there are no valid orders
|
* @return false if there are no valid orders
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool CheckForValidOrders(Vehicle *v)
|
bool CheckForValidOrders(const Vehicle* v)
|
||||||
{
|
{
|
||||||
const Order *order;
|
const Order *order;
|
||||||
|
|
||||||
|
|
|
@ -421,7 +421,7 @@ static void DrawPlayerVehiclesAmount(PlayerID player)
|
||||||
{
|
{
|
||||||
const int x = 110;
|
const int x = 110;
|
||||||
int y = 72;
|
int y = 72;
|
||||||
Vehicle *v;
|
const Vehicle* v;
|
||||||
uint train,road,air,ship;
|
uint train,road,air,ship;
|
||||||
|
|
||||||
DrawString(x, y, STR_7039_VEHICLES, 0);
|
DrawString(x, y, STR_7039_VEHICLES, 0);
|
||||||
|
|
|
@ -27,7 +27,7 @@ static byte _build_depot_direction;
|
||||||
static byte _waypoint_count=1;
|
static byte _waypoint_count=1;
|
||||||
static byte _cur_waypoint_type;
|
static byte _cur_waypoint_type;
|
||||||
|
|
||||||
struct {
|
static struct {
|
||||||
byte orientation;
|
byte orientation;
|
||||||
byte numtracks;
|
byte numtracks;
|
||||||
byte platlength;
|
byte platlength;
|
||||||
|
|
|
@ -799,7 +799,7 @@ static Vehicle *RoadVehFindCloseTo(Vehicle *v, int x, int y, byte dir)
|
||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RoadVehArrivesAt(Vehicle *v, Station *st)
|
static void RoadVehArrivesAt(const Vehicle* v, Station* st)
|
||||||
{
|
{
|
||||||
if (v->cargo_type == CT_PASSENGERS) {
|
if (v->cargo_type == CT_PASSENGERS) {
|
||||||
/* Check if station was ever visited before */
|
/* Check if station was ever visited before */
|
||||||
|
|
|
@ -431,7 +431,7 @@ static void DrawNewRoadVehWindow(Window *w)
|
||||||
|
|
||||||
void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||||
{
|
{
|
||||||
Vehicle *v;
|
const Vehicle* v;
|
||||||
|
|
||||||
if (!success) return;
|
if (!success) return;
|
||||||
|
|
||||||
|
|
10
ship_cmd.c
10
ship_cmd.c
|
@ -57,10 +57,10 @@ int GetShipImage(const Vehicle *v, byte direction)
|
||||||
return _ship_sprites[spritenum] + direction;
|
return _ship_sprites[spritenum] + direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Depot *FindClosestShipDepot(Vehicle *v)
|
static const Depot* FindClosestShipDepot(const Vehicle* v)
|
||||||
{
|
{
|
||||||
Depot *depot;
|
const Depot* depot;
|
||||||
Depot *best_depot = NULL;
|
const Depot* best_depot = NULL;
|
||||||
uint dist;
|
uint dist;
|
||||||
uint best_dist = (uint)-1;
|
uint best_dist = (uint)-1;
|
||||||
TileIndex tile;
|
TileIndex tile;
|
||||||
|
@ -91,7 +91,7 @@ static Depot *FindClosestShipDepot(Vehicle *v)
|
||||||
|
|
||||||
static void CheckIfShipNeedsService(Vehicle *v)
|
static void CheckIfShipNeedsService(Vehicle *v)
|
||||||
{
|
{
|
||||||
Depot *depot;
|
const Depot* depot;
|
||||||
|
|
||||||
if (_patches.servint_ships == 0)
|
if (_patches.servint_ships == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -442,7 +442,7 @@ static void ShipEnterDepot(Vehicle *v)
|
||||||
InvalidateWindowClasses(WC_SHIPS_LIST);
|
InvalidateWindowClasses(WC_SHIPS_LIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ShipArrivesAt(Vehicle *v, Station *st)
|
static void ShipArrivesAt(const Vehicle* v, Station* st)
|
||||||
{
|
{
|
||||||
/* Check if station was ever visited before */
|
/* Check if station was ever visited before */
|
||||||
if (!(st->had_vehicle_of_type & HVOT_SHIP)) {
|
if (!(st->had_vehicle_of_type & HVOT_SHIP)) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ void DrawShipPurchaseInfo(int x, int y, EngineID engine_number)
|
||||||
{
|
{
|
||||||
YearMonthDay ymd;
|
YearMonthDay ymd;
|
||||||
const ShipVehicleInfo *svi = ShipVehInfo(engine_number);
|
const ShipVehicleInfo *svi = ShipVehInfo(engine_number);
|
||||||
Engine *e;
|
const Engine* e;
|
||||||
|
|
||||||
/* Purchase cost - Max speed */
|
/* Purchase cost - Max speed */
|
||||||
SetDParam(0, svi->base_cost * (_price.ship_base>>3)>>5);
|
SetDParam(0, svi->base_cost * (_price.ship_base>>3)>>5);
|
||||||
|
@ -301,7 +301,7 @@ static void ShowShipDetailsWindow(const Vehicle* v)
|
||||||
|
|
||||||
void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||||
{
|
{
|
||||||
Vehicle *v;
|
const Vehicle* v;
|
||||||
if (!success) return;
|
if (!success) return;
|
||||||
|
|
||||||
v = GetVehicle(_new_ship_id);
|
v = GetVehicle(_new_ship_id);
|
||||||
|
@ -755,7 +755,7 @@ static void HandleCloneVehClick(const Vehicle* v, const Window* w)
|
||||||
|
|
||||||
static void ClonePlaceObj(TileIndex tile, const Window* w)
|
static void ClonePlaceObj(TileIndex tile, const Window* w)
|
||||||
{
|
{
|
||||||
Vehicle* v = CheckMouseOverVehicle();
|
const Vehicle* v = CheckMouseOverVehicle();
|
||||||
|
|
||||||
if (v != NULL) HandleCloneVehClick(v, w);
|
if (v != NULL) HandleCloneVehClick(v, w);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2082,7 +2082,7 @@ static void DrawTile_Station(TileInfo *ti)
|
||||||
//debug("Cust-o-mized %p", statspec);
|
//debug("Cust-o-mized %p", statspec);
|
||||||
|
|
||||||
if (statspec != NULL) {
|
if (statspec != NULL) {
|
||||||
Station *st = GetStation(_m[ti->tile].m2);
|
const Station* st = GetStation(_m[ti->tile].m2);
|
||||||
|
|
||||||
relocation = GetCustomStationRelocation(statspec, st, 0);
|
relocation = GetCustomStationRelocation(statspec, st, 0);
|
||||||
//debug("Relocation %d", relocation);
|
//debug("Relocation %d", relocation);
|
||||||
|
@ -2197,7 +2197,7 @@ static uint32 GetTileTrackStatus_Station(TileIndex tile, TransportType mode)
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case TRANSPORT_RAIL:
|
case TRANSPORT_RAIL:
|
||||||
if (i < 8) {
|
if (i < 8) {
|
||||||
const byte tile_track_status_rail[8] = { 1, 2, 1, 2, 1, 2, 1, 2 };
|
static const byte tile_track_status_rail[] = { 1, 2, 1, 2, 1, 2, 1, 2 };
|
||||||
j = tile_track_status_rail[i];
|
j = tile_track_status_rail[i];
|
||||||
}
|
}
|
||||||
j += (j << 8);
|
j += (j << 8);
|
||||||
|
|
|
@ -164,10 +164,8 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
{
|
{
|
||||||
byte p = 0;
|
byte p = 0;
|
||||||
Station *st;
|
int xb = 2;
|
||||||
int x,xb = 2;
|
|
||||||
int y = 16; // offset from top of widget
|
int y = 16; // offset from top of widget
|
||||||
int j;
|
|
||||||
|
|
||||||
if (w->vscroll.count == 0) { // player has no stations
|
if (w->vscroll.count == 0) { // player has no stations
|
||||||
DrawString(xb, y, STR_304A_NONE, 0);
|
DrawString(xb, y, STR_304A_NONE, 0);
|
||||||
|
@ -178,7 +176,9 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
|
||||||
assert(i < _num_station_sort[owner]); // at least one station must exist
|
assert(i < _num_station_sort[owner]); // at least one station must exist
|
||||||
|
|
||||||
while (i < _num_station_sort[owner]) { // do until max number of stations of owner
|
while (i < _num_station_sort[owner]) { // do until max number of stations of owner
|
||||||
st = GetStation(_station_sort[i].index);
|
const Station* st = GetStation(_station_sort[i].index);
|
||||||
|
uint j;
|
||||||
|
int x;
|
||||||
|
|
||||||
assert(st->xy && st->owner == owner);
|
assert(st->xy && st->owner == owner);
|
||||||
|
|
||||||
|
@ -211,7 +211,8 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
{
|
{
|
||||||
const PlayerID owner = w->window_number;
|
const PlayerID owner = w->window_number;
|
||||||
Station *st;
|
const Station* st;
|
||||||
|
|
||||||
id_v += (owner == 0) ? 0 : _num_station_sort[owner - 1]; // first element in list
|
id_v += (owner == 0) ? 0 : _num_station_sort[owner - 1]; // first element in list
|
||||||
|
|
||||||
if (id_v >= _num_station_sort[owner]) { return;} // click out of station bound
|
if (id_v >= _num_station_sort[owner]) { return;} // click out of station bound
|
||||||
|
@ -310,17 +311,13 @@ static const Widget _station_view_widgets[] = {
|
||||||
|
|
||||||
static void DrawStationViewWindow(Window *w)
|
static void DrawStationViewWindow(Window *w)
|
||||||
{
|
{
|
||||||
Station *st;
|
StationID station_id = w->window_number;
|
||||||
int i;
|
const Station* st = GetStation(station_id);
|
||||||
int num;
|
uint i;
|
||||||
|
uint num;
|
||||||
int x,y;
|
int x,y;
|
||||||
int pos;
|
int pos;
|
||||||
StringID str;
|
StringID str;
|
||||||
StationID station_id;
|
|
||||||
|
|
||||||
station_id = w->window_number;
|
|
||||||
|
|
||||||
st = GetStation(station_id);
|
|
||||||
|
|
||||||
num = 1;
|
num = 1;
|
||||||
for(i=0; i!=NUM_CARGO; i++) {
|
for(i=0; i!=NUM_CARGO; i++) {
|
||||||
|
|
|
@ -702,10 +702,9 @@ static char *FormatString(char *buff, const char *str, const int32 *argv, uint c
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case 0x9A: { // {STATION}
|
case 0x9A: { // {STATION}
|
||||||
Station *st;
|
const Station* st = GetStation(GetInt32(&argv));
|
||||||
int32 temp[2];
|
int32 temp[2];
|
||||||
|
|
||||||
st = GetStation(GetInt32(&argv));
|
|
||||||
if (st->xy == 0) { // station doesn't exist anymore
|
if (st->xy == 0) { // station doesn't exist anymore
|
||||||
buff = GetStringWithArgs(buff, STR_UNKNOWN_DESTINATION, NULL);
|
buff = GetStringWithArgs(buff, STR_UNKNOWN_DESTINATION, NULL);
|
||||||
break;
|
break;
|
||||||
|
@ -716,10 +715,10 @@ static char *FormatString(char *buff, const char *str, const int32 *argv, uint c
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x9B: { // {TOWN}
|
case 0x9B: { // {TOWN}
|
||||||
Town *t;
|
const Town* t = GetTown(GetInt32(&argv));
|
||||||
int32 temp[1];
|
int32 temp[1];
|
||||||
t = GetTown(GetInt32(&argv));
|
|
||||||
assert(t->xy);
|
assert(t->xy);
|
||||||
|
|
||||||
temp[0] = t->townnameparts;
|
temp[0] = t->townnameparts;
|
||||||
buff = GetStringWithArgs(buff, t->townnametype, temp);
|
buff = GetStringWithArgs(buff, t->townnametype, temp);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
static void HandleSubsidyClick(int y)
|
static void HandleSubsidyClick(int y)
|
||||||
{
|
{
|
||||||
Subsidy *s;
|
const Subsidy* s;
|
||||||
int num,offs;
|
int num,offs;
|
||||||
TileIndex xy;
|
TileIndex xy;
|
||||||
|
|
||||||
|
@ -74,12 +74,11 @@ handle_click:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DrawSubsidiesWindow(Window *w)
|
static void DrawSubsidiesWindow(const Window* w)
|
||||||
{
|
{
|
||||||
YearMonthDay ymd;
|
YearMonthDay ymd;
|
||||||
Subsidy *s;
|
const Subsidy* s;
|
||||||
int x,xt,y,num,x2;
|
int x,xt,y,num,x2;
|
||||||
Player *p;
|
|
||||||
|
|
||||||
DrawWindowWidgets(w);
|
DrawWindowWidgets(w);
|
||||||
|
|
||||||
|
@ -114,6 +113,8 @@ static void DrawSubsidiesWindow(Window *w)
|
||||||
|
|
||||||
for(s=_subsidies; s != endof(_subsidies); s++) {
|
for(s=_subsidies; s != endof(_subsidies); s++) {
|
||||||
if (s->cargo_type != CT_INVALID && s->age >= 12) {
|
if (s->cargo_type != CT_INVALID && s->age >= 12) {
|
||||||
|
const Player* p;
|
||||||
|
|
||||||
SetupSubsidyDecodeParam(s, 1);
|
SetupSubsidyDecodeParam(s, 1);
|
||||||
|
|
||||||
p = GetPlayer(GetStation(s->to)->owner);
|
p = GetPlayer(GetStation(s->to)->owner);
|
||||||
|
|
|
@ -201,7 +201,7 @@ static void UpdateTownRadius(Town *t);
|
||||||
|
|
||||||
static bool IsCloseToTown(TileIndex tile, uint dist)
|
static bool IsCloseToTown(TileIndex tile, uint dist)
|
||||||
{
|
{
|
||||||
Town *t;
|
const Town* t;
|
||||||
|
|
||||||
FOR_ALL_TOWNS(t) {
|
FOR_ALL_TOWNS(t) {
|
||||||
if (t->xy != 0 && DistanceManhattan(tile, t->xy) < dist)
|
if (t->xy != 0 && DistanceManhattan(tile, t->xy) < dist)
|
||||||
|
@ -245,7 +245,8 @@ static void ChangePopulation(Town *t, int mod)
|
||||||
uint32 GetWorldPopulation(void)
|
uint32 GetWorldPopulation(void)
|
||||||
{
|
{
|
||||||
uint32 pop;
|
uint32 pop;
|
||||||
Town *t;
|
const Town* t;
|
||||||
|
|
||||||
pop = 0;
|
pop = 0;
|
||||||
FOR_ALL_TOWNS(t) {
|
FOR_ALL_TOWNS(t) {
|
||||||
pop += t->population;
|
pop += t->population;
|
||||||
|
|
|
@ -107,7 +107,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
{
|
{
|
||||||
int y;
|
int y;
|
||||||
Player *p;
|
const Player* p;
|
||||||
int r;
|
int r;
|
||||||
StringID str;
|
StringID str;
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ static int CDECL TownPopSorter(const void *a, const void *b)
|
||||||
|
|
||||||
static void MakeSortedTownList(void)
|
static void MakeSortedTownList(void)
|
||||||
{
|
{
|
||||||
Town *t;
|
const Town* t;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
/* Create array for sorting */
|
/* Create array for sorting */
|
||||||
|
@ -439,7 +439,7 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e)
|
||||||
DoDrawString(_town_sort_order & 1 ? DOWNARROW : UPARROW, (_town_sort_order <= 1) ? 88 : 187, 15, 0x10);
|
DoDrawString(_town_sort_order & 1 ? DOWNARROW : UPARROW, (_town_sort_order <= 1) ? 88 : 187, 15, 0x10);
|
||||||
|
|
||||||
{
|
{
|
||||||
Town *t;
|
const Town* t;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
uint16 i = w->vscroll.pos;
|
uint16 i = w->vscroll.pos;
|
||||||
int y = 28;
|
int y = 28;
|
||||||
|
@ -486,7 +486,7 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e)
|
||||||
if (id_v >= _num_town_sort) return; // click out of town bounds
|
if (id_v >= _num_town_sort) return; // click out of town bounds
|
||||||
|
|
||||||
{
|
{
|
||||||
Town *t = GetTown(_town_sort[id_v]);
|
const Town* t = GetTown(_town_sort[id_v]);
|
||||||
assert(t->xy);
|
assert(t->xy);
|
||||||
|
|
||||||
ScrollMainWindowToTile(t->xy);
|
ScrollMainWindowToTile(t->xy);
|
||||||
|
|
21
train_cmd.c
21
train_cmd.c
|
@ -188,9 +188,10 @@ enum AccelType {
|
||||||
AM_BRAKE
|
AM_BRAKE
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool TrainShouldStop(Vehicle *v, TileIndex tile)
|
static bool TrainShouldStop(const Vehicle* v, TileIndex tile)
|
||||||
{
|
{
|
||||||
Order *o = &v->current_order;
|
const Order* o = &v->current_order;
|
||||||
|
|
||||||
assert(v->type == VEH_Train);
|
assert(v->type == VEH_Train);
|
||||||
assert(IsTileType(v->tile, MP_STATION));
|
assert(IsTileType(v->tile, MP_STATION));
|
||||||
//When does a train drive through a station
|
//When does a train drive through a station
|
||||||
|
@ -590,9 +591,9 @@ static int32 CmdBuildRailWagon(EngineID engine, TileIndex tile, uint32 flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move all free vehicles in the depot to the train
|
// Move all free vehicles in the depot to the train
|
||||||
static void NormalizeTrainVehInDepot(Vehicle *u)
|
static void NormalizeTrainVehInDepot(const Vehicle* u)
|
||||||
{
|
{
|
||||||
Vehicle *v;
|
const Vehicle* v;
|
||||||
|
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
if (v->type == VEH_Train && v->subtype == TS_Free_Car &&
|
if (v->type == VEH_Train && v->subtype == TS_Free_Car &&
|
||||||
|
@ -624,7 +625,7 @@ static const byte _railveh_score[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int32 EstimateTrainCost(const RailVehicleInfo *rvi)
|
static int32 EstimateTrainCost(const RailVehicleInfo* rvi)
|
||||||
{
|
{
|
||||||
return (rvi->base_cost * (_price.build_railvehicle >> 3)) >> 5;
|
return (rvi->base_cost * (_price.build_railvehicle >> 3)) >> 5;
|
||||||
}
|
}
|
||||||
|
@ -1443,7 +1444,7 @@ static void AdvanceWagons(Vehicle *v, bool before)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TileIndex GetVehicleTileOutOfTunnel(const Vehicle *v, bool reverse)
|
static TileIndex GetVehicleTileOutOfTunnel(const Vehicle* v, bool reverse)
|
||||||
{
|
{
|
||||||
TileIndex tile;
|
TileIndex tile;
|
||||||
byte direction = (!reverse) ? DirToDiagdir(v->direction) : ReverseDiagdir(v->direction >> 1);
|
byte direction = (!reverse) ? DirToDiagdir(v->direction) : ReverseDiagdir(v->direction >> 1);
|
||||||
|
@ -1859,9 +1860,9 @@ static const int8 _vehicle_smoke_pos[8] = {
|
||||||
1, 1, 1, 0, -1, -1, -1, 0
|
1, 1, 1, 0, -1, -1, -1, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
static void HandleLocomotiveSmokeCloud(Vehicle *v)
|
static void HandleLocomotiveSmokeCloud(const Vehicle* v)
|
||||||
{
|
{
|
||||||
Vehicle *u;
|
const Vehicle* u;
|
||||||
|
|
||||||
if (v->vehstatus & VS_TRAIN_SLOWING || v->load_unload_time_rem != 0 || v->cur_speed < 2)
|
if (v->vehstatus & VS_TRAIN_SLOWING || v->load_unload_time_rem != 0 || v->cur_speed < 2)
|
||||||
return;
|
return;
|
||||||
|
@ -2054,7 +2055,7 @@ static bool NtpCallbFindStation(TileIndex tile, TrainTrackFollowerData *ttfd, in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FillWithStationData(TrainTrackFollowerData *fd, Vehicle *v)
|
static void FillWithStationData(TrainTrackFollowerData* fd, const Vehicle* v)
|
||||||
{
|
{
|
||||||
fd->dest_coords = v->dest_tile;
|
fd->dest_coords = v->dest_tile;
|
||||||
if (v->current_order.type == OT_GOTO_STATION)
|
if (v->current_order.type == OT_GOTO_STATION)
|
||||||
|
@ -3535,7 +3536,7 @@ void TrainEnterDepot(Vehicle *v, TileIndex tile)
|
||||||
|
|
||||||
static void CheckIfTrainNeedsService(Vehicle *v)
|
static void CheckIfTrainNeedsService(Vehicle *v)
|
||||||
{
|
{
|
||||||
Depot *depot;
|
const Depot* depot;
|
||||||
TrainFindDepotData tfdd;
|
TrainFindDepotData tfdd;
|
||||||
|
|
||||||
if (PBSTileReserved(v->tile) & v->u.rail.track)
|
if (PBSTileReserved(v->tile) & v->u.rail.track)
|
||||||
|
|
|
@ -148,7 +148,7 @@ void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
void CcBuildLoco(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
void CcBuildLoco(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||||
{
|
{
|
||||||
Vehicle *v;
|
const Vehicle* v;
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
return;
|
return;
|
||||||
|
|
14
vehicle.c
14
vehicle.c
|
@ -39,25 +39,25 @@
|
||||||
#define CMD_STARTSTOP_VEH(x) _veh_start_stop_proc_table[ x - VEH_Train]
|
#define CMD_STARTSTOP_VEH(x) _veh_start_stop_proc_table[ x - VEH_Train]
|
||||||
#define CMD_REFIT_VEH(x) _veh_refit_proc_table[ x - VEH_Train]
|
#define CMD_REFIT_VEH(x) _veh_refit_proc_table[ x - VEH_Train]
|
||||||
|
|
||||||
static uint32 const _veh_build_proc_table[] = {
|
static const uint32 _veh_build_proc_table[] = {
|
||||||
CMD_BUILD_RAIL_VEHICLE,
|
CMD_BUILD_RAIL_VEHICLE,
|
||||||
CMD_BUILD_ROAD_VEH,
|
CMD_BUILD_ROAD_VEH,
|
||||||
CMD_BUILD_SHIP,
|
CMD_BUILD_SHIP,
|
||||||
CMD_BUILD_AIRCRAFT,
|
CMD_BUILD_AIRCRAFT,
|
||||||
};
|
};
|
||||||
static uint32 const _veh_sell_proc_table[] = {
|
static const uint32 _veh_sell_proc_table[] = {
|
||||||
CMD_SELL_RAIL_WAGON,
|
CMD_SELL_RAIL_WAGON,
|
||||||
CMD_SELL_ROAD_VEH,
|
CMD_SELL_ROAD_VEH,
|
||||||
CMD_SELL_SHIP,
|
CMD_SELL_SHIP,
|
||||||
CMD_SELL_AIRCRAFT,
|
CMD_SELL_AIRCRAFT,
|
||||||
};
|
};
|
||||||
static uint32 const _veh_start_stop_proc_table[] = {
|
static const uint32 _veh_start_stop_proc_table[] = {
|
||||||
CMD_START_STOP_TRAIN,
|
CMD_START_STOP_TRAIN,
|
||||||
CMD_START_STOP_ROADVEH,
|
CMD_START_STOP_ROADVEH,
|
||||||
CMD_START_STOP_SHIP,
|
CMD_START_STOP_SHIP,
|
||||||
CMD_START_STOP_AIRCRAFT,
|
CMD_START_STOP_AIRCRAFT,
|
||||||
};
|
};
|
||||||
static uint32 const _veh_refit_proc_table[] = {
|
static const uint32 _veh_refit_proc_table[] = {
|
||||||
CMD_REFIT_RAIL_VEHICLE,
|
CMD_REFIT_RAIL_VEHICLE,
|
||||||
0, // road vehicles can't be refitted
|
0, // road vehicles can't be refitted
|
||||||
CMD_REFIT_SHIP,
|
CMD_REFIT_SHIP,
|
||||||
|
@ -107,7 +107,7 @@ bool VehicleNeedsService(const Vehicle *v)
|
||||||
(v->date_of_last_service + v->service_interval < _date);
|
(v->date_of_last_service + v->service_interval < _date);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VehicleInTheWayErrMsg(Vehicle *v)
|
void VehicleInTheWayErrMsg(const Vehicle* v)
|
||||||
{
|
{
|
||||||
StringID id;
|
StringID id;
|
||||||
|
|
||||||
|
@ -525,7 +525,7 @@ Vehicle *GetFirstVehicleInChain(const Vehicle *v)
|
||||||
return (Vehicle*)v;
|
return (Vehicle*)v;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CountVehiclesInChain(Vehicle *v)
|
uint CountVehiclesInChain(const Vehicle* v)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
do count++; while ( (v=v->next) != NULL);
|
do count++; while ( (v=v->next) != NULL);
|
||||||
|
@ -570,7 +570,7 @@ void DisasterVehicle_Tick(Vehicle *v);
|
||||||
static void MaybeReplaceVehicle(Vehicle *v);
|
static void MaybeReplaceVehicle(Vehicle *v);
|
||||||
|
|
||||||
// head of the linked list to tell what vehicles that visited a depot in a tick
|
// head of the linked list to tell what vehicles that visited a depot in a tick
|
||||||
Vehicle *_first_veh_in_depot_list;
|
static Vehicle* _first_veh_in_depot_list;
|
||||||
|
|
||||||
/** Adds a vehicle to the list of vehicles, that visited a depot this tick
|
/** Adds a vehicle to the list of vehicles, that visited a depot this tick
|
||||||
* @param *v vehicle to add
|
* @param *v vehicle to add
|
||||||
|
|
|
@ -293,7 +293,7 @@ void AfterLoadVehicles(void);
|
||||||
Vehicle *GetLastVehicleInChain(Vehicle *v);
|
Vehicle *GetLastVehicleInChain(Vehicle *v);
|
||||||
Vehicle *GetPrevVehicleInChain(const Vehicle *v);
|
Vehicle *GetPrevVehicleInChain(const Vehicle *v);
|
||||||
Vehicle *GetFirstVehicleInChain(const Vehicle *v);
|
Vehicle *GetFirstVehicleInChain(const Vehicle *v);
|
||||||
int CountVehiclesInChain(Vehicle *v);
|
uint CountVehiclesInChain(const Vehicle* v);
|
||||||
void DeleteVehicle(Vehicle *v);
|
void DeleteVehicle(Vehicle *v);
|
||||||
void DeleteVehicleChain(Vehicle *v);
|
void DeleteVehicleChain(Vehicle *v);
|
||||||
void *VehicleFromPos(TileIndex tile, void *data, VehicleFromPosProc *proc);
|
void *VehicleFromPos(TileIndex tile, void *data, VehicleFromPosProc *proc);
|
||||||
|
@ -323,7 +323,7 @@ Vehicle *CreateEffectVehicleRel(const Vehicle *v, int x, int y, int z, EffectVeh
|
||||||
|
|
||||||
uint32 VehicleEnterTile(Vehicle *v, TileIndex tile, int x, int y);
|
uint32 VehicleEnterTile(Vehicle *v, TileIndex tile, int x, int y);
|
||||||
|
|
||||||
void VehicleInTheWayErrMsg(Vehicle *v);
|
void VehicleInTheWayErrMsg(const Vehicle* v);
|
||||||
Vehicle *FindVehicleBetween(TileIndex from, TileIndex to, byte z);
|
Vehicle *FindVehicleBetween(TileIndex from, TileIndex to, byte z);
|
||||||
TileIndex GetVehicleOutOfTunnelTile(const Vehicle *v);
|
TileIndex GetVehicleOutOfTunnelTile(const Vehicle *v);
|
||||||
|
|
||||||
|
|
|
@ -490,9 +490,9 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
|
||||||
}
|
}
|
||||||
case VEH_Road: {
|
case VEH_Road: {
|
||||||
int num = NUM_ROAD_ENGINES;
|
int num = NUM_ROAD_ENGINES;
|
||||||
Engine *e = GetEngine(ROAD_ENGINES_INDEX);
|
const Engine* e = GetEngine(ROAD_ENGINES_INDEX);
|
||||||
byte cargo;
|
byte cargo;
|
||||||
EngineInfo *info;
|
const EngineInfo* info;
|
||||||
engine_id = ROAD_ENGINES_INDEX;
|
engine_id = ROAD_ENGINES_INDEX;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -523,9 +523,9 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
|
||||||
|
|
||||||
case VEH_Ship: {
|
case VEH_Ship: {
|
||||||
int num = NUM_SHIP_ENGINES;
|
int num = NUM_SHIP_ENGINES;
|
||||||
Engine *e = GetEngine(SHIP_ENGINES_INDEX);
|
const Engine* e = GetEngine(SHIP_ENGINES_INDEX);
|
||||||
byte cargo, refittable;
|
byte cargo, refittable;
|
||||||
EngineInfo *info;
|
const EngineInfo* info;
|
||||||
engine_id = SHIP_ENGINES_INDEX;
|
engine_id = SHIP_ENGINES_INDEX;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -560,8 +560,8 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
|
||||||
case VEH_Aircraft:{
|
case VEH_Aircraft:{
|
||||||
int num = NUM_AIRCRAFT_ENGINES;
|
int num = NUM_AIRCRAFT_ENGINES;
|
||||||
byte subtype;
|
byte subtype;
|
||||||
Engine *e = GetEngine(AIRCRAFT_ENGINES_INDEX);
|
const Engine* e = GetEngine(AIRCRAFT_ENGINES_INDEX);
|
||||||
EngineInfo *info;
|
const EngineInfo* info;
|
||||||
engine_id = AIRCRAFT_ENGINES_INDEX;
|
engine_id = AIRCRAFT_ENGINES_INDEX;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -635,10 +635,10 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
|
||||||
|
|
||||||
case VEH_Road: {
|
case VEH_Road: {
|
||||||
int num = NUM_ROAD_ENGINES;
|
int num = NUM_ROAD_ENGINES;
|
||||||
Engine *e = GetEngine(ROAD_ENGINES_INDEX);
|
const Engine* e = GetEngine(ROAD_ENGINES_INDEX);
|
||||||
EngineID engine_id = ROAD_ENGINES_INDEX;
|
EngineID engine_id = ROAD_ENGINES_INDEX;
|
||||||
byte cargo;
|
byte cargo;
|
||||||
EngineInfo *info;
|
const EngineInfo* info;
|
||||||
|
|
||||||
if ( selected_id[0] >= ROAD_ENGINES_INDEX && selected_id[0] <= SHIP_ENGINES_INDEX ) {
|
if ( selected_id[0] >= ROAD_ENGINES_INDEX && selected_id[0] <= SHIP_ENGINES_INDEX ) {
|
||||||
cargo = RoadVehInfo(selected_id[0])->cargo_type;
|
cargo = RoadVehInfo(selected_id[0])->cargo_type;
|
||||||
|
@ -671,10 +671,10 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
|
||||||
|
|
||||||
case VEH_Ship: {
|
case VEH_Ship: {
|
||||||
int num = NUM_SHIP_ENGINES;
|
int num = NUM_SHIP_ENGINES;
|
||||||
Engine *e = GetEngine(SHIP_ENGINES_INDEX);
|
const Engine* e = GetEngine(SHIP_ENGINES_INDEX);
|
||||||
EngineID engine_id = SHIP_ENGINES_INDEX;
|
EngineID engine_id = SHIP_ENGINES_INDEX;
|
||||||
byte cargo, refittable;
|
byte cargo, refittable;
|
||||||
EngineInfo *info;
|
const EngineInfo* info;
|
||||||
|
|
||||||
if ( selected_id[0] != -1 ) {
|
if ( selected_id[0] != -1 ) {
|
||||||
cargo = ShipVehInfo(selected_id[0])->cargo_type;
|
cargo = ShipVehInfo(selected_id[0])->cargo_type;
|
||||||
|
@ -710,10 +710,10 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
|
||||||
case VEH_Aircraft: {
|
case VEH_Aircraft: {
|
||||||
if ( selected_id[0] != -1 ) {
|
if ( selected_id[0] != -1 ) {
|
||||||
int num = NUM_AIRCRAFT_ENGINES;
|
int num = NUM_AIRCRAFT_ENGINES;
|
||||||
Engine *e = GetEngine(AIRCRAFT_ENGINES_INDEX);
|
const Engine* e = GetEngine(AIRCRAFT_ENGINES_INDEX);
|
||||||
EngineID engine_id = AIRCRAFT_ENGINES_INDEX;
|
EngineID engine_id = AIRCRAFT_ENGINES_INDEX;
|
||||||
byte subtype = AircraftVehInfo(selected_id[0])->subtype;
|
byte subtype = AircraftVehInfo(selected_id[0])->subtype;
|
||||||
EngineInfo *info;
|
const EngineInfo* info;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
info = &_engine_info[engine_id];
|
info = &_engine_info[engine_id];
|
||||||
|
|
6
window.c
6
window.c
|
@ -158,7 +158,7 @@ void DrawOverlappedWindowForAll(int left, int top, int right, int bottom)
|
||||||
|
|
||||||
void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom)
|
void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom)
|
||||||
{
|
{
|
||||||
Window *v = w;
|
const Window* v = w;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
while (++v != _last_window) {
|
while (++v != _last_window) {
|
||||||
|
@ -1574,7 +1574,7 @@ void InvalidateWidget(const Window* w, byte widget_index)
|
||||||
|
|
||||||
void InvalidateWindowWidget(byte cls, WindowNumber number, byte widget_index)
|
void InvalidateWindowWidget(byte cls, WindowNumber number, byte widget_index)
|
||||||
{
|
{
|
||||||
Window *w;
|
const Window* w;
|
||||||
|
|
||||||
for(w=_windows; w!=_last_window; w++) {
|
for(w=_windows; w!=_last_window; w++) {
|
||||||
if (w->window_class==cls && w->window_number==number) {
|
if (w->window_class==cls && w->window_number==number) {
|
||||||
|
@ -1585,7 +1585,7 @@ void InvalidateWindowWidget(byte cls, WindowNumber number, byte widget_index)
|
||||||
|
|
||||||
void InvalidateWindowClasses(byte cls)
|
void InvalidateWindowClasses(byte cls)
|
||||||
{
|
{
|
||||||
Window *w;
|
const Window* w;
|
||||||
for(w=_windows; w!=_last_window; w++) {
|
for(w=_windows; w!=_last_window; w++) {
|
||||||
if (w->window_class==cls)
|
if (w->window_class==cls)
|
||||||
SetWindowDirty(w);
|
SetWindowDirty(w);
|
||||||
|
|
Loading…
Reference in New Issue