From ccaaa7d33ac92f91ebddcf4d1f6537639a38a13c Mon Sep 17 00:00:00 2001 From: maedhros Date: Thu, 12 Apr 2007 13:07:15 +0000 Subject: (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist. --- src/ai/default/default.cpp | 1 + src/aircraft_cmd.cpp | 1 + src/command.cpp | 1 + src/console_cmds.cpp | 1 + src/depot.cpp | 1 + src/disaster_cmd.cpp | 1 + src/economy.cpp | 1 + src/elrail.cpp | 1 + src/functions.h | 30 ------------------------------ src/genworld.cpp | 4 +--- src/landscape.h | 42 ++++++++++++++++++++++++++++++++++++++++++ src/misc.cpp | 2 +- src/misc_gui.cpp | 3 +-- src/npf.cpp | 1 + src/openttd.cpp | 1 + src/pathfind.cpp | 1 + src/rail_gui.cpp | 1 + src/road_map.cpp | 1 + src/roadveh_cmd.cpp | 1 + src/ship_cmd.cpp | 1 + src/signs.cpp | 1 + src/smallmap_gui.cpp | 1 + src/sound.cpp | 1 + src/station_cmd.cpp | 1 + src/texteff.cpp | 1 + src/train_cmd.cpp | 1 + src/unmovable_cmd.cpp | 1 + src/vehicle.cpp | 1 + src/viewport.cpp | 1 + src/water_cmd.cpp | 1 + src/waypoint.cpp | 1 + src/yapf/yapf.hpp | 1 + 32 files changed, 72 insertions(+), 36 deletions(-) diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp index 5dc7a16f4..2f33e37cc 100644 --- a/src/ai/default/default.cpp +++ b/src/ai/default/default.cpp @@ -5,6 +5,7 @@ #include "../../aircraft.h" #include "../../bridge_map.h" #include "../../functions.h" +#include "../../landscape.h" #include "../../map.h" #include "../../rail_map.h" #include "../../road_map.h" diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 9d6310fcd..90d704460 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -8,6 +8,7 @@ #include "aircraft.h" #include "debug.h" #include "functions.h" +#include "landscape.h" #include "station_map.h" #include "table/strings.h" #include "map.h" diff --git a/src/command.cpp b/src/command.cpp index 7bd6a3992..0b67cb4df 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -6,6 +6,7 @@ #include "openttd.h" #include "table/strings.h" #include "functions.h" +#include "landscape.h" #include "map.h" #include "gui.h" #include "command.h" diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 40cf2c57c..47dc27ea0 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -8,6 +8,7 @@ #include "debug.h" #include "engine.h" #include "functions.h" +#include "landscape.h" #include "saveload.h" #include "string.h" #include "variables.h" diff --git a/src/depot.cpp b/src/depot.cpp index 6c5790b1f..2267e362e 100644 --- a/src/depot.cpp +++ b/src/depot.cpp @@ -6,6 +6,7 @@ #include "openttd.h" #include "depot.h" #include "functions.h" +#include "landscape.h" #include "tile.h" #include "map.h" #include "table/strings.h" diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp index 98181f603..7bdb71d87 100644 --- a/src/disaster_cmd.cpp +++ b/src/disaster_cmd.cpp @@ -19,6 +19,7 @@ #include "stdafx.h" #include "openttd.h" #include "functions.h" +#include "landscape.h" #include "industry_map.h" #include "station_map.h" #include "table/strings.h" diff --git a/src/economy.cpp b/src/economy.cpp index aafad4a37..751a43c09 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -6,6 +6,7 @@ #include "openttd.h" #include "currency.h" #include "functions.h" +#include "landscape.h" #include "strings.h" // XXX InjectDParam() #include "table/strings.h" #include "table/sprites.h" diff --git a/src/elrail.cpp b/src/elrail.cpp index 6304842cf..4e43fe2e3 100644 --- a/src/elrail.cpp +++ b/src/elrail.cpp @@ -52,6 +52,7 @@ #include "viewport.h" #include "functions.h" /* We should REALLY get rid of this goddamn file, as it is butt-ugly */ #include "variables.h" /* ... same here */ +#include "landscape.h" #include "rail.h" #include "debug.h" #include "tunnel_map.h" diff --git a/src/functions.h b/src/functions.h index 2d3bcc998..714316b61 100644 --- a/src/functions.h +++ b/src/functions.h @@ -7,35 +7,8 @@ #include "gfx.h" -void DoClearSquare(TileIndex tile); -void RunTileLoop(); - -uint GetPartialZ(int x, int y, Slope corners); -uint GetSlopeZ(int x, int y); -uint32 GetTileTrackStatus(TileIndex tile, TransportType mode); -void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac); -void ChangeTileOwner(TileIndex tile, PlayerID old_player, PlayerID new_player); -void AnimateTile(TileIndex tile); -void ClickTile(TileIndex tile); -void GetTileDesc(TileIndex tile, TileDesc *td); void UpdateTownMaxPass(Town *t); -bool IsValidTile(TileIndex tile); - -static inline Point RemapCoords(int x, int y, int z) -{ - Point pt; - pt.x = (y - x) * 2; - pt.y = y + x - z; - return pt; -} - -static inline Point RemapCoords2(int x, int y) -{ - return RemapCoords(x, y, GetSlopeZ(x, y)); -} - - /* clear_land.cpp */ void DrawHillyLandTile(const TileInfo *ti); void DrawClearLandTile(const TileInfo *ti, byte set); @@ -170,8 +143,6 @@ void MarkAllViewportsDirty(int left, int top, int right, int bottom); void ShowCostOrIncomeAnimation(int x, int y, int z, int32 cost); void ShowFeederIncomeAnimation(int x, int y, int z, int32 cost); -void DrawFoundation(TileInfo *ti, uint f); - bool CheckIfAuthorityAllows(TileIndex tile); Town *ClosestTownFromTile(TileIndex tile, uint threshold); void ChangeTownRating(Town *t, int add, int max); @@ -179,7 +150,6 @@ void ChangeTownRating(Town *t, int add, int max); uint GetTownRadiusGroup(const Town* t, TileIndex tile); int FindFirstBit(uint32 x); void ShowHighscoreTable(int difficulty, int8 rank); -TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng); void AfterLoadTown(); void UpdatePatches(); diff --git a/src/genworld.cpp b/src/genworld.cpp index 532925fdd..c2b025f31 100644 --- a/src/genworld.cpp +++ b/src/genworld.cpp @@ -5,6 +5,7 @@ #include "stdafx.h" #include "openttd.h" #include "functions.h" +#include "landscape.h" #include "player.h" #include "table/sprites.h" #include "variables.h" @@ -19,7 +20,6 @@ #include "heightmap.h" #include "date.h" -void GenerateLandscape(byte mode); void GenerateClearTile(); void GenerateIndustries(); void GenerateUnmovables(); @@ -32,8 +32,6 @@ void StartupDisasters(); void InitializeGame(int mode, uint size_x, uint size_y); -void ConvertGroundTilesIntoWaterTiles(); - /* Please only use this variable in genworld.h and genworld.c and * nowhere else. For speed improvements we need it to be global, but * in no way the meaning of it is to use it anywhere else besides diff --git a/src/landscape.h b/src/landscape.h index 5cfe80edf..8d39e8d31 100644 --- a/src/landscape.h +++ b/src/landscape.h @@ -2,6 +2,9 @@ /** @file landscape.h */ +#ifndef LANDSCAPE_H +#define LANDSCAPE_H + enum { SNOW_LINE_MONTHS = 12, SNOW_LINE_DAYS = 32, @@ -17,3 +20,42 @@ void SetSnowLine(byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]); byte GetSnowLine(void); byte HighestSnowLine(void); void ClearSnowLine(void); + +bool IsValidTile(TileIndex tile); + +uint GetPartialZ(int x, int y, Slope corners); +uint GetSlopeZ(int x, int y); + +static inline Point RemapCoords(int x, int y, int z) +{ + Point pt; + pt.x = (y - x) * 2; + pt.y = y + x - z; + return pt; +} + +static inline Point RemapCoords2(int x, int y) +{ + return RemapCoords(x, y, GetSlopeZ(x, y)); +} + +void DrawFoundation(TileInfo *ti, uint f); + +void DoClearSquare(TileIndex tile); +void RunTileLoop(); + +uint32 GetTileTrackStatus(TileIndex tile, TransportType mode); +void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac); +void ChangeTileOwner(TileIndex tile, PlayerID old_player, PlayerID new_player); +void AnimateTile(TileIndex tile); +void ClickTile(TileIndex tile); +void GetTileDesc(TileIndex tile, TileDesc *td); + +void InitializeLandscape(); +void GenerateLandscape(byte mode); + +void ConvertGroundTilesIntoWaterTiles(); + +TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng); + +#endif /* LANDSCAPE_H */ diff --git a/src/misc.cpp b/src/misc.cpp index 62a824714..ec121ecb4 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -6,6 +6,7 @@ #include "openttd.h" #include "currency.h" #include "functions.h" +#include "landscape.h" #include "news.h" #include "player.h" #include "string.h" @@ -87,7 +88,6 @@ void InitializeAirportGui(); void InitializeDockGui(); void InitializeIndustries(); void InitializeMainGui(); -void InitializeLandscape(); void InitializeTowns(); void InitializeTrees(); void InitializeSigns(); diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 04a20c290..9bc7ab1c9 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -8,6 +8,7 @@ #include "heightmap.h" #include "debug.h" #include "functions.h" +#include "landscape.h" #include "newgrf.h" #include "saveload.h" #include "strings.h" @@ -40,8 +41,6 @@ FiosItem *_fios_list; int _saveload_mode; -extern void GenerateLandscape(byte mode); -extern void SwitchMode(int new_mode); static bool _fios_path_changed; static bool _savegame_sort_dirty; diff --git a/src/npf.cpp b/src/npf.cpp index d5689ab47..cb8c8dc45 100644 --- a/src/npf.cpp +++ b/src/npf.cpp @@ -7,6 +7,7 @@ #include "bridge_map.h" #include "debug.h" #include "functions.h" +#include "landscape.h" #include "npf.h" #include "aystar.h" #include "macros.h" diff --git a/src/openttd.cpp b/src/openttd.cpp index 263751c62..26106e1ab 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -24,6 +24,7 @@ #include "gfx.h" #include "gfxinit.h" #include "gui.h" +#include "landscape.h" #include "station.h" #include "station_map.h" #include "town_map.h" diff --git a/src/pathfind.cpp b/src/pathfind.cpp index 812a23790..f834097cd 100644 --- a/src/pathfind.cpp +++ b/src/pathfind.cpp @@ -8,6 +8,7 @@ #include "station_map.h" #include "depot.h" #include "functions.h" +#include "landscape.h" #include "map.h" #include "tile.h" #include "pathfind.h" diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 547050b0d..d6571e4f6 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -7,6 +7,7 @@ #include "table/sprites.h" #include "table/strings.h" #include "functions.h" +#include "landscape.h" #include "date.h" #include "map.h" #include "tile.h" diff --git a/src/road_map.cpp b/src/road_map.cpp index f04d6bf65..98a893490 100644 --- a/src/road_map.cpp +++ b/src/road_map.cpp @@ -6,6 +6,7 @@ #include "openttd.h" #include "bridge_map.h" #include "functions.h" +#include "landscape.h" #include "road_map.h" #include "station.h" #include "tunnel_map.h" diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index b0cd7c946..7cf2c8eeb 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -6,6 +6,7 @@ #include "openttd.h" #include "debug.h" #include "functions.h" +#include "landscape.h" #include "road_map.h" #include "roadveh.h" #include "station_map.h" diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index 9bc935e04..19f8d19c5 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -7,6 +7,7 @@ #include "ship.h" #include "table/strings.h" #include "functions.h" +#include "landscape.h" #include "map.h" #include "tile.h" #include "vehicle.h" diff --git a/src/signs.cpp b/src/signs.cpp index 4e394ea77..ff7517574 100644 --- a/src/signs.cpp +++ b/src/signs.cpp @@ -6,6 +6,7 @@ #include "openttd.h" #include "table/strings.h" #include "functions.h" +#include "landscape.h" #include "player.h" #include "signs.h" #include "saveload.h" diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index fa95fa65e..2c1299aa2 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -11,6 +11,7 @@ #include "station_map.h" #include "table/strings.h" #include "table/sprites.h" +#include "landscape.h" #include "map.h" #include "tile.h" #include "gui.h" diff --git a/src/sound.cpp b/src/sound.cpp index 3dea2e5a2..5700125d0 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -5,6 +5,7 @@ #include "stdafx.h" #include "openttd.h" #include "functions.h" +#include "landscape.h" #include "map.h" #include "mixer.h" #include "sound.h" diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 740321b01..91d3aae16 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -9,6 +9,7 @@ #include "cmd_helper.h" #include "debug.h" #include "functions.h" +#include "landscape.h" #include "station_map.h" #include "table/sprites.h" #include "table/strings.h" diff --git a/src/texteff.cpp b/src/texteff.cpp index 4dc3b310f..70fd7edba 100644 --- a/src/texteff.cpp +++ b/src/texteff.cpp @@ -8,6 +8,7 @@ #include "macros.h" #include "strings.h" #include "gfx.h" +#include "landscape.h" #include "viewport.h" #include "saveload.h" #include "hal.h" diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 12956353d..51f0f1ecf 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -7,6 +7,7 @@ #include "bridge_map.h" #include "debug.h" #include "functions.h" +#include "landscape.h" #include "gui.h" #include "station_map.h" #include "table/strings.h" diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp index 2549e51cc..4e496ec21 100644 --- a/src/unmovable_cmd.cpp +++ b/src/unmovable_cmd.cpp @@ -7,6 +7,7 @@ #include "table/strings.h" #include "table/sprites.h" #include "functions.h" +#include "landscape.h" #include "map.h" #include "tile.h" #include "command.h" diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 870a291f2..4e74afed2 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -11,6 +11,7 @@ #include "table/sprites.h" #include "table/strings.h" #include "functions.h" +#include "landscape.h" #include "map.h" #include "tile.h" #include "vehicle.h" diff --git a/src/viewport.cpp b/src/viewport.cpp index baba22c74..2be6ec1d1 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -11,6 +11,7 @@ #include "strings.h" #include "table/sprites.h" #include "table/strings.h" +#include "landscape.h" #include "map.h" #include "viewport.h" #include "window.h" diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index c20983325..85f15b109 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -11,6 +11,7 @@ #include "table/sprites.h" #include "table/strings.h" #include "functions.h" +#include "landscape.h" #include "map.h" #include "tile.h" #include "vehicle.h" diff --git a/src/waypoint.cpp b/src/waypoint.cpp index b981694b7..d691636dc 100644 --- a/src/waypoint.cpp +++ b/src/waypoint.cpp @@ -8,6 +8,7 @@ #include "command.h" #include "functions.h" #include "gfx.h" +#include "landscape.h" #include "map.h" #include "order.h" #include "rail_map.h" diff --git a/src/yapf/yapf.hpp b/src/yapf/yapf.hpp index 9de9f7834..2756326c8 100644 --- a/src/yapf/yapf.hpp +++ b/src/yapf/yapf.hpp @@ -17,6 +17,7 @@ #include "../vehicle.h" #include "../date.h" #include "../functions.h" +#include "../landscape.h" #include "yapf.h" #include "../pathfind.h" #include "../waypoint.h" -- cgit v1.2.3-70-g09d2