Mercurial > hg > openttd
changeset 2817:6109c518dc4f draft
(svn r3365) Staticise 36 functions
author | tron <tron@openttd.org> |
---|---|
date | Thu, 05 Jan 2006 12:40:50 +0000 |
parents | fb4c969d9ed0 |
children | 6634108b4540 |
files | ai/ai.c console.c console.h engine.c engine.h functions.h gui.h industry_cmd.c network_client.c network_server.c network_udp.c openttd.c order.h order_cmd.c player.h players.c rail.h rail_cmd.c road_cmd.c roadveh_cmd.c settings_gui.c ship_cmd.c station.h station_cmd.c terraform_gui.c town.h town_cmd.c train_cmd.c unmovable_cmd.c vehicle.c vehicle.h viewport.c viewport.h waypoint.c waypoint.h window.c window.h |
diffstat | 37 files changed, 68 insertions(+), 68 deletions(-) [+] |
line wrap: on
line diff
--- a/ai/ai.c +++ b/ai/ai.c @@ -46,7 +46,7 @@ * 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;
--- a/console.c +++ b/console.c @@ -58,6 +58,10 @@ 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) { @@ -322,7 +326,7 @@ * 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]); @@ -335,7 +339,7 @@ * 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; @@ -687,7 +691,7 @@ * @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];
--- a/console.h +++ b/console.h @@ -123,10 +123,6 @@ 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, ...); @@ -150,7 +146,6 @@ // *** 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);
--- a/engine.c +++ b/engine.c @@ -829,7 +829,7 @@ } -void AcceptEnginePreview(Engine *e, PlayerID player) +static void AcceptEnginePreview(Engine *e, PlayerID player) { Player *p = GetPlayer(player);
--- a/engine.h +++ b/engine.h @@ -206,8 +206,6 @@ 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);
--- a/functions.h +++ b/functions.h @@ -216,7 +216,6 @@ 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);
--- a/gui.h +++ b/gui.h @@ -17,7 +17,6 @@ void ShowGameDifficulty(void); void ShowPatchesSelection(void); void ShowNewgrf(void); -void ShowCustCurrency(void); /* graph_gui.c */ void ShowOperatingProfitGraph(void); @@ -64,8 +63,6 @@ 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);
--- a/industry_cmd.c +++ b/industry_cmd.c @@ -27,7 +27,7 @@ /** * Called if a new block is added to the industry-pool */ -void IndustryPoolNewBlock(uint start_item) +static void IndustryPoolNewBlock(uint start_item) { Industry *i;
--- a/network_client.c +++ b/network_client.c @@ -32,7 +32,7 @@ static uint32 last_ack_frame; -void NetworkRecvPatchSettings(NetworkClientState *cs, Packet *p); +static void NetworkRecvPatchSettings(NetworkClientState* cs, Packet* p); // ********** // Sending functions @@ -823,7 +823,7 @@ // 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;
--- a/network_server.c +++ b/network_server.c @@ -24,9 +24,10 @@ // 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? @@ -1190,7 +1191,7 @@ // 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); @@ -1484,7 +1485,8 @@ } // Handle the local command-queue -void NetworkHandleCommandQueue(NetworkClientState *cs) { +static void NetworkHandleCommandQueue(NetworkClientState* cs) +{ CommandPacket *cp; while ( (cp = cs->command_queue) != NULL) {
--- a/network_udp.c +++ b/network_udp.c @@ -41,7 +41,7 @@ }; #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; @@ -303,7 +303,7 @@ 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; @@ -322,7 +322,7 @@ // 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; @@ -451,7 +451,7 @@ } // Broadcast to all ips -void NetworkUDPBroadCast(SOCKET udp) +static void NetworkUDPBroadCast(SOCKET udp) { int i; struct sockaddr_in out_addr;
--- a/openttd.c +++ b/openttd.c @@ -544,7 +544,7 @@ /** 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;
--- a/order.h +++ b/order.h @@ -178,7 +178,6 @@ void AssignOrder(Order *order, Order data); bool CheckForValidOrders(const Vehicle* v); -Order UnpackVersion4Order(uint16 packed); Order UnpackOldOrder(uint16 packed); #endif /* ORDER_H */
--- a/order_cmd.c +++ b/order_cmd.c @@ -63,7 +63,7 @@ * 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);
--- a/player.h +++ b/player.h @@ -266,7 +266,5 @@ 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 */
--- a/players.c +++ b/players.c @@ -637,6 +637,10 @@ 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 @@ -1141,7 +1145,7 @@ * @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; @@ -1154,7 +1158,7 @@ * @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;
--- a/rail.h +++ b/rail.h @@ -638,7 +638,6 @@ 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 */
--- a/rail_cmd.c +++ b/rail_cmd.c @@ -1342,7 +1342,7 @@ * @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;
--- a/road_cmd.c +++ b/road_cmd.c @@ -773,7 +773,7 @@ * @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;
--- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -93,7 +93,7 @@ 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; }
--- a/settings_gui.c +++ b/settings_gui.c @@ -83,6 +83,9 @@ return false; } + +static void ShowCustCurrency(void); + static void GameOptionsWndProc(Window *w, WindowEvent *e) { switch (e->event) { @@ -1506,7 +1509,7 @@ CustCurrencyWndProc, }; -void ShowCustCurrency(void) +static void ShowCustCurrency(void) { _str_separator[0] = _custom_currency.separator; _str_separator[1] = '\0';
--- a/ship_cmd.c +++ b/ship_cmd.c @@ -377,7 +377,7 @@ 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; }
--- a/station.h +++ b/station.h @@ -207,7 +207,6 @@ 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);
--- a/station_cmd.c +++ b/station_cmd.c @@ -118,7 +118,7 @@ return rs; } -uint GetNumRoadStops(const Station *st, RoadStopType type) +static uint GetNumRoadStops(const Station* st, RoadStopType type) { uint num = 0; const RoadStop *rs;
--- a/terraform_gui.c +++ b/terraform_gui.c @@ -141,12 +141,12 @@ 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); }
--- a/town.h +++ b/town.h @@ -83,7 +83,6 @@ void ShowTownViewWindow(uint town); void DeleteTown(Town *t); void ExpandTown(Town *t); -bool GrowTown(Town *t); Town *CreateRandomTown(uint attempts); enum {
--- a/town_cmd.c +++ b/town_cmd.c @@ -415,6 +415,9 @@ { 0, 1} }; + +static bool GrowTown(Town *t); + static void TownTickHandler(Town *t) { if (t->flags12&1) { @@ -762,7 +765,7 @@ // 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;
--- a/train_cmd.c +++ b/train_cmd.c @@ -354,7 +354,7 @@ } } -void UpdateTrainAcceleration(Vehicle *v) +static void UpdateTrainAcceleration(Vehicle* v) { uint power = 0; uint weight = 0; @@ -630,7 +630,7 @@ 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;
--- a/unmovable_cmd.c +++ b/unmovable_cmd.c @@ -23,7 +23,7 @@ * @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;
--- a/vehicle.c +++ b/vehicle.c @@ -191,6 +191,9 @@ return NULL; } + +static void UpdateVehiclePosHash(Vehicle* v, int x, int y); + void VehiclePositionChanged(Vehicle *v) { int img = v->cur_image; @@ -395,7 +398,7 @@ -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;
--- a/vehicle.h +++ b/vehicle.h @@ -249,7 +249,6 @@ 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); @@ -272,8 +271,6 @@ 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); @@ -311,7 +308,6 @@ int LoadUnloadVehicle(Vehicle *v); void TrainConsistChanged(Vehicle *v); -void UpdateTrainAcceleration(Vehicle *v); int32 GetTrainRunningCost(const Vehicle *v); int CheckTrainStoppedInDepot(const Vehicle *v);
--- a/viewport.c +++ b/viewport.c @@ -216,7 +216,7 @@ } } -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; @@ -1939,7 +1939,7 @@ _thd.next_drawstyle = HT_RECT; } -void VpStartPreSizing(void) +static void VpStartPreSizing(void) { _thd.selend.x = -1; _special_mouse_mode = WSM_PRESIZE;
--- a/viewport.h +++ b/viewport.h @@ -18,7 +18,6 @@ /* 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); @@ -44,7 +43,6 @@ 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);
--- a/waypoint.c +++ b/waypoint.c @@ -64,7 +64,7 @@ } /* 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);
--- a/waypoint.h +++ b/waypoint.h @@ -74,7 +74,6 @@ 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);
--- a/window.c +++ b/window.c @@ -23,6 +23,10 @@ InvalidateWidget(w, widget); } + +static Window* StartWindowDrag(Window* w); +static Window* StartWindowSizing(Window* w); + static void DispatchLeftClickEvent(Window* w, int x, int y) { WindowEvent e; @@ -139,6 +143,8 @@ } +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; @@ -155,7 +161,7 @@ } } -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; @@ -287,6 +293,9 @@ } } + +static Window* BringWindowToFront(Window* w); + Window *BringWindowToFrontById(WindowClass cls, WindowNumber number) { Window *w = FindWindowById(cls, number); @@ -312,7 +321,7 @@ * - 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; @@ -1057,7 +1066,7 @@ return false; } -Window *StartWindowDrag(Window *w) +static Window* StartWindowDrag(Window* w) { w->flags4 |= WF_DRAGGING; _dragging_window = true; @@ -1070,7 +1079,7 @@ return w; } -Window *StartWindowSizing(Window *w) +static Window* StartWindowSizing(Window* w) { w->flags4 |= WF_SIZING; _dragging_window = true;
--- a/window.h +++ b/window.h @@ -552,7 +552,6 @@ }; /* 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); @@ -561,9 +560,6 @@ 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);