(svn r3172) static, const

This commit is contained in:
tron 2005-11-13 13:43:55 +00:00
parent 59e885c2bf
commit ee15e3de13
31 changed files with 132 additions and 131 deletions

View File

@ -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 bool AiIsTileBanned(Player *p, TileIndex tile, byte val) {
static bool AiIsTileBanned(const Player* p, TileIndex tile, byte val)
{
int i;
for(i=0; i!=p->ai.banned_tile_count; i++)

View File

@ -544,7 +544,7 @@ void HandleClickOnAircraft(Vehicle *v)
static void CheckIfAircraftNeedsService(Vehicle *v)
{
Station *st;
const Station* st;
if (_patches.servint_aircraft == 0)
return;
@ -1269,7 +1269,7 @@ static void AircraftEntersTerminal(Vehicle *v)
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));
}
@ -1324,7 +1324,7 @@ static void AircraftLandAirplane(Vehicle *v)
// set the right pos when heading to other airports after takeoff
static void AircraftNextAirportPos_and_Order(Vehicle *v)
{
Station *st;
const Station* st;
const AirportFTAClass *Airport;
if (v->current_order.type == OT_GOTO_STATION ||
@ -1634,7 +1634,7 @@ static AircraftStateHandler * const _aircraft_state_handlers[] = {
AircraftEventHandler_HeliEndLanding,// HELIENDLANDING = 18
};
static void AirportClearBlock(Vehicle *v, const AirportFTAClass *Airport)
static void AirportClearBlock(const Vehicle* v, const AirportFTAClass* Airport)
{
Station *st;
// 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
static bool AirportHasBlock(Vehicle *v, AirportFTA *current_pos, const AirportFTAClass *Airport)
{
Station *st;
uint32 airport_flags;
AirportFTA *next, *reference;
reference = &Airport->layout[v->u.air.pos];
next = &Airport->layout[current_pos->next_position];
const AirportFTA* reference = &Airport->layout[v->u.air.pos];
const AirportFTA* next = &Airport->layout[current_pos->next_position];
// same block, then of course we can move
if (Airport->layout[current_pos->position].block != next->block) {
airport_flags = next->block;
st = GetStation(v->u.air.targetairport);
const Station* st = GetStation(v->u.air.targetairport);
uint32 airport_flags = next->block;
// check additional possible extra blocks
if (current_pos != reference && current_pos->block != NOTHING_block) {
airport_flags |= current_pos->block;

View File

@ -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)
{
Vehicle *v;
if (success) {
v = GetVehicle(_new_aircraft_id);
const Vehicle* v = GetVehicle(_new_aircraft_id);
if (v->tile == _backup_orders_tile) {
_backup_orders_tile = 0;
RestoreVehicleOrders(v, _backup_orders_data);
@ -508,7 +507,7 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e)
{
switch(e->event) {
case WE_PAINT: {
Vehicle *v = GetVehicle(w->window_number);
const Vehicle* v = GetVehicle(w->window_number);
uint32 disabled = 1<<8;
StringID str;

View File

@ -825,7 +825,7 @@ void StartupEconomy(void)
_economy.fluct = GB(Random(), 0, 8) + 168;
}
Pair SetupSubsidyDecodeParam(Subsidy *s, bool mode)
Pair SetupSubsidyDecodeParam(const Subsidy* s, bool mode)
{
TileIndex tile;
TileIndex tile2;
@ -983,7 +983,7 @@ static void FindSubsidyCargoRoute(FoundRoute *fr)
static bool CheckSubsidyDuplicate(Subsidy *s)
{
Subsidy *ss;
const Subsidy* ss;
for(ss=_subsidies; ss != endof(_subsidies); ss++) {
if (s != ss &&

View File

@ -60,7 +60,7 @@ void UpdatePlayerHouse(Player *p, uint score);
VARDEF Subsidy _subsidies[MAX_PLAYERS];
Pair SetupSubsidyDecodeParam(Subsidy *s, bool mode);
Pair SetupSubsidyDecodeParam(const Subsidy* s, bool mode);
void DeleteSubsidyWithIndustry(uint16 index);
void DeleteSubsidyWithStation(uint16 index);

View File

@ -9,7 +9,7 @@ struct Industry {
TileIndex xy;
byte width; /* swapped order of w/h with town */
byte height;
Town *town;
const Town* town;
byte produced_cargo[2];
uint16 cargo_waiting[2];
byte production_rate[2];

View File

@ -38,8 +38,8 @@ void IndustryPoolNewBlock(uint start_item)
/* Initialize the industry-pool */
MemoryPool _industry_pool = { "Industry", INDUSTRY_POOL_MAX_BLOCKS, INDUSTRY_POOL_BLOCK_SIZE_BITS, sizeof(Industry), &IndustryPoolNewBlock, 0, 0, NULL };
byte _industry_sound_ctr;
TileIndex _industry_sound_tile;
static byte _industry_sound_ctr;
static TileIndex _industry_sound_tile;
void ShowIndustryViewWindow(int industry);
void BuildOilRig(TileIndex tile);
@ -341,7 +341,7 @@ static IndustryDrawTileProc * const _industry_draw_tile_procs[5] = {
static void DrawTile_Industry(TileInfo *ti)
{
Industry *ind;
const Industry* ind;
const DrawIndustryTileStruct *dits;
byte z;
uint32 image, ormod;
@ -425,7 +425,7 @@ static void GetAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac)
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->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)
{
Industry *i = GetIndustry(_m[tile].m2);
const Industry* i = GetIndustry(_m[tile].m2);
b[0] = i->produced_cargo[0];
b[1] = i->produced_cargo[1];
}
@ -1262,10 +1263,10 @@ static bool CheckSuitableIndustryPos(TileIndex tile)
return true;
}
static Town *CheckMultipleIndustryInTown(TileIndex tile, int type)
static const Town* CheckMultipleIndustryInTown(TileIndex tile, int type)
{
Town *t;
Industry *i;
const Town* t;
const Industry* i;
t = ClosestTownFromTile(tile, (uint)-1);
@ -1309,7 +1310,7 @@ static const byte _industry_map5_bits[] = {
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;
@ -1451,7 +1452,7 @@ static Industry *AllocateIndustry(void)
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;
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)
{
Town *t;
const Town* t;
Industry *i;
TileIndex tile = TileVirtXY(x, y);
int num;
@ -1601,7 +1602,7 @@ int32 CmdBuildIndustry(int x, int y, uint32 flags, uint32 p1, uint32 p2)
Industry *CreateNewIndustry(TileIndex tile, int type)
{
Town *t;
const Town* t;
const IndustryTileTable *it;
Industry *i;

View File

@ -566,9 +566,9 @@ static const Widget _player_menu_widgets[] = {
static int GetPlayerIndexFromMenu(int index)
{
Player *p;
if (index >= 0) {
const Player* p;
FOR_ALL_PLAYERS(p) {
if (p->is_active) {
if (--index < 0)
@ -582,7 +582,7 @@ static int GetPlayerIndexFromMenu(int index)
static void UpdatePlayerMenuHeight(Window *w)
{
int num = 0;
Player *p;
const Player* p;
FOR_ALL_PLAYERS(p) {
if (p->is_active)
@ -822,7 +822,7 @@ static void ToolbarIndustryClick(Window *w)
static void ToolbarTrainClick(Window *w)
{
Vehicle *v;
const Vehicle* v;
int dis = -1;
FOR_ALL_VEHICLES(v)
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)
{
Vehicle *v;
const Vehicle* v;
int dis = -1;
FOR_ALL_VEHICLES(v)
if (v->type == VEH_Road) CLRBIT(dis, v->owner);
@ -840,7 +840,7 @@ static void ToolbarRoadClick(Window *w)
static void ToolbarShipClick(Window *w)
{
Vehicle *v;
const Vehicle* v;
int dis = -1;
FOR_ALL_VEHICLES(v)
if (v->type == VEH_Ship) CLRBIT(dis, v->owner);
@ -849,7 +849,7 @@ static void ToolbarShipClick(Window *w)
static void ToolbarAirClick(Window *w)
{
Vehicle *v;
const Vehicle* v;
int dis = -1;
FOR_ALL_VEHICLES(v)
if (v->type == VEH_Aircraft) CLRBIT(dis, v->owner);
@ -1651,11 +1651,11 @@ static const Widget _scenedit_industry_candy_widgets[] = {
{ WIDGETS_END},
};
int _industry_type_to_place;
static bool AnyTownExists(void)
{
Town *t;
const Town* t;
FOR_ALL_TOWNS(t) {
if (t->xy)
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},
};
static int _industry_type_to_place;
bool _ignore_restrictions;
static void ScenEditIndustryWndProc(Window *w, WindowEvent *e)

View File

@ -29,7 +29,7 @@
static bool _fios_path_changed;
static bool _savegame_sort_dirty;
bool _query_string_active;
static bool _query_string_active;
typedef struct LandInfoData {
Town *town;
@ -41,10 +41,9 @@ typedef struct LandInfoData {
static void LandInfoWndProc(Window *w, WindowEvent *e)
{
LandInfoData *lid;
StringID str;
if (e->event == WE_PAINT) {
const LandInfoData* lid;
StringID str;
int i;
DrawWindowWidgets(w);
@ -883,7 +882,8 @@ bool MoveTextBufferPos(Textbuf *tb, int navmode)
*/
void UpdateTextBufferSize(Textbuf *tb)
{
char *buf;
const char* buf;
tb->length = 0;
tb->width = 0;

View File

@ -206,9 +206,9 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
{
switch(e->event) {
case WE_PAINT: {
const byte* p;
uint i;
int y;
byte *p;
w->disabled_state = (msf.playlist <= 3) ? (1 << 11) : 0;
w->click_state |= 0x18;

View File

@ -79,8 +79,9 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e)
_selected_field = 3;
_selected_item = NULL;
break;
case WE_PAINT: {
NetworkGameList *sel = _selected_item;
const NetworkGameList* sel = _selected_item;
w->disabled_state = 0;
@ -891,9 +892,10 @@ static WindowDesc _client_list_desc = {
};
// 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++) {
// Skip non-active items
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)
{
int i, h;
NetworkClientInfo *ci;
const NetworkClientInfo* ci;
DeleteWindowById(WC_TOOLBAR_MENU, 0);
// Clean the current actions

View File

@ -168,7 +168,7 @@ static inline Order UnpackOrder(uint32 packed)
/* Functions */
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 InvalidateVehicleOrder(const Vehicle *v);
bool VehicleHasDepotOrders(const Vehicle *v);
@ -176,7 +176,7 @@ bool CheckOrders(uint data_a, uint data_b);
void DeleteVehicleOrders(Vehicle *v);
bool IsOrderListShared(const Vehicle *v);
void AssignOrder(Order *order, Order data);
bool CheckForValidOrders(Vehicle *v);
bool CheckForValidOrders(const Vehicle* v);
Order UnpackVersion4Order(uint16 packed);
Order UnpackOldOrder(uint16 packed);

View File

@ -785,7 +785,7 @@ void BackupVehicleOrders(const Vehicle *v, BackuppedOrders *bak)
* Restore vehicle orders that are backupped via BackupVehicleOrders
*
*/
void RestoreVehicleOrders(Vehicle *v, BackuppedOrders *bak)
void RestoreVehicleOrders(const Vehicle* v, const BackuppedOrders* bak)
{
uint i;
@ -1100,7 +1100,7 @@ bool IsOrderListShared(const Vehicle *v)
* @return false if there are no valid orders
*
*/
bool CheckForValidOrders(Vehicle *v)
bool CheckForValidOrders(const Vehicle* v)
{
const Order *order;

View File

@ -421,7 +421,7 @@ static void DrawPlayerVehiclesAmount(PlayerID player)
{
const int x = 110;
int y = 72;
Vehicle *v;
const Vehicle* v;
uint train,road,air,ship;
DrawString(x, y, STR_7039_VEHICLES, 0);

View File

@ -27,7 +27,7 @@ static byte _build_depot_direction;
static byte _waypoint_count=1;
static byte _cur_waypoint_type;
struct {
static struct {
byte orientation;
byte numtracks;
byte platlength;

View File

@ -799,7 +799,7 @@ static Vehicle *RoadVehFindCloseTo(Vehicle *v, int x, int y, byte dir)
return u;
}
static void RoadVehArrivesAt(Vehicle *v, Station *st)
static void RoadVehArrivesAt(const Vehicle* v, Station* st)
{
if (v->cargo_type == CT_PASSENGERS) {
/* Check if station was ever visited before */

View File

@ -431,7 +431,7 @@ static void DrawNewRoadVehWindow(Window *w)
void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2)
{
Vehicle *v;
const Vehicle* v;
if (!success) return;

View File

@ -57,10 +57,10 @@ int GetShipImage(const Vehicle *v, byte direction)
return _ship_sprites[spritenum] + direction;
}
static Depot *FindClosestShipDepot(Vehicle *v)
static const Depot* FindClosestShipDepot(const Vehicle* v)
{
Depot *depot;
Depot *best_depot = NULL;
const Depot* depot;
const Depot* best_depot = NULL;
uint dist;
uint best_dist = (uint)-1;
TileIndex tile;
@ -91,7 +91,7 @@ static Depot *FindClosestShipDepot(Vehicle *v)
static void CheckIfShipNeedsService(Vehicle *v)
{
Depot *depot;
const Depot* depot;
if (_patches.servint_ships == 0)
return;
@ -442,7 +442,7 @@ static void ShipEnterDepot(Vehicle *v)
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 */
if (!(st->had_vehicle_of_type & HVOT_SHIP)) {

View File

@ -28,7 +28,7 @@ void DrawShipPurchaseInfo(int x, int y, EngineID engine_number)
{
YearMonthDay ymd;
const ShipVehicleInfo *svi = ShipVehInfo(engine_number);
Engine *e;
const Engine* e;
/* Purchase cost - Max speed */
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)
{
Vehicle *v;
const Vehicle* v;
if (!success) return;
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)
{
Vehicle* v = CheckMouseOverVehicle();
const Vehicle* v = CheckMouseOverVehicle();
if (v != NULL) HandleCloneVehClick(v, w);
}

View File

@ -2082,7 +2082,7 @@ static void DrawTile_Station(TileInfo *ti)
//debug("Cust-o-mized %p", statspec);
if (statspec != NULL) {
Station *st = GetStation(_m[ti->tile].m2);
const Station* st = GetStation(_m[ti->tile].m2);
relocation = GetCustomStationRelocation(statspec, st, 0);
//debug("Relocation %d", relocation);
@ -2197,7 +2197,7 @@ static uint32 GetTileTrackStatus_Station(TileIndex tile, TransportType mode)
switch (mode) {
case TRANSPORT_RAIL:
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 += (j << 8);

View File

@ -164,10 +164,8 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
{
byte p = 0;
Station *st;
int x,xb = 2;
int xb = 2;
int y = 16; // offset from top of widget
int j;
if (w->vscroll.count == 0) { // player has no stations
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
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);
@ -211,7 +211,8 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
{
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
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)
{
Station *st;
int i;
int num;
StationID station_id = w->window_number;
const Station* st = GetStation(station_id);
uint i;
uint num;
int x,y;
int pos;
StringID str;
StationID station_id;
station_id = w->window_number;
st = GetStation(station_id);
num = 1;
for(i=0; i!=NUM_CARGO; i++) {

View File

@ -702,10 +702,9 @@ static char *FormatString(char *buff, const char *str, const int32 *argv, uint c
} break;
case 0x9A: { // {STATION}
Station *st;
const Station* st = GetStation(GetInt32(&argv));
int32 temp[2];
st = GetStation(GetInt32(&argv));
if (st->xy == 0) { // station doesn't exist anymore
buff = GetStringWithArgs(buff, STR_UNKNOWN_DESTINATION, NULL);
break;
@ -716,10 +715,10 @@ static char *FormatString(char *buff, const char *str, const int32 *argv, uint c
break;
}
case 0x9B: { // {TOWN}
Town *t;
const Town* t = GetTown(GetInt32(&argv));
int32 temp[1];
t = GetTown(GetInt32(&argv));
assert(t->xy);
temp[0] = t->townnameparts;
buff = GetStringWithArgs(buff, t->townnametype, temp);
break;

View File

@ -16,7 +16,7 @@
static void HandleSubsidyClick(int y)
{
Subsidy *s;
const Subsidy* s;
int num,offs;
TileIndex xy;
@ -74,12 +74,11 @@ handle_click:
}
}
static void DrawSubsidiesWindow(Window *w)
static void DrawSubsidiesWindow(const Window* w)
{
YearMonthDay ymd;
Subsidy *s;
const Subsidy* s;
int x,xt,y,num,x2;
Player *p;
DrawWindowWidgets(w);
@ -114,6 +113,8 @@ static void DrawSubsidiesWindow(Window *w)
for(s=_subsidies; s != endof(_subsidies); s++) {
if (s->cargo_type != CT_INVALID && s->age >= 12) {
const Player* p;
SetupSubsidyDecodeParam(s, 1);
p = GetPlayer(GetStation(s->to)->owner);

View File

@ -201,7 +201,7 @@ static void UpdateTownRadius(Town *t);
static bool IsCloseToTown(TileIndex tile, uint dist)
{
Town *t;
const Town* t;
FOR_ALL_TOWNS(t) {
if (t->xy != 0 && DistanceManhattan(tile, t->xy) < dist)
@ -245,7 +245,8 @@ static void ChangePopulation(Town *t, int mod)
uint32 GetWorldPopulation(void)
{
uint32 pop;
Town *t;
const Town* t;
pop = 0;
FOR_ALL_TOWNS(t) {
pop += t->population;

View File

@ -107,7 +107,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e)
{
int y;
Player *p;
const Player* p;
int r;
StringID str;
@ -402,7 +402,7 @@ static int CDECL TownPopSorter(const void *a, const void *b)
static void MakeSortedTownList(void)
{
Town *t;
const Town* t;
int n = 0;
/* 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);
{
Town *t;
const Town* t;
int n = 0;
uint16 i = w->vscroll.pos;
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
{
Town *t = GetTown(_town_sort[id_v]);
const Town* t = GetTown(_town_sort[id_v]);
assert(t->xy);
ScrollMainWindowToTile(t->xy);

View File

@ -188,9 +188,10 @@ enum AccelType {
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(IsTileType(v->tile, MP_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
static void NormalizeTrainVehInDepot(Vehicle *u)
static void NormalizeTrainVehInDepot(const Vehicle* u)
{
Vehicle *v;
const Vehicle* v;
FOR_ALL_VEHICLES(v) {
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;
}
@ -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;
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
};
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)
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;
if (v->current_order.type == OT_GOTO_STATION)
@ -3535,7 +3536,7 @@ void TrainEnterDepot(Vehicle *v, TileIndex tile)
static void CheckIfTrainNeedsService(Vehicle *v)
{
Depot *depot;
const Depot* depot;
TrainFindDepotData tfdd;
if (PBSTileReserved(v->tile) & v->u.rail.track)

View File

@ -148,7 +148,7 @@ void CcBuildWagon(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)
return;

View File

@ -39,25 +39,25 @@
#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]
static uint32 const _veh_build_proc_table[] = {
static const uint32 _veh_build_proc_table[] = {
CMD_BUILD_RAIL_VEHICLE,
CMD_BUILD_ROAD_VEH,
CMD_BUILD_SHIP,
CMD_BUILD_AIRCRAFT,
};
static uint32 const _veh_sell_proc_table[] = {
static const uint32 _veh_sell_proc_table[] = {
CMD_SELL_RAIL_WAGON,
CMD_SELL_ROAD_VEH,
CMD_SELL_SHIP,
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_ROADVEH,
CMD_START_STOP_SHIP,
CMD_START_STOP_AIRCRAFT,
};
static uint32 const _veh_refit_proc_table[] = {
static const uint32 _veh_refit_proc_table[] = {
CMD_REFIT_RAIL_VEHICLE,
0, // road vehicles can't be refitted
CMD_REFIT_SHIP,
@ -107,7 +107,7 @@ bool VehicleNeedsService(const Vehicle *v)
(v->date_of_last_service + v->service_interval < _date);
}
void VehicleInTheWayErrMsg(Vehicle *v)
void VehicleInTheWayErrMsg(const Vehicle* v)
{
StringID id;
@ -525,7 +525,7 @@ Vehicle *GetFirstVehicleInChain(const Vehicle *v)
return (Vehicle*)v;
}
int CountVehiclesInChain(Vehicle *v)
uint CountVehiclesInChain(const Vehicle* v)
{
int count = 0;
do count++; while ( (v=v->next) != NULL);
@ -570,7 +570,7 @@ void DisasterVehicle_Tick(Vehicle *v);
static void MaybeReplaceVehicle(Vehicle *v);
// 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
* @param *v vehicle to add

View File

@ -293,7 +293,7 @@ void AfterLoadVehicles(void);
Vehicle *GetLastVehicleInChain(Vehicle *v);
Vehicle *GetPrevVehicleInChain(const Vehicle *v);
Vehicle *GetFirstVehicleInChain(const Vehicle *v);
int CountVehiclesInChain(Vehicle *v);
uint CountVehiclesInChain(const Vehicle* v);
void DeleteVehicle(Vehicle *v);
void DeleteVehicleChain(Vehicle *v);
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);
void VehicleInTheWayErrMsg(Vehicle *v);
void VehicleInTheWayErrMsg(const Vehicle* v);
Vehicle *FindVehicleBetween(TileIndex from, TileIndex to, byte z);
TileIndex GetVehicleOutOfTunnelTile(const Vehicle *v);

View File

@ -490,9 +490,9 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
}
case VEH_Road: {
int num = NUM_ROAD_ENGINES;
Engine *e = GetEngine(ROAD_ENGINES_INDEX);
const Engine* e = GetEngine(ROAD_ENGINES_INDEX);
byte cargo;
EngineInfo *info;
const EngineInfo* info;
engine_id = ROAD_ENGINES_INDEX;
do {
@ -523,9 +523,9 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
case VEH_Ship: {
int num = NUM_SHIP_ENGINES;
Engine *e = GetEngine(SHIP_ENGINES_INDEX);
const Engine* e = GetEngine(SHIP_ENGINES_INDEX);
byte cargo, refittable;
EngineInfo *info;
const EngineInfo* info;
engine_id = SHIP_ENGINES_INDEX;
do {
@ -560,8 +560,8 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
case VEH_Aircraft:{
int num = NUM_AIRCRAFT_ENGINES;
byte subtype;
Engine *e = GetEngine(AIRCRAFT_ENGINES_INDEX);
EngineInfo *info;
const Engine* e = GetEngine(AIRCRAFT_ENGINES_INDEX);
const EngineInfo* info;
engine_id = AIRCRAFT_ENGINES_INDEX;
do {
@ -635,10 +635,10 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
case VEH_Road: {
int num = NUM_ROAD_ENGINES;
Engine *e = GetEngine(ROAD_ENGINES_INDEX);
const Engine* e = GetEngine(ROAD_ENGINES_INDEX);
EngineID engine_id = ROAD_ENGINES_INDEX;
byte cargo;
EngineInfo *info;
const EngineInfo* info;
if ( selected_id[0] >= ROAD_ENGINES_INDEX && selected_id[0] <= SHIP_ENGINES_INDEX ) {
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: {
int num = NUM_SHIP_ENGINES;
Engine *e = GetEngine(SHIP_ENGINES_INDEX);
const Engine* e = GetEngine(SHIP_ENGINES_INDEX);
EngineID engine_id = SHIP_ENGINES_INDEX;
byte cargo, refittable;
EngineInfo *info;
const EngineInfo* info;
if ( selected_id[0] != -1 ) {
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: {
if ( selected_id[0] != -1 ) {
int num = NUM_AIRCRAFT_ENGINES;
Engine *e = GetEngine(AIRCRAFT_ENGINES_INDEX);
const Engine* e = GetEngine(AIRCRAFT_ENGINES_INDEX);
EngineID engine_id = AIRCRAFT_ENGINES_INDEX;
byte subtype = AircraftVehInfo(selected_id[0])->subtype;
EngineInfo *info;
const EngineInfo* info;
do {
info = &_engine_info[engine_id];

View File

@ -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)
{
Window *v = w;
const Window* v = w;
int x;
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)
{
Window *w;
const Window* w;
for(w=_windows; w!=_last_window; w++) {
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)
{
Window *w;
const Window* w;
for(w=_windows; w!=_last_window; w++) {
if (w->window_class==cls)
SetWindowDirty(w);