Changeset - r2817:7ad46034031f
[Not reviewed]
master
0 37 0
tron - 18 years ago 2006-01-05 12:40:50
tron@openttd.org
(svn r3365) Staticise 36 functions
37 files changed with 68 insertions and 68 deletions:
0 comments (0 inline, 0 general)
ai/ai.c
Show inline comments
 
@@ -43,13 +43,13 @@ static void AI_DequeueCommands(byte play
 
}
 

	
 
/**
 
 * Needed for SP; we need to delay DoCommand with 1 tick, because else events
 
 *  will make infinite loops (AIScript).
 
 */
 
void AI_PutCommandInQueue(byte player, uint tile, uint32 p1, uint32 p2, uint procc)
 
static void AI_PutCommandInQueue(byte player, uint tile, uint32 p1, uint32 p2, uint procc)
 
{
 
	AICommand *com;
 

	
 
	if (_ai_player[player].queue_tail == NULL) {
 
		/* There is no item in the queue yet, create the queue */
 
		_ai_player[player].queue = malloc(sizeof(AICommand));
console.c
Show inline comments
 
@@ -55,12 +55,16 @@ static void IConsoleClearCommand(void)
 
	_iconsole_cmdline.caretxoffs = 0;
 
	SetWindowDirty(_iconsole_win);
 
}
 

	
 
static inline void IConsoleResetHistoryPos(void) {_iconsole_historypos = ICON_HISTORY_SIZE - 1;}
 

	
 

	
 
static void IConsoleHistoryAdd(const char* cmd);
 
static void IConsoleHistoryNavigate(int direction);
 

	
 
// ** console window ** //
 
static void IConsoleWndProc(Window* w, WindowEvent* e)
 
{
 
	switch (e->event) {
 
		case WE_PAINT: {
 
			int i = _iconsole_scroll;
 
@@ -319,26 +323,26 @@ void IConsoleOpen(void)  {if (_iconsole_
 

	
 
/**
 
 * Add the entered line into the history so you can look it back
 
 * scroll, etc. Put it to the beginning as it is the latest text
 
 * @param cmd Text to be entered into the 'history'
 
 */
 
void IConsoleHistoryAdd(const char *cmd)
 
static void IConsoleHistoryAdd(const char* cmd)
 
{
 
	free(_iconsole_history[ICON_HISTORY_SIZE - 1]);
 

	
 
	memmove(&_iconsole_history[1], &_iconsole_history[0], sizeof(_iconsole_history[0]) * (ICON_HISTORY_SIZE - 1));
 
	_iconsole_history[0] = strdup(cmd);
 
	IConsoleResetHistoryPos();
 
}
 

	
 
/**
 
 * Navigate Up/Down in the history of typed commands
 
 * @param direction Go further back in history (+1), go to recently typed commands (-1)
 
 */
 
void IConsoleHistoryNavigate(signed char direction)
 
static void IConsoleHistoryNavigate(int direction)
 
{
 
	int i = _iconsole_historypos + direction;
 

	
 
	// watch out for overflows, just wrap around
 
	if (i < 0) i = ICON_HISTORY_SIZE - 1;
 
	if (i >= ICON_HISTORY_SIZE) i = 0;
 
@@ -684,13 +688,13 @@ static inline int IConsoleCopyInParams(c
 
 * An alias is just another name for a command, or for more commands
 
 * Execute it as well.
 
 * @param *alias is the alias of the command
 
 * @param tokencount the number of parameters passed
 
 * @param *tokens are the parameters given to the original command (0 is the first param)
 
 */
 
void IConsoleAliasExec(const IConsoleAlias *alias, byte tokencount, char *tokens[ICON_TOKEN_COUNT])
 
static void IConsoleAliasExec(const IConsoleAlias* alias, byte tokencount, char* tokens[ICON_TOKEN_COUNT])
 
{
 
	const char *cmdptr;
 
	char *aliases[ICON_MAX_ALIAS_LINES], aliasstream[ICON_MAX_STREAMSIZE];
 
	int i;
 
	uint a_index, astream_i;
 

	
console.h
Show inline comments
 
@@ -120,16 +120,12 @@ void IConsoleFree(void);
 
void IConsoleClearBuffer(void);
 
void IConsoleResize(void);
 
void IConsoleSwitch(void);
 
void IConsoleClose(void);
 
void IConsoleOpen(void);
 

	
 
// ** console cmd buffer ** //
 
void IConsoleHistoryAdd(const char *cmd);
 
void IConsoleHistoryNavigate(signed char direction);
 

	
 
// ** console output ** //
 
void IConsolePrint(uint16 color_code, const char *string);
 
void CDECL IConsolePrintF(uint16 color_code, const char *s, ...);
 
void IConsoleDebug(const char *string);
 
void IConsoleWarning(const char *string);
 
void IConsoleError(const char *string);
 
@@ -147,13 +143,12 @@ IConsoleVar* IConsoleVarGet(const char *
 
void IConsoleVarPrintGetValue(const IConsoleVar *var);
 
void IConsoleVarPrintSetValue(const IConsoleVar *var);
 

	
 
// *** Parser *** //
 
void IConsoleCmdExec(const char *cmdstr);
 
void IConsoleVarExec(const IConsoleVar *var, byte tokencount, char *token[]);
 
void IConsoleAliasExec(const IConsoleAlias *alias, byte tokencount, char *tokens[]);
 

	
 
// ** console std lib (register ingame commands/aliases/variables) ** //
 
void IConsoleStdLibRegister(void);
 

	
 
// ** Hooking code ** //
 
void IConsoleCmdHookAdd(const char *name, IConsoleHookTypes type, IConsoleHook *proc);
engine.c
Show inline comments
 
@@ -826,13 +826,13 @@ StringID GetCustomEngineName(EngineID en
 
		return _engine_name_strings[engine];
 
	ttd_strlcpy(_userstring, _engine_custom_names[engine], lengthof(_userstring));
 
	return STR_SPEC_USERSTRING;
 
}
 

	
 

	
 
void AcceptEnginePreview(Engine *e, PlayerID player)
 
static void AcceptEnginePreview(Engine *e, PlayerID player)
 
{
 
	Player *p = GetPlayer(player);
 

	
 
	assert(e->railtype < RAILTYPE_END);
 
	SETBIT(e->player_avail, player);
 
	SETBIT(p->avail_railtypes, e->railtype);
engine.h
Show inline comments
 
@@ -203,14 +203,12 @@ StringID GetCustomEngineName(EngineID en
 

	
 
void DrawTrainEngine(int x, int y, EngineID engine, uint32 image_ormod);
 
void DrawRoadVehEngine(int x, int y, EngineID engine, uint32 image_ormod);
 
void DrawShipEngine(int x, int y, EngineID engine, uint32 image_ormod);
 
void DrawAircraftEngine(int x, int y, EngineID engine, uint32 image_ormod);
 

	
 
void AcceptEnginePreview(Engine *e, PlayerID player);
 

	
 
void LoadCustomEngineNames(void);
 
void DeleteCustomEngineNames(void);
 

	
 
bool IsEngineBuildable(uint engine, byte type);
 

	
 
enum {
functions.h
Show inline comments
 
@@ -213,13 +213,12 @@ void DrawFoundation(TileInfo *ti, uint f
 

	
 
bool CheckIfAuthorityAllows(TileIndex tile);
 
Town *ClosestTownFromTile(TileIndex tile, uint threshold);
 
void ChangeTownRating(Town *t, int add, int max);
 

	
 
uint GetRoadBitsByTile(TileIndex tile);
 
void DrawRoadBits(TileInfo *ti, byte road, byte ground_type, bool snow, bool flat);
 
int GetTownRadiusGroup(const Town *t, TileIndex tile);
 
void ShowNetworkChatQueryWindow(byte desttype, byte dest);
 
void ShowNetworkGiveMoneyWindow(byte player);
 
void ShowNetworkNeedGamePassword(void);
 
void ShowNetworkNeedCompanyPassword(void);
 
int FindFirstBit(uint32 x);
gui.h
Show inline comments
 
@@ -14,13 +14,12 @@ void CcTerraform(bool success, TileIndex
 

	
 
/* settings_gui.c */
 
void ShowGameOptions(void);
 
void ShowGameDifficulty(void);
 
void ShowPatchesSelection(void);
 
void ShowNewgrf(void);
 
void ShowCustCurrency(void);
 

	
 
/* graph_gui.c */
 
void ShowOperatingProfitGraph(void);
 
void ShowIncomeGraph(void);
 
void ShowDeliveredCargoGraph(void);
 
void ShowPerformanceHistoryGraph(void);
 
@@ -61,14 +60,12 @@ void ShowBuildAirToolbar(void);
 
void ShowPlayerAircraft(PlayerID player, StationID station);
 

	
 
/* terraform_gui.c */
 
void ShowTerraformToolbar(void);
 

	
 
void PlaceProc_DemolishArea(TileIndex tile);
 
void PlaceProc_LowerLand(TileIndex tile);
 
void PlaceProc_RaiseLand(TileIndex tile);
 
void PlaceProc_LevelLand(TileIndex tile);
 
bool GUIPlaceProcDragXY(const WindowEvent *we);
 

	
 
enum { // max 32 - 4 = 28 types
 
	GUI_PlaceProc_DemolishArea    = 0 << 4,
 
	GUI_PlaceProc_LevelArea       = 1 << 4,
industry_cmd.c
Show inline comments
 
@@ -24,13 +24,13 @@ enum {
 
	INDUSTRY_POOL_MAX_BLOCKS      = 8000,
 
};
 

	
 
/**
 
 * Called if a new block is added to the industry-pool
 
 */
 
void IndustryPoolNewBlock(uint start_item)
 
static void IndustryPoolNewBlock(uint start_item)
 
{
 
	Industry *i;
 

	
 
	FOR_ALL_INDUSTRIES_FROM(i, start_item) i->index = start_item++;
 
}
 

	
network_client.c
Show inline comments
 
@@ -29,13 +29,13 @@ extern const char _openttd_revision[];
 

	
 
// So we don't make too much typos ;)
 
#define MY_CLIENT DEREF_CLIENT(0)
 

	
 
static uint32 last_ack_frame;
 

	
 
void NetworkRecvPatchSettings(NetworkClientState *cs, Packet *p);
 
static void NetworkRecvPatchSettings(NetworkClientState* cs, Packet* p);
 

	
 
// **********
 
// Sending functions
 
//   DEF_CLIENT_SEND_COMMAND has no parameters
 
// **********
 

	
 
@@ -820,13 +820,13 @@ assert_compile(lengthof(_network_client_
 

	
 
extern const SettingDesc patch_settings[];
 

	
 
// This is a TEMPORARY solution to get the patch-settings
 
//  to the client. When the patch-settings are saved in the savegame
 
//  this should be removed!!
 
void NetworkRecvPatchSettings(NetworkClientState *cs, Packet *p)
 
static void NetworkRecvPatchSettings(NetworkClientState* cs, Packet* p)
 
{
 
	const SettingDesc *item;
 

	
 
	item = patch_settings;
 

	
 
	while (item->name != NULL) {
network_server.c
Show inline comments
 
@@ -21,15 +21,16 @@
 
#include "station.h"
 
#include "settings.h"
 
#include "variables.h"
 

	
 
// This file handles all the server-commands
 

	
 
void NetworkHandleCommandQueue(NetworkClientState *cs);
 
static void NetworkHandleCommandQueue(NetworkClientState* cs);
 
static void NetworkSendPatchSettings(NetworkClientState* cs);
 

	
 
void NetworkPopulateCompanyInfo(void);
 
void NetworkSendPatchSettings(NetworkClientState *cs);
 

	
 
// Is the network enabled?
 

	
 
// **********
 
// Sending functions
 
//   DEF_SERVER_SEND_COMMAND has parameter: NetworkClientState *cs
 
@@ -1187,13 +1188,13 @@ assert_compile(lengthof(_network_server_
 

	
 
extern const SettingDesc patch_settings[];
 

	
 
// This is a TEMPORARY solution to get the patch-settings
 
//  to the client. When the patch-settings are saved in the savegame
 
//  this should be removed!!
 
void NetworkSendPatchSettings(NetworkClientState *cs)
 
static void NetworkSendPatchSettings(NetworkClientState* cs)
 
{
 
	const SettingDesc *item;
 
	Packet *p = NetworkSend_Init(PACKET_SERVER_MAP);
 
	NetworkSend_uint8(p, MAP_PACKET_PATCH);
 
	// Now send all the patch-settings in a pretty order..
 

	
 
@@ -1481,13 +1482,14 @@ bool NetworkServer_ReadPackets(NetworkCl
 
	}
 

	
 
	return true;
 
}
 

	
 
// Handle the local command-queue
 
void NetworkHandleCommandQueue(NetworkClientState *cs) {
 
static void NetworkHandleCommandQueue(NetworkClientState* cs)
 
{
 
	CommandPacket *cp;
 

	
 
	while ( (cp = cs->command_queue) != NULL) {
 
		SEND_COMMAND(PACKET_SERVER_COMMAND)(cs, cp);
 

	
 
		cs->command_queue = cp->next;
network_udp.c
Show inline comments
 
@@ -38,13 +38,13 @@ enum {
 
	ADVERTISE_NORMAL_INTERVAL = 450,	// interval between advertising in days
 
	ADVERTISE_RETRY_INTERVAL = 5,			// readvertise when no response after this amount of days
 
	ADVERTISE_RETRY_TIMES = 3					// give up readvertising after this much failed retries
 
};
 

	
 
#define DEF_UDP_RECEIVE_COMMAND(type) void NetworkPacketReceive_ ## type ## _command(Packet *p, struct sockaddr_in *client_addr)
 
void NetworkSendUDP_Packet(SOCKET udp, Packet *p, struct sockaddr_in *recv);
 
static void NetworkSendUDP_Packet(SOCKET udp, Packet* p, struct sockaddr_in* recv);
 

	
 
static NetworkClientState _udp_cs;
 

	
 
DEF_UDP_RECEIVE_COMMAND(PACKET_UDP_CLIENT_FIND_SERVER)
 
{
 
	Packet *packet;
 
@@ -300,13 +300,13 @@ static NetworkUDPPacket* const _network_
 

	
 

	
 
// If this fails, check the array above with network_data.h
 
assert_compile(lengthof(_network_udp_packet) == PACKET_UDP_END);
 

	
 

	
 
void NetworkHandleUDPPacket(Packet *p, struct sockaddr_in *client_addr)
 
static void NetworkHandleUDPPacket(Packet* p, struct sockaddr_in* client_addr)
 
{
 
	byte type;
 

	
 
	/* Fake a client, so we can see when there is an illegal packet */
 
	_udp_cs.socket = INVALID_SOCKET;
 
	_udp_cs.quited = false;
 
@@ -319,13 +319,13 @@ void NetworkHandleUDPPacket(Packet *p, s
 
		DEBUG(net, 0)("[NET][UDP] Received invalid packet type %d", type);
 
	}
 
}
 

	
 

	
 
// Send a packet over UDP
 
void NetworkSendUDP_Packet(SOCKET udp, Packet *p, struct sockaddr_in *recv)
 
static void NetworkSendUDP_Packet(SOCKET udp, Packet* p, struct sockaddr_in* recv)
 
{
 
	int res;
 

	
 
	// Put the length in the buffer
 
	p->buffer[0] = p->size & 0xFF;
 
	p->buffer[1] = p->size >> 8;
 
@@ -448,13 +448,13 @@ void NetworkUDPReceive(SOCKET udp)
 
		free(p);
 
		p = NULL;
 
	}
 
}
 

	
 
// Broadcast to all ips
 
void NetworkUDPBroadCast(SOCKET udp)
 
static void NetworkUDPBroadCast(SOCKET udp)
 
{
 
	int i;
 
	struct sockaddr_in out_addr;
 
	byte *bcptr;
 
	uint32 bcaddr;
 
	Packet *p;
openttd.c
Show inline comments
 
@@ -541,13 +541,13 @@ void OTTD_SendThreadMessage(ThreadMsg ms
 
}
 

	
 

	
 
/** Handle the user-messages sent to us
 
 * @param message message sent
 
 */
 
void ProcessSentMessage(ThreadMsg message)
 
static void ProcessSentMessage(ThreadMsg message)
 
{
 
	switch (message) {
 
		case MSG_OTTD_SAVETHREAD_START: SaveFileStart(); break;
 
		case MSG_OTTD_SAVETHREAD_DONE:  SaveFileDone(); break;
 
		case MSG_OTTD_SAVETHREAD_ERROR: SaveFileError(); break;
 
		default: NOT_REACHED();
order.h
Show inline comments
 
@@ -175,10 +175,9 @@ bool VehicleHasDepotOrders(const Vehicle
 
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(const Vehicle* v);
 

	
 
Order UnpackVersion4Order(uint16 packed);
 
Order UnpackOldOrder(uint16 packed);
 

	
 
#endif /* ORDER_H */
order_cmd.c
Show inline comments
 
@@ -60,13 +60,13 @@ Order UnpackOldOrder(uint16 packed)
 

	
 
/**
 
 *
 
 * Unpacks a order from savegames with version 4 and lower
 
 *
 
 */
 
Order UnpackVersion4Order(uint16 packed)
 
static Order UnpackVersion4Order(uint16 packed)
 
{
 
	Order order;
 
	order.type    = GB(packed, 0, 4);
 
	order.flags   = GB(packed, 4, 4);
 
	order.station = GB(packed, 8, 8);
 
	order.next    = NULL;
player.h
Show inline comments
 
@@ -263,10 +263,8 @@ void LoadFromHighScore(void);
 
int8 SaveHighScoreValue(const Player *p);
 
int8 SaveHighScoreValueNetwork(void);
 

	
 
void InitialiseEngineReplacement(Player *p);
 
EngineID EngineReplacement(const Player *p, EngineID engine);
 
bool EngineHasReplacement(const Player *p, EngineID engine);
 
int32 AddEngineReplacement(Player *p, EngineID old_engine, EngineID new_engine, uint32 flags);
 
int32 RemoveEngineReplacement(Player *p, EngineID engine, uint32 flags);
 

	
 
#endif /* PLAYER_H */
players.c
Show inline comments
 
@@ -634,12 +634,16 @@ static void DeletePlayerStuff(PlayerID p
 
	DeleteName(p->name_1);
 
	DeleteName(p->president_name_1);
 
	p->name_1 = 0;
 
	p->president_name_1 = 0;
 
}
 

	
 

	
 
static int32 AddEngineReplacement(Player* p, EngineID old_engine, EngineID new_engine, uint32 flags);
 
static int32 RemoveEngineReplacement(Player* p, EngineID engine, uint32 flags);
 

	
 
/** Change engine renewal parameters
 
 * @param x,y unused
 
 * @param p1 bits 0-3 command
 
 * - p1 = 0 - change auto renew bool
 
 * - p1 = 1 - change auto renew months
 
 * - p1 = 2 - change auto renew money
 
@@ -1138,26 +1142,26 @@ bool EngineHasReplacement(const Player *
 
 * @param p Player.
 
 * @param old_engine The original engine type.
 
 * @param new_engine The replacement engine type.
 
 * @param flags The calling command flags.
 
 * @return 0 on success, CMD_ERROR on failure.
 
 */
 
int32 AddEngineReplacement(Player *p, EngineID old_engine, EngineID new_engine, uint32 flags)
 
static int32 AddEngineReplacement(Player* p, EngineID old_engine, EngineID new_engine, uint32 flags)
 
{
 
	if (flags & DC_EXEC) p->engine_replacement[old_engine] = new_engine;
 
	return 0;
 
}
 

	
 
/**
 
 * Remove an engine replacement for the player.
 
 * @param p Player.
 
 * @param engine The original engine type.
 
 * @param flags The calling command flags.
 
 * @return 0 on success, CMD_ERROR on failure.
 
 */
 
int32 RemoveEngineReplacement(Player *p, EngineID engine, uint32 flags)
 
static int32 RemoveEngineReplacement(Player* p, EngineID engine, uint32 flags)
 
{
 
	if (flags & DC_EXEC) p->engine_replacement[engine] = INVALID_ENGINE;
 
	return 0;
 
}
 

	
 
// Save/load of players
rail.h
Show inline comments
 
@@ -635,10 +635,9 @@ static inline bool TracksOverlap(TrackBi
 
   * always overlap unless they are lower & upper or right & left. */
 
  if ((bits == (TRACK_BIT_UPPER|TRACK_BIT_LOWER)) || (bits == (TRACK_BIT_LEFT | TRACK_BIT_RIGHT)))
 
    return false;
 
  return true;
 
}
 

	
 
void DrawTrackBits(TileInfo *ti, TrackBits track, bool earth, bool snow, bool flat);
 
void DrawTrainDepotSprite(int x, int y, int image, RailType railtype);
 
void DrawDefaultWaypointSprite(int x, int y, RailType railtype);
 
#endif /* RAIL_H */
rail_cmd.c
Show inline comments
 
@@ -1339,13 +1339,13 @@ static void DrawSpecialBuilding(uint32 i
 
 * @param ti TileInfo
 
 * @param track TrackBits to draw
 
 * @param earth Draw as earth
 
 * @param snow Draw as snow
 
 * @param flat Always draw foundation
 
 */
 
void DrawTrackBits(TileInfo *ti, TrackBits track, bool earth, bool snow, bool flat)
 
static void DrawTrackBits(TileInfo* ti, TrackBits track, bool earth, bool snow, bool flat)
 
{
 
	const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
 
	PalSpriteID image;
 
	bool junction = false;
 

	
 
	// Select the sprite to use.
road_cmd.c
Show inline comments
 
@@ -770,13 +770,13 @@ const byte _road_sloped_sprites[14] = {
 
 * @param ti TileInfo
 
 * @param road RoadBits to draw
 
 * @param ground_type Ground type
 
 * @param snow Draw snow
 
 * @param flat Draw foundation
 
 */
 
void DrawRoadBits(TileInfo *ti, byte road, byte ground_type, bool snow, bool flat)
 
static void DrawRoadBits(TileInfo *ti, byte road, byte ground_type, bool snow, bool flat)
 
{
 
	const DrawRoadTileStruct *drts;
 
	PalSpriteID image = 0;
 

	
 
	if (ti->tileh != 0) {
 
		int foundation;
roadveh_cmd.c
Show inline comments
 
@@ -90,13 +90,13 @@ void DrawRoadVehEngine(int x, int y, Eng
 
		}
 
		spritenum = orig_road_vehicle_info[engine - ROAD_ENGINES_INDEX].image_index;
 
	}
 
	DrawSprite((6 + _roadveh_images[spritenum]) | image_ormod, x, y);
 
}
 

	
 
int32 EstimateRoadVehCost(EngineID engine_type)
 
static int32 EstimateRoadVehCost(EngineID engine_type)
 
{
 
	return ((_price.roadveh_base >> 3) * RoadVehInfo(engine_type)->base_cost) >> 5;
 
}
 

	
 
/** Build a road vehicle.
 
 * @param x,y tile coordinates of depot where road vehicle is built
settings_gui.c
Show inline comments
 
@@ -80,12 +80,15 @@ static inline bool RoadVehiclesAreBuilt(
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_Road) return true;
 
	}
 
	return false;
 
}
 

	
 

	
 
static void ShowCustCurrency(void);
 

	
 
static void GameOptionsWndProc(Window *w, WindowEvent *e)
 
{
 
	switch (e->event) {
 
	case WE_PAINT: {
 
		int i;
 
		StringID str = STR_02BE_DEFAULT;
 
@@ -1503,13 +1506,13 @@ static const WindowDesc _cust_currency_d
 
	WC_CUSTOM_CURRENCY, 0,
 
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
 
	_cust_currency_widgets,
 
	CustCurrencyWndProc,
 
};
 

	
 
void ShowCustCurrency(void)
 
static void ShowCustCurrency(void)
 
{
 
	_str_separator[0] = _custom_currency.separator;
 
	_str_separator[1] = '\0';
 

	
 
	DeleteWindowById(WC_CUSTOM_CURRENCY, 0);
 
	AllocateWindowDesc(&_cust_currency_desc);
ship_cmd.c
Show inline comments
 
@@ -374,13 +374,13 @@ static bool ShipAccelerate(Vehicle *v)
 

	
 
	v->progress = (t = v->progress) - (byte)spd;
 

	
 
	return (t < v->progress);
 
}
 

	
 
int32 EstimateShipCost(EngineID engine_type)
 
static int32 EstimateShipCost(EngineID engine_type)
 
{
 
	return ShipVehInfo(engine_type)->base_cost * (_price.ship_base>>3)>>5;
 
}
 

	
 
static void ShipEnterDepot(Vehicle *v)
 
{
station.h
Show inline comments
 
@@ -204,13 +204,12 @@ uint32 GetCustomStationRelocation(const 
 
RoadStop * GetRoadStopByTile(TileIndex tile, RoadStopType type);
 
static inline int GetRoadStopType(TileIndex tile)
 
{
 
	return (_m[tile].m5 < 0x47) ? RS_TRUCK : RS_BUS;
 
}
 

	
 
uint GetNumRoadStops(const Station *st, RoadStopType type);
 
RoadStop * GetPrimaryRoadStop(const Station *st, RoadStopType type);
 
RoadStop * AllocateRoadStop( void );
 
void ClearSlot(Vehicle *v, RoadStop *rs);
 

	
 
static inline bool IsTrainStationTile(TileIndex tile)
 
{
station_cmd.c
Show inline comments
 
@@ -115,13 +115,13 @@ RoadStop* GetRoadStopByTile(TileIndex ti
 
		assert(rs->next != NULL);
 
	}
 

	
 
	return rs;
 
}
 

	
 
uint GetNumRoadStops(const Station *st, RoadStopType type)
 
static uint GetNumRoadStops(const Station* st, RoadStopType type)
 
{
 
	uint num = 0;
 
	const RoadStop *rs;
 

	
 
	assert(st != NULL);
 
	for (rs = GetPrimaryRoadStop(st, type); rs != NULL; rs = rs->next) num++;
terraform_gui.c
Show inline comments
 
@@ -138,18 +138,18 @@ static const uint16 _terraform_keycodes[
 

	
 
void PlaceProc_DemolishArea(TileIndex tile)
 
{
 
	VpStartPlaceSizing(tile, VPM_X_AND_Y | GUI_PlaceProc_DemolishArea);
 
}
 

	
 
void PlaceProc_RaiseLand(TileIndex tile)
 
static void PlaceProc_RaiseLand(TileIndex tile)
 
{
 
	GenericRaiseLowerLand(tile, 1);
 
}
 

	
 
void PlaceProc_LowerLand(TileIndex tile)
 
static void PlaceProc_LowerLand(TileIndex tile)
 
{
 
	GenericRaiseLowerLand(tile, 0);
 
}
 

	
 
void PlaceProc_LevelLand(TileIndex tile)
 
{
town.h
Show inline comments
 
@@ -80,13 +80,12 @@ uint32 GetWorldPopulation(void);
 

	
 
void UpdateTownVirtCoord(Town *t);
 
void InitializeTown(void);
 
void ShowTownViewWindow(uint town);
 
void DeleteTown(Town *t);
 
void ExpandTown(Town *t);
 
bool GrowTown(Town *t);
 
Town *CreateRandomTown(uint attempts);
 

	
 
enum {
 
	ROAD_REMOVE = 0,
 
	UNMOVEABLE_REMOVE = 1,
 
	TUNNELBRIDGE_REMOVE = 1,
town_cmd.c
Show inline comments
 
@@ -412,12 +412,15 @@ static const TileIndexDiffC _roadblock_t
 
	// Lets us rotate without using &3.
 
	{ 0, -1},
 
	{ 1,  0},
 
	{ 0,  1}
 
};
 

	
 

	
 
static bool GrowTown(Town *t);
 

	
 
static void TownTickHandler(Town *t)
 
{
 
	if (t->flags12&1) {
 
		int i = t->grow_counter - 1;
 
		if (i < 0) {
 
			if (GrowTown(t)) {
 
@@ -759,13 +762,13 @@ static int GenRandomRoadBits(void)
 
	if (a == b) b ^= 2;
 
	return (1 << a) + (1 << b);
 
}
 

	
 
// Grow the town
 
// Returns true if a house was built, or no if the build failed.
 
bool GrowTown(Town *t)
 
static bool GrowTown(Town *t)
 
{
 
	TileIndex tile;
 
	const TileIndexDiffC *ptr;
 
	TileInfo ti;
 
	PlayerID old_player;
 

	
train_cmd.c
Show inline comments
 
@@ -351,13 +351,13 @@ static int GetTrainAcceleration(Vehicle 
 
		return (force - resistance) / (mass * 4);
 
	} else {
 
		return min((-force - resistance) / (mass * 4), 10000 / (mass * 4));
 
	}
 
}
 

	
 
void UpdateTrainAcceleration(Vehicle *v)
 
static void UpdateTrainAcceleration(Vehicle* v)
 
{
 
	uint power = 0;
 
	uint weight = 0;
 

	
 
	assert(IsFrontEngine(v));
 

	
 
@@ -627,13 +627,13 @@ static const byte _railveh_score[] = {
 

	
 
static int32 EstimateTrainCost(const RailVehicleInfo* rvi)
 
{
 
	return (rvi->base_cost * (_price.build_railvehicle >> 3)) >> 5;
 
}
 

	
 
void AddRearEngineToMultiheadedTrain(Vehicle *v, Vehicle *u, bool building)
 
static void AddRearEngineToMultiheadedTrain(Vehicle* v, Vehicle* u, bool building)
 
{
 
	u->direction = v->direction;
 
	u->owner = v->owner;
 
	u->tile = v->tile;
 
	u->x_pos = v->x_pos;
 
	u->y_pos = v->y_pos;
unmovable_cmd.c
Show inline comments
 
@@ -20,13 +20,13 @@
 
/** Destroy a HQ.
 
 * During normal gameplay you can only implicitely destroy a HQ when you are
 
 * rebuilding it. Otherwise, only water can destroy it.
 
 * @param tile tile coordinates where HQ is located to destroy
 
 * @param flags docommand flags of calling function
 
 */
 
int32 DestroyCompanyHQ(TileIndex tile, uint32 flags)
 
static int32 DestroyCompanyHQ(TileIndex tile, uint32 flags)
 
{
 
	Player *p;
 

	
 
	SET_EXPENSES_TYPE(EXPENSES_PROPERTY);
 

	
 
	/* Find player that has HQ flooded, and reset their location_of_house */
vehicle.c
Show inline comments
 
@@ -188,12 +188,15 @@ Vehicle *FindVehicleBetween(TileIndex fr
 
			}
 
		}
 
	}
 
	return NULL;
 
}
 

	
 

	
 
static void UpdateVehiclePosHash(Vehicle* v, int x, int y);
 

	
 
void VehiclePositionChanged(Vehicle *v)
 
{
 
	int img = v->cur_image;
 
	Point pt = RemapCoords(v->x_pos + v->x_offs, v->y_pos + v->y_offs, v->z_pos);
 
	const Sprite* spr = GetSprite(img);
 

	
 
@@ -392,13 +395,13 @@ void *VehicleFromPos(TileIndex tile, voi
 
	}
 
	return NULL;
 
}
 

	
 

	
 

	
 
void UpdateVehiclePosHash(Vehicle *v, int x, int y)
 
static void UpdateVehiclePosHash(Vehicle* v, int x, int y)
 
{
 
	VehicleID *old_hash, *new_hash;
 
	int old_x = v->left_coord;
 
	int old_y = v->top_coord;
 
	Vehicle *u;
 

	
vehicle.h
Show inline comments
 
@@ -246,13 +246,12 @@ typedef void *VehicleFromPosProc(Vehicle
 

	
 
void VehicleServiceInDepot(Vehicle *v);
 
Vehicle *AllocateVehicle(void);
 
bool AllocateVehicles(Vehicle **vl, int num);
 
Vehicle *ForceAllocateVehicle(void);
 
Vehicle *ForceAllocateSpecialVehicle(void);
 
void UpdateVehiclePosHash(Vehicle *v, int x, int y);
 
void VehiclePositionChanged(Vehicle *v);
 
void AfterLoadVehicles(void);
 
Vehicle *GetLastVehicleInChain(Vehicle *v);
 
Vehicle *GetPrevVehicleInChain(const Vehicle *v);
 
Vehicle *GetFirstVehicleInChain(const Vehicle *v);
 
uint CountVehiclesInChain(const Vehicle* v);
 
@@ -269,14 +268,12 @@ bool CanFillVehicle(Vehicle *v);
 
bool CanRefitTo(EngineID engine_type, CargoID cid_to);
 

	
 
void ViewportAddVehicles(DrawPixelInfo *dpi);
 

	
 
void TrainEnterDepot(Vehicle *v, TileIndex tile);
 

	
 
void AddRearEngineToMultiheadedTrain(Vehicle *v, Vehicle *u, bool building) ;
 

	
 
/* train_cmd.h */
 
int GetTrainImage(const Vehicle *v, byte direction);
 
int GetAircraftImage(const Vehicle *v, byte direction);
 
int GetRoadVehImage(const Vehicle *v, byte direction);
 
int GetShipImage(const Vehicle *v, byte direction);
 

	
 
@@ -308,13 +305,12 @@ void ShowAircraftViewWindow(const Vehicl
 

	
 
UnitID GetFreeUnitNumber(byte type);
 

	
 
int LoadUnloadVehicle(Vehicle *v);
 

	
 
void TrainConsistChanged(Vehicle *v);
 
void UpdateTrainAcceleration(Vehicle *v);
 
int32 GetTrainRunningCost(const Vehicle *v);
 

	
 
int CheckTrainStoppedInDepot(const Vehicle *v);
 

	
 
bool VehicleNeedsService(const Vehicle *v);
 
void ConvertOldMultiheadToNew(void);
viewport.c
Show inline comments
 
@@ -213,13 +213,13 @@ static void DoSetViewportPosition(Window
 
		} else if (yo < 0) {
 
			RedrawScreenRect(left, top + height + yo, width+left, top + height);
 
		}
 
	}
 
}
 

	
 
void SetViewportPosition(Window *w, int x, int y)
 
static void SetViewportPosition(Window* w, int x, int y)
 
{
 
	ViewPort *vp = w->viewport;
 
	int old_left = vp->virtual_left;
 
	int old_top = vp->virtual_top;
 
	int i;
 
	int left, top, width, height;
 
@@ -1936,13 +1936,13 @@ void VpSetPresizeRange(uint from, uint t
 
	_thd.selend.y = TileY(to) * 16;
 
	_thd.selstart.x = TileX(from) * 16;
 
	_thd.selstart.y = TileY(from) * 16;
 
	_thd.next_drawstyle = HT_RECT;
 
}
 

	
 
void VpStartPreSizing(void)
 
static void VpStartPreSizing(void)
 
{
 
	_thd.selend.x = -1;
 
	_special_mouse_mode = WSM_PRESIZE;
 
}
 

	
 
/* returns information about the 2x1 piece to be build.
viewport.h
Show inline comments
 
@@ -15,13 +15,12 @@ struct ViewPort {
 

	
 
void SetSelectionRed(bool);
 

	
 
/* viewport.c */
 
void AssignWindowViewport(Window *w, int x, int y,
 
	int width, int height, uint32 follow_flags, byte zoom);
 
void SetViewportPosition(Window *w, int x, int y);
 
ViewPort *IsPtInWindowViewport(const Window *w, int x, int y);
 
Point GetTileBelowCursor(void);
 
void ZoomInOrOutToCursorWindow(bool in, Window * w);
 
Point GetTileZoomCenterWindow(bool in, Window * w);
 
void UpdateViewportPosition(Window *w);
 

	
 
@@ -41,13 +40,12 @@ void HandleViewportClicked(const ViewPor
 
void PlaceObject(void);
 
void SetRedErrorSquare(TileIndex tile);
 
void SetTileSelectSize(int w, int h);
 
void SetTileSelectBigSize(int ox, int oy, int sx, int sy);
 

	
 
void VpStartPlaceSizing(TileIndex tile, int user);
 
void VpStartPreSizing(void);
 
void VpSetPresizeRange(uint from, uint to);
 
void VpSetPlaceSizingLimit(int limit);
 

	
 
Vehicle *CheckMouseOverVehicle(void);
 

	
 
enum {
waypoint.c
Show inline comments
 
@@ -61,13 +61,13 @@ static Waypoint* AllocateWaypoint(void)
 
		return AllocateWaypoint();
 

	
 
	return NULL;
 
}
 

	
 
/* Update the sign for the waypoint */
 
void UpdateWaypointSign(Waypoint *wp)
 
static void UpdateWaypointSign(Waypoint* wp)
 
{
 
	Point pt = RemapCoords2(TileX(wp->xy) * 16, TileY(wp->xy) * 16);
 
	SetDParam(0, wp->index);
 
	UpdateViewportSignPos(&wp->sign, pt.x, pt.y - 0x20, STR_WAYPOINT_VIEWPORT);
 
}
 

	
waypoint.h
Show inline comments
 
@@ -71,12 +71,11 @@ static inline Waypoint *GetWaypointByTil
 
}
 

	
 
int32 RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove);
 
Station *ComposeWaypointStation(TileIndex tile);
 
void ShowRenameWaypointWindow(const Waypoint *cp);
 
void DrawWaypointSprite(int x, int y, int image, RailType railtype);
 
void UpdateWaypointSign(Waypoint *cp);
 
void FixOldWaypoints(void);
 
void UpdateAllWaypointSigns(void);
 
void UpdateAllWaypointCustomGraphics(void);
 

	
 
#endif /* WAYPOINT_H */
window.c
Show inline comments
 
@@ -20,12 +20,16 @@ void HandleButtonClick(Window *w, byte w
 
{
 
	w->click_state |= (1 << widget);
 
	w->flags4 |= 5 << WF_TIMEOUT_SHL;
 
	InvalidateWidget(w, widget);
 
}
 

	
 

	
 
static Window* StartWindowDrag(Window* w);
 
static Window* StartWindowSizing(Window* w);
 

	
 
static void DispatchLeftClickEvent(Window* w, int x, int y)
 
{
 
	WindowEvent e;
 
	const Widget *wi;
 

	
 
	e.click.pt.x = x;
 
@@ -136,12 +140,14 @@ static void DispatchMouseWheelEvent(Wind
 
			}
 
		}
 
	}
 
}
 

	
 

	
 
static void DrawOverlappedWindow(Window* w, int left, int top, int right, int bottom);
 

	
 
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom)
 
{
 
	Window *w;
 
	DrawPixelInfo bk;
 
	_cur_dpi = &bk;
 

	
 
@@ -152,13 +158,13 @@ void DrawOverlappedWindowForAll(int left
 
				top < w->top + w->height) {
 
			DrawOverlappedWindow(w, left, top, right, bottom);
 
		}
 
	}
 
}
 

	
 
void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom)
 
static void DrawOverlappedWindow(Window* w, int left, int top, int right, int bottom)
 
{
 
	const Window* v = w;
 
	int x;
 

	
 
	while (++v != _last_window) {
 
		if (right > v->left &&
 
@@ -284,12 +290,15 @@ void DeleteWindowByClass(WindowClass cls
 
		} else {
 
			w++;
 
		}
 
	}
 
}
 

	
 

	
 
static Window* BringWindowToFront(Window* w);
 

	
 
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number)
 
{
 
	Window *w = FindWindowById(cls, number);
 

	
 
	if (w != NULL) {
 
		w->flags4 |= WF_WHITE_BORDER_MASK;
 
@@ -309,13 +318,13 @@ static inline bool IsVitalWindow(const W
 
/** On clicking on a window, make it the frontmost window of all. However
 
 * there are certain windows that always need to be on-top; these include
 
 * - Toolbar, Statusbar (always on)
 
 * - New window, Chatbar (only if open)
 
 * @param w window that is put into the foreground
 
 */
 
Window *BringWindowToFront(Window *w)
 
static Window* BringWindowToFront(Window* w)
 
{
 
	Window *v;
 
	Window temp;
 

	
 
	v = _last_window;
 
	do {
 
@@ -1054,26 +1063,26 @@ static bool HandleWindowDragging(void)
 
	}
 

	
 
	_dragging_window = false;
 
	return false;
 
}
 

	
 
Window *StartWindowDrag(Window *w)
 
static Window* StartWindowDrag(Window* w)
 
{
 
	w->flags4 |= WF_DRAGGING;
 
	_dragging_window = true;
 

	
 
	_drag_delta.x = w->left - _cursor.pos.x;
 
	_drag_delta.y = w->top  - _cursor.pos.y;
 

	
 
	w = BringWindowToFront(w);
 
	DeleteWindowById(WC_DROPDOWN_MENU, 0);
 
	return w;
 
}
 

	
 
Window *StartWindowSizing(Window *w)
 
static Window* StartWindowSizing(Window* w)
 
{
 
	w->flags4 |= WF_SIZING;
 
	_dragging_window = true;
 

	
 
	_drag_delta.x = _cursor.pos.x;
 
	_drag_delta.y = _cursor.pos.y;
window.h
Show inline comments
 
@@ -549,24 +549,20 @@ enum WindowFlags {
 
	WF_WHITE_BORDER_ONE = 1 << 11,
 
	WF_WHITE_BORDER_MASK = 3 << 11,
 
	WF_SCROLL2 = 1 << 13,
 
};
 

	
 
/* window.c */
 
void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom);
 
void CallWindowEventNP(Window *w, int event);
 
void CallWindowTickEvent(void);
 
void SetWindowDirty(const Window* w);
 
void SendWindowMessage(WindowClass wnd_class, WindowNumber wnd_num, uint msg, uint wparam, uint lparam);
 

	
 
Window *FindWindowById(WindowClass cls, WindowNumber number);
 
void DeleteWindow(Window *w);
 
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number);
 
Window *BringWindowToFront(Window *w);
 
Window *StartWindowDrag(Window *w);
 
Window *StartWindowSizing(Window *w);
 
Window *FindWindowFromPt(int x, int y);
 

	
 
bool IsWindowOfPrototype(const Window* w, const Widget* widget);
 
void AssignWidgetToWindow(Window *w, const Widget *widget);
 
Window *AllocateWindow(
 
							int x,
0 comments (0 inline, 0 general)