(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.

This commit is contained in:
rubidium 2006-08-28 18:53:03 +00:00
parent 8cc7aa9aa0
commit 27cee58ab8
56 changed files with 273 additions and 276 deletions

View File

@ -2419,7 +2419,7 @@ handle_nocash:
cost = DoCommand(tile, p->ai.wagon_list[i], 0, DC_EXEC, CMD_SELL_RAIL_WAGON);
assert(!CmdFailed(cost));
}
p->ai.state = AIS_0;
p->ai.state = AIS_0;
}
return;
}
@ -2459,7 +2459,7 @@ handle_nocash:
if (p->ai.num_want_fullload != 0 && (is_pass || i == 0))
order.flags |= OF_FULL_LOAD;
DoCommand(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
DoCommand(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
}
DoCommand(0, loco_id, 0, DC_EXEC, CMD_START_STOP_TRAIN);
@ -2472,7 +2472,7 @@ handle_nocash:
// p->ai.loco_id = INVALID_VEHICLE;
p->ai.wagon_list[0] = INVALID_VEHICLE;
} else {
p->ai.state = AIS_0;
p->ai.state = AIS_0;
}
}
@ -2499,8 +2499,8 @@ static bool AiCheckRoadResources(TileIndex tile, const AiDefaultBlockData *p, by
int rad;
if (_patches.modified_catchment) {
rad = CA_TRUCK; //Same as CA_BUS at the moment?
} else { //change that at some point?
rad = CA_TRUCK; // Same as CA_BUS at the moment?
} else { // change that at some point?
rad = 4;
}
@ -3010,11 +3010,11 @@ do_some_terraform:
p->ai.cur_tile_a = arf.bridge_end_tile;
bridge_len = GetBridgeLength(tile, p->ai.cur_tile_a); // tile
/* Figure out what (road)bridge type to build
start with best bridge, then go down to worse and worse bridges
unnecessary to check for worse bridge (i=0), since AI will always build that.
AI is so fucked up that fixing this small thing will probably not solve a thing
*/
/* Figure out what (road)bridge type to build
* start with best bridge, then go down to worse and worse bridges
* unnecessary to check for worse bridge (i=0), since AI will always build that.
*AI is so fucked up that fixing this small thing will probably not solve a thing
*/
for (i = 10; i != 0; i--) {
if (CheckBridge_Stuff(i, bridge_len)) {
int32 cost = DoCommand(tile, p->ai.cur_tile_a, i + (0x80 << 8), DC_AUTO, CMD_BUILD_BRIDGE);
@ -3191,7 +3191,7 @@ static void AiStateBuildRoadVehicles(Player *p)
if (p->ai.num_want_fullload != 0 && (is_pass || i == 0))
order.flags |= OF_FULL_LOAD;
DoCommand(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
DoCommand(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
}
DoCommand(0, loco_id, 0, DC_EXEC, CMD_START_STOP_ROADVEH);
@ -3320,8 +3320,8 @@ static bool AiCheckAirportResources(TileIndex tile, const AiDefaultBlockData *p,
int rad;
if (_patches.modified_catchment) {
rad = CA_AIR_LARGE; //I Have NFI what airport the
} else { //AI is going to build here
rad = CA_AIR_LARGE; // I Have NFI what airport the
} else { // AI is going to build here
rad = 4;
}

View File

@ -1897,8 +1897,8 @@ static bool AirportFindFreeTerminal(Vehicle *v, const AirportFTAClass *Airport)
1. group 0 -- TERM_GROUP1_block (check block)
2. group 1 -- TERM_GROUP2_ENTER_block (check block)
First in line is checked first, group 0. If the block (TERM_GROUP1_block) is free, it
looks at the corresponding terminals of that group. If no free ones are found, other
possible groups are checked (in this case group 1, since that is after group 0). If that
looks at the corresponding terminals of that group. If no free ones are found, other
possible groups are checked (in this case group 1, since that is after group 0). If that
fails, then attempt fails and plane waits
*/
if (Airport->terminals[0] > 1) {
@ -1992,7 +1992,7 @@ static bool AirportFindFreeHelipad(Vehicle *v, const AirportFTAClass *Airport)
// The blocks for helipads start after the last terminal (MAX_TERMINALS)
return FreeTerminal(v, MAX_TERMINALS, GetNumHelipads(Airport) + MAX_TERMINALS);
}
return false; // it shouldn't get here anytime, but just to be sure
return false; // it shouldn't get here anytime, but just to be sure
}
static void AircraftEventHandler(Vehicle *v, int loop)
@ -2103,11 +2103,11 @@ void UpdateAirplanesOnNewStation(Station *st)
const AirportFTAClass *ap = GetAirport(st->airport_type);
FOR_ALL_VEHICLES(v) {
if (v->type == VEH_Aircraft && v->subtype <= 2) {
if (v->u.air.targetairport == st->index) { // if heading to this airport
/* update position of airplane. If plane is not flying, landing, or taking off
you cannot delete airport, so it doesn't matter
*/
if (v->u.air.state >= FLYING) { // circle around
if (v->u.air.targetairport == st->index) { // if heading to this airport
/* update position of airplane. If plane is not flying, landing, or taking off
*you cannot delete airport, so it doesn't matter
*/
if (v->u.air.state >= FLYING) { // circle around
v->u.air.pos = v->u.air.previous_pos = ap->entry_point;
v->u.air.state = FLYING;
// landing plane needs to be reset to flying height (only if in pause mode upgrade,

View File

@ -197,7 +197,7 @@ static void NewAircraftWndProc(Window *w, WindowEvent *e)
DoCommandP(w->window_number, sel_eng, 0, CcBuildAircraft, CMD_BUILD_AIRCRAFT | CMD_MSG(STR_A008_CAN_T_BUILD_AIRCRAFT));
} break;
case 6: { /* rename */
case 6: { /* rename */
EngineID sel_eng = WP(w,buildtrain_d).sel_engine;
if (sel_eng != INVALID_ENGINE) {
WP(w,buildtrain_d).rename_engine = sel_eng;
@ -882,7 +882,7 @@ static void AircraftDepotWndProc(Window *w, WindowEvent *e)
case 4:
if (!HASBIT(w->disabled_state, 4) &&
WP(w,traindepot_d).sel != INVALID_VEHICLE) {
WP(w,traindepot_d).sel != INVALID_VEHICLE) {
Vehicle *v;
HandleButtonClick(w, 4);
@ -1227,6 +1227,6 @@ void ShowPlayerAircraft(PlayerID player, StationID station)
void ShowVehWithSharedOrdersAircraft(Vehicle *v)
{
if (v->orders == NULL) return; // no shared list to show
if (v->orders == NULL) return; // no shared list to show
ShowPlayerAircraftLocal(v->owner, INVALID_STATION, v->orders->index, true);
}

View File

@ -216,7 +216,7 @@ static void AirportFTAClass_Constructor(AirportFTAClass *Airport,
curr = terminals;
while (i-- > 0) {
curr++;
assert(*curr != 0); //we don't want to have an empty group
assert(*curr != 0); //we don't want to have an empty group
nofterminals += *curr;
}
@ -394,7 +394,7 @@ static const char* const _airport_heading_strings[] = {
"TERM8",
"HELIPAD3",
"HELIPAD4",
"DUMMY" // extra heading for 255
"DUMMY" // extra heading for 255
};

View File

@ -79,7 +79,7 @@ static void AyStarMain_OpenList_Add(AyStar *aystar, PathNode *parent, const AySt
/*
* Checks one tile and calculate his f-value
* return values:
* AYSTAR_DONE : indicates we are done
* AYSTAR_DONE : indicates we are done
*/
int AyStarMain_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *parent)
{
@ -140,12 +140,12 @@ int AyStarMain_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *pare
* This function is the core of AyStar. It handles one item and checks
* his neighbour items. If they are valid, they are added to be checked too.
* return values:
* AYSTAR_EMPTY_OPENLIST : indicates all items are tested, and no path
* has been found.
* AYSTAR_LIMIT_REACHED : Indicates that the max_nodes limit has been
* reached.
* AYSTAR_FOUND_END_NODE : indicates we found the end. Path_found now is true, and in path is the path found.
* AYSTAR_STILL_BUSY : indicates we have done this tile, did not found the path yet, and have items left to try.
* AYSTAR_EMPTY_OPENLIST : indicates all items are tested, and no path
* has been found.
* AYSTAR_LIMIT_REACHED : Indicates that the max_nodes limit has been
* reached.
* AYSTAR_FOUND_END_NODE : indicates we found the end. Path_found now is true, and in path is the path found.
* AYSTAR_STILL_BUSY : indicates we have done this tile, did not found the path yet, and have items left to try.
*/
int AyStarMain_Loop(AyStar *aystar)
{
@ -224,9 +224,9 @@ void AyStarMain_Clear(AyStar *aystar)
/*
* This is the function you call to run AyStar.
* return values:
* AYSTAR_FOUND_END_NODE : indicates we found an end node.
* AYSTAR_NO_PATH : indicates that there was no path found.
* AYSTAR_STILL_BUSY : indicates we have done some checked, that we did not found the path yet, and that we still have items left to try.
* AYSTAR_FOUND_END_NODE : indicates we found an end node.
* AYSTAR_NO_PATH : indicates that there was no path found.
* AYSTAR_STILL_BUSY : indicates we have done some checked, that we did not found the path yet, and that we still have items left to try.
* When the algorithm is done (when the return value is not AYSTAR_STILL_BUSY)
* aystar->clear() is called. Note that when you stop the algorithm halfway,
* you should still call clear() yourself!
@ -287,10 +287,10 @@ void init_AyStar(AyStar *aystar, Hash_HashProc hash, uint num_buckets)
// That is why it can stay this high
init_BinaryHeap(&aystar->OpenListQueue, 102400);
aystar->addstart = AyStarMain_AddStartNode;
aystar->main = AyStarMain_Main;
aystar->loop = AyStarMain_Loop;
aystar->free = AyStarMain_Free;
aystar->clear = AyStarMain_Clear;
aystar->checktile = AyStarMain_CheckTile;
aystar->addstart = AyStarMain_AddStartNode;
aystar->main = AyStarMain_Main;
aystar->loop = AyStarMain_Loop;
aystar->free = AyStarMain_Free;
aystar->clear = AyStarMain_Clear;
aystar->checktile = AyStarMain_CheckTile;
}

View File

@ -5,7 +5,7 @@
* AyStar is a fast pathfinding routine and is used for things like
* AI_pathfinding and Train_pathfinding.
* For more information about AyStar (A* Algorithm), you can look at
* http://en.wikipedia.org/wiki/A-star_search_algorithm
* http://en.wikipedia.org/wiki/A-star_search_algorithm
*/
#ifndef AYSTAR_H
@ -55,8 +55,8 @@ typedef struct AyStar AyStar;
/*
* This function is called to check if the end-tile is found
* return values can be:
* AYSTAR_FOUND_END_NODE : indicates this is the end tile
* AYSTAR_DONE : indicates this is not the end tile (or direction was wrong)
* AYSTAR_FOUND_END_NODE : indicates this is the end tile
* AYSTAR_DONE : indicates this is not the end tile (or direction was wrong)
*/
/*
* The 2nd parameter should be OpenListNode, and NOT AyStarNode. AyStarNode is
@ -71,8 +71,8 @@ typedef int32 AyStar_EndNodeCheck(AyStar *aystar, OpenListNode *current);
/*
* This function is called to calculate the G-value for AyStar Algorithm.
* return values can be:
* AYSTAR_INVALID_NODE : indicates an item is not valid (e.g.: unwalkable)
* Any value >= 0 : the g-value for this tile
* AYSTAR_INVALID_NODE : indicates an item is not valid (e.g.: unwalkable)
* Any value >= 0 : the g-value for this tile
*/
typedef int32 AyStar_CalculateG(AyStar *aystar, AyStarNode *current, OpenListNode *parent);
@ -81,7 +81,7 @@ typedef int32 AyStar_CalculateG(AyStar *aystar, AyStarNode *current, OpenListNod
* Mostly, this must result the distance (Manhattan way) between the
* current point and the end point
* return values can be:
* Any value >= 0 : the h-value for this tile
* Any value >= 0 : the h-value for this tile
*/
typedef int32 AyStar_CalculateH(AyStar *aystar, AyStarNode *current, OpenListNode *parent);

View File

@ -134,8 +134,8 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, byte bridge_type)
errmsg = _error_message;
} else {
// check which bridges can be built
int bridge_len; // length of the middle parts of the bridge
int tot_bridgedata_len; // total length of bridge
int bridge_len; // length of the middle parts of the bridge
int tot_bridgedata_len; // total length of bridge
// get absolute bridge length
bridge_len = GetBridgeLength(start, end);
@ -143,7 +143,7 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, byte bridge_type)
tot_bridgedata_len = CalcBridgeLenCostFactor(tot_bridgedata_len);
for (bridge_type = 0; bridge_type != MAX_BRIDGES; bridge_type++) { // loop for all bridgetypes
for (bridge_type = 0; bridge_type != MAX_BRIDGES; bridge_type++) { // loop for all bridgetypes
if (CheckBridge_Stuff(bridge_type, bridge_len)) {
const Bridge *b = &_bridge[bridge_type];
// bridge is accepted, add to list

View File

@ -1517,7 +1517,7 @@ static void DoAcquireCompany(Player *p)
p->is_active = false;
DeletePlayerWindows(pi);
RebuildVehicleLists(); //Updates the open windows to add the newly acquired vehicles to the lists
RebuildVehicleLists(); //Updates the open windows to add the newly acquired vehicles to the lists
}
extern int GetAmountOwnedBy(Player *p, byte owner);

View File

@ -27,7 +27,7 @@ typedef struct RailVehicleInfo {
// for when the 'powered wagon' callback fails. But it should really also determine what
// kind of visual effect to generate for a vehicle (default, steam, diesel, electric).
// Same goes for the callback result, which atm is only used to check if a wagon is powered.
byte shorten_factor; // length on main map for this type is 8 - shorten_factor
byte shorten_factor; // length on main map for this type is 8 - shorten_factor
byte user_def_data; ///! Property 0x25: "User-defined bit mask" Used only for (very few) NewGRF vehicles
} RailVehicleInfo;
@ -99,7 +99,7 @@ typedef struct Engine {
byte preview_wait;
byte railtype;
byte player_avail;
byte type; // type, ie VEH_Road, VEH_Train, etc. Same as in vehicle.h
byte type; // type, ie VEH_Road, VEH_Train, etc. Same as in vehicle.h
} Engine;
/**

2
gui.h
View File

@ -125,7 +125,7 @@ void UpdateTextBufferSize(Textbuf *tb);
void BuildFileList(void);
void SetFiosType(const byte fiostype);
/* FIOS_TYPE_FILE, FIOS_TYPE_OLDFILE etc. different colours */
/* FIOS_TYPE_FILE, FIOS_TYPE_OLDFILE etc. different colours */
extern const byte _fios_colors[];
/* network gui */

View File

@ -340,11 +340,11 @@ static int32 ClearTile_Industry(TileIndex tile, byte flags)
{
Industry *i = GetIndustryByTile(tile);
/* * water can destroy industries
* in editor you can bulldoze industries
* with magic_bulldozer cheat you can destroy industries
* (area around OILRIG is water, so water shouldn't flood it
*/
/* water can destroy industries
* in editor you can bulldoze industries
* with magic_bulldozer cheat you can destroy industries
* (area around OILRIG is water, so water shouldn't flood it
*/
if ((_current_player != OWNER_WATER && _game_mode != GM_EDITOR &&
!_cheats.magic_bulldozer.value) ||
(_current_player == OWNER_WATER && i->type == IT_OIL_RIG)) {
@ -409,7 +409,7 @@ static void AnimateTile_Industry(TileIndex tile)
m = _m[tile].m3 + 1;
switch (m & 7) {
case 2: SndPlayTileFx(SND_2D_RIP_2, tile); break;
case 2: SndPlayTileFx(SND_2D_RIP_2, tile); break;
case 6: SndPlayTileFx(SND_29_RIP, tile); break;
}
@ -1903,7 +1903,7 @@ const TileTypeProcs _tile_type_industry_procs = {
DrawTile_Industry, /* draw_tile_proc */
GetSlopeZ_Industry, /* get_slope_z_proc */
ClearTile_Industry, /* clear_tile_proc */
GetAcceptedCargo_Industry, /* get_accepted_cargo_proc */
GetAcceptedCargo_Industry, /* get_accepted_cargo_proc */
GetTileDesc_Industry, /* get_tile_desc_proc */
GetTileTrackStatus_Industry, /* get_tile_track_status_proc */
ClickTile_Industry, /* click_tile_proc */

View File

@ -1310,7 +1310,7 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
HandleButtonClick(w, e->click.widget);
size += _terraform_size;
if (!IS_INT_INSIDE(size, 1, 8 + 1)) return;
if (!IS_INT_INSIDE(size, 1, 8 + 1)) return;
_terraform_size = size;
SndPlayFx(SND_15_BEEP);

12
md5.c
View File

@ -57,7 +57,7 @@
#include "md5.h"
#include <string.h>
#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */
#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */
#if defined(TTD_BIG_ENDIAN)
# define BYTE_ORDER 1
#else
@ -158,7 +158,7 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
if (*((const md5_byte_t *)&w)) /* dynamic little-endian */
#endif
#if BYTE_ORDER <= 0 /* little-endian */
#if BYTE_ORDER <= 0 /* little-endian */
{
/*
* On little-endian machines, we can process properly aligned
@ -175,9 +175,9 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
}
#endif
#if BYTE_ORDER == 0
else /* dynamic big-endian */
else /* dynamic big-endian */
#endif
#if BYTE_ORDER >= 0 /* big-endian */
#if BYTE_ORDER >= 0 /* big-endian */
{
/*
* On big-endian machines, we must arrange the bytes in the
@ -187,9 +187,9 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
int i;
# if BYTE_ORDER == 0
X = xbuf; /* (dynamic only) */
X = xbuf; /* (dynamic only) */
# else
# define xbuf X /* (static only) */
# define xbuf X /* (static only) */
# endif
for (i = 0; i < 16; ++i, xp += 4)
xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);

6
md5.h
View File

@ -67,9 +67,9 @@ typedef unsigned int md5_word_t; /* 32-bit word */
/* Define the state of the MD5 Algorithm. */
typedef struct md5_state_s {
md5_word_t count[2]; /* message length in bits, lsw first */
md5_word_t abcd[4]; /* digest buffer */
md5_byte_t buf[64]; /* accumulate block */
md5_word_t count[2]; /* message length in bits, lsw first */
md5_word_t abcd[4]; /* digest buffer */
md5_byte_t buf[64]; /* accumulate block */
} md5_state_t;
#ifdef __cplusplus

View File

@ -62,10 +62,6 @@ extern "C" {
#endif
/***********************************************************************
//
************************************************************************/
/* Memory required for the wrkmem parameter.
* When the required size is 0, you can also pass a NULL pointer.
*/

View File

@ -224,7 +224,7 @@ int32 CmdMoneyCheat(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
/** Transfer funds (money) from one player to another.
* To prevent abuse in multiplayer games you can only send money to other
* To prevent abuse in multiplayer games you can only send money to other
* players if you have paid off your loan (either explicitely, or implicitely
* given the fact that you have more money than loan).
* @param tile unused

View File

@ -761,12 +761,12 @@ uint32 GetOldTownName(uint32 townnameparts, byte old_town_name_type)
{
switch (old_town_name_type) {
case 0: case 3: /* English, American */
/* Already OK */
/* Already OK */
return townnameparts;
case 1: /* French */
/* For some reason 86 needs to be subtracted from townnameparts
* 0000 0000 0000 0000 0000 0000 1111 1111 */
/* For some reason 86 needs to be subtracted from townnameparts
* 0000 0000 0000 0000 0000 0000 1111 1111 */
return FIXNUM(townnameparts - 86, lengthof(name_french_real), 0);
case 2: /* German */
@ -774,13 +774,13 @@ uint32 GetOldTownName(uint32 townnameparts, byte old_town_name_type)
return townnameparts;
case 4: /* Latin-American */
/* 0000 0000 0000 0000 0000 0000 1111 1111 */
/* 0000 0000 0000 0000 0000 0000 1111 1111 */
return FIXNUM(townnameparts, lengthof(name_spanish_real), 0);
case 5: /* Silly */
/* NUM_SILLY_1 - lower 16 bits
* NUM_SILLY_2 - upper 16 bits without leading 1 (first 8 bytes)
* 1000 0000 2222 2222 0000 0000 1111 1111 */
/* NUM_SILLY_1 - lower 16 bits
* NUM_SILLY_2 - upper 16 bits without leading 1 (first 8 bytes)
* 1000 0000 2222 2222 0000 0000 1111 1111 */
return FIXNUM(townnameparts, lengthof(name_silly_1), 0) | FIXNUM(GB(townnameparts, 16, 8), lengthof(name_silly_2), 16);
}
return 0;

View File

@ -1640,8 +1640,8 @@ static void NewSpriteGroup(byte *buf, int len)
static void FeatureMapSpriteGroup(byte *buf, int len)
{
/* <03> <feature> <n-id> <ids>... <num-cid> [<cargo-type> <cid>]... <def-cid>
* id-list := [<id>] [id-list]
* cargo-list := <cargo-type> <cid> [cargo-list]
* id-list := [<id>] [id-list]
* cargo-list := <cargo-type> <cid> [cargo-list]
*
* B feature see action 0
* B n-id bits 0-6: how many IDs this definition applies to

6
npf.c
View File

@ -63,10 +63,10 @@ static uint NTPHash(uint key1, uint key2)
/**
* Calculates a hash value for use in the NPF.
* @param key1 The TileIndex of the tile to hash
* @param key1 The Trackdir of the track on the tile.
* @param key1 The TileIndex of the tile to hash
* @param key2 The Trackdir of the track on the tile.
*
* @todo Think of a better hash.
* @todo Think of a better hash.
*/
static uint NPFHash(uint key1, uint key2)
{

View File

@ -129,7 +129,7 @@ typedef enum TransportTypes {
*/
TRANSPORT_RAIL = 0,
TRANSPORT_ROAD = 1,
TRANSPORT_WATER, // = 2
TRANSPORT_WATER, // = 2
TRANSPORT_END,
INVALID_TRANSPORT = 0xff,
} TransportType;
@ -239,7 +239,7 @@ typedef struct GameDifficulty {
int economy;
int line_reverse_mode;
int disasters;
int town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff
int town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff
} GameDifficulty;
enum {

View File

@ -8,8 +8,8 @@
* use ShowMacDialog when you want to control title, message and text on the button
* ShowMacAssertDialog is used by assert
* ShowMacErrorDialog should be used when an unrecoverable error shows up. It only contains the title, which will should tell what went wrong
* the function then adds text that tells the user to update and then report the bug if it's present in the newest version
* It also quits in a nice way since we call it when we know something happened that will crash OpenTTD (like a needed pointer turns out to be NULL or similar)
* the function then adds text that tells the user to update and then report the bug if it's present in the newest version
* It also quits in a nice way since we call it when we know something happened that will crash OpenTTD (like a needed pointer turns out to be NULL or similar)
*/
void ShowMacDialog ( const char *title, const char *message, const char *buttonLabel );
void ShowMacAssertDialog ( const char *function, const char *file, const int line, const char *expression );

2
rail.h
View File

@ -119,7 +119,7 @@ typedef enum TrackdirBits {
TRACKDIR_BIT_LOWER_W = 0x0800,
TRACKDIR_BIT_LEFT_N = 0x1000,
TRACKDIR_BIT_RIGHT_N = 0x2000,
TRACKDIR_BIT_MASK = 0x3F3F,
TRACKDIR_BIT_MASK = 0x3F3F,
INVALID_TRACKDIR_BIT = 0xFFFF,
} TrackdirBits;

View File

@ -59,10 +59,10 @@ void ShowTrainDepotWindow(TileIndex tile);
/* MAP2 byte: abcd???? => Signal On? Same coding as map3lo
* MAP3LO byte: abcd???? => Signal Exists?
* a and b are for diagonals, upper and left,
* one for each direction. (ie a == NE->SW, b ==
* SW->NE, or v.v., I don't know. b and c are
* similar for lower and right.
* a and b are for diagonals, upper and left,
* one for each direction. (ie a == NE->SW, b ==
* SW->NE, or v.v., I don't know. b and c are
* similar for lower and right.
* MAP2 byte: ????abcd => Type of ground.
* MAP3LO byte: ????abcd => Type of rail.
* MAP5: 00abcdef => rail
@ -721,7 +721,7 @@ int32 CmdBuildSingleSignal(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
return cost;
}
/** Build many signals by dragging; AutoSignals
/** Build many signals by dragging; AutoSignals
* @param tile start tile of drag
* @param p1 end tile of drag
* @param p2 various bitstuffed elements
@ -1956,7 +1956,7 @@ static void ChangeTileOwner_Track(TileIndex tile, PlayerID old_player, PlayerID
if (new_player != OWNER_SPECTATOR) {
SetTileOwner(tile, new_player);
} else {
} else {
DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
}
}
@ -1986,9 +1986,9 @@ static uint32 VehicleEnter_Track(Vehicle *v, TileIndex tile, int x, int y)
length = v->u.rail.cached_veh_length;
fract_coord_leave =
((_fractcoords_enter[dir] & 0x0F) + // x
((_fractcoords_enter[dir] & 0x0F) + // x
(length + 1) * _deltacoord_leaveoffset[dir]) +
(((_fractcoords_enter[dir] >> 4) + // y
(((_fractcoords_enter[dir] >> 4) + // y
((length + 1) * _deltacoord_leaveoffset[dir+4])) << 4);
fract_coord = (x & 0xF) + ((y & 0xF) << 4);

View File

@ -412,7 +412,7 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
if (WP(w,def_d).close) return;
w->click_state = ((1<<3) << _road_station_picker_orientation) |
w->click_state = ((1<<3) << _road_station_picker_orientation) |
((1<<7) << _station_show_coverage);
DrawWindowWidgets(w);

View File

@ -1393,7 +1393,7 @@ again:
}
if (rd.x & 0x40) {
int dir = RoadFindPathToDest(v, v->tile, rd.x & 3);
int dir = RoadFindPathToDest(v, v->tile, rd.x & 3);
uint32 r;
int tmp;
Direction newdir;

View File

@ -656,7 +656,7 @@ static void DrawRoadDepotWindow(Window *w)
FOR_ALL_VEHICLES(v) {
if (v->type == VEH_Road && IsRoadVehInDepot(v) && v->tile == tile &&
--num < 0 && num >= -w->vscroll.cap * w->hscroll.cap) {
--num < 0 && num >= -w->vscroll.cap * w->hscroll.cap) {
DrawRoadVehImage(v, x+24, y, WP(w,traindepot_d).sel);
SetDParam(0, v->unitnumber);
@ -1053,7 +1053,7 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
if (id_v >= vl->list_length) return; // click out of list bound
v = vl->sort_list[id_v];
v = vl->sort_list[id_v];
assert(v->type == VEH_Road && v->owner == owner);
@ -1161,6 +1161,6 @@ void ShowPlayerRoadVehicles(PlayerID player, StationID station)
void ShowVehWithSharedOrdersRoadVehicles(Vehicle *v)
{
if (v->orders == NULL) return; // no shared list to show
if (v->orders == NULL) return; // no shared list to show
ShowPlayerRoadVehiclesLocal(v->owner, INVALID_STATION, v->orders->index, true);
}

View File

@ -341,7 +341,7 @@ static bool ini_save(const char *filename, IniFile *ini)
assert(item->value != NULL);
if (item->comment != NULL) fputs(item->comment, f);
//*Don't give an equal sign to list items that don't have a parameter */
/* Don't give an equal sign to list items that don't have a parameter */
if (group->type == IGT_LIST && *item->value == '\0') {
fprintf(f, "%s\n", item->name);
} else {

View File

@ -383,7 +383,7 @@ static void NewShipWndProc(Window *w, WindowEvent *e)
DoCommandP(w->window_number, sel_eng, 0, CcBuildShip, CMD_BUILD_SHIP | CMD_MSG(STR_980D_CAN_T_BUILD_SHIP));
} break;
case 6: { /* rename */
case 6: { /* rename */
EngineID sel_eng = WP(w,buildtrain_d).sel_engine;
if (sel_eng != INVALID_ENGINE) {
WP(w,buildtrain_d).rename_engine = sel_eng;
@ -828,7 +828,7 @@ static void ShipDepotWndProc(Window *w, WindowEvent *e)
case 4:
if (!HASBIT(w->disabled_state, 4) &&
WP(w,traindepot_d).sel != INVALID_VEHICLE) {
WP(w,traindepot_d).sel != INVALID_VEHICLE) {
Vehicle *v;
HandleButtonClick(w, 4);
@ -1066,7 +1066,7 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e)
if (id_v >= vl->list_length) return; // click out of list bound
v = vl->sort_list[id_v];
v = vl->sort_list[id_v];
assert(v->type == VEH_Ship);
@ -1175,6 +1175,6 @@ void ShowPlayerShips(PlayerID player, StationID station)
void ShowVehWithSharedOrdersShips(Vehicle *v)
{
if (v->orders == NULL) return; // no shared list to show
if (v->orders == NULL) return; // no shared list to show
ShowPlayerShipsLocal(v->owner, INVALID_STATION, v->orders->index, true);
}

View File

@ -799,7 +799,7 @@ int32 CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint invali
if (tileh != SLOPE_FLAT) {
// need to check so the entrance to the station is not pointing at a slope.
if ((invalid_dirs&1 && !(tileh & SLOPE_NE) && (uint)w_cur == w) ||
(invalid_dirs&2 && !(tileh & SLOPE_SE) && h_cur == 1) ||
(invalid_dirs&2 && !(tileh & SLOPE_SE) && h_cur == 1) ||
(invalid_dirs&4 && !(tileh & SLOPE_SW) && w_cur == 1) ||
(invalid_dirs&8 && !(tileh & SLOPE_NW) && (uint)h_cur == h)) {
return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
@ -1020,7 +1020,7 @@ int32 CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1, uint3
//XXX can't we pack this in the "else" part of the if above?
if (!CheckStationSpreadOut(st, tile_org, w_org, h_org)) return CMD_ERROR;
} else {
} else {
// Create a new station
st = AllocateStation();
if (st == NULL) return CMD_ERROR;

View File

@ -39,7 +39,7 @@ typedef struct LanguagePackHeader {
uint32 ident;
uint32 version; // 32-bits of auto generated version info which is basically a hash of strings.h
char name[32]; // the international name of this language
char own_name[32]; // the localized name of this language
char own_name[32]; // the localized name of this language
char isocode[16]; // the ISO code for the language (not country code)
uint16 offsets[32]; // the offsets
byte plural_form; // plural form index
@ -451,8 +451,8 @@ static const CmdStruct _cmd_structs[] = {
{"WEIGHT_S", EmitEscapedByte, 19, 1, 0},
{"FORCE", EmitEscapedByte, 20, 1, 0},
{"P", EmitPlural, 0, 0, C_DONTCOUNT}, // plural specifier
{"G", EmitGender, 0, 0, C_DONTCOUNT}, // gender specifier
{"P", EmitPlural, 0, 0, C_DONTCOUNT}, // plural specifier
{"G", EmitGender, 0, 0, C_DONTCOUNT}, // gender specifier
{"DATE_LONG", EmitSingleByte, 0x82, 1, 0},
{"DATE_SHORT", EmitSingleByte, 0x83, 1, 0},

View File

@ -41,13 +41,13 @@ extern const char _openttd_revision[];
typedef struct LanguagePack {
uint32 ident;
uint32 version; // 32-bits of auto generated version info which is basically a hash of strings.h
char name[32]; // the international name of this language
char own_name[32]; // the localized name of this language
char isocode[16]; // the ISO code for the language (not country code)
uint16 offsets[32]; // the offsets
byte plural_form; // how to compute plural forms
byte pad[3]; // pad header to be a multiple of 4
uint32 version; // 32-bits of auto generated version info which is basically a hash of strings.h
char name[32]; // the international name of this language
char own_name[32]; // the localized name of this language
char isocode[16]; // the ISO code for the language (not country code)
uint16 offsets[32]; // the offsets
byte plural_form; // how to compute plural forms
byte pad[3]; // pad header to be a multiple of 4
char data[VARARRAY_SIZE];
} LanguagePack;

View File

@ -30,8 +30,8 @@ static FileList files_dos = {
{ "dosdummy.grf", {0x07, 0x01, 0xe6, 0xc4, 0x07, 0x6a, 0x5b, 0xc3, 0xf4, 0x9f, 0x01, 0xad, 0x21, 0x6c, 0xa0, 0xc2} }, // 4890 - 4895 inclusive
{ "nsignalsw.grf", {0x65, 0xb9, 0xd7, 0x30, 0x56, 0x06, 0xcc, 0x9e, 0x27, 0x57, 0xc8, 0xe4, 0x9b, 0xb3, 0x66, 0x81} }, // 4896 - 5381 inclusive
{ NULL, { 0 } }
},
{ { "TRGC.GRF", {0xed, 0x44, 0x66, 0x37, 0xe0, 0x34, 0x10, 0x4c, 0x55, 0x59, 0xb3, 0x2c, 0x18, 0xaf, 0xe7, 0x8d} },
}, {
{ "TRGC.GRF", {0xed, 0x44, 0x66, 0x37, 0xe0, 0x34, 0x10, 0x4c, 0x55, 0x59, 0xb3, 0x2c, 0x18, 0xaf, 0xe7, 0x8d} },
{ "TRGH.GRF", {0xee, 0x66, 0x16, 0xfb, 0x0e, 0x6e, 0xf6, 0xb2, 0x48, 0x92, 0xc5, 0x8c, 0x93, 0xd8, 0x6f, 0xc9} },
{ "TRGT.GRF", {0xfc, 0xde, 0x1d, 0x7e, 0x8a, 0x74, 0x19, 0x7d, 0x72, 0xa6, 0x26, 0x95, 0x88, 0x4b, 0x90, 0x9e} }
}
@ -44,8 +44,8 @@ static FileList files_win = {
{ "nsignalsw.grf", {0x65, 0xb9, 0xd7, 0x30, 0x56, 0x06, 0xcc, 0x9e, 0x27, 0x57, 0xc8, 0xe4, 0x9b, 0xb3, 0x66, 0x81} }, // 4896 - 5381 inclusive
{ NULL, { 0 } },
{ NULL, { 0 } }
},
{ { "TRGCR.GRF", {0x36, 0x68, 0xf4, 0x10, 0xc7, 0x61, 0xa0, 0x50, 0xb5, 0xe7, 0x09, 0x5a, 0x2b, 0x14, 0x87, 0x9b} },
}, {
{ "TRGCR.GRF", {0x36, 0x68, 0xf4, 0x10, 0xc7, 0x61, 0xa0, 0x50, 0xb5, 0xe7, 0x09, 0x5a, 0x2b, 0x14, 0x87, 0x9b} },
{ "TRGHR.GRF", {0x06, 0xbf, 0x2b, 0x7a, 0x31, 0x76, 0x6f, 0x04, 0x8b, 0xaa, 0xc2, 0xeb, 0xe4, 0x34, 0x57, 0xb1} },
{ "TRGTR.GRF", {0xde, 0x53, 0x65, 0x05, 0x17, 0xfe, 0x66, 0x1c, 0xea, 0xa3, 0x13, 0x8c, 0x6e, 0xdb, 0x0e, 0xb8} }
}

View File

@ -156,7 +156,7 @@ static const ExtraPaletteValues _extra_palette_values = {
M( 48, 84, 128) },
{ M( 28, 108, 124), M( 32, 112, 128), M( 36, 116, 132), M( 40, 120, 136),
M( 44, 124, 140) },
{ M(240, 208, 0), M( 0, 0, 0), M( 0, 0, 0), M( 0, 0, 0) },
{ M(240, 208, 0), M( 0, 0, 0), M( 0, 0, 0), M( 0, 0, 0) },
{ M(252, 60, 0), M(252, 84, 0), M(252, 108, 0), M(252, 124, 0),
M(252, 148, 0), M(252, 172, 0), M(252, 196, 0) },
{ M( 76, 24, 8), M(108, 44, 24), M(144, 72, 52), M(176, 108, 84),

View File

@ -334,7 +334,7 @@ enum Sprites {
SPR_AIRPORT_RADAR_B = 2690,
SPR_AIRPORT_RADAR_C = 2691,
SPR_AIRPORT_HELIPAD = SPR_OPENTTD_BASE + 28,
SPR_AIRPORT_HELIDEPOT_OFFICE = 2095,
SPR_AIRPORT_HELIDEPOT_OFFICE = 2095,
/* Road Stops */
/* Road stops have a ground tile and 3 buildings, one on each side

View File

@ -674,7 +674,7 @@ static const DrawTileSeqStruct _station_display_datas_0113[] = {
// concrete underground
static const DrawTileSeqStruct _station_display_datas_0114[] = {
{ 10, 6, 0, 0, 0, 0, SPR_AIRPORT_HELIPAD },
{ 15, 0, 0, 1, 16, 6, SPR_AIRPORT_FENCE_Y | PALETTE_MODIFIER_COLOR }, // fences bottom
{ 15, 0, 0, 1, 16, 6, SPR_AIRPORT_FENCE_Y | PALETTE_MODIFIER_COLOR }, // fences bottom
TILE_SEQ_END()
};

2
tgp.c
View File

@ -198,7 +198,7 @@ static HeightMap _height_map = {NULL, 0, 0, 0, 0};
#define FOR_ALL_TILES_IN_HEIGHT(h) for (h = _height_map.h; h < &_height_map.h[_height_map.total_size]; h++)
/** Noise amplitudes (multiplied by 1024)
* - indexed by "smoothness setting" and log2(frequency) */
* - indexed by "smoothness setting" and log2(frequency) */
static const amplitude_t _amplitudes_by_smoothness_and_frequency[4][12] = {
// Very smooth
{1000, 350, 123, 43, 15, 1, 1, 0, 0, 0, 0, 0},

View File

@ -676,7 +676,7 @@ build_road_and_exit:
tmptile = tile;
// Now it contains the direction of the slope
j = -11; // max 11 tile long bridges
j = -11; // max 11 tile long bridges
do {
if (++j == 0)
goto build_road_and_exit;
@ -1555,9 +1555,9 @@ static void TownActionBribe(Town* t)
// but this is special, because it can only 'fail' on a DC_EXEC
if (IsLocalPlayer()) ShowErrorMessage(STR_BRIBE_FAILED_2, STR_BRIBE_FAILED, 0, 0);
/* decrease by a lot!
* ChangeTownRating is only for stuff in demolishing. Bribe failure should
* be independent of any cheat settings
/* decrease by a lot!
* ChangeTownRating is only for stuff in demolishing. Bribe failure should
* be independent of any cheat settings
*/
if (t->ratings[_current_player] > RATING_BRIBE_DOWN_TO) {
t->ratings[_current_player] = RATING_BRIBE_DOWN_TO;
@ -1659,14 +1659,14 @@ static void UpdateTownGrowRate(Town *t)
}
if (_opt.landscape == LT_HILLY) {
if (TilePixelHeight(t->xy) >= _opt.snow_line && t->act_food == 0 && t->population > 90)
if (TilePixelHeight(t->xy) >= _opt.snow_line && t->act_food == 0 && t->population > 90)
return;
} else if (_opt.landscape == LT_DESERT) {
if (GetTropicZone(t->xy) == TROPICZONE_DESERT && (t->act_food==0 || t->act_water==0) && t->population > 60)
if (GetTropicZone(t->xy) == TROPICZONE_DESERT && (t->act_food==0 || t->act_water==0) && t->population > 60)
return;
}
t->growth_rate = m / (t->num_houses / 50 + 1);
t->growth_rate = m / (t->num_houses / 50 + 1);
if (m <= t->grow_counter)
t->grow_counter = m;
@ -1753,7 +1753,7 @@ void ChangeTownRating(Town *t, int add, int max)
{
int rating;
// if magic_bulldozer cheat is active, town doesn't penaltize for removing stuff
// if magic_bulldozer cheat is active, town doesn't penaltize for removing stuff
if (t == NULL ||
_current_player >= MAX_PLAYERS ||
(_cheats.magic_bulldozer.value && add < 0)) {
@ -1778,7 +1778,7 @@ void ChangeTownRating(Town *t, int add, int max)
t->ratings[_current_player] = rating;
}
/* penalty for removing town-owned stuff */
/* penalty for removing town-owned stuff */
static const int _default_rating_settings [3][3] = {
// ROAD_REMOVE, TUNNELBRIDGE_REMOVE, INDUSTRY_REMOVE
{ 0, 128, 384}, // Permissive
@ -1790,13 +1790,13 @@ bool CheckforTownRating(uint32 flags, Town *t, byte type)
{
int modemod;
// if magic_bulldozer cheat is active, town doesn't restrict your destructive actions
// if magic_bulldozer cheat is active, town doesn't restrict your destructive actions
if (t == NULL || _current_player >= MAX_PLAYERS || _cheats.magic_bulldozer.value)
return true;
/* check if you're allowed to remove the street/bridge/tunnel/industry
* owned by a town no removal if rating is lower than ... depends now on
* difficulty setting. Minimum town rating selected by difficulty level
/* check if you're allowed to remove the street/bridge/tunnel/industry
* owned by a town no removal if rating is lower than ... depends now on
* difficulty setting. Minimum town rating selected by difficulty level
*/
modemod = _default_rating_settings[_opt.diff.town_council_tolerance][type];

View File

@ -130,14 +130,14 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e)
SetDParam(2, GetPlayerNameString(p->index, 3));
r = t->ratings[p->index];
(str = STR_3035_APPALLING, r <= RATING_APPALLING) || // Apalling
(str++, r <= RATING_VERYPOOR) || // Very Poor
(str++, r <= RATING_POOR) || // Poor
(str++, r <= RATING_MEDIOCRE) || // Mediocore
(str++, r <= RATING_GOOD) || // Good
(str++, r <= RATING_VERYGOOD) || // Very Good
(str++, r <= RATING_EXCELLENT) || // Excellent
(str++, true); // Outstanding
(str = STR_3035_APPALLING, r <= RATING_APPALLING) || // Apalling
(str++, r <= RATING_VERYPOOR) || // Very Poor
(str++, r <= RATING_POOR) || // Poor
(str++, r <= RATING_MEDIOCRE) || // Mediocore
(str++, r <= RATING_GOOD) || // Good
(str++, r <= RATING_VERYGOOD) || // Very Good
(str++, r <= RATING_EXCELLENT) || // Excellent
(str++, true); // Outstanding
SetDParam(4, str);
if (t->exclusivity == p->index) // red icon for player with exclusive rights

View File

@ -95,8 +95,8 @@ void TrainPowerChanged(Vehicle* v)
if (!HasPowerOnRail(u->u.rail.railtype, GetRailTypeOnBridge(u->tile))) engine_has_power = false;
if (!HasPowerOnRail(v->u.rail.railtype, GetRailTypeOnBridge(u->tile))) wagon_has_power = false;
} else if (IsLevelCrossingTile(u->tile)) {
if (!HasPowerOnRail(u->u.rail.railtype, GetRailTypeCrossing(u->tile))) engine_has_power = false;
if (!HasPowerOnRail(v->u.rail.railtype, GetRailTypeCrossing(u->tile))) wagon_has_power = false;
if (!HasPowerOnRail(u->u.rail.railtype, GetRailTypeCrossing(u->tile))) engine_has_power = false;
if (!HasPowerOnRail(v->u.rail.railtype, GetRailTypeCrossing(u->tile))) wagon_has_power = false;
} else {
if (!HasPowerOnRail(u->u.rail.railtype, GetRailType(u->tile))) engine_has_power = false;
if (!HasPowerOnRail(v->u.rail.railtype, GetRailType(u->tile))) wagon_has_power = false;
@ -271,13 +271,13 @@ static bool TrainShouldStop(const Vehicle* v, TileIndex tile)
static int GetTrainAcceleration(Vehicle *v, bool mode)
{
const Vehicle *u;
int num = 0; //number of vehicles, change this into the number of axles later
int num = 0; //number of vehicles, change this into the number of axles later
int power = 0;
int mass = 0;
int max_speed = 2000;
int area = 120;
int friction = 35; //[1e-3]
int drag_coeff = 20; //[1e-4]
int drag_coeff = 20; //[1e-4]
int incl = 0;
int resistance;
int speed = v->cur_speed; //[mph]
@ -358,7 +358,7 @@ static int GetTrainAcceleration(Vehicle *v, bool mode)
if (u->u.rail.track == 0x80) max_speed = min(max_speed, 61);
if (HASBIT(u->u.rail.flags, VRF_GOINGUP)) {
incl += u->u.rail.cached_veh_weight * 60; //3% slope, quite a bit actually
incl += u->u.rail.cached_veh_weight * 60; //3% slope, quite a bit actually
} else if (HASBIT(u->u.rail.flags, VRF_GOINGDOWN)) {
incl -= u->u.rail.cached_veh_weight * 60;
}
@ -810,7 +810,7 @@ int32 CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
TrainConsistChanged(v);
UpdateTrainAcceleration(v);
if (!HASBIT(p2, 1)) { // check if the cars should be added to the new vehicle
if (!HASBIT(p2, 1)) { // check if the cars should be added to the new vehicle
NormalizeTrainVehInDepot(v);
}
@ -1183,7 +1183,7 @@ int32 CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
* we can't loop forever here because next time we reach this line we will have a front engine */
if (src_head != NULL && !IsFrontEngine(src_head) && IsTrainEngine(src_head)) {
CmdMoveRailVehicle(0, flags, src_head->index | (INVALID_VEHICLE << 16), 1);
src_head = NULL; // don't do anything more to this train since the new call will do it
src_head = NULL; // don't do anything more to this train since the new call will do it
}
if (src_head != NULL) {
@ -3670,7 +3670,7 @@ void ConvertOldMultiheadToNew(void)
Vehicle *v;
FOR_ALL_VEHICLES(v) {
if (v->type == VEH_Train) {
SETBIT(v->subtype, 7); // indicates that it's the old format and needs to be converted in the next loop
SETBIT(v->subtype, 7); // indicates that it's the old format and needs to be converted in the next loop
}
}
@ -3684,18 +3684,18 @@ void ConvertOldMultiheadToNew(void)
CLRBIT(u->subtype, 7);
switch (u->subtype) {
case 0: /* TS_Front_Engine */
case 0: /* TS_Front_Engine */
if (rvi->flags & RVI_MULTIHEAD) SetMultiheaded(u);
SetFrontEngine(u);
SetTrainEngine(u);
break;
case 1: /* TS_Artic_Part */
case 1: /* TS_Artic_Part */
u->subtype = 0;
SetArticulatedPart(u);
break;
case 2: /* TS_Not_First */
case 2: /* TS_Not_First */
u->subtype = 0;
if (rvi->flags & RVI_WAGON) {
// normal wagon
@ -3711,7 +3711,7 @@ void ConvertOldMultiheadToNew(void)
SetTrainEngine(u);
break;
case 4: /* TS_Free_Car */
case 4: /* TS_Free_Car */
u->subtype = 0;
SetTrainWagon(u);
SetFreeWagon(u);

View File

@ -454,7 +454,7 @@ static void DrawTrainDepotWindow(Window *w)
// Number of wagons relative to a standard length wagon (rounded up)
SetDParam(0, (v->u.rail.cached_total_length + 7) / 8);
DrawStringRightAligned(w->widget[6].right - 1, y + 4, STR_TINY_BLACK, 0); //Draw the counter
DrawStringRightAligned(w->widget[6].right - 1, y + 4, STR_TINY_BLACK, 0); // Draw the counter
/* Draw the pretty flag */
DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, x + 15, y);
@ -474,9 +474,9 @@ static void DrawTrainDepotWindow(Window *w)
/*Draw the train counter */
i = 0;
u = v;
do i++; while ( (u=u->next) != NULL); //Determine length of train
SetDParam(0, i); //Set the counter
DrawStringRightAligned(w->widget[6].right - 1, y + 4, STR_TINY_BLACK, 0); //Draw the counter
do i++; while ( (u=u->next) != NULL); // Determine length of train
SetDParam(0, i); // Set the counter
DrawStringRightAligned(w->widget[6].right - 1, y + 4, STR_TINY_BLACK, 0); // Draw the counter
y += 14;
}
}
@ -1020,10 +1020,10 @@ static void TrainViewWndProc(Window *w, WindowEvent *e)
case 5: /* start/stop train */
DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_TRAIN | CMD_MSG(STR_883B_CAN_T_STOP_START_TRAIN));
break;
case 6: /* center main view */
case 6: /* center main view */
ScrollMainWindowTo(v->x_pos, v->y_pos);
break;
case 7: /* goto depot */
case 7: /* goto depot */
/* TrainGotoDepot has a nice randomizer in the pathfinder, which causes desyncs... */
DoCommandP(v->tile, v->index, _ctrl_pressed ? 1 : 0, NULL, CMD_TRAIN_GOTO_DEPOT | CMD_NO_TEST_IF_IN_NETWORK | CMD_MSG(STR_8830_CAN_T_SEND_TRAIN_TO_DEPOT));
break;
@ -1149,7 +1149,7 @@ static TrainDetailsDrawerProc * const _train_details_drawer_proc[3] = {
static void DrawTrainDetailsWindow(Window *w)
{
const Vehicle *v, *u;
uint16 tot_cargo[NUM_CARGO][2]; // count total cargo ([0]-actual cargo, [1]-total cargo)
uint16 tot_cargo[NUM_CARGO][2]; // count total cargo ([0]-actual cargo, [1]-total cargo)
int i,num,x,y,sel;
byte det_tab = WP(w, traindetails_d).tab;
@ -1157,7 +1157,7 @@ static void DrawTrainDetailsWindow(Window *w)
num = 0;
// det_tab == 3 <-- Total Cargo tab
if (det_tab == 3) // reset tot_cargo array to 0 values
if (det_tab == 3) // reset tot_cargo array to 0 values
memset(tot_cargo, 0, sizeof(tot_cargo));
u = v = GetVehicle(w->window_number);
@ -1170,15 +1170,15 @@ static void DrawTrainDetailsWindow(Window *w)
}
} while ((u = GetNextVehicle(u)) != NULL);
/* set scroll-amount seperately from counting, as to not
compute num double for more carriages of the same type
/* set scroll-amount seperately from counting, as to not
* compute num double for more carriages of the same type
*/
if (det_tab == 3) {
for (i = 0; i != NUM_CARGO; i++) {
if (tot_cargo[i][1] > 0) // only count carriages that the train has
if (tot_cargo[i][1] > 0) // only count carriages that the train has
num++;
}
num++; // needs one more because first line is description string
num++; // needs one more because first line is description string
}
SetVScrollCount(w, num);
@ -1249,11 +1249,11 @@ static void DrawTrainDetailsWindow(Window *w)
for (i = 0; i != NUM_CARGO; i++) {
if (tot_cargo[i][1] > 0 && --sel < 0 && sel > -w->vscroll.cap) {
y += 14;
// STR_013F_TOTAL_CAPACITY :{LTBLUE}- {CARGO} ({SHORTCARGO})
SetDParam(0, i); // {CARGO} #1
SetDParam(1, tot_cargo[i][0]); // {CARGO} #2
SetDParam(2, i); // {SHORTCARGO} #1
SetDParam(3, tot_cargo[i][1]); // {SHORTCARGO} #2
// STR_013F_TOTAL_CAPACITY :{LTBLUE}- {CARGO} ({SHORTCARGO})
SetDParam(0, i); // {CARGO} #1
SetDParam(1, tot_cargo[i][0]); // {CARGO} #2
SetDParam(2, i); // {SHORTCARGO} #1
SetDParam(3, tot_cargo[i][1]); // {SHORTCARGO} #2
DrawString(x, y + 2, STR_013F_TOTAL_CAPACITY, 0);
}
}
@ -1275,7 +1275,7 @@ static void TrainDetailsWndProc(Window *w, WindowEvent *e)
SetDParam(0, v->unitnumber);
ShowQueryString(v->string_id, STR_8865_NAME_TRAIN, 31, 150, w->window_class, w->window_number, CS_ALPHANUMERAL);
break;
case 6: /* inc serv interval */
case 6: /* inc serv interval */
mod = _ctrl_pressed? 5 : 10;
goto do_change_service_int;
@ -1290,10 +1290,10 @@ do_change_service_int:
DoCommandP(v->tile, v->index, mod, NULL, CMD_CHANGE_SERVICE_INT | CMD_MSG(STR_018A_CAN_T_CHANGE_SERVICING));
break;
/* details buttons*/
case 9: // Cargo
case 10: // Information
case 11: // Capacities
case 12: // Total cargo
case 9: // Cargo
case 10: // Information
case 11: // Capacities
case 12: // Total cargo
CLRBIT(w->disabled_state, 9);
CLRBIT(w->disabled_state, 10);
CLRBIT(w->disabled_state, 11);
@ -1626,6 +1626,6 @@ void ShowPlayerTrains(PlayerID player, StationID station)
void ShowVehWithSharedOrdersTrains(Vehicle *v)
{
if (v->orders == NULL) return; // no shared list to show
if (v->orders == NULL) return; // no shared list to show
ShowPlayerTrainsLocal(v->owner, INVALID_STATION, v->orders->index, true);
}

View File

@ -413,14 +413,14 @@ not_valid_below:;
SetSignalsOnBothDir(tile_start, AxisToTrack(direction));
YapfNotifyTrackLayoutChange(tile_start, AxisToTrack(direction));
/* for human player that builds the bridge he gets a selection to choose from bridges (DC_QUERY_COST)
It's unnecessary to execute this command every time for every bridge. So it is done only
and cost is computed in "bridge_gui.c". For AI, Towns this has to be of course calculated
*/
/* for human player that builds the bridge he gets a selection to choose from bridges (DC_QUERY_COST)
* It's unnecessary to execute this command every time for every bridge. So it is done only
* and cost is computed in "bridge_gui.c". For AI, Towns this has to be of course calculated
*/
if (!(flags & DC_QUERY_COST)) {
const Bridge *b = &_bridge[bridge_type];
bridge_len += 2; // begin and end tiles/ramps
bridge_len += 2; // begin and end tiles/ramps
if (_current_player < MAX_PLAYERS && !_is_old_ai_player)
bridge_len = CalcBridgeLenCostFactor(bridge_len);
@ -1315,7 +1315,7 @@ static void ChangeTileOwner_TunnelBridge(TileIndex tile, PlayerID old_player, Pl
if (new_player != OWNER_SPECTATOR) {
SetTileOwner(tile, new_player);
} else {
} else {
if (IsBridge(tile) && IsBridgeMiddle(tile) && IsTransportUnderBridge(tile)) {
// the stuff BELOW the middle part is owned by the deleted player.
if (GetTransportTypeUnderBridge(tile) == TRANSPORT_RAIL) {

View File

@ -37,15 +37,15 @@
#define GEN_HASH(x, y) ((GB((y), 6, 6) << 6) + GB((x), 7, 6))
/*
* These command macros are used to call vehicle type specific commands with non type specific commands
* it should be used like: DoCommandP(x, y, p1, p2, flags, CMD_STARTSTOP_VEH(v->type))
* that line will start/stop a vehicle nomatter what type it is
* VEH_Train is used as an offset because the vehicle type values doesn't start with 0
* These command macros are used to call vehicle type specific commands with non type specific commands
* it should be used like: DoCommandP(x, y, p1, p2, flags, CMD_STARTSTOP_VEH(v->type))
* that line will start/stop a vehicle nomatter what type it is
* VEH_Train is used as an offset because the vehicle type values doesn't start with 0
*/
#define CMD_BUILD_VEH(x) _veh_build_proc_table[ x - VEH_Train]
#define CMD_SELL_VEH(x) _veh_sell_proc_table[ x - VEH_Train]
#define CMD_REFIT_VEH(x) _veh_refit_proc_table[ x - VEH_Train]
#define CMD_BUILD_VEH(x) _veh_build_proc_table[ x - VEH_Train]
#define CMD_SELL_VEH(x) _veh_sell_proc_table [ x - VEH_Train]
#define CMD_REFIT_VEH(x) _veh_refit_proc_table[ x - VEH_Train]
static const uint32 _veh_build_proc_table[] = {
CMD_BUILD_RAIL_VEHICLE,
@ -314,7 +314,7 @@ static Vehicle *AllocateSingleVehicle(VehicleID *skip_vehicles)
/* We don't use FOR_ALL here, because FOR_ALL skips invalid items.
* TODO - This is just a temporary stage, this will be removed. */
if (*skip_vehicles < (_vehicle_pool.total_items - offset)) { // make sure the offset in the array is not larger than the array itself
if (*skip_vehicles < (_vehicle_pool.total_items - offset)) { // make sure the offset in the array is not larger than the array itself
for (v = GetVehicle(offset + *skip_vehicles); v != NULL; v = (v->index + 1 < GetVehiclePoolSize()) ? GetVehicle(v->index + 1) : NULL) {
(*skip_vehicles)++;
if (!IsValidVehicle(v)) return InitializeVehicle(v);
@ -339,7 +339,7 @@ Vehicle *AllocateVehicle(void)
/** Allocates a lot of vehicles and frees them again
* @param vl pointer to an array of vehicles to get allocated. Can be NULL if the vehicles aren't needed (makes it test only)
* @param num number of vehicles to allocate room for
* returns true if there is room to allocate all the vehicles
* @return true if there is room to allocate all the vehicles
*/
bool AllocateVehicles(Vehicle **vl, int num)
{
@ -614,7 +614,7 @@ void CallVehicleTicks(void)
}
#endif //ENABLE_NETWORK
_first_veh_in_depot_list = NULL; // now we are sure it's initialized at the start of each tick
_first_veh_in_depot_list = NULL; // now we are sure it's initialized at the start of each tick
FOR_ALL_VEHICLES(v) {
_vehicle_tick_procs[v->type - 0x10](v);
@ -624,7 +624,7 @@ void CallVehicleTicks(void)
v = _first_veh_in_depot_list;
while (v != NULL) {
Vehicle *w = v->depot_list;
v->depot_list = NULL; // it should always be NULL at the end of each tick
v->depot_list = NULL; // it should always be NULL at the end of each tick
MaybeReplaceVehicle(v);
v = w;
}
@ -1591,7 +1591,7 @@ int32 CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
w->service_interval = v->service_interval;
DoCommand(0, (v->index << 16) | w->index, p2 & 1 ? CO_SHARE : CO_COPY, flags, CMD_CLONE_ORDER);
}
w_rear = w; // trains needs to know the last car in the train, so they can add more in next loop
w_rear = w; // trains needs to know the last car in the train, so they can add more in next loop
}
} while (v->type == VEH_Train && (v = GetNextVehicle(v)) != NULL);
@ -1613,10 +1613,10 @@ static void MoveVehicleCargo(Vehicle *dest, Vehicle *source)
do {
do {
if (source->cargo_type != dest->cargo_type)
continue; // cargo not compatible
continue; // cargo not compatible
if (dest->cargo_count == dest->cargo_cap)
continue; // the destination vehicle is already full
continue; // the destination vehicle is already full
units_moved = min(source->cargo_count, dest->cargo_cap - dest->cargo_count);
source->cargo_count -= units_moved;
@ -1660,7 +1660,7 @@ static int32 ReplaceVehicle(Vehicle **w, byte flags)
if (flags & DC_EXEC) {
CargoID new_cargo_type = old_v->cargo_type;
new_v = GetVehicle(_new_vehicle_id);
*w = new_v; //we changed the vehicle, so MaybeReplaceVehicle needs to work on the new one. Now we tell it what the new one is
*w = new_v; //we changed the vehicle, so MaybeReplaceVehicle needs to work on the new one. Now we tell it what the new one is
/* refit if needed */
if (old_v->type == VEH_Train && old_v->cargo_cap == 0 && new_v->cargo_cap != 0) {
@ -1710,7 +1710,7 @@ static int32 ReplaceVehicle(Vehicle **w, byte flags)
new_v->profit_last_year = old_v->profit_last_year;
new_v->service_interval = old_v->service_interval;
new_front = true;
new_v->unitnumber = old_v->unitnumber; // use the same unit number
new_v->unitnumber = old_v->unitnumber; // use the same unit number
new_v->current_order = old_v->current_order;
if (old_v->type == VEH_Train && GetNextVehicle(old_v) != NULL){
@ -1758,8 +1758,8 @@ static int32 ReplaceVehicle(Vehicle **w, byte flags)
/** replaces a vehicle if it's set for autoreplace or is too old
* (used to be called autorenew)
* @param v The vehicle to replace
* if the vehicle is a train, v needs to be the front engine
* return value is a pointer to the new vehicle, which is the same as the argument if nothing happened
* if the vehicle is a train, v needs to be the front engine
* @return pointer to the new vehicle, which is the same as the argument if nothing happened
*/
static void MaybeReplaceVehicle(Vehicle *v)
{
@ -1783,7 +1783,7 @@ static void MaybeReplaceVehicle(Vehicle *v)
assert(v->type == VEH_Train || v->type == VEH_Road || v->type == VEH_Ship || v->type == VEH_Aircraft);
assert(v->vehstatus & VS_STOPPED); // the vehicle should have been stopped in VehicleEnteredDepotThisTick() if needed
assert(v->vehstatus & VS_STOPPED); // the vehicle should have been stopped in VehicleEnteredDepotThisTick() if needed
if (v->leave_depot_instantly) {
// we stopped the vehicle to do this, so we have to remember to start it again when we are done
@ -1855,7 +1855,7 @@ static void MaybeReplaceVehicle(Vehicle *v)
}
if (flags & DC_EXEC) {
break; // we are done replacing since the loop ran once with DC_EXEC
break; // we are done replacing since the loop ran once with DC_EXEC
}
// now we redo the loop, but this time we actually do stuff since we know that we can do it
flags |= DC_EXEC;

View File

@ -43,7 +43,7 @@ typedef enum EffectVehicle {
} EffectVehicle;
typedef struct VehicleRail {
uint16 last_speed; // NOSAVE: only used in UI
uint16 last_speed; // NOSAVE: only used in UI
uint16 crash_anim_pos;
uint16 days_since_order_progr;

View File

@ -281,9 +281,9 @@ int ShowAdditionalText(int x, int y, int w, EngineID engine)
/* Variables you need to set before calling this function!
* 1. (byte)_internal_sort_type: sorting criteria to sort on
* 2. (bool)_internal_sort_order: sorting order, descending/ascending
* 3. (uint32)_internal_name_sorter_id: default StringID of the vehicle when no name is set. eg
* 1. (byte)_internal_sort_type: sorting criteria to sort on
* 2. (bool)_internal_sort_order: sorting order, descending/ascending
* 3. (uint32)_internal_name_sorter_id: default StringID of the vehicle when no name is set. eg
* STR_SV_TRAIN_NAME for trains or STR_SV_AIRCRAFT_NAME for aircraft
*/
static int CDECL VehicleUnsortedSorter(const void *a, const void *b)
@ -325,7 +325,7 @@ static int CDECL VehicleNameSorter(const void *a, const void *b)
}
}
r = strcmp(buf1, _bufcache); // sort by name
r = strcmp(buf1, _bufcache); // sort by name
VEHICLEUNITNUMBERSORTER(r, va, vb);
@ -464,8 +464,9 @@ static int CDECL VehicleValueSorter(const void *a, const void *b)
#define ENGINE_AVAILABLE ((e->flags & 1 && HASBIT(info->climates, _opt.landscape)) || HASBIT(e->player_avail, _local_player))
/* if show_outdated is selected, it do not sort psudo engines properly but it draws all engines
* if used compined with show_cars set to false, it will work as intended. Replace window do it like that
* this was a big hack even before show_outdated was added. Stupid newgrf :p */
* if used compined with show_cars set to false, it will work as intended. Replace window do it like that
* this was a big hack even before show_outdated was added. Stupid newgrf :p
*/
static void train_engine_drawing_loop(int *x, int *y, int *pos, int *sel, EngineID *selected_id, RailType railtype,
uint8 lines_drawn, bool is_engine, bool show_cars, bool show_outdated, bool show_compatible)
{
@ -535,8 +536,8 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
case VEH_Train: {
RailType railtype = _railtype_selected_in_replace_gui;
w->widget[13].color = _player_colors[_local_player]; // sets the colour of that art thing
w->widget[16].color = _player_colors[_local_player]; // sets the colour of that art thing
w->widget[13].color = _player_colors[_local_player]; // sets the colour of that art thing
w->widget[16].color = _player_colors[_local_player]; // sets the colour of that art thing
for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
EngineID eid = GetRailVehAtPosition(i);
@ -911,7 +912,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
DrawString(145, 87 + w->resize.step_height * w->vscroll.cap, STR_02BD, 0x10);
/* now we draw the two arrays according to what we just counted */
/* now we draw the two arrays according to what we just counted */
DrawEngineArrayInReplaceWindow(w, x, y, x2, y2, pos, pos2, sel[0], sel[1], selected_id[0], selected_id[1]);
WP(w,replaceveh_d).sel_engine[0] = selected_id[0];

View File

@ -24,8 +24,8 @@ void SortVehicleList(struct vehiclelist_d *vl);
extern const StringID _vehicle_sort_listing[];
typedef struct Listing {
bool order; // Ascending/descending?
byte criteria; // Sorting criteria
bool order; // Ascending/descending?
byte criteria; // Sorting criteria
} Listing;
typedef struct Sorting {

View File

@ -1849,7 +1849,7 @@ static void QZ_HideMouse(void)
QZ_AskQuit();
return NSTerminateCancel; // NSTerminateLater ?
return NSTerminateCancel; // NSTerminateLater ?
}
@end

View File

@ -225,28 +225,28 @@ typedef struct VkMapping {
static const VkMapping _vk_mapping[] = {
// Pageup stuff + up/down
AM(SDLK_PAGEUP, SDLK_PAGEDOWN, WKC_PAGEUP, WKC_PAGEDOWN),
AS(SDLK_UP, WKC_UP),
AS(SDLK_DOWN, WKC_DOWN),
AS(SDLK_LEFT, WKC_LEFT),
AS(SDLK_RIGHT, WKC_RIGHT),
AS(SDLK_UP, WKC_UP),
AS(SDLK_DOWN, WKC_DOWN),
AS(SDLK_LEFT, WKC_LEFT),
AS(SDLK_RIGHT, WKC_RIGHT),
AS(SDLK_HOME, WKC_HOME),
AS(SDLK_END, WKC_END),
AS(SDLK_HOME, WKC_HOME),
AS(SDLK_END, WKC_END),
AS(SDLK_INSERT, WKC_INSERT),
AS(SDLK_DELETE, WKC_DELETE),
AS(SDLK_INSERT, WKC_INSERT),
AS(SDLK_DELETE, WKC_DELETE),
// Map letters & digits
AM(SDLK_a, SDLK_z, 'A', 'Z'),
AM(SDLK_0, SDLK_9, '0', '9'),
AS(SDLK_ESCAPE, WKC_ESC),
AS(SDLK_PAUSE, WKC_PAUSE),
AS(SDLK_BACKSPACE, WKC_BACKSPACE),
AS(SDLK_ESCAPE, WKC_ESC),
AS(SDLK_PAUSE, WKC_PAUSE),
AS(SDLK_BACKSPACE, WKC_BACKSPACE),
AS(SDLK_SPACE, WKC_SPACE),
AS(SDLK_RETURN, WKC_RETURN),
AS(SDLK_TAB, WKC_TAB),
AS(SDLK_SPACE, WKC_SPACE),
AS(SDLK_RETURN, WKC_RETURN),
AS(SDLK_TAB, WKC_TAB),
// Function keys
AM(SDLK_F1, SDLK_F12, WKC_F1, WKC_F12),
@ -254,12 +254,12 @@ static const VkMapping _vk_mapping[] = {
// Numeric part.
// What is the virtual keycode for numeric enter??
AM(SDLK_KP0, SDLK_KP9, WKC_NUM_0, WKC_NUM_9),
AS(SDLK_KP_DIVIDE, WKC_NUM_DIV),
AS(SDLK_KP_MULTIPLY, WKC_NUM_MUL),
AS(SDLK_KP_MINUS, WKC_NUM_MINUS),
AS(SDLK_KP_PLUS, WKC_NUM_PLUS),
AS(SDLK_KP_ENTER, WKC_NUM_ENTER),
AS(SDLK_KP_PERIOD, WKC_NUM_DECIMAL)
AS(SDLK_KP_DIVIDE, WKC_NUM_DIV),
AS(SDLK_KP_MULTIPLY, WKC_NUM_MUL),
AS(SDLK_KP_MINUS, WKC_NUM_MINUS),
AS(SDLK_KP_PLUS, WKC_NUM_PLUS),
AS(SDLK_KP_ENTER, WKC_NUM_ENTER),
AS(SDLK_KP_PERIOD, WKC_NUM_DECIMAL)
};
static uint32 ConvertSdlKeyIntoMy(SDL_keysym *sym)

View File

@ -91,26 +91,26 @@ static const VkMapping _vk_mapping[] = {
AM('A','Z','A','Z'),
AM('0','9','0','9'),
AS(VK_ESCAPE, WKC_ESC),
AS(VK_PAUSE, WKC_PAUSE),
AS(VK_BACK, WKC_BACKSPACE),
AM(VK_INSERT,VK_DELETE,WKC_INSERT, WKC_DELETE),
AS(VK_ESCAPE, WKC_ESC),
AS(VK_PAUSE, WKC_PAUSE),
AS(VK_BACK, WKC_BACKSPACE),
AM(VK_INSERT, VK_DELETE, WKC_INSERT, WKC_DELETE),
AS(VK_SPACE, WKC_SPACE),
AS(VK_RETURN, WKC_RETURN),
AS(VK_TAB, WKC_TAB),
AS(VK_SPACE, WKC_SPACE),
AS(VK_RETURN, WKC_RETURN),
AS(VK_TAB, WKC_TAB),
// Function keys
AM(VK_F1, VK_F12, WKC_F1, WKC_F12),
AM(VK_F1, VK_F12, WKC_F1, WKC_F12),
// Numeric part.
// What is the virtual keycode for numeric enter??
AM(VK_NUMPAD0,VK_NUMPAD9, WKC_NUM_0, WKC_NUM_9),
AS(VK_DIVIDE, WKC_NUM_DIV),
AS(VK_MULTIPLY, WKC_NUM_MUL),
AS(VK_SUBTRACT, WKC_NUM_MINUS),
AS(VK_ADD, WKC_NUM_PLUS),
AS(VK_DECIMAL, WKC_NUM_DECIMAL)
AM(VK_NUMPAD0, VK_NUMPAD9, WKC_NUM_0, WKC_NUM_9),
AS(VK_DIVIDE, WKC_NUM_DIV),
AS(VK_MULTIPLY, WKC_NUM_MUL),
AS(VK_SUBTRACT, WKC_NUM_MINUS),
AS(VK_ADD, WKC_NUM_PLUS),
AS(VK_DECIMAL, WKC_NUM_DECIMAL)
};
static uint MapWindowsKey(uint sym)

View File

@ -604,13 +604,13 @@ static void FloodVehicle(Vehicle *v)
if (!(v->vehstatus & VS_CRASHED)) {
uint16 pass = 0;
if (v->type == VEH_Road) { // flood bus/truck
pass = 1; // driver
if (v->type == VEH_Road) { // flood bus/truck
pass = 1; // driver
if (v->cargo_type == CT_PASSENGERS)
pass += v->cargo_count;
v->vehstatus |= VS_CRASHED;
v->u.road.crashed_ctr = 2000; // max 2220, disappear pretty fast
v->u.road.crashed_ctr = 2000; // max 2220, disappear pretty fast
RebuildVehicleLists();
} else if (v->type == VEH_Train) {
Vehicle *u;

View File

@ -372,7 +372,7 @@ typedef struct {
byte sel_index[2];
EngineID sel_engine[2];
uint16 count[2];
bool wagon_btnstate; // true means engine is selected
bool wagon_btnstate; // true means engine is selected
} replaceveh_d;
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(replaceveh_d));
@ -554,9 +554,9 @@ enum WindowWidgetTypes {
WWT_MASK = 31,
WWT_PUSHTXTBTN = WWT_TEXTBTN | WWB_PUSHBUTTON,
WWT_PUSHIMGBTN = WWT_IMGBTN | WWB_PUSHBUTTON,
WWT_NODISTXTBTN = WWT_TEXTBTN | WWB_NODISBUTTON,
WWT_PUSHTXTBTN = WWT_TEXTBTN | WWB_PUSHBUTTON,
WWT_PUSHIMGBTN = WWT_IMGBTN | WWB_PUSHBUTTON,
WWT_NODISTXTBTN = WWT_TEXTBTN | WWB_NODISBUTTON,
};
#define WIDGETS_END WWT_LAST, RESIZE_NONE, 0, 0, 0, 0, 0, 0, STR_NULL

View File

@ -19,7 +19,7 @@ class CAutoCopyPtrT {
protected:
typedef Tdata_ Tdata;
struct CItem {
struct CItem {
int m_ref_cnt; ///< reference counter
Tdata m_data; ///< custom data itself

View File

@ -142,7 +142,7 @@ FORCEINLINE void CBinaryHeapT<Titem_>::RemoveHead()
child = gap * 2;
}
// move last item to the proper place
if (m_size > 0) m_items[gap] = &new_item;
if (m_size > 0) m_items[gap] = &new_item;
CheckConsistency();
}

View File

@ -21,7 +21,7 @@ FORCEINLINE void MemCpyT(Titem_* d, const Titem_* s, int num_items = 1)
- no thread synchronization at all */
class CBlobBaseSimple {
protected:
struct CHdr {
struct CHdr {
int m_size; // actual blob size in bytes
int m_max_size; // maximum (allocated) size in bytes
};
@ -66,7 +66,7 @@ public:
assert(p != NULL);
if (num_bytes > 0) {
memcpy(GrowRawSize(num_bytes), p, num_bytes);
} else {
} else {
assert(num_bytes >= 0);
}
}
@ -116,7 +116,7 @@ public:
// ask allocation policy for some reasonable block size
int alloc_size = AllocPolicy(min_alloc_size);
// allocate new block
CHdr* pNewHdr = RawAlloc(alloc_size);
CHdr* pNewHdr = RawAlloc(alloc_size);
// setup header
pNewHdr->m_size = RawSize();
pNewHdr->m_max_size = alloc_size - (sizeof(CHdr) + Ttail_reserve);

View File

@ -74,7 +74,7 @@ public:
FORCEINLINE bool operator == (const CCountedPtr& sp) const {return m_pT == sp.m_pT;}
/** yet another way how to test for NULL value */
FORCEINLINE bool operator != (const CCountedPtr& sp) const {return m_pT != sp.m_pT;}
FORCEINLINE bool operator != (const CCountedPtr& sp) const {return m_pT != sp.m_pT;}
/** assign pointer w/o incrementing ref count */
FORCEINLINE void Attach(Tcls* pT) {Release(); m_pT = pT;}

View File

@ -41,7 +41,7 @@ struct CCrc32
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,

View File

@ -77,7 +77,7 @@ struct CPerfStartReal
{
CPerformanceTimer* m_pperf;
FORCEINLINE CPerfStartReal(CPerformanceTimer& perf) : m_pperf(&perf) {if (m_pperf != NULL) m_pperf->Start();}
FORCEINLINE CPerfStartReal(CPerformanceTimer& perf) : m_pperf(&perf) {if (m_pperf != NULL) m_pperf->Start();}
FORCEINLINE ~CPerfStartReal() {Stop();}
FORCEINLINE void Stop() {if (m_pperf != NULL) {m_pperf->Stop(); m_pperf = NULL;}}
};