1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-17 11:39:11 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
rubidium
7def546fca (svn r11869) -Release: 0.6.0-beta3
Took way too long, but that happens when real life interferes and the bugcount is rising instead of declining.
2008-01-15 20:55:36 +00:00
318 changed files with 19944 additions and 19244 deletions

11
.gitignore vendored
View File

@@ -1,11 +0,0 @@
Makefile*
bin/*
!bin/data/chars.grf
!bin/data/openttdd.grf
!bin/data/openttdw.grf
!bin/data/opntitle.grf
!bin/scenario/README
!bin/scripts*
config.*
objs/*
src/rev.cpp

View File

@@ -22,6 +22,7 @@ INSTALL_DIR = !!INSTALL_DIR!!
INSTALL_BINARY_DIR = "$(INSTALL_DIR)/"!!BINARY_DIR!!
INSTALL_ICON_DIR = "$(INSTALL_DIR)/"!!ICON_DIR!!
INSTALL_DATA_DIR = "$(INSTALL_DIR)/"!!DATA_DIR!!
INSTALL_PERSONAL_DIR = !!PERSONAL_DIR!!
TTD = !!TTD!!
TTDS = $(SRC_DIRS:%=%/$(TTD))
OS = !!OS!!
@@ -270,5 +271,10 @@ install: bundle
$(Q)install -m 644 "$(BUNDLE_DIR)/data/"* "$(INSTALL_DATA_DIR)/data"
$(Q)install -m 644 "$(BUNDLE_DIR)/docs/"* "$(INSTALL_DATA_DIR)/docs"
$(Q)install -m 644 "$(BUNDLE_DIR)/media/"* "$(INSTALL_ICON_DIR)"
ifdef INSTALL_PERSONAL_DIR
$(Q)mkdir -p ~/"$(INSTALL_PERSONAL_DIR)"
$(Q)cp -R "$(BUNDLE_DIR)/scenario" ~/"$(INSTALL_PERSONAL_DIR)"
else
$(Q)cp -R "$(BUNDLE_DIR)/scenario" "$(INSTALL_DATA_DIR)"
endif # INSTALL_PERSONAL_DIR
endif # OSXAPP

View File

@@ -36,7 +36,7 @@ RES := $(shell mkdir -p $(BIN_DIR)/lang )
all: table/strings.h $(LANGS)
strgen.o: $(SRC_DIR)/strgen/strgen.cpp endian_host.h $(SRC_DIR)/table/control_codes.h
strgen.o: $(SRC_DIR)/strgen/strgen.cpp endian_host.h
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $<
@@ -44,17 +44,13 @@ string.o: $(SRC_DIR)/string.cpp endian_host.h
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $<
alloc_func.o: $(SRC_DIR)/core/alloc_func.cpp endian_host.h
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $<
lang/english.txt: $(LANG_DIR)/english.txt
$(Q)mkdir -p lang
$(Q)cp $(LANG_DIR)/english.txt lang/english.txt
$(STRGEN): alloc_func.o string.o strgen.o
$(STRGEN): string.o strgen.o
$(E) '$(STAGE) Compiling and Linking $@'
$(Q)$(CXX_BUILD) $^ -o $@
$(Q)$(CXX_BUILD) string.o strgen.o -o $@
table/strings.h: lang/english.txt $(STRGEN)
$(E) '$(STAGE) Generating $@'

BIN
bin/data/chars.grf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,308 +1,48 @@
0.6.1-RC2 (2008-05-21)
------------------------------------------------------------------------
- Fix: Do not send rcon commands of the server to the first client but do directly execute those on the server (r13137)
- Fix: For multiheaded engines, halve power and running cost when used instead of when loading, to allow callback values to work properly (r13074)
- Fix: Loading of TTDP savegames with rivers in them [FS#2005] (r13066)
- Fix: Update build industry window when raw_industry_construction setting is modified (r13060)
- Fix: Revert changes to multihead engine weight -- the original values were correct (r13023)
- Fix: Debugging was not possible with MSVC 2008 (r12996)
- Fix: List used for sorting GRFs was not freed (r12993)
- Fix: Default difficulty settings were different to TTD's original settings [FS#1977] (r12951)
- Fix: All vehicles would be available when an original scenario would be played [FS#1982] (r12948)
- Fix: Keep only first 15 bits for non failed callback results (r12947)
- Fix: Reading/modifying invalid data under some circumstances (r12943)
- Fix: Minor errors related to industries accepted/produced cargo (r12933)
- Fix: Town rating was affected even after the test run (r12920)
- Fix: Flood road tiles even when there are road works in progress [FS#1965] (r12919)
- Fix: Do not initialize Station struct with tile=0, buoys will never change that value [FS#1960] (r12915)
- Fix: Game crash when a spectator/server tried to show an engine with no owner when a NewGRF requested a specific variable (r12914)
- Fix: Report reverse sprite status (FD/FE) to NewGRF for manually toggled vehicles (r12910)
- Fix: Vehicles going twice to a depot when the automatic service interfered with the current order [FS#1985] (r12629)
0.6.1-RC1 (2008-04-26)
------------------------------------------------------------------------
- Fix: Vehicle groups, engine replacement rules and player/company names were not properly reset/freed after bankrupt (r12906)
- Fix: Remove trams from savegames saved in OTTD without tram support, it is better than to simply crash [FS#1953] (r12904)
- Fix: GCC on FreeBSD does not support -dumpmachine causing configure to fail. Use g++ instead [FS#1928] (r12876)
- Fix: Make the town rating tests use less memory and much quicker (r12859)
- Fix: Usage of AutoPtr made (trying to) build stuff very (time) expensive (r12857, r12855)
- Fix: Ensure that prop 25 is set for all vehicles in the consist before other properties as it could cause desyncs (r12856)
- Fix: Too much catenary was drawn about tunnel entrances, middle bridge pieces and non-rail station tiles (r12853, r12852)
- Fix: Use YAPF for fairly old savegames from before YAPF was introduced (r12845)
- Fix: The industry tick trigger should only be triggered once every 256 ticks, not every tick... Also bail out of the triggers a little earlier if you know they are not going to happen anyway (r12844)
- Fix: Inconsistent use of 8/15-bitness of NewGRF callback results with respect to TTDP's implementation of the specification (r12819, r12818, r12759)
- Fix: Possible out of bounds array access (r12809)
- Fix: Enforce autorenew values range in command (r12808)
- Fix: Vehicles could break down during loading and keep loading. The intention of the break down code is not to break down when having zero speed, therefor break downs now do not happen when loading [FS#1938] (r12795)
- Fix: [OSX] In some rare cases when using an uncalibrated monitor the system colour space could not be retrieved. Show an error when this happens instead of just trying an assertion (r12776)
- Fix: Slope checking for NewGRFs failed (r12759)
- Fix: Check the TILE_NOT_SLOPED flag of the _north_ tile of multi-tile houses to decide if autoslope is allowed (r12717)
- Fix: Do not move windows below the toolbar on resizes unless they would go behind the toolbar [FS#1904] (r12714)
- Fix: Increase default sound buffer size only for Vista [FS#1914] (r12708)
- Fix: Do not crash very hard on unrecognised savegames, just go back to the intro menu instead (r12707)
- Fix: In some cases a news messages would not be shown [FS#1906] (r12683)
- Fix: Removing road pieces from a town gave you twice the intended penalty [FS#1920] (r12682)
- Fix: When a road vehicle has a tram only stop multiple times in a row in it's orders, only the first one would be skipped [FS#1918] (r12678)
- Fix: Colour remaps on station sprites only worked for company colours [FS#1902] (r12674)
- Fix: Remove buggy buoys at tile 0 from old TTDP savegames (r12642)
- Fix: Possible NULL pointer dereference when reading some NewGRF data [FS#1913] (r12637)
- Fix: Infinite loop in case your compiler decides that enums are unsigned by default (r12622)
- Fix: The convert signal button disallowed signal dragging when the signal GUI was closed (r12577)
- Fix: Binding to a specific IP could cause OpenTTD to not register properly with the masterserver if one has multiple external interfaces (r12574)
- Fix: min() has 32bit arguments, clamping of 64bit values did not work (r12572)
- Fix: Towns could not terraform when inflation rised terraform prices enough (r12564)
- Fix: Do not affect town rating change by the order in which we examine stations (r12561)
- Fix: Redraw the signal GUI when the signal drag density changes in the patch settings and vice versa (r12553)
- Fix: Do not install scenarios into the current user's homedir when running 'make install', that is silly. Simply always install scenarios system wide instead (r12542)
0.6.0 (2008-04-01)
------------------------------------------------------------------------
- Fix: Final formatting of some string codes from NewGRFs was not done correctly [FS#1889] (r12488)
- Fix: Timetable times for aircraft were always doubled [FS#1883] (r12477)
- Fix: Remove broken endian-dependent code and unnecessary rgb to bgr swapping [FS#1880] (r12453)
- Fix: Do not 'disable' the drawing of autorail overlays when the tile is 'error'-marked (red pulsating selection) [FS#1871] (r12439)
- Fix: Plural rule for Icelandic was wrong (r12417)
0.6.0-RC1 (2008-03-26)
------------------------------------------------------------------------
- Feature: Show whether a town is a "city" in the town description title bar (r12391)
- Feature: Increase house animation frame number from 32 to 128 (r12347)
- Fix: Loading of TTD savegames (r12399, r12401)
- Fix: Vehicle lists related to stations not closed when the station is deleted [FS#1872] (r12393)
- Fix: Trams failing to turn on bridge heads/tunnel entrances [FS#1851] (r123890)
- Fix: Train could break apart when reversed while partially in a depot [FS#1841] (r12386, r12384)
- Fix: Non-breaking spaces should not be broken (r12385)
- Fix: Check return of AfterLoadGame for success or failure when loading TTD games [FS#1860] (r12383)
- Fix: Use 'items' unit for batteries, fizzy drinks, toys and bubbles in total cargo tab [FS#1864] (r12382)
- Fix: The number of houses wasn't computed right [FS#1835, FS#1535] (r12381)
- Fix: Update train acceleration and max speed after setting cached value to ensure the correct max speed is used with disabled real acceleration (r12380)
- Fix: Refresh vehicle details window when cached values are updated (r12378)
- Fix: Set cached value for vehicle property 25 before other cached values [FS#1854] (r12377)
- Fix: Don't close a dropmenu when clicking on a dropdown widget (r12374)
- Fix: win32 music driver fails if path is too long or if containing non-latin chars [FS#1849] (r12373, r12372)
- Fix: Do not let window hide behind the main toolbar after resizing the screen [FS#1823] (r12371)
- Fix: Close language drop down when parent window is clicked/closed [FS#1853] (r12370)
- Fix: Reset train speed limits when _patches.realistic_acceleration changes (r12369)
- Fix: Commands were sent to clients waiting for map download causing 'executing command from the past' error [FS#1650] (r12367)
- Fix: Do not allow building 'zero' road bits (r12363)
- Fix: Randomize variable 8F only once per callback 28 (r12362)
- Fix: openttdd.grf was using the wrong colours for glyphs due to a grfcodec bug (fixed in grfcodec 0.9.10 r1837) (r12360)
- Fix: Some callback-results were treated as 8 bit, when they were 15 bit, and vice versa (r12352, r12358)
- Fix: Do not try to flood water tile [FS#1836] (r12350)
- Fix: NTP skipped junction just after bridge end (r12348)
- Fix: Remove duplicated and inconsistent code wrt. autoreplace with rules in both vehicles' group and ALL_GROUP [FS#1748, FS#1825] (r12346)
- Fix: Don't try to restore backupped timetable when timetabling is disabled [FS#1828] (r12345)
- Fix: Slow helicopters never got the 'chance' to finish the landing routine (r12343)
- Fix: GRM buffer for cargos was incorrect size [FS#1827] (r12341)
- Fix: Recalculate cached train data after clearing reversing flag when entering depot (r12339)
0.6.0-beta5 (2008-03-04)
------------------------------------------------------------------------
- Feature: Vehicle variable FE bit 5, 6 and 8 [FS#1812] (r12331, r12330)
- Feature: Support loading full range of 0xD0xx NewGRF strings which includes 0xD000 to 0xD3FF (r12316)
- Feature: Ability to change aircraft speed factor, from so called 'realistic' (matching other vehicles) (1/1) to original TTD speed (1/4) (r12293, r12294)
- Change: Update readme about where openttd looks for files (r12321)
- Fix: Don't pause/unpause the game when showing load/save windows when the game is paused due to missing GRFs [FS#1733] (r12336)
- Fix: Disallow building level crossings over one-way roads as this allowed competitors to remove the one-way state [FS#1819] (r12329)
- Fix: Wrong Y pillar specified for girder with arch bridge (r12328)
- Fix: Vehicles could be sorted in a wrong order when a vehicle name changed - cached name was not invalidated (r12324)
- Fix: Vehicle sorting by name was broken, it was comparing the same string (when caching was not used) [FS#1821] (r12323)
- Fix: Endian issue when saving/loading group owner (r12322)
- Fix: Wrong transparency options could be saved after toggling all [FS#1817] (r12320)
- Fix: Map string IDs that are embedded from other strings [FS#1815] (r12317)
- Fix: Include prop 25 data for all train parts, not just those that carry cargo (r12314)
- Fix: YAPF and NTP did not apply penalty for uphill tracks on steep slopes (r12313)
- Fix: Restore timetable from backupped orders and add group ID to the backup [FS#1549] (r12296)
- Fix: Do not draw trees nor lamps between tram tracks (r12290) [FS#1807]
- Fix: [Win32] Do not create save dir on install (r12269)
- Fix: Autoreplace did not update vehicle index for timetable window [FS#1805] (r12261)
- Fix: GetProductionAroundTiles() may fail if only the second production slot exists (r12258)
- Fix: Town variables 0x9E to 0xAD (company ratings) returned wrong values (r12247)
- Fix: Typo resulting in no players are given the engine preview offer (r12244)
- Fix: Mac OSX bundle display name should be 'OpenTTD' [FS#1798] (r12234)
- Fix: [NewGRF] Support using any base price for rail and road vehicles' running cost, show running cost of wagons if available (r12209)
- Fix: When loading a savegame fails, do not start creating a new game, just go straight back to the intro screen (r12202)
- Fix: Force AI to build rail or road instead of bridges if possible, so it doesn't build bridges everywhere (r12200)
- Fix: "Transparent buildings" now only toggles buildings, so show tick when buildings are transparent [FS#1789] (r12198)
- Fix: Show correct last year profit when the train had negative income [FS#1788] (r12197)
- Fix: There can be oil rigs at map borders, do not set water class for them [FS#1787] (r12195)
- Fix: Do not start overtaking if the RV reaches wrong-way one-way-road in the next tiles (r12191)
- Fix: Assert when trying to play tile sound at NW border of map (placing buyos, leveling land) [FS#1784] (r12186)
- Fix: Take into account possible loan when AI is deciding which bridge to build, so it won't build wooden bridges everytime (r12184)
0.6.0-beta4 (2008-02-18)
------------------------------------------------------------------------
- Feature: Allow buttons to resize in NewGRF settings window (r12172)
- Feature: Change colour of autorail and autoroad selection when Ctrl is pressed (r12167)
- Feature: Separate catenary transparency settings from building transparency settings (r12103)
- Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x' (r12102)
- Feature: Add some missing VarAction2 variables (r12124)
- Feature: Make snow appear on rail tiles dependant on track height, not on height of the lowest part of the tile (r12098)
- Feature: [NewGRF] Specify the purchase, rail and road description of a bridge (r12069)
- Feature: [NewGRF] Add support for var 12, Variational Action 2 (r12045)
- Feature: Allow trees on shore (r12029)
- Feature: Invisible trees are now separate from the building concept (r12022)
- Feature: Add support for passenger engine designation for AI-use, NewGRF property 0x08 for trains (r12019)
- Feature: Show all cargo sources (en-route from) in the station view cargo waiting list instead of just one (r11990)
- Feature: [NewGRF] Resizable industry view window on callback 3A (r11987)
- Feature: [NewGRF] Implement var 8F (random bits) during callback 28 [FS#1697] (r11985)
- Feature: [NewGRF] Add support for Action 0D, var 13: informations about current map size (r11961)
- Feature: Support Action5 type 0D (newwater) (r11947)
- Feature: Allow building bridge heads on more slopes (r11937)
- Feature: [NewGRF] Add support for Rivers. Rivers can currently only be placed with-in the scenario editor (r11926,r11938,r11949,r12071)
- Feature: Generate.vbs script to allow project files generation for users unable to run generate bash script (r12123)
- Feature: Sort the strings in languages dropdown (r11886)
- Codechange: Drop MSVC 2003 support (r11979)
- Fix: Test purchase list loading/loaded sprites instead of unconditionally returning a possibly non-existant sprite (r12180)
- Fix: Return correct bridge price for AI when DC_QUERY_COST is set [FS#609] (r12171)
- Fix: When drag&drop mode was cancelled by keyboard input, depot/group window wasn't updated [FS#337] (r12166)
- Fix: Buffer overflow when drawing scrolling news [FS#1652, FS#1773] (r12165)
- Fix: If a train is 'stopping' when entering a depot, do not let it leave again [FS#1705] (r12163)
- Fix: Towns shouldn't build over houses owned by another town [FS#1757] (r12162)
- Fix: Towns will no longer build houses > 1x1 there where should be road (with 2x2, 3x3 grid town layouts) (r12161)
- Fix: Remove the arbitrary limit of 64 waypoints per town [FS#1744] (r12160)
- Fix: Chance16I was now biased towards zero - round to nearest now (r12156)
- Fix: Adjust aircraft slowing algorithm (r12144)
- Fix: Callback 0x3D always gets a cargobit in var 0x18, independent of grf version [FS#1766] (r12142)
- Fix: Do not allow adding tram to rail-road crossing when there is a vehicle on it (r12138)
- Fix: Show cargo capacity for articulated vehicles correctly in the purchase list. Multiple cargo types can also now been shown [FS#1769] (r12137)
- Fix: With mammoth trains disabled, maximum train length was limited to 9 (r12131)
- Fix: Use tile index 0 for planes in the air, so it cannot have an invalid tile index [FS#1745] (r12109)
- Fix: X/Y axis swap for station tiles in GetNearbyTile() was wrong way around [FS#1753]( r12108)
- Fix: Loading older savegames fixes (r12096,r12097)
- Fix: When a company bankrupts, remove drive-through road stops, ship depots and buoys too. Update owners of water and road [FS#1703] (r12095)
- Fix: Do not set station owner for buoys when merging company (r12093)
- Fix: Keep production level within delimited boundaries, while using var result 0D/0E and than multiplying/dividing it [FS#1755] (r12092)
- Fix: Assert when loading savegame with wrong tiletype at south map borders (r12088)
- Fix: Check overrides only for industries when mapping newgrf entities to 'real' entities [FS#1747] (r12086)
- Fix: Update waypoint signs when changing language (r12080)
- Fix: Use search paths when opening console scripts (r12079)
- Fix: When reusing a renamed deleted waypoint, keep the new name (r12076)
- Fix: Make docks at sea flood neighboured tiles (r12072)
- Fix: Possible deadlock when there are no houses available to build at given tile (r12062)
- Fix: Houses with zero probability could be built (r12062)
- Fix: Do not clear tiles when the town won't be able to build any buildings anyway (r12060)
- Fix: Allow building 2x2 building on slopes if not explicitly forbidden (r12060)
- Fix: It was possible to build 2x1 and 1x2 buildings on slopes even if it was not allowed (r12060)
- Fix: Teach NPF where road vehicles and trams can reverse (r12058)
- Fix: Ships can drive through opponents' ship depots (r12058)
- Fix: Slowdown train when approaching 90deg turn when 90deg turns are forbidden (r12057)
- Fix: Enable YAPF to start searching inside a wormhole [FS#1704] (r12056)
- Fix: Another way to fix AI trying to build road through depots (r12055)
- Fix: The cargo translation table was loaded at the right time, but all the other global variables were now loaded too early [FS#1737] (r12052)
- Fix: Random_func broke for desync debug (r12050)
- Fix: Memset on multibyte array with wrong byte count (r12049)
- Fix: Crash when centering on a vehicle (aircraft) that is outside of the map [FS#1741] (r12044)
- Fix: Allow building transmitters and lighthouses on tree tiles [FS#1736] (r12043)
- Fix: Reimplement how rivers and canals are stored in the map, allowing the sea/river/canal status to also be stored for buoys, docks, locks and depots. All these are now allowed on rivers and removal of them will revert to the original water type [FS#1676] (r12042)
- Fix: Change ownership of or remove statues when merging/bankrupting companies (r12038)
- Fix: For station tiles, only get road types for road stops (r12036)
- Fix: Teach YAPF where trams can reverse, and where not [FS#1702] (r12035)
- Fix: Do not show train speed as zero after loading paused game (r12033)
- Fix: When removing a statue, remove town statue flag for the statue owner, not current player (r12032)
- Fix: Prevent towns from removing or claiming ownership of player owned tiles when growing [FS#1689,FS#1719] (r12031)
- Fix: In one case trees could spread under bridges (r12024)
- Fix: Put a better suited text in the quit-dialog [FS#1690] (r12023)
- Fix: Restore initial intent on the invisible tree while transparent building patch setting [FS#1721] (r12018)
- Fix: When you have more than 9 network interfaces you'll enter the wonderfull world of overflows (r12017)
- Fix: Better work on strings in regard to gender [FS#1716] (r12015)
- Fix: Lighthouses and transmitters were never supposed to be build on a slope (r12014)
- Fix: When modifying watered tiles, mark neighboured canals and rivers dirty in more cases (r12013)
- Fix: Enable TownRatingTestMode during cost estimation with 'shift'-key (r12012)
- Fix: Do not consider one-corner-raised-shores to be watered tiles from all sides [FS#1701] (r12011)
- Fix: Avoid loading sample.cat if it 'looks' incorrect, and avoid later null pointer dereferences by moving volume lookup deeper [FS#1707] (r12009)
- Fix: Possible reading from an invalid pointer [FS#1717] (r12005)
- Fix: When skipping Action 11 or 12, also skip belonging sprites (r12001)
- Fix: Do entrance-slope-check for every tile of railstations (r11999)
- Fix: Possible remote assert by setting bit 6 of p1 for CMD_REMOVE_ROAD [FS#1692] (r11998)
- Fix: Update train statusbar when stopping from zero speed [FS#1706] (r11996)
- Fix: Resize station/roadstop/dock/airport construction windows if cargo acceptance list is too long (r11993)
- Fix: When building two rail stations close to each other (with control) so they looked like one long track trains would see them as one (r11992)
- Fix: Resize autoreplace window to fit purchase information text if it is too large (r11989)
- Fix: Build system ignored changes to table/control_codes.h which require strgen to be rebuilt (r11986)
- Fix: Also draw corner shores under rail tracks (r11984)
- Fix: Use unicode glyph mapping to fix up missing/shuffled sprites in original data files instead of shuffling or skipping sprites directly [FS#1698] (r11981)
- Fix: Industries using results 0D/0E on callback cb29/35 were a bit too eager to close down (r11976)
- Fix: Shore and sea tiles under bridges were converted to canals in old savegames [FS#1684] (r11974)
- Fix: Use grass tiles for corner shores, if shores got replaced by ActionA [FS#1683] (r11973)
- Fix: Old AI shouldn't build fast planes with a small airport in orders(r11972)
- Fix: MP_ROAD can have railbits too - OPF searching over rail of diffen t owner behind crossing (r11967)
- Fix: OPF was searching through depots and normal road stops [FS#1403, FS#1506] (r11966)
- Fix: Tropic zone data was returned incorrectly [FS#1685] (r11964)
- Fix: NewAI couldn't build any road vehicles when there were any tram grfs loaded (r11958)
- Fix: Disallow building locks and docks on rapids [FS#1675] (r11956)
- Fix: Do not allow modifying roadbits when other roadtypes would need different foundation (r11953)
- Fix: Loading of very old savegames was broken (r11951)
- Fix: Slope detection of bridge ramps. Helps YAPF and Trolly (r11946)
- Fix: FileExists() failed for non latin paths (win32) (r11945)
- Fix: Allow building drive-through road/tram stops at road/tram track that has no owner (r11944)
- Fix: 'BRIDGE_TOO_LOW_FOR_TERRAIN'-check was wrong for steep slopes (r11936)
- Fix: [Autoreplace] Single to dualhead locomotive replacefailed when player had enough money to replace and refit one but not enough to refit the last one as well [FS#1624] (r11929)
- Fix: [Autoreplace] Autoreplace could refit train engines to the wrong cargo type if the old engine had no cargo capacity and the new one had (r11928)
- Fix: Loading old, pre savegame version 2, savegames (r11925)
- Fix: AI was reading wrong tile slope while building road bridge (r11917)
- Fix: set correctly crossing state after train reversal, train leaving crossing, train crash (r11900)
- Fix: Segmentation faults/wrong frees due uninitialized memory in the AI [FS#1658] (r11887)
- Fix: Assert when trying to remove rail from a house or industry tile [FS#1663,FS#1665-6-7-8,FS#1680,FS#1686-7-8 FS#1715 FS#1742 FS#1771 FS#1776](r11883)
- Fix: Crash in MP in vehicle group window if the currently selected group is deleted by another player (r11878)
- Fix: Another way to crash competitors' train in a station (r11877)
- Fix: Automatically sending aircraft to depot for autoreplace/renew is now triggered by the correct conditions (r11875)
- Fix: EngineHasReplacementForPlayer() didn't look in ALL_GROUP (r11872)
- Fix: Do not update signals after each tile when building/removing a large block of track/signals/station [FS#1074] (r11871)
- Fix: Slow down train when approaching tile we can't enter in more cases (r11870)
- Fix: Do not make crossing red when we can't enter it in any case (r11870)
0.6.0-beta3 (2008-01-16)
------------------------------------------------------------------------
- Feature: Replaced fixed size custom name array. Names are now attached to their object directly and there is no limit to the amount of names (r11822)
- Feature: Add drag-n-drop support to the raise/lower land tools. Land is raised/lowered at the start and the rest of the area levelled to match (r11759)
- Feature: Add support for NewGRF's train 'tilt' flag. Trains with tilt capability (specific details are per NewGRF set) will be given a 20% speed limit bonus on curves (r11741)
- Feature: Added sorting for cost, running costs and speed to road vehicles and ships build windows (r11710)
- Feature: List neutral stations where the player has service in the station list too (r11670)
- Feature: Check whether (some) characters are missing in the current 'font' for the 'currently' chosen language and give a warning when that does happen (r11646)
- Feature: Support shore replacement via Action 5 (r11726)
- Fix: When two NewGRFs 'fight' to define the same cargo it could happen that the strings are defined by one cargo and the 'action2' by another and when one assumes that both come from the same NewGRF [FS#1559] (r11862)
- Fix: Recompute town population when removing a 'newhouses' grf, or when loading a game with missing 'newhouses' grfs [FS#1335] (r11855)
- Fix: Road vehicle count was incorrect in network lobby window (r11844)
- Fix: Mark dirty canal tile even in diagonal direction from flooded tile, draw correctly canal next to half flooded rail tile (r11843, r11838)
- Fix: At least one instance of dmusic driver is needed for it to be registered and usable (r11826)
- Fix: An articulated road vehicle could split up when it turned around at a corner and then would enter a drive through station at the next tile [FS#1627] (r11825)
- Fix: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots [FS#1602] (r11813)
- Fix: Do not crash trains when leaving depot to a very long track [FS#716] (r11802)
- Fix: Take town rating into account when testing if a command can be executed [FS#1616] (r11795)
- Fix: Reversing a train when loading at a station with an adjacent station in the same axis crashed [FS#1632] (r11794)
- Fix: Group names got not deallocated in the command test run [FS#1614] (r11743)
- Fix: Run window tick events when paused, so that news pop-ups and the about window still progress. For other windows the events are ignored when paused [FS#1319] (r11742)
- Fix: Modify and possibly discard key events for code points in the unicode private use area [FS#1610] (r11740)
- Fix: Set the new scroll position after zooming in instead of before, as the zoom will cancel it out [FS#1609] (r11739)
- Fix: Do not reset loading indicator IDs when only reloading NewGRFs [FS#1574] (r11735)
- Fix: Elrail merge gave elrail, monorail & maglev unintended speed bonuses for curves, as the bonus was based on the railtype index. The bonus is now specified by a property of the railtype (r11732)
- Fix: Clear sprite override data before performing NewGRF wagon attach callback. This stopped the callback working for autoreplace and when moving wagons from train to train in a depot [FS#1582] ( r11731)
- Fix: If there are no houses that can be build in a specific year yet, force the houses with the earliest introduction year to be available [FS#1577] (r11727)
- Fix: Make it impossible (for users) to circumvent the length checking of the NewGRF 'allow wagon attach' callback by moving several wagons at a time (r11724)
- Fix: Do not put more than one Random() in function calls because parameter evaluation order is not guaranteed in the C++ standard [FS#1561] (r11716)
- Fix: Do not allow player inauguration date on scenarios to be bigger than current year [FS#1569] (r11714)
- Fix: Add more house string id ranges to MapGRFStringID so NewGRFs use the proper string ids (r11712)
- Fix: Do not allow refitting flooded (destroyed) vehicles (r11707)
- Fix: Trains could have sprites with wrong direction when reversing, also was inconsistent with save/load process [FS#1557] (r11705)
- Fix: When removing buoys, return to water or canal depending on their owner (r11666)
- Fix: Animation informations should not be copied from original industry tile spec, while doing an action 00, industry tile, prop 08 (r11665)
- Fix: Do not allow modifying non-uniform stations when non-uniform stations are disabled [FS#1563] (r11659)
- Fix: 'Initialised' NewGRFs could still be deactivated in the later 'activation' pass (r11650)
- Fix: Vehicles were still followed when sold [FS#1541] (r11632)
- Fix: Many viewports could crash the scenario editor [FS#1527] (r11629)
- Fix: Popping from text reference stack must be done in a precise order. But some compiler (MSVC) over optimised it and inverted this order [FS#1532] (r11627)
- Fix: There were still some cases where one could not build a tram track, but the tram could become blocked [FS#1525] (r11621)
- Fix: Do not make crossing red behind depot the train is entering [FS#1531] (r11619)
- Fix: Buoys are just waypoints, so don't allow load/unload/transfert for them (r11618)
- Fix: Sometimes large values could go off the chart [FS#1526] (r11616)
- Fix: Temperate banks can only be built in towns (over a house) (r11615)
-Feature: Replaced fixed size custom name array. Names are now attached to their object directly and there is no limit to the amount of names (r11822)
-Feature: Add drag-n-drop support to the raise/lower land tools. Land is raised/lowered at the start and the rest of the area levelled to match (r11759)
-Feature: Add support for NewGRF's train 'tilt' flag. Trains with tilt capability (specific details are per NewGRF set) will be given a 20% speed limit bonus on curves (r11741)
-Feature: Added sorting for cost, running costs and speed to road vehicles and ships build windows (r11710)
-Feature: List neutral stations where the player has service in the station list too (r11670)
-Feature: Check whether (some) characters are missing in the current 'font' for the 'currently' chosen language and give a warning when that does happen (r11646)
-Feature: Support shore replacement via Action 5 (r11726)
-Fix: When two NewGRFs 'fight' to define the same cargo it could happen that the strings are defined by one cargo and the 'action2' by another and when one assumes that both come from the same NewGRF [FS#1559] (r11862)
-Fix: Recompute town population when removing a 'newhouses' grf, or when loading a game with missing 'newhouses' grfs [FS#1335] (r11855)
-Fix: Road vehicle count was incorrect in network lobby window (r11844)
-Fix: Mark dirty canal tile even in diagonal direction from flooded tile, draw correctly canal next to half flooded rail tile (r11843, r11838)
-Fix: At least one instance of dmusic driver is needed for it to be registered and usable (r11826)
-Fix: An articulated road vehicle could split up when it turned around at a corner and then would enter a drive through station at the next tile [FS#1627] (r11825)
-Fix: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots [FS#1602] (r11813)
-Fix: Do not crash trains when leaving depot to a very long track [FS#716] (r11802)
-Fix: Take town rating into account when testing if a command can be executed [FS#1616] (r11795)
-Fix: Reversing a train when loading at a station with an adjacent station in the same axis crashed [FS#1632] (r11794)
-Fix: Group names got not deallocated in the command test run [FS#1614] (r11743)
-Fix: Run window tick events when paused, so that news pop-ups and the about window still progress. For other windows the events are ignored when paused [FS#1319] (r11742)
-Fix: Modify and possibly discard key events for code points in the unicode private use area [FS#1610] (r11740)
-Fix: Set the new scroll position after zooming in instead of before, as the zoom will cancel it out [FS#1609] (r11739)
-Fix: Do not reset loading indicator IDs when only reloading NewGRFs [FS#1574] (r11735)
-Fix: Elrail merge gave elrail, monorail & maglev unintended speed bonuses for curves, as the bonus was based on the railtype index. The bonus is now specified by a property of the railtype (r11732)
-Fix: Clear sprite override data before performing NewGRF wagon attach callback. This stopped the callback working for autoreplace and when moving wagons from train to train in a depot [FS#1582] (r11731)
-Fix: If there are no houses that can be build in a specific year yet, force the houses with the earliest introduction year to be available [FS#1577] (r11727)
-Fix: Make it impossible (for users) to circumvent the length checking of the NewGRF 'allow wagon attach' callback by moving several wagons at a time (r11724)
-Fix: Do not put more than one Random() in function calls because parameter evaluation order is not guaranteed in the c++ standard [FS#1561] (r11716)
-Fix: Do not allow player inauguration date on scenarios to be bigger than current year [FS#1569] (r11714)
-Fix: Add more house string id ranges to MapGRFStringID so NewGRFs use the proper string ids (r11712)
-Fix: Do not allow refitting flooded (destroyed) vehicles (r11707)
-Fix: Trains could have sprites with wrong direction when reversing, also was inconsistent with save/load process [FS#1557] (r11705)
-Fix: When removing buoys, return to water or canal depending on their owner (r11666)
-Fix: Animation informations should not be copied from original industry tile spec, while doing an action 00, industry tile, prop 08 (r11665)
-Fix: Do not allow modifying non-uniform stations when non-uniform stations are disabled [FS#1563] (r11659)
-Fix: 'Initialised' NewGRFs could still be deactivated in the later 'activation' pass (r11650)
-Fix: Vehicles were still followed when sold [FS#1541] (r11632)
-Fix: Many viewports could crash the scenario editor [FS#1527] (r11629)
-Fix: Popping from text reference stack must be done in a precise order. But some compiler (MSVC) over optimised it and inverted this order [FS#1532] (r11627)
-Fix: There were still some cases where one could not build a tram track, but the tram could become blocked [FS#1525] (r11621)
-Fix: Do not make crossing red behind depot the train is entering [FS#1531] (r11619)
-Fix: Buoys are just waypoints, so don't allow load/unload/transfert for them (r11618)
-Fix: Sometimes large values could go off the chart [FS#1526] (r11616)
-Fix: Temperate banks can only be built in towns (over a house) (r11615)
0.6.0-beta2 (2007-12-09)

View File

@@ -5,7 +5,7 @@ log() {
}
set_default() {
released_version="0.6.1-RC2"
released_version="0.6.0-beta3"
ignore_extra_parameters="0"
# We set all kinds of defaults for params. Later on the user can override
@@ -41,7 +41,7 @@ set_default() {
enable_translator="0"
enable_unicode="1"
enable_assert="1"
enable_strip="0"
enable_strip="1"
enable_universal="1"
enable_osx_g5="0"
enable_cocoa_quartz="1"
@@ -419,11 +419,11 @@ check_params() {
detect_awk
detect_os
check_build
check_host
detect_os
# We might enable universal builds always on OSX targets.. but currently we don't
# if [ "$enable_universal" = "1" ] && [ "$os" != "OSX" ]; then
if [ "$enable_universal" = "1" ]; then
@@ -635,7 +635,7 @@ check_params() {
distcc="$with_distcc"
fi
if [ "$with_distcc" != "0" ]; then
res="`$distcc --version 2>/dev/null | head -n 1 | cut -b 1-6`"
res="`$distcc --version 2>/dev/null | head -n 1 | cut -b 0-6`"
if [ "$res" != "distcc" ]; then
distcc=""
log 1 "checking distcc... no"
@@ -664,7 +664,7 @@ check_params() {
ccache="$with_ccache"
fi
if [ "$with_ccache" != "0" ]; then
res="`$ccache --version 2>/dev/null | head -n 1 | cut -b 1-6`"
res="`$ccache --version 2>/dev/null | head -n 1 | cut -b 0-6`"
if [ "$res" != "ccache" ]; then
ccache=""
log 1 "checking ccache... no"
@@ -970,6 +970,12 @@ make_cflags_and_ldflags() {
if [ $cc_version -ge 42 ]; then
CFLAGS="$CFLAGS -fno-strict-overflow"
fi
# GCC 4.3+ gives a warning about empty body of
# loops and conditions
if [ $cc_version -ge 43 ]; then
CFLAGS="$CFLAGS -Wno-empty-body"
fi
fi
if [ "$os" != "CYGWIN" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then
@@ -1347,26 +1353,13 @@ check_compiler() {
}
check_build() {
if [ "$os" = "FREEBSD" ]; then
# FreeBSD's C compiler does not support dump machine.
# However, removing C support is not possible because PSP must be linked with the C compiler.
check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CXX" "g++" "c++" "0" "-dumpmachine"
else
check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CC" "gcc" "cc" "0" "-dumpmachine"
fi
check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CC" "gcc" "cc" "0" "-dumpmachine"
}
check_host() {
# By default the host is the build
if [ -z "$host" ]; then host="$build"; fi
if [ "$os" = "FREEBSD" ]; then
# FreeBSD's C compiler does not support dump machine.
# However, removing C support is not possible because PSP must be linked with the C compiler.
check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CXX" "g++" "c++" "0" "-dumpmachine"
else
check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CC" "gcc" "cc" "0" "-dumpmachine"
fi
check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CC" "gcc" "cc" "0" "-dumpmachine"
}
check_cxx_build() {
@@ -2348,7 +2341,7 @@ showhelp() {
echo " version (Win32 ONLY)"
echo " --disable-network disable network support"
echo " --disable-assert disable asserts (continue on errors)"
echo " --enable-strip enable any possible stripping"
echo " --disable-strip disable any possible stripping"
echo " --without-osx-sysroot disable the automatic adding of sysroot "
echo " (OSX ONLY)"
echo " --without-application-bundle disable generation of application bundle"

View File

@@ -6,11 +6,11 @@ PLEASE READ THE ENTIRE DOCUMENT BEFORE DOING ANY ACTUAL CHANGES!!
SUPPORTED MSVC COMPILERS
------------------------
OpenTTD includes projects for MSVC 2005.NET and MSVC 2008.NET. Both will
OpenTTD includes projects for MSVC 2003.NET and MSVC 2005.NET. Both will
compile out of the box, providing you have the required libraries/headers;
which ones, see below. There is no support for VS6 or MSVC 2002, or
MSVC 2003.NET. You are therefore strongly encouraged to either upgrade to
MSVC 2005 Express (free) or use GCC.
which ones, see below. There is no support for VS6, you are therefore
strongly encouraged to either upgrade to MSVC 2005 Express (free) or use GCC.
MSVC 2002 probably works as well, but it has not been tested.
1) REQUIRED FILES
@@ -74,6 +74,20 @@ NOTE: make sure that the directory for the DirectX SDK is the first one in the
list, above all others, otherwise compilation will most likely fail!!
2.3) DEBUGGING - WORKING DIRECTORY (MSVC 2003 ONLY!)
----------------------------------------------------
The very first time you check out and compile OpenTTD with Visual Studio 2003, running
the binary will complain about missing files. You need to go into and change a setting
OpenTTD > Project > Properties > Configuration (All Configurations) > ...
Configuration Properties > Debugging >
* Working Directory: ..\bin
VS 2005 works out of the box because Microsoft allowed a user to supply a humanly-
readable defaults file (openttd_vs80.vcproj.user), whereas 2003 is braindead.
3) TTD GRAPHICS FILES
---------------------
Copy the following files from Transport Tycoon Deluxe to the bin/data folder
@@ -88,12 +102,12 @@ Copy the following files from Transport Tycoon Deluxe to the bin/data folder
4) COMPILING
------------
Open trunk/openttd_vs[89]0.sln
Open trunk/openttd[_vs80].sln
Set the build mode to 'Release' in
Build > Configuration manager > Active solution configuration > select "Release"
Compile...
If everything works well the binary should be in trunk/objs/Win[32|64]/Release/openttd.exe
If everything works well the binary should be in trunk/objs/[Win32]/Release/openttd.exe
5) EDITING, CHANGING SOURCE CODE
@@ -112,4 +126,4 @@ to ask about reasons; or just wait. The problem will most likely solve itself
within a few days as the problem is noticed and fixed.
An up-to-date version of this README can be found on the wiki:
http://wiki.openttd.org/index.php/MicrosoftVisualCExpress
http://wiki.openttd.org/index.php/MicrosoftVisualCExpress

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,6 @@
<title>OpenTTD Landscape Internals - #2</title>
<style type="text/css">
span.abuse { font-family: "Courier New", Courier, mono; background-color: rgb(255, 58, 31); }
span.option{ font-family: "Courier New", Courier, mono; background-color: rgb(255,255, 30); }
span.free { font-family: "Courier New", Courier, mono; background-color: rgb(30, 178, 54); }
span.used { font-family: "Courier New", Courier, mono; }
td.bits { white-space: nowrap; text-align: center; font-family: "Courier New", Courier, mono; }
@@ -23,8 +22,7 @@ the array so you can quickly see what is used and what is not.
<ul>
<li><span style="font-weight: bold;"><span class="free">O</span></span> - bit is free</li>
<li><span style="font-weight: bold;"><span class="used">X</span></span> - bit is used</li>
<li><span style="font-weight: bold;"><span class="abuse">&nbsp;</span></span> - bit of attribute is abused for different purposes, i.e. other bits define the actual meaning.</li>
<li><span style="font-weight: bold;"><span class="option">~</span></span> - bit is accessed, but does not really have a meaning (e.g. owner of clear land is always OWNER_NONE)</li>
<li><span style="font-weight: bold;"><span class="abuse">&nbsp;</span></span> - bit of attribute is abused for different purposes</li>
</ul>
<p>
<ul>
@@ -66,7 +64,7 @@ the array so you can quickly see what is used and what is not.
<td rowspan="2">0</td>
<td class="caption">ground</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="option">~~~~ ~~~~</span></td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits">XXXX XX<span class="free">OO</span></td>
@@ -77,34 +75,23 @@ the array so you can quickly see what is used and what is not.
<tr>
<td class="caption">farmland</td>
<td class="bits">-inherit-</td>
<td class="bits"><span class="option">~~~~ ~~~~</span></td>
<td class="bits">-inherit-</td>
<td class="bits">XXXX XXXX XXXX XXXX</td>
<td class="bits"><span class="free">OOOO</span> XXXX</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOO</span>X XXXX</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
<tr>
<td rowspan=4>1</td>
<td rowspan=3>1</td>
<td class="caption">rail</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="option">~~~</span>X XXXX</td>
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO</span> <span class="option">~~</span>XX</td>
<td class="bits"><span class="free">OOOO</span> XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
<tr>
<td class="caption">rail with signals</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOOO OOOO O</span>XXX <span class="free">O</span>XXX</td>
<td class="bits">XXXX <span class="option">~~</span>XX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">-inherit-</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
@@ -113,9 +100,9 @@ the array so you can quickly see what is used and what is not.
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO</span> <span class="option">~~</span>XX</td>
<td class="bits"><span class="free">OOOO</span> XXXX</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits"><span class="free">OOOO</span> XXXX</td>
<td class="bits">XX<span class="free">OO O</span>XXX</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
@@ -124,9 +111,9 @@ the array so you can quickly see what is used and what is not.
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits">XXXX XXXX XXXX XXXX</td>
<td class="bits"><span class="free">OOOO</span> <span class="option">~~</span>XX</td>
<td class="bits"><span class="free">OOOO</span> XXXX</td>
<td class="bits">XX<span class="free">OO OOO</span>X</td>
<td class="bits"><span class="free">OOOO</span> XXXX</td>
<td class="bits">XX<span class="free">OO O</span>XXX</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
@@ -134,7 +121,7 @@ the array so you can quickly see what is used and what is not.
<td rowspan=3>2</td>
<td class="caption">road</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="option">~~~</span>X XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XXXX XXXX XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XXXX</td>
@@ -147,11 +134,11 @@ the array so you can quickly see what is used and what is not.
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits">XXXX <span class="option">~~</span>XX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">O</span>XXX XXXX</td>
<td class="bits">XX<span class="free">OO</span> XXXX</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits">-inherit-</td>
<td class="bits">XXXX XXXX</td>
</tr>
<tr>
<td class="caption">road depot</td>
@@ -160,7 +147,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
<td class="bits">X<span class="free">OOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits">XX<span class="free">OO</span> XXXX</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits">XXX<span class="free">O OOOO</span></td>
</tr>
@@ -170,122 +157,45 @@ the array so you can quickly see what is used and what is not.
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XXXX XXXX XXXX</td>
<td class="bits">XXX<span class="option">~ ~~</span>XX</td>
<td class="bits">XX<span class="free">O</span>X XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXX<span class="abuse">X XXXX</span></td>
<td class="bits">XX<span class="abuse">XX XXXX</span></td>
<td class="bits"><span class="abuse">XXXX XX</span>XX</td>
<td class="bits">XXXX <span class="abuse">XXXX</span></td>
<td class="bits"><span class="abuse">X</span>XX<span class="abuse">X XXX</span>X</td>
</tr>
<tr>
<td>4</td>
<td class="caption">trees</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="option">~~~~ ~~~~</span></td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OOOO OOOO</span> XXXX XXXX</td>
<td class="bits"><span class="option">~~</span>XX XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XX<span class="free">OO</span></td>
<td class="bits">XX<span class="free">OO O</span>XXX</td>
<td class="bits"><span class="free">OOOO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
<tr>
<td rowspan=6>5</td>
<td class="caption">rail station</td>
<td>5</td>
<td class="caption">station</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="option">~~~</span>X XXXX</td>
<td class="bits">XXXX XXXX XXXX XXXX</td>
<td class="bits">XXXX <span class="option">~~</span>XX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OO</span>XX X<span class="free">O</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
<tr>
<td class="caption">road stop</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOOO O</span>XXX</td>
<td class="bits"><span class="option">~~~~ ~~~~</span></td>
<td class="bits"><span class="option">~~~~ ~</span>XXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OO</span>XX XXXX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
<tr>
<td class="caption">dock</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOOO OO</span>XX</td>
<td class="bits"><span class="option">~~~~ ~~~~</span></td>
<td class="bits"><span class="option">~~~~ ~</span>XXX</td>
<td class="bits"><span class="free">OO</span>XX X<span class="free">O</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
<tr>
<td class="caption">airport</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="option">~~~~ ~~~~</span></td>
<td>6</td>
<td class="caption">water</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OO</span>XX X<span class="free">O</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
<tr>
<td class="caption">buoy</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOOO OO</span>XX</td>
<td class="bits"><span class="option">~~~~ ~~~~</span></td>
<td class="bits"><span class="option">~~~~ ~~~~</span></td>
<td class="bits"><span class="free">OO</span>XX X<span class="free">O</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
<tr>
<td class="caption">oilrig</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="option">~~~~ ~~~~</span></td>
<td class="bits"><span class="option">~~~~ ~~~~</span></td>
<td class="bits"><span class="free">OO</span>XX X<span class="free">O</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
<tr>
<td rowspan=3>6</td>
<td class="caption">sea, shore</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="option">~~~</span>X XXXX</td>
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits">X<span class="option">~~</span>X XXXX</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
<tr>
<td class="caption">canal, river</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OO</span>XX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">-inherit-</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
<tr>
<td class="caption">shipdepot</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits">-inherit-</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
@@ -293,7 +203,7 @@ the array so you can quickly see what is used and what is not.
<td>8</td>
<td class="caption">industry</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">X<span class="free">OOO</span> <span class="abuse">
<td class="bits"><span class="abuse">X</span><span class="free">OO</span><span class="abuse">X
XXXX</span></td>
<td class="bits">XXXX XXXX XXXX XXXX</td>
<td class="bits">XXXX XXXX</td>
@@ -306,45 +216,35 @@ the array so you can quickly see what is used and what is not.
<td rowspan=2>9</td>
<td class="caption">tunnel entrance</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="option">~~~</span>X XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO</span> <span class="option">~</span><span class="abuse">XXX</span></td>
<td class="bits"><span class="free">OOOO</span> XXXX</td>
<td class="bits">X<span class="free">OOO OOOO</span></td>
<td class="bits">X<span class="free">OOO</span> <span class="option">~</span>XXX</td>
<td class="bits">X<span class="free">OOO</span> XXXX</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
<tr>
<td>bridge ramp</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOOO OOOO</span> XXXX <span class="free">OOOO</span></td>
<td class="bits"><span class="free">OOOO</span> <span class="option">~</span><span class="abuse">XXX</span></td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OOOO OOOO</span> <span class="abuse">XXXX</span>
<span class="free">OOOO</span></td>
<td class="bits"><span class="free">OOOO</span> XXXX</td>
<td class="bits">X<span class="free">OOO OOOO</span></td>
<td class="bits">X<span class="free">OOO</span> <span class="option">~</span>XXX</td>
<td class="bits">X<span class="free">OOO</span> XXXX</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
<tr>
<td rowspan=2>A</td>
<td>A</td>
<td class="caption">unmovables</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="option">~~~</span>X XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits">X<span class="option">~~</span>X XXXX</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
<tr>
<td class="caption">company statue</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits">XXXX XXXX XXXX XXXX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits">-inherit-</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>

View File

@@ -11,26 +11,18 @@ by the number below on http://bugs.openttd.org.
If the bug report is closed, it has been fixed, which then can be verified
in the latest SVN version of /trunk.
Bugs for 0.6.1
Bugs for 0.6.0-beta3
------------------------------------------------------------------------
URL: http://bugs.openttd.org
- 1944 Road vehicles not picking empty drivethrough platform
- 1923 Unique names not always enforced
- 1891 Go to depot for servicing is forgotten
- 1890 Airplanes copy helipcopters goto heliport order
- 1885 Almost all unserved industries die in big maps
- 1868 In depot, cannot move wagon from another line before first wagon in a wagon-only line
- 1858 Industry legend in small map overwrites buttons
- 1852 Minor tram reversing glitches
- 1802 Path with space in configure fails
- 1793 Inconsistent travel time for fast trains
- 1762 Strange Autoreplace behaviour
- 1752 User input is not checked
- 1693 Removing road does not reset owner
- 1624 Autoreplace refit fails -> crash
- 1549 Timetable + group ID are not backed up with orders
- 1495 Long vehicles block multistop station
- 1487 Ending_year is never written to
- 1473 Train not going to available platform
- 1404 Spinner widget interprets one click as many
- 1264 Autoreplace for multiple NewGRF DMU sets fails
- 1140 [OSX] Not smooth moving map with touchpad
- 1074 Large slowdown when building tracks
- 1072 Text overflows in several windows
- 119 Clipping problems with vehicles on slopes

View File

@@ -1,38 +1,8 @@
openttd (0.6.1~RC2) unstable; urgency=low
openttd (0.6~svn) unstable; urgency=low
* New upstream release.
* Unreleased SVN version. Versioned to allow normal upgrades to released versions.
-- Matthijs Kooijman <m.kooijman@student.utwente.nl> Wed, 21 May 2008 00:05:00 +0200
openttd (0.6.1~RC1) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <m.kooijman@student.utwente.nl> Sat, 26 Apr 2008 22:55:00 +0200
openttd (0.6.0) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <m.kooijman@student.utwente.nl> Tue, 01 Apr 2008 13:33:37 +0100
openttd (0.6.0~RC1) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <m.kooijman@student.utwente.nl> Wed, 26 Mar 2008 15:51:40 +0100
openttd (0.6.0~beta5-1) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <m.kooijman@student.utwente.nl> Mon, 04 Mar 2008 18:06:31 +0100
openttd (0.6.0~beta4-1) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <m.kooijman@student.utwente.nl> Mon, 18 Feb 2008 20:09:29 +0100
-- Matthijs Kooijman <m.kooijman@student.utwente.nl> Mon, 26 Feb 2007 21:07:05 +0100
openttd (0.6.0~beta3-1) unstable; urgency=low

View File

@@ -19,7 +19,7 @@ echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>OpenTTD</string>
<string>Open Transport Tycoon</string>
<key>CFBundleExecutable</key>
<string>openttd</string>
<key>CFBundleGetInfoString</key>

9
os/mandrake/README.urpmi Normal file
View File

@@ -0,0 +1,9 @@
You require the data files of the original Transport Tycoon Deluxe
for Windows to play the game. You have to manually copy the following
files to %{_gamesdatadir}/openttd/data/
sample.cat
trg1r.grf
trgcr.grf
trghr.grf
trgir.grf
trgtr.grf

146
os/mandrake/openttd.spec Normal file
View File

@@ -0,0 +1,146 @@
#------------------------------------------------------------------------------
# openttd.spec
# This SPEC file controls the building of custom OpenTTD RPM
# packages.
#------------------------------------------------------------------------------
%define name openttd
%define version 0.5.0
%define release 1mdk
#------------------------------------------------------------------------------
# Prologue information
#------------------------------------------------------------------------------
Name: %{name}
Version: %{version}
Release: %{release}
Summary: An open source clone of the Microprose game "Transport Tycoon Deluxe"
Group: Games/Strategy
License: GPL
URL: http://www.openttd.org
Source: %{name}-%{version}.tar.gz
Packager: Dominik Scherer <dominik@openttd.com>
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires: libSDL1.2-devel >= 1.2.7
BuildRequires: libpng3-devel >= 1.2.5
BuildRequires: zlib1-devel >= 1.2.1
#------------------------------------------------------------------------------
# Description
#------------------------------------------------------------------------------
%description
An enhanced open source clone of the Microprose game "Transport Tycoon Deluxe".
You require the data files of the original Transport Tycoon Deluxe
for Windows to play the game. You have to MANUALLY copy them to the
game data directory!
#------------------------------------------------------------------------------
# install scripts
#------------------------------------------------------------------------------
%prep
rm -rf $RPM_BUILD_ROOT
%setup
%build
make BINARY_DIR=%{_gamesbindir} PREFIX=%{_gamesdatadir} DATA_DIR=openttd INSTALL_DIR=%{_gamesdatadir}/openttd/ USE_HOMEDIR=1 PERSONAL_DIR=.openttd INSTALL=1 RELEASE=%{version}
%install
mkdir -p $RPM_BUILD_ROOT%{_gamesbindir}
mkdir -p $RPM_BUILD_ROOT%{_gamesdatadir}/openttd/lang
mkdir -p $RPM_BUILD_ROOT%{_gamesdatadir}/openttd/data
mkdir -p $RPM_BUILD_ROOT%{_gamesdatadir}/openttd/scenario
cp ./openttd $RPM_BUILD_ROOT%{_gamesbindir}/
cp -r ./lang/*.lng $RPM_BUILD_ROOT%{_gamesdatadir}/openttd/lang/
cp -r ./data/*.grf $RPM_BUILD_ROOT%{_gamesdatadir}/openttd/data/
cp -r ./scenario/*.scn $RPM_BUILD_ROOT%{_gamesdatadir}/openttd/scenario/
cp -r ./data/opntitle.dat $RPM_BUILD_ROOT%{_gamesdatadir}/openttd/data/
# icon
install -m644 media/openttd.32.png -D $RPM_BUILD_ROOT%{_miconsdir}/%{name}.png
install -m644 media/openttd.64.png -D $RPM_BUILD_ROOT%{_iconsdir}/%{name}.png
install -m644 media/openttd.128.png -D $RPM_BUILD_ROOT%{_liconsdir}/%{name}.png
# menu entry
mkdir -p $RPM_BUILD_ROOT/%{_menudir}
cat << EOF > $RPM_BUILD_ROOT/%{_menudir}/%{name}
?package(%{name}):command="%{_gamesbindir}/openttd" icon="%{name}.png" \
needs="X11" section="Amusement/Strategy" title="OpenTTD" \
longtitle="%{Summary}"
EOF
%clean
rm -rf $RPM_BUILD_ROOT
%post
%{update_menus}
%postun
%{clean_menus}
#------------------------------------------------------------------------------
# Files listing.
#------------------------------------------------------------------------------
%files
%defattr(-,root,root,0755)
%{_gamesbindir}/openttd
%{_gamesdatadir}/openttd/lang/american.lng
%{_gamesdatadir}/openttd/lang/catalan.lng
%{_gamesdatadir}/openttd/lang/czech.lng
%{_gamesdatadir}/openttd/lang/danish.lng
%{_gamesdatadir}/openttd/lang/dutch.lng
%{_gamesdatadir}/openttd/lang/english.lng
%{_gamesdatadir}/openttd/lang/finnish.lng
%{_gamesdatadir}/openttd/lang/french.lng
%{_gamesdatadir}/openttd/lang/galician.lng
%{_gamesdatadir}/openttd/lang/german.lng
%{_gamesdatadir}/openttd/lang/hungarian.lng
%{_gamesdatadir}/openttd/lang/icelandic.lng
%{_gamesdatadir}/openttd/lang/italian.lng
%{_gamesdatadir}/openttd/lang/norwegian.lng
%{_gamesdatadir}/openttd/lang/origveh.lng
%{_gamesdatadir}/openttd/lang/polish.lng
%{_gamesdatadir}/openttd/lang/portuguese.lng
%{_gamesdatadir}/openttd/lang/romanian.lng
%{_gamesdatadir}/openttd/lang/slovak.lng
%{_gamesdatadir}/openttd/lang/spanish.lng
%{_gamesdatadir}/openttd/lang/swedish.lng
%{_gamesdatadir}/openttd/data/autorail.grf
%{_gamesdatadir}/openttd/data/canalsw.grf
%{_gamesdatadir}/openttd/data/openttd.grf
%{_gamesdatadir}/openttd/data/opntitle.dat
%{_gamesdatadir}/openttd/data/signalsw.grf
%{_gamesdatadir}/openttd/data/trkfoundw.grf
"%{_gamesdatadir}/openttd/scenario/Linkgame Islands 2004.scn"
"%{_gamesdatadir}/openttd/scenario/Mountain Pass.scn"
"%{_gamesdatadir}/openttd/scenario/Volcano City.scn"
%{_menudir}/%{name}
%{_iconsdir}/*.png
%{_miconsdir}/*.png
%{_liconsdir}/*.png
%doc changelog.txt readme.txt COPYING os/linux/README.urpmi
#------------------------------------------------------------------------------
# Change Log
#------------------------------------------------------------------------------
%changelog
* Sun Jan 23 2005 Dominik Scherer <dominik@openttd.com> 0.3.6-1mdk
- Upgraded to 0.3.6
- Structured and commented the spec file a bit (inspired by ScummVM)
* Fri Dec 24 2004 Dominik Scherer <dominik@openttd.com> 0.3.5-1mdk
- Upgraded to 0.3.5
- Added a warning message about the additional required files (only displayed when installing via urpmi)
* Wed Sep 15 2004 Dominik Scherer <> 0.3.4-1mdk
- Upgraded to 0.3.4
* Wed Jul 31 2004 Dominik Scherer <> 0.3.3-1mdk
- Initial release

View File

@@ -1,75 +0,0 @@
#
# spec file for package openttd (trunk)
#
# Copyright (c) 2007 The OpenTTD team.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself
#
Name: openttd
Version: svn
Release: head
Group: Applications/Games
Source: %{name}-%{version}-%{release}.tar.gz
License: GPL
URL: http://www.openttd.org
Packager: Denis Burlaka <burlaka@yandex.ru>
Summary: OpenTTD is an Open Source clone of Chris Sawyer's Transport Tycoon Deluxe
Requires: SDL zlib libpng freetype2 fontconfig
BuildRequires: gcc SDL-devel zlib-devel libpng-devel fontconfig-devel
%if %{_vendor}=="suse"
BuildRequires: freetype2-devel
%endif
%if %{_vendor}=="fedora"
BuildRequires: freetype-devel
%endif
%if %{_vendor}=="mandriva"
BuildRequires: libfreetype6-devel
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: /usr
%description
OpenTTD is a clone of the Microprose game "Transport Tycoon Deluxe", a popular game originally written by Chris Sawyer. It attempts to mimic the original game as closely as possible while extending it with new features.
OpenTTD is licensed under the GNU General Public License version 2.0. For more information, see the file 'COPYING' included with every release and source download of the game.
%prep
%setup
%build
./configure --prefix-dir=%{prefix} --binary-dir=bin --install-dir="$RPM_BUILD_ROOT"
make
%install
make ROOT="$RPM_BUILD_ROOT" install
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/applications
cat << EOF > $RPM_BUILD_ROOT/%{_datadir}/applications/%{name}.desktop
[Desktop Entry]
Categories=Games;
Encoding=UTF-8
Exec=/usr/bin/openttd
Name=OpenTTD
Icon=openttd.32
Terminal=false
Type=Application
EOF
%clean
rm -Rf "$RPM_BUILD_ROOT"
%files
%dir %{_datadir}/games/%{name}
%dir %{_datadir}/games/%{name}/lang
%dir %{_datadir}/games/%{name}/data
%dir %{_datadir}/games/%{name}/gm
%dir %{_datadir}/games/%{name}/docs
%dir %{_datadir}/pixmaps
%defattr(644, root, games, 755)
%attr(755, root, games) %{_bindir}/%{name}
%{_datadir}/games/%{name}/lang/*
%{_datadir}/games/%{name}/data/*
%{_datadir}/games/%{name}/docs/*
%{_datadir}/pixmaps/*
%{_datadir}/applications/%{name}.desktop

BIN
os/suse/openttd.spec Normal file

Binary file not shown.

View File

@@ -1,9 +1,9 @@
!define APPNAME "OpenTTD" ; Define application name
!define APPVERSION "0.6.1" ; Define application version
!define INSTALLERVERSION 47 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
!define APPVERSION "0.6.0" ; Define application version
!define INSTALLERVERSION 41 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
!define APPURLLINK "http://www.openttd.org"
!define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}"
!define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}-beta3"
!define APPVERSIONINTERNAL "${APPVERSION}.0" ; Needs to be of the format X.X.X.X
!define MUI_ICON "..\..\..\media\openttd.ico"
@@ -97,6 +97,8 @@ Section "!OpenTTD" Section1
; Overwrite files by default, but don't complain on failure
SetOverwrite try
; Make savegame folder
SetOutPath "$INSTDIR\save"
; Define root variable relative to installer
!define PATH_ROOT "..\..\..\"

83
projects/determineversion.vbs Executable file → Normal file
View File

@@ -53,43 +53,6 @@ Sub UpdateFiles(version)
UpdateFile revision, version, cur_date, "../src/ottdres.rc"
End Sub
Function ReadRegistryKey(shive, subkey, valuename, architecture)
Dim hiveKey, objCtx, objLocator, objServices, objReg, Inparams, Outparams
' First, get the Registry Provider for the requested architecture
Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
objCtx.Add "__ProviderArchitecture", architecture ' Must be 64 of 32
Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
Set objServices = objLocator.ConnectServer("","root\default","","",,,,objCtx)
Set objReg = objServices.Get("StdRegProv")
' Check the hive and give it the right value
Select Case shive
Case "HKCR", "HKEY_CLASSES_ROOT"
hiveKey = &h80000000
Case "HKCU", "HKEY_CURRENT_USER"
hiveKey = &H80000001
Case "HKLM", "HKEY_LOCAL_MACHINE"
hiveKey = &h80000002
Case "HKU", "HKEY_USERS"
hiveKey = &h80000003
Case "HKCC", "HKEY_CURRENT_CONFIG"
hiveKey = &h80000005
Case "HKDD", "HKEY_DYN_DATA" ' Only valid for Windows 95/98
hiveKey = &h80000006
Case Else
MsgBox "Hive not valid (ReadRegistryKey)"
End Select
Set Inparams = objReg.Methods_("GetStringValue").Inparameters
Inparams.Hdefkey = hiveKey
Inparams.Ssubkeyname = subkey
Inparams.Svaluename = valuename
Set Outparams = objReg.ExecMethod_("GetStringValue", Inparams,,objCtx)
ReadRegistryKey = Outparams.SValue
End Function
Function DetermineSVNVersion()
Dim WshShell, version, url, oExec, line
Set WshShell = CreateObject("WScript.Shell")
@@ -98,35 +61,27 @@ Function DetermineSVNVersion()
' Try TortoiseSVN
' Get the directory where TortoiseSVN (should) reside(s)
Dim sTortoise
' First, try with 32-bit architecture
sTortoise = ReadRegistryKey("HKLM", "SOFTWARE\TortoiseSVN", "Directory", 32)
If sTortoise = Nothing Then
' No 32-bit version of TortoiseSVN installed, try 64-bit version (doesn't hurt on 32-bit machines, it returns nothing or is ignored)
sTortoise = ReadRegistryKey("HKLM", "SOFTWARE\TortoiseSVN", "Directory", 64)
End If
sTortoise = WshShell.RegRead("HKLM\SOFTWARE\TortoiseSVN\Directory")
' If TortoiseSVN is installed, try to get the revision number
If sTortoise <> Nothing Then
Dim file
' Write some "magic" to a temporary file so we can acquire the svn revision/state
Set file = FSO.CreateTextFile("tsvn_tmp", -1, 0)
file.WriteLine "r$WCREV$$WCMODS?M:$"
file.WriteLine "$WCURL$"
file.Close
Set oExec = WshShell.Exec(sTortoise & "\bin\SubWCRev.exe ../src tsvn_tmp tsvn_tmp")
' Wait till the application is finished ...
Do
OExec.StdOut.ReadLine()
Loop While Not OExec.StdOut.atEndOfStream
Dim file
' Write some "magic" to a temporary file so we can acquire the svn revision/state
Set file = FSO.CreateTextFile("tsvn_tmp", -1, 0)
file.WriteLine "r$WCREV$$WCMODS?M:$"
file.WriteLine "$WCURL$"
file.Close
Set oExec = WshShell.Exec(sTortoise & "\bin\SubWCRev.exe ../src tsvn_tmp tsvn_tmp")
' Wait till the application is finished ...
Do
OExec.StdOut.ReadLine()
Loop While Not OExec.StdOut.atEndOfStream
Set file = FSO.OpenTextFile("tsvn_tmp", 1, 0, 0)
version = file.ReadLine
url = file.ReadLine
file.Close
Set file = FSO.OpenTextFile("tsvn_tmp", 1, 0, 0)
version = file.ReadLine
url = file.ReadLine
file.Close
Set file = FSO.GetFile("tsvn_tmp")
file.Delete
End If
Set file = FSO.GetFile("tsvn_tmp")
file.Delete
' Looks like there is no TortoiseSVN installed either. Then we don't know it.
If InStr(version, "$") Then
@@ -239,7 +194,7 @@ Function IsCachedVersion(version)
End Function
Dim version
version = "0.6.1-RC2"
version = "0.6.0-beta3"
If Not (IsCachedVersion(version) And FSO.FileExists("../src/rev.cpp") And FSO.FileExists("../src/ottdres.rc")) Then
UpdateFiles version
End If

View File

@@ -25,6 +25,13 @@ fi
# langs_vs80.vcproj is for MSVC 2005
# strgen_vs80.vcproj is for MSVC 2005
# openttd.sln is for MSVC 2003
# openttd.vcproj is for MSVC 2003
# langs.vcproj is for MSVC 2003
# strgen.vcproj is for MSVC 2003
# openttd.tgt is for WatCom
# First, collect the list of Windows files
@@ -103,7 +110,7 @@ load_main_data() {
print " <Filter";
print " Name=\\""$0"\\"";
print " >";
print " Filter=\\"\\">";
}
next;
@@ -114,8 +121,7 @@ load_main_data() {
gsub(" ", "", $0);
gsub("/", "\\\\", $0);
print " <File";
print " RelativePath=\\".\\\\'$file_prefix'"$0"\\"";
print " >";
print " RelativePath=\\".\\\\'$file_prefix'"$0"\\">";
print " </File>";
}
}
@@ -132,18 +138,15 @@ load_lang_data() {
i=`basename $i | sed s/.txt$//g`
RES="$RES
<File
RelativePath=\"..\\src\\lang\\"$i".txt\"
>
RelativePath=\"..\\src\\lang\\"$i".txt\">
<FileConfiguration
Name=\"Debug|Win32\"
>
Name=\"Debug|Win32\">
<Tool
Name=\"VCCustomBuildTool\"
Description=\"Generating "$i" language file\"
CommandLine=\"..\\objs\\strgen\\strgen.exe -s ..\\src\\lang -d ..\\bin\\lang &quot;\$(InputPath)&quot;&#x0D;&#x0A;\"
AdditionalDependencies=\"\"
Outputs=\"..\\bin\\lang\\"$i".lng\"
/>
Outputs=\"..\\bin\\lang\\"$i".lng\"/>
</FileConfiguration>
</File>"
done
@@ -162,7 +165,22 @@ generate() {
}
' > "$ROOT_DIR/projects/$2"
echo "$1" >> "$ROOT_DIR/projects/$2"
# The files-list
echo "$1" | awk -v type="$3" '
/&#x0D;&#x0A;/ {
if (type == "msvc2003") gsub("&#x0D;&#x0A;", "\n", $0);
}
/Filter="">/ {
if (type == "msvc2005") gsub("Filter=\"\">", ">", $0);
}
/"\/>/ {
if (type == "msvc2005") gsub("/>", "\n" substr($0, 1, index($0, $1) - 2) "/>", $0);
}
/">/ {
if (type == "msvc2005") gsub(">", "\n" substr($0, 1, index($0, $1) - 1) ">", $0);
}
{ print $0 }
' >> "$ROOT_DIR/projects/$2"
# Everything below the !!FILES!! marker
cat "$ROOT_DIR/projects/$2".in | tr '\r' '\n' | awk '
@@ -181,7 +199,9 @@ safety_check "$ROOT_DIR/source.list"
load_main_data "$ROOT_DIR/source.list" openttd
load_lang_data "$ROOT_DIR/src/lang/*.txt" lang
generate "$openttd" "openttd_vs80.vcproj"
generate "$openttd" "openttd_vs90.vcproj"
generate "$lang" "langs_vs80.vcproj"
generate "$lang" "langs_vs90.vcproj"
generate "$openttd" "openttd.vcproj" "msvc2003"
generate "$openttd" "openttd_vs80.vcproj" "msvc2005"
generate "$openttd" "openttd_vs90.vcproj" "msvc2005"
generate "$lang" "langs.vcproj" "msvc2003"
generate "$lang" "langs_vs80.vcproj" "msvc2005"
generate "$lang" "langs_vs90.vcproj" "msvc2005"

View File

@@ -1,183 +0,0 @@
Option Explicit
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
' openttd_vs90.sln is for MSVC 2008
' openttd_vs90.vcproj is for MSVC 2008
' langs_vs90.vcproj is for MSVC 2008
' strgen_vs90.vcproj is for MSVC 2008
' openttd_vs80.sln is for MSVC 2005
' openttd_vs80.vcproj is for MSVC 2005
' langs_vs80.vcproj is for MSVC 2005
' strgen_vs80.vcproj is for MSVC 2005
Sub safety_check(filename)
Dim file, line, regexp, list
' Define regexp
Set regexp = New RegExp
regexp.Pattern = "#|ottdres.rc|win32.cpp|win32_v.cpp"
regexp.Global = True
' We use a dictionary to check duplicates
Set list = CreateObject("Scripting.Dictionary")
Set file = FSO.OpenTextFile(filename, 1, 0, 0)
While Not file.AtEndOfStream
line = Replace(file.ReadLine, Chr(9), "") ' Remove tabs
If Len(line) > 0 And Not regexp.Test(line) Then
line = FSO.GetFileName(line)
if list.Exists(line) Then
WScript.Echo " !! ERROR !!" _
& vbCrLf & "" _
& vbCrLf & "The filename '" & line & "' is already used in this project." _
& vbCrLf & "Because MSVC uses one single directory for all object files, it" _
& vbCrLf & "cannot handle filenames with the same name inside the same project." _
& vbCrLf & "Please rename either one of the file and try generating again." _
& vbCrLf & "" _
& vbCrLf & " !! ERROR !!"
WScript.Quit(1)
End If
list.Add line, line
End If
Wend
file.Close
End Sub
Function load_main_data(filename)
Dim res, file, line, deep, skip, first_time
res = ""
' Read the source.list and process it
Set file = FSO.OpenTextFile(filename, 1, 0, 0)
While Not file.AtEndOfStream
line = Replace(file.ReadLine, Chr(9), "") ' Remove tabs
If Len(line) > 0 Then
Select Case Split(line, " ")(0)
Case "#end"
If deep = skip Then skip = skip - 1
deep = deep - 1
Case "#else"
If deep = skip Then
skip = skip - 1
ElseIf deep - 1 = skip Then
skip = skip + 1
End If
Case "#if"
line = Replace(line, "#if ", "")
If deep = skip And ( _
line = "SDL" Or _
line = "PNG" Or _
line = "WIN32" Or _
line = "MSVC" Or _
line = "DIRECTMUSIC" Or _
line = "NO_THREADS" _
) Then skip = skip + 1
deep = deep + 1
Case "#"
if deep = skip Then
line = Replace(line, "# ", "")
if first_time <> 0 Then
res = res & " </Filter>" & vbCrLf
Else
first_time = 1
End If
res = res & _
" <Filter" & vbCrLf & _
" Name=" & Chr(34) & line & Chr(34) & vbCrLf & _
" >" & vbCrLf
End If
Case Else
If deep = skip Then
line = Replace(line, "/" ,"\")
res = res & _
" <File" & vbCrLf & _
" RelativePath=" & Chr(34) & ".\..\src\" & line & Chr(34) & vbCrLf & _
" >" & vbCrLf & _
" </File>" & vbCrLf
End If
End Select
End If
Wend
res = res & " </Filter>"
file.Close()
load_main_data = res
End Function
Function load_lang_data(dir)
Dim res, folder, file
res = ""
Set folder = FSO.GetFolder(dir)
For Each file In folder.Files
file = FSO.GetFileName(file)
If FSO.GetExtensionName(file) = "txt" Then
file = Left(file, Len(file) - 4)
res = res _
& vbCrLf & " <File" _
& vbCrLf & " RelativePath=" & Chr(34) & "..\src\lang\" & file & ".txt" & Chr(34) _
& vbCrLf & " >" _
& vbCrLf & " <FileConfiguration" _
& vbCrLf & " Name=" & Chr(34) & "Debug|Win32" & Chr(34) _
& vbCrLf & " >" _
& vbCrLf & " <Tool" _
& vbCrLf & " Name=" & Chr(34) & "VCCustomBuildTool" & Chr(34) _
& vbCrLf & " Description=" & Chr(34) & "Generating " & file & " language file" & Chr(34) _
& vbCrLf & " CommandLine=" & Chr(34) & "..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;" & Chr(34) _
& vbCrLf & " AdditionalDependencies=" & Chr(34) & Chr(34) _
& vbCrLf & " Outputs=" & Chr(34) & "..\bin\lang\" & file & ".lng" & Chr(34) _
& vbCrLf & " />" _
& vbCrLf & " </FileConfiguration>" _
& vbCrLf & " </File>"
End If
Next
load_lang_data = res
End Function
Sub generate(data, dest)
Dim srcfile, destfile, line
WScript.Echo "Generating " & FSO.GetFileName(dest) & "..."
Set srcfile = FSO.OpenTextFile(dest & ".in", 1, 0, 0)
Set destfile = FSO.CreateTextFile(dest, -1, 0)
' Everything above the !!FILES!! marker
line = srcfile.ReadLine()
While line <> "!!FILES!!"
If len(line) > 0 Then destfile.WriteLine(line)
line = srcfile.ReadLine()
Wend
' Our generated content
destfile.WriteLine(data)
' Everything below the !!FILES!! marker
While Not srcfile.AtEndOfStream
line = srcfile.ReadLine()
If len(line) > 0 Then destfile.WriteLine(line)
Wend
srcfile.Close()
destfile.Close()
End Sub
Dim ROOT_DIR
ROOT_DIR = FSO.GetFolder("..").Path
If Not FSO.FileExists(ROOT_DIR & "/source.list") Then
ROOT_DIR = FSO.GetFolder(".").Path
End If
If Not FSO.FileExists(ROOT_DIR & "/source.list") Then
WScript.Echo "Can't find source.list, needed in order to make this run." _
& vbCrLf & "Please go to either the project dir, or the root dir of a clean SVN checkout."
WScript.Quit(1)
End If
safety_check ROOT_DIR & "/source.list"
Dim openttd
openttd = load_main_data(ROOT_DIR &"/source.list")
generate openttd, ROOT_DIR & "/projects/openttd_vs80.vcproj"
generate openttd, ROOT_DIR & "/projects/openttd_vs90.vcproj"
Dim lang
lang = load_lang_data(ROOT_DIR & "/src/lang")
generate lang, ROOT_DIR & "/projects/langs_vs80.vcproj"
generate lang, ROOT_DIR & "/projects/langs_vs90.vcproj"

538
projects/langs.vcproj Normal file
View File

@@ -0,0 +1,538 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="langs"
ProjectGUID="{0F066B23-18DF-4284-8265-F4A5E7E3B966}"
RootNamespace="langs"
SccProjectName=""
SccLocalPath=""
Keyword="MakeFileProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="..\bin\lang\"
IntermediateDirectory="..\objs\langs\"
ConfigurationType="10"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName="./langs.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"
Description="Generating strings.h"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\objs\langs\table"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="..\src\lang\afrikaans.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating afrikaans language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\afrikaans.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\brazilian_portuguese.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating brazilian_portuguese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\brazilian_portuguese.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\bulgarian.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating bulgarian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\bulgarian.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\catalan.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating catalan language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\catalan.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\croatian.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating croatian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\croatian.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\czech.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating czech language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\czech.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\danish.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating danish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\danish.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\dutch.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating dutch language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\dutch.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\english.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating english language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\english.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\english_US.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating english_US language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\english_US.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\esperanto.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating esperanto language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\esperanto.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\estonian.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating estonian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\estonian.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\finnish.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating finnish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\finnish.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\french.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating french language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\french.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\galician.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating galician language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\galician.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\german.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating german language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\german.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\hungarian.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating hungarian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\hungarian.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\icelandic.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating icelandic language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\icelandic.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\italian.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating italian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\italian.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\japanese.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating japanese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\japanese.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\korean.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating korean language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\korean.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\lithuanian.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating lithuanian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\lithuanian.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\norwegian_bokmal.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating norwegian_bokmal language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\norwegian_bokmal.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\norwegian_nynorsk.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating norwegian_nynorsk language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\norwegian_nynorsk.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\origveh.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating origveh language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\origveh.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\piglatin.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating piglatin language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\piglatin.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\polish.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating polish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\polish.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\portuguese.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating portuguese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\portuguese.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\romanian.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating romanian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\romanian.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\russian.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating russian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\russian.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\simplified_chinese.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating simplified_chinese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\simplified_chinese.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\slovak.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating slovak language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\slovak.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\slovenian.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating slovenian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\slovenian.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\spanish.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating spanish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\spanish.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\swedish.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating swedish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\swedish.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\traditional_chinese.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating traditional_chinese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\traditional_chinese.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\turkish.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating turkish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\turkish.lng"/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\ukrainian.txt">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Generating ukrainian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;
"
AdditionalDependencies=""
Outputs="..\bin\lang\ukrainian.lng"/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

44
projects/langs.vcproj.in Normal file
View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="langs"
ProjectGUID="{0F066B23-18DF-4284-8265-F4A5E7E3B966}"
RootNamespace="langs"
SccProjectName=""
SccLocalPath=""
Keyword="MakeFileProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="..\bin\lang\"
IntermediateDirectory="..\objs\langs\"
ConfigurationType="10"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName="./langs.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"
Description="Generating strings.h"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\objs\langs\table"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
!!FILES!!
</Files>
<Globals>
</Globals>
</VisualStudioProject>

43
projects/openttd.sln Normal file
View File

@@ -0,0 +1,43 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openttd", "openttd.vcproj", "{668328A0-B40E-4CDB-BD72-D0064424414A}"
ProjectSection(ProjectDependencies) = postProject
{0F066B23-18DF-4284-8265-F4A5E7E3B966} = {0F066B23-18DF-4284-8265-F4A5E7E3B966}
{A133A442-BD0A-4ADE-B117-AD7545E4BDD1} = {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "strgen", "strgen.vcproj", "{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "langs", "langs.vcproj", "{0F066B23-18DF-4284-8265-F4A5E7E3B966}"
ProjectSection(ProjectDependencies) = postProject
{A133A442-BD0A-4ADE-B117-AD7545E4BDD1} = {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{668328A0-B40E-4CDB-BD72-D0064424414A}.Debug.ActiveCfg = Debug|Win32
{668328A0-B40E-4CDB-BD72-D0064424414A}.Debug.Build.0 = Debug|Win32
{668328A0-B40E-4CDB-BD72-D0064424414A}.Release.ActiveCfg = Release|Win32
{668328A0-B40E-4CDB-BD72-D0064424414A}.Release.Build.0 = Release|Win32
{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Debug.ActiveCfg = Release|Win32
{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Debug.Build.0 = Release|Win32
{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Release.ActiveCfg = Release|Win32
{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Release.Build.0 = Release|Win32
{0F066B23-18DF-4284-8265-F4A5E7E3B966}.Debug.ActiveCfg = Debug|Win32
{0F066B23-18DF-4284-8265-F4A5E7E3B966}.Debug.Build.0 = Debug|Win32
{0F066B23-18DF-4284-8265-F4A5E7E3B966}.Release.ActiveCfg = Debug|Win32
{0F066B23-18DF-4284-8265-F4A5E7E3B966}.Release.Build.0 = Debug|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
EndGlobalSection
EndGlobal

2667
projects/openttd.tgt Normal file

File diff suppressed because it is too large Load Diff

1426
projects/openttd.vcproj Normal file

File diff suppressed because it is too large Load Diff

177
projects/openttd.vcproj.in Normal file
View File

@@ -0,0 +1,177 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="openttd"
RootNamespace="openttd"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="..\objs\$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="..\objs\$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="1"
WholeProgramOptimization="TRUE">
<Tool
Name="VCCLCompilerTool"
Optimization="3"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="2"
OmitFramePointers="TRUE"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="..\objs\langs"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
StringPooling="TRUE"
ExceptionHandling="TRUE"
RuntimeLibrary="0"
StructMemberAlignment="3"
BufferSecurityCheck="FALSE"
EnableFunctionLevelLinking="TRUE"
DefaultCharIsUnsigned="TRUE"
UsePrecompiledHeader="0"
PrecompiledHeaderThrough=""
PrecompiledHeaderFile=""
AssemblerOutput="2"
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/$(TargetName).pdb"
BrowseInformation="1"
BrowseInformationFile="$(IntDir)/"
WarningLevel="3"
WarnAsError="TRUE"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"
CallingConvention="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="winmm.lib ws2_32.lib libpng.lib zlibstat.lib dxguid.lib libfreetype2.lib"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
OptimizeForWindows98="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/openttd.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"
Description="Determining version number"
CommandLine="&quot;$(InputDir)/determineversion.vbs&quot;"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1053"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory="..\objs\$(PlatformName)\$(ConfigurationName)\"
IntermediateDirectory="..\objs\$(PlatformName)\$(ConfigurationName)\"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="1">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\objs\langs"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/$(TargetName).pdb"
WarningLevel="3"
WarnAsError="TRUE"
SuppressStartupBanner="TRUE"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="4"
CallingConvention="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="unicows.lib winmm.lib ws2_32.lib libpng.lib zlibstat.lib dxguid.lib libfreetype2.lib"
LinkIncremental="0"
SuppressStartupBanner="TRUE"
IgnoreDefaultLibraryNames="LIBCMT.lib"
GenerateDebugInformation="TRUE"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/openttd.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"
Description="Determining version number"
CommandLine="&quot;$(InputDir)/determineversion.vbs&quot;"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1053"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
!!FILES!!
<File
RelativePath=".\..\media\mainicon.ico">
</File>
<File
RelativePath=".\..\media\openttd.ico">
</File>
<File
RelativePath=".\..\readme.txt">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -455,10 +455,6 @@
RelativePath=".\..\src\airport.cpp"
>
</File>
<File
RelativePath=".\..\src\core\alloc_func.cpp"
>
</File>
<File
RelativePath=".\..\src\articulated_vehicles.cpp"
>
@@ -471,10 +467,6 @@
RelativePath=".\..\src\aystar.cpp"
>
</File>
<File
RelativePath=".\..\src\core\bitmath_func.cpp"
>
</File>
<File
RelativePath=".\..\src\bmp.cpp"
>
@@ -503,6 +495,14 @@
RelativePath=".\..\src\console_cmds.cpp"
>
</File>
<File
RelativePath=".\..\src\core\bitmath_func.cpp"
>
</File>
<File
RelativePath=".\..\src\core\random_func.cpp"
>
</File>
<File
RelativePath=".\..\src\currency.cpp"
>
@@ -527,10 +527,6 @@
RelativePath=".\..\src\driver.cpp"
>
</File>
<File
RelativePath=".\..\src\widgets\dropdown.cpp"
>
</File>
<File
RelativePath=".\..\src\economy.cpp"
>
@@ -671,10 +667,6 @@
RelativePath=".\..\src\rail.cpp"
>
</File>
<File
RelativePath=".\..\src\core\random_func.cpp"
>
</File>
<File
RelativePath=".\..\src\rev.cpp"
>
@@ -759,6 +751,10 @@
RelativePath=".\..\src\widget.cpp"
>
</File>
<File
RelativePath=".\..\src\widgets\dropdown.cpp"
>
</File>
<File
RelativePath=".\..\src\win32.cpp"
>
@@ -783,30 +779,10 @@
RelativePath=".\..\src\airport_movement.h"
>
</File>
<File
RelativePath=".\..\src\core\alloc_func.hpp"
>
</File>
<File
RelativePath=".\..\src\articulated_vehicles.h"
>
</File>
<File
RelativePath=".\..\src\autoreplace_base.h"
>
</File>
<File
RelativePath=".\..\src\autoreplace_func.h"
>
</File>
<File
RelativePath=".\..\src\autoreplace_gui.h"
>
</File>
<File
RelativePath=".\..\src\autoreplace_type.h"
>
</File>
<File
RelativePath=".\..\src\autoslope.h"
>
@@ -815,26 +791,10 @@
RelativePath=".\..\src\aystar.h"
>
</File>
<File
RelativePath=".\..\src\core\bitmath_func.hpp"
>
</File>
<File
RelativePath=".\..\src\bmp.h"
>
</File>
<File
RelativePath=".\..\src\bridge.h"
>
</File>
<File
RelativePath=".\..\src\callback_table.h"
>
</File>
<File
RelativePath=".\..\src\cargo_type.h"
>
</File>
<File
RelativePath=".\..\src\cargopacket.h"
>
@@ -844,31 +804,31 @@
>
</File>
<File
RelativePath=".\..\src\cmd_helper.h"
>
</File>
<File
RelativePath=".\..\src\command_func.h"
>
</File>
<File
RelativePath=".\..\src\command_type.h"
RelativePath=".\..\src\command.h"
>
</File>
<File
RelativePath=".\..\src\console.h"
>
</File>
<File
RelativePath=".\..\src\core\bitmath_func.hpp"
>
</File>
<File
RelativePath=".\..\src\core\math_func.hpp"
>
</File>
<File
RelativePath=".\..\src\core\random_func.hpp"
>
</File>
<File
RelativePath=".\..\src\currency.h"
>
</File>
<File
RelativePath=".\..\src\date_func.h"
>
</File>
<File
RelativePath=".\..\src\date_type.h"
RelativePath=".\..\src\date.h"
>
</File>
<File
@@ -884,11 +844,7 @@
>
</File>
<File
RelativePath=".\..\src\direction_func.h"
>
</File>
<File
RelativePath=".\..\src\direction_type.h"
RelativePath=".\..\src\direction.h"
>
</File>
<File
@@ -900,33 +856,13 @@
>
</File>
<File
RelativePath=".\..\src\widgets\dropdown_func.h"
>
</File>
<File
RelativePath=".\..\src\widgets\dropdown_type.h"
>
</File>
<File
RelativePath=".\..\src\economy_func.h"
>
</File>
<File
RelativePath=".\..\src\economy_type.h"
>
</File>
<File
RelativePath=".\..\src\core\endian_func.hpp"
RelativePath=".\..\src\economy.h"
>
</File>
<File
RelativePath=".\..\src\engine.h"
>
</File>
<File
RelativePath=".\..\src\core\enum_type.hpp"
>
</File>
<File
RelativePath=".\..\src\fileio.h"
>
@@ -948,15 +884,7 @@
>
</File>
<File
RelativePath=".\..\src\core\geometry_type.hpp"
>
</File>
<File
RelativePath=".\..\src\gfx_func.h"
>
</File>
<File
RelativePath=".\..\src\gfx_type.h"
RelativePath=".\..\src\gfx.h"
>
</File>
<File
@@ -967,10 +895,6 @@
RelativePath=".\..\src\group.h"
>
</File>
<File
RelativePath=".\..\src\group_gui.h"
>
</File>
<File
RelativePath=".\..\src\gui.h"
>
@@ -983,10 +907,6 @@
RelativePath=".\..\src\industry.h"
>
</File>
<File
RelativePath=".\..\src\industry_type.h"
>
</File>
<File
RelativePath=".\..\src\landscape.h"
>
@@ -996,7 +916,7 @@
>
</File>
<File
RelativePath=".\..\src\core\math_func.hpp"
RelativePath=".\..\src\map.h"
>
</File>
<File
@@ -1031,10 +951,6 @@
RelativePath=".\..\src\network\network_gui.h"
>
</File>
<File
RelativePath=".\..\src\network\network_internal.h"
>
</File>
<File
RelativePath=".\..\src\network\network_server.h"
>
@@ -1071,10 +987,6 @@
RelativePath=".\..\src\newgrf_engine.h"
>
</File>
<File
RelativePath=".\..\src\newgrf_generic.h"
>
</File>
<File
RelativePath=".\..\src\newgrf_house.h"
>
@@ -1143,38 +1055,18 @@
RelativePath=".\..\src\openttd.h"
>
</File>
<File
RelativePath=".\..\src\order.h"
>
</File>
<File
RelativePath=".\..\src\core\overflowsafe_type.hpp"
>
</File>
<File
RelativePath=".\..\src\pathfind.h"
>
</File>
<File
RelativePath=".\..\src\player_base.h"
RelativePath=".\..\src\player.h"
>
</File>
<File
RelativePath=".\..\src\player_face.h"
>
</File>
<File
RelativePath=".\..\src\player_func.h"
>
</File>
<File
RelativePath=".\..\src\player_gui.h"
>
</File>
<File
RelativePath=".\..\src\player_type.h"
>
</File>
<File
RelativePath=".\..\src\queue.h"
>
@@ -1183,42 +1075,10 @@
RelativePath=".\..\src\rail.h"
>
</File>
<File
RelativePath=".\..\src\rail_gui.h"
>
</File>
<File
RelativePath=".\..\src\rail_type.h"
>
</File>
<File
RelativePath=".\..\src\core\random_func.hpp"
>
</File>
<File
RelativePath=".\..\src\road_cmd.h"
>
</File>
<File
RelativePath=".\..\src\road_func.h"
>
</File>
<File
RelativePath=".\..\src\road_gui.h"
>
</File>
<File
RelativePath=".\..\src\road_internal.h"
>
</File>
<File
RelativePath=".\..\src\road_type.h"
>
</File>
<File
RelativePath=".\..\src\roadveh.h"
>
</File>
<File
RelativePath=".\..\src\saveload.h"
>
@@ -1236,23 +1096,7 @@
>
</File>
<File
RelativePath=".\..\src\settings_func.h"
>
</File>
<File
RelativePath=".\..\src\settings_internal.h"
>
</File>
<File
RelativePath=".\..\src\settings_type.h"
>
</File>
<File
RelativePath=".\..\src\ship.h"
>
</File>
<File
RelativePath=".\..\src\signal_func.h"
RelativePath=".\..\src\settings.h"
>
</File>
<File
@@ -1260,19 +1104,15 @@
>
</File>
<File
RelativePath=".\..\src\slope_func.h"
RelativePath=".\..\src\signal_func.h"
>
</File>
<File
RelativePath=".\..\src\slope_type.h"
RelativePath=".\..\src\slope.h"
>
</File>
<File
RelativePath=".\..\src\sound_func.h"
>
</File>
<File
RelativePath=".\..\src\sound_type.h"
RelativePath=".\..\src\sound.h"
>
</File>
<File
@@ -1296,27 +1136,7 @@
>
</File>
<File
RelativePath=".\..\src\string_func.h"
>
</File>
<File
RelativePath=".\..\src\string_type.h"
>
</File>
<File
RelativePath=".\..\src\strings_func.h"
>
</File>
<File
RelativePath=".\..\src\strings_type.h"
>
</File>
<File
RelativePath=".\..\src\terraform_gui.h"
>
</File>
<File
RelativePath=".\..\src\textbuf_gui.h"
RelativePath=".\..\src\string.h"
>
</File>
<File
@@ -1332,11 +1152,7 @@
>
</File>
<File
RelativePath=".\..\src\tile_cmd.h"
>
</File>
<File
RelativePath=".\..\src\tile_type.h"
RelativePath=".\..\src\tile.h"
>
</File>
<File
@@ -1347,18 +1163,6 @@
RelativePath=".\..\src\town.h"
>
</File>
<File
RelativePath=".\..\src\town_type.h"
>
</File>
<File
RelativePath=".\..\src\track_func.h"
>
</File>
<File
RelativePath=".\..\src\track_type.h"
>
</File>
<File
RelativePath=".\..\src\train.h"
>
@@ -1371,24 +1175,12 @@
RelativePath=".\..\src\transparency_gui.h"
>
</File>
<File
RelativePath=".\..\src\tunnelbridge.h"
>
</File>
<File
RelativePath=".\..\src\unmovable.h"
>
</File>
<File
RelativePath=".\..\src\variables.h"
>
</File>
<File
RelativePath=".\..\src\vehicle_base.h"
>
</File>
<File
RelativePath=".\..\src\vehicle_func.h"
RelativePath=".\..\src\vehicle.h"
>
</File>
<File
@@ -1396,7 +1188,7 @@
>
</File>
<File
RelativePath=".\..\src\vehicle_type.h"
RelativePath=".\..\src\viewport.h"
>
</File>
<File
@@ -1416,23 +1208,23 @@
>
</File>
<File
RelativePath=".\..\src\window_func.h"
RelativePath=".\..\src\window.h"
>
</File>
<File
RelativePath=".\..\src\window_gui.h"
RelativePath=".\..\src\widgets\dropdown.h"
>
</File>
<File
RelativePath=".\..\src\window_type.h"
RelativePath=".\..\src\widgets\dropdown_type.h"
>
</File>
<File
RelativePath=".\..\src\zoom_func.h"
RelativePath=".\..\src\widgets\dropdown_func.h"
>
</File>
<File
RelativePath=".\..\src\zoom_type.h"
RelativePath=".\..\src\zoom.hpp"
>
</File>
</Filter>
@@ -1732,7 +1524,7 @@
>
</File>
<File
RelativePath=".\..\src\table\roadveh_movement.h"
RelativePath=".\..\src\table\roadveh.h"
>
</File>
<File
@@ -1951,10 +1743,6 @@
RelativePath=".\..\src\newgrf_engine.cpp"
>
</File>
<File
RelativePath=".\..\src\newgrf_generic.cpp"
>
</File>
<File
RelativePath=".\..\src\newgrf_house.cpp"
>
@@ -2031,10 +1819,6 @@
RelativePath=".\..\src\station_map.h"
>
</File>
<File
RelativePath=".\..\src\tile_map.h"
>
</File>
<File
RelativePath=".\..\src\town_map.h"
>
@@ -2075,6 +1859,14 @@
RelativePath=".\..\src\misc\array.hpp"
>
</File>
<File
RelativePath=".\..\src\misc\autocopyptr.hpp"
>
</File>
<File
RelativePath=".\..\src\misc\autoptr.hpp"
>
</File>
<File
RelativePath=".\..\src\misc\binaryheap.hpp"
>
@@ -2167,6 +1959,10 @@
<Filter
Name="YAPF"
>
<File
RelativePath=".\..\src\yapf\follow_track.cpp"
>
</File>
<File
RelativePath=".\..\src\yapf\follow_track.hpp"
>
@@ -2191,6 +1987,10 @@
RelativePath=".\..\src\yapf\yapf_base.hpp"
>
</File>
<File
RelativePath=".\..\src\yapf\yapf_common.cpp"
>
</File>
<File
RelativePath=".\..\src\yapf\yapf_common.hpp"
>

View File

@@ -452,10 +452,6 @@
RelativePath=".\..\src\airport.cpp"
>
</File>
<File
RelativePath=".\..\src\core\alloc_func.cpp"
>
</File>
<File
RelativePath=".\..\src\articulated_vehicles.cpp"
>
@@ -468,10 +464,6 @@
RelativePath=".\..\src\aystar.cpp"
>
</File>
<File
RelativePath=".\..\src\core\bitmath_func.cpp"
>
</File>
<File
RelativePath=".\..\src\bmp.cpp"
>
@@ -500,6 +492,14 @@
RelativePath=".\..\src\console_cmds.cpp"
>
</File>
<File
RelativePath=".\..\src\core\bitmath_func.cpp"
>
</File>
<File
RelativePath=".\..\src\core\random_func.cpp"
>
</File>
<File
RelativePath=".\..\src\currency.cpp"
>
@@ -524,10 +524,6 @@
RelativePath=".\..\src\driver.cpp"
>
</File>
<File
RelativePath=".\..\src\widgets\dropdown.cpp"
>
</File>
<File
RelativePath=".\..\src\economy.cpp"
>
@@ -668,10 +664,6 @@
RelativePath=".\..\src\rail.cpp"
>
</File>
<File
RelativePath=".\..\src\core\random_func.cpp"
>
</File>
<File
RelativePath=".\..\src\rev.cpp"
>
@@ -756,6 +748,10 @@
RelativePath=".\..\src\widget.cpp"
>
</File>
<File
RelativePath=".\..\src\widgets\dropdown.cpp"
>
</File>
<File
RelativePath=".\..\src\win32.cpp"
>
@@ -780,30 +776,10 @@
RelativePath=".\..\src\airport_movement.h"
>
</File>
<File
RelativePath=".\..\src\core\alloc_func.hpp"
>
</File>
<File
RelativePath=".\..\src\articulated_vehicles.h"
>
</File>
<File
RelativePath=".\..\src\autoreplace_base.h"
>
</File>
<File
RelativePath=".\..\src\autoreplace_func.h"
>
</File>
<File
RelativePath=".\..\src\autoreplace_gui.h"
>
</File>
<File
RelativePath=".\..\src\autoreplace_type.h"
>
</File>
<File
RelativePath=".\..\src\autoslope.h"
>
@@ -812,26 +788,10 @@
RelativePath=".\..\src\aystar.h"
>
</File>
<File
RelativePath=".\..\src\core\bitmath_func.hpp"
>
</File>
<File
RelativePath=".\..\src\bmp.h"
>
</File>
<File
RelativePath=".\..\src\bridge.h"
>
</File>
<File
RelativePath=".\..\src\callback_table.h"
>
</File>
<File
RelativePath=".\..\src\cargo_type.h"
>
</File>
<File
RelativePath=".\..\src\cargopacket.h"
>
@@ -841,31 +801,31 @@
>
</File>
<File
RelativePath=".\..\src\cmd_helper.h"
>
</File>
<File
RelativePath=".\..\src\command_func.h"
>
</File>
<File
RelativePath=".\..\src\command_type.h"
RelativePath=".\..\src\command.h"
>
</File>
<File
RelativePath=".\..\src\console.h"
>
</File>
<File
RelativePath=".\..\src\core\bitmath_func.hpp"
>
</File>
<File
RelativePath=".\..\src\core\math_func.hpp"
>
</File>
<File
RelativePath=".\..\src\core\random_func.hpp"
>
</File>
<File
RelativePath=".\..\src\currency.h"
>
</File>
<File
RelativePath=".\..\src\date_func.h"
>
</File>
<File
RelativePath=".\..\src\date_type.h"
RelativePath=".\..\src\date.h"
>
</File>
<File
@@ -881,11 +841,7 @@
>
</File>
<File
RelativePath=".\..\src\direction_func.h"
>
</File>
<File
RelativePath=".\..\src\direction_type.h"
RelativePath=".\..\src\direction.h"
>
</File>
<File
@@ -897,33 +853,13 @@
>
</File>
<File
RelativePath=".\..\src\widgets\dropdown_func.h"
>
</File>
<File
RelativePath=".\..\src\widgets\dropdown_type.h"
>
</File>
<File
RelativePath=".\..\src\economy_func.h"
>
</File>
<File
RelativePath=".\..\src\economy_type.h"
>
</File>
<File
RelativePath=".\..\src\core\endian_func.hpp"
RelativePath=".\..\src\economy.h"
>
</File>
<File
RelativePath=".\..\src\engine.h"
>
</File>
<File
RelativePath=".\..\src\core\enum_type.hpp"
>
</File>
<File
RelativePath=".\..\src\fileio.h"
>
@@ -945,15 +881,7 @@
>
</File>
<File
RelativePath=".\..\src\core\geometry_type.hpp"
>
</File>
<File
RelativePath=".\..\src\gfx_func.h"
>
</File>
<File
RelativePath=".\..\src\gfx_type.h"
RelativePath=".\..\src\gfx.h"
>
</File>
<File
@@ -964,10 +892,6 @@
RelativePath=".\..\src\group.h"
>
</File>
<File
RelativePath=".\..\src\group_gui.h"
>
</File>
<File
RelativePath=".\..\src\gui.h"
>
@@ -980,10 +904,6 @@
RelativePath=".\..\src\industry.h"
>
</File>
<File
RelativePath=".\..\src\industry_type.h"
>
</File>
<File
RelativePath=".\..\src\landscape.h"
>
@@ -993,7 +913,7 @@
>
</File>
<File
RelativePath=".\..\src\core\math_func.hpp"
RelativePath=".\..\src\map.h"
>
</File>
<File
@@ -1028,10 +948,6 @@
RelativePath=".\..\src\network\network_gui.h"
>
</File>
<File
RelativePath=".\..\src\network\network_internal.h"
>
</File>
<File
RelativePath=".\..\src\network\network_server.h"
>
@@ -1068,10 +984,6 @@
RelativePath=".\..\src\newgrf_engine.h"
>
</File>
<File
RelativePath=".\..\src\newgrf_generic.h"
>
</File>
<File
RelativePath=".\..\src\newgrf_house.h"
>
@@ -1140,38 +1052,18 @@
RelativePath=".\..\src\openttd.h"
>
</File>
<File
RelativePath=".\..\src\order.h"
>
</File>
<File
RelativePath=".\..\src\core\overflowsafe_type.hpp"
>
</File>
<File
RelativePath=".\..\src\pathfind.h"
>
</File>
<File
RelativePath=".\..\src\player_base.h"
RelativePath=".\..\src\player.h"
>
</File>
<File
RelativePath=".\..\src\player_face.h"
>
</File>
<File
RelativePath=".\..\src\player_func.h"
>
</File>
<File
RelativePath=".\..\src\player_gui.h"
>
</File>
<File
RelativePath=".\..\src\player_type.h"
>
</File>
<File
RelativePath=".\..\src\queue.h"
>
@@ -1180,42 +1072,10 @@
RelativePath=".\..\src\rail.h"
>
</File>
<File
RelativePath=".\..\src\rail_gui.h"
>
</File>
<File
RelativePath=".\..\src\rail_type.h"
>
</File>
<File
RelativePath=".\..\src\core\random_func.hpp"
>
</File>
<File
RelativePath=".\..\src\road_cmd.h"
>
</File>
<File
RelativePath=".\..\src\road_func.h"
>
</File>
<File
RelativePath=".\..\src\road_gui.h"
>
</File>
<File
RelativePath=".\..\src\road_internal.h"
>
</File>
<File
RelativePath=".\..\src\road_type.h"
>
</File>
<File
RelativePath=".\..\src\roadveh.h"
>
</File>
<File
RelativePath=".\..\src\saveload.h"
>
@@ -1233,23 +1093,7 @@
>
</File>
<File
RelativePath=".\..\src\settings_func.h"
>
</File>
<File
RelativePath=".\..\src\settings_internal.h"
>
</File>
<File
RelativePath=".\..\src\settings_type.h"
>
</File>
<File
RelativePath=".\..\src\ship.h"
>
</File>
<File
RelativePath=".\..\src\signal_func.h"
RelativePath=".\..\src\settings.h"
>
</File>
<File
@@ -1257,19 +1101,15 @@
>
</File>
<File
RelativePath=".\..\src\slope_func.h"
RelativePath=".\..\src\signal_func.h"
>
</File>
<File
RelativePath=".\..\src\slope_type.h"
RelativePath=".\..\src\slope.h"
>
</File>
<File
RelativePath=".\..\src\sound_func.h"
>
</File>
<File
RelativePath=".\..\src\sound_type.h"
RelativePath=".\..\src\sound.h"
>
</File>
<File
@@ -1293,27 +1133,7 @@
>
</File>
<File
RelativePath=".\..\src\string_func.h"
>
</File>
<File
RelativePath=".\..\src\string_type.h"
>
</File>
<File
RelativePath=".\..\src\strings_func.h"
>
</File>
<File
RelativePath=".\..\src\strings_type.h"
>
</File>
<File
RelativePath=".\..\src\terraform_gui.h"
>
</File>
<File
RelativePath=".\..\src\textbuf_gui.h"
RelativePath=".\..\src\string.h"
>
</File>
<File
@@ -1329,11 +1149,7 @@
>
</File>
<File
RelativePath=".\..\src\tile_cmd.h"
>
</File>
<File
RelativePath=".\..\src\tile_type.h"
RelativePath=".\..\src\tile.h"
>
</File>
<File
@@ -1344,18 +1160,6 @@
RelativePath=".\..\src\town.h"
>
</File>
<File
RelativePath=".\..\src\town_type.h"
>
</File>
<File
RelativePath=".\..\src\track_func.h"
>
</File>
<File
RelativePath=".\..\src\track_type.h"
>
</File>
<File
RelativePath=".\..\src\train.h"
>
@@ -1368,24 +1172,12 @@
RelativePath=".\..\src\transparency_gui.h"
>
</File>
<File
RelativePath=".\..\src\tunnelbridge.h"
>
</File>
<File
RelativePath=".\..\src\unmovable.h"
>
</File>
<File
RelativePath=".\..\src\variables.h"
>
</File>
<File
RelativePath=".\..\src\vehicle_base.h"
>
</File>
<File
RelativePath=".\..\src\vehicle_func.h"
RelativePath=".\..\src\vehicle.h"
>
</File>
<File
@@ -1393,7 +1185,7 @@
>
</File>
<File
RelativePath=".\..\src\vehicle_type.h"
RelativePath=".\..\src\viewport.h"
>
</File>
<File
@@ -1413,23 +1205,23 @@
>
</File>
<File
RelativePath=".\..\src\window_func.h"
RelativePath=".\..\src\window.h"
>
</File>
<File
RelativePath=".\..\src\window_gui.h"
RelativePath=".\..\src\widgets\dropdown.h"
>
</File>
<File
RelativePath=".\..\src\window_type.h"
RelativePath=".\..\src\widgets\dropdown_type.h"
>
</File>
<File
RelativePath=".\..\src\zoom_func.h"
RelativePath=".\..\src\widgets\dropdown_func.h"
>
</File>
<File
RelativePath=".\..\src\zoom_type.h"
RelativePath=".\..\src\zoom.hpp"
>
</File>
</Filter>
@@ -1729,7 +1521,7 @@
>
</File>
<File
RelativePath=".\..\src\table\roadveh_movement.h"
RelativePath=".\..\src\table\roadveh.h"
>
</File>
<File
@@ -1948,10 +1740,6 @@
RelativePath=".\..\src\newgrf_engine.cpp"
>
</File>
<File
RelativePath=".\..\src\newgrf_generic.cpp"
>
</File>
<File
RelativePath=".\..\src\newgrf_house.cpp"
>
@@ -2028,10 +1816,6 @@
RelativePath=".\..\src\station_map.h"
>
</File>
<File
RelativePath=".\..\src\tile_map.h"
>
</File>
<File
RelativePath=".\..\src\town_map.h"
>
@@ -2072,6 +1856,14 @@
RelativePath=".\..\src\misc\array.hpp"
>
</File>
<File
RelativePath=".\..\src\misc\autocopyptr.hpp"
>
</File>
<File
RelativePath=".\..\src\misc\autoptr.hpp"
>
</File>
<File
RelativePath=".\..\src\misc\binaryheap.hpp"
>
@@ -2164,6 +1956,10 @@
<Filter
Name="YAPF"
>
<File
RelativePath=".\..\src\yapf\follow_track.cpp"
>
</File>
<File
RelativePath=".\..\src\yapf\follow_track.hpp"
>
@@ -2188,6 +1984,10 @@
RelativePath=".\..\src\yapf\yapf_base.hpp"
>
</File>
<File
RelativePath=".\..\src\yapf\yapf_common.cpp"
>
</File>
<File
RelativePath=".\..\src\yapf\yapf_common.hpp"
>

View File

@@ -1,37 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioUserFile
ProjectType="Visual C++"
Version="9.00"
ShowAllFiles="false"
>
<Configurations>
<Configuration
Name="Release|Win32"
>
<DebugSettings
WorkingDirectory="..\bin"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
>
<DebugSettings
WorkingDirectory="..\bin"
/>
</Configuration>
<Configuration
Name="Release|x64"
>
<DebugSettings
WorkingDirectory="..\bin"
/>
</Configuration>
<Configuration
Name="Debug|x64"
>
<DebugSettings
WorkingDirectory="..\bin"
/>
</Configuration>
</Configurations>
</VisualStudioUserFile>

101
projects/strgen.vcproj Normal file
View File

@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="strgen"
RootNamespace="strgen"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="..\objs\strgen\"
IntermediateDirectory="..\objs\strgen\"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
GlobalOptimizations="TRUE"
FavorSizeOrSpeed="2"
PreprocessorDefinitions="STRGEN;WIN32;NDEBUG;_CONSOLE"
BasicRuntimeChecks="0"
RuntimeLibrary="5"
PrecompiledHeaderFile=""
AssemblerOutput="2"
AssemblerListingLocation="$(IntDir)"
ObjectFile="$(IntDir)"
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
WarningLevel="3"
WarnAsError="TRUE"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(IntDir)\strgen.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(IntDir)\strgen.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/strgen.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1053"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\src\strgen\strgen.cpp">
</File>
<File
RelativePath="..\src\string.cpp">
</File>
</Filter>
<File
RelativePath="..\src\macros.h">
</File>
<File
RelativePath="..\src\stdafx.h">
</File>
<File
RelativePath="..\src\string.h">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -112,10 +112,6 @@
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="..\src\core\alloc_func.cpp"
>
</File>
<File
RelativePath="..\src\strgen\strgen.cpp"
>
@@ -126,19 +122,7 @@
</File>
</Filter>
<File
RelativePath="..\src\core\alloc_func.hpp"
>
</File>
<File
RelativePath="..\src\table\control_codes.h"
>
</File>
<File
RelativePath="..\src\debug.h"
>
</File>
<File
RelativePath="..\src\core\endian_func.hpp"
RelativePath="..\src\macros.h"
>
</File>
<File

View File

@@ -112,10 +112,6 @@
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="..\src\core\alloc_func.cpp"
>
</File>
<File
RelativePath="..\src\strgen\strgen.cpp"
>
@@ -126,19 +122,7 @@
</File>
</Filter>
<File
RelativePath="..\src\core\alloc_func.hpp"
>
</File>
<File
RelativePath="..\src\table\control_codes.h"
>
</File>
<File
RelativePath="..\src\debug.h"
>
</File>
<File
RelativePath="..\src\core\endian_func.hpp"
RelativePath="..\src\macros.h"
>
</File>
<File

View File

@@ -1,6 +1,6 @@
OpenTTD README
Last updated: 2008-04-01
Release version: 0.6.0
Last updated: 2008-01-16
Release version: 0.6.0-beta3
------------------------------------------------------------------------
@@ -11,9 +11,6 @@ Table of Contents:
* 2.1 Reporting Bugs
3.0) Supported Platforms
4.0) Installing and running OpenTTD
* 4.1 (Required) 3rd party files
* 4.2 OpenTTD directories
* 4.3 Portable Installations (External Media)
5.0) OpenTTD features
6.0) Configuration File
7.0) Compiling
@@ -91,100 +88,25 @@ archive which you have to extract to a directory where you want OpenTTD to
be installed, or you have downloaded an installer, which will automatically
extract OpenTTD in the given directory.
OpenTTD looks in multiple locations to find the required data files (described
in section 4.2). Installing any 3rd party files into a "shared" location has
the advantage that you only need to do this step once, rather than copying the
data files into all OpenTTD versions you have.
Savegames, screenshots, etc are saved relative to the config file (openttd.cfg)
currently being used. This means that if you use a config file in one of the
shared directories, savegames will reside in the save/ directory next to the
openttd.cfg file there.
If you want savegames and screenshots in the directory where the OpenTTD binary
resides, simply have your config file in that location. But if you remove this
config file, savegames will still be in this directory (see notes in section 4.2)
4.1) (Required) 3rd party files:
---- ---------------------------
Before you run OpenTTD, you need to put the game's datafiles into a data/
directory which can be located in various places addressed in the following
section.
As OpenTTD makes use of the original TTD artwork you will need the files listed
below, which you can find on a Transport Tycoon Deluxe CD-ROM.
The Windows installer optionally can copy these files from that CD-ROM.
Before you run OpenTTD, you need to put the game's datafiles into the data/
subdirectory. You need the following files from the original version
of TTD as OpenTTD makes use of the original TTD artwork. The Windows
installer optionally can copy these files from your Transport Tycoon Deluxe
CD-ROM.
List of the required files:
- sample.cat
- trg1r.grf
- trgcr.grf
- trghr.grf
- trgir.grf
- trgtr.grf
sample.cat
trg1r.grf
trgcr.grf
trghr.grf
trgir.grf
trgtr.grf
Alternatively you can use the TTD GRF files from the DOS version:
- TRG1.GRF
- TRGC.GRF
- TRGH.GRF
- TRGI.GRF
- TRGT.GRF
(Alternatively you can use the TTD GRF files from the DOS version: TRG1.GRF,
TRGC.GRF, TRGH.GRF, TRGI.GRF, TRGT.GRF.
If you want the TTD music, copy the gm/ folder from the Windows version
of TTD to your OpenTTD folder (not your data folder - also explained in
the following sections).
Do NOT copy files included with OpenTTD into "shared" directories (explained in
the following sections) as sooner or later you will run into graphical glitches
when using other versions of the game.
4.2) OpenTTD directories
---- -------------------------------
The TTD artwork files listed in the section 4.1 "(Required) 3rd party files"
can be placed in a few different locations:
1. The current working directory (from where you started OpenTTD)
2. Your personal directory
Windows: C:\Documents and Settings\<username>\My Documents\OpenTTD
Mac OSX: ~/Documents/OpenTTD
Linux: ~/.openttd
3. The shared directory
Windows: C:\Documents and Settings\All Users\Documents\OpenTTD
Mac OSX: /Library/Application Support/OpenTTD
Linux: not available
4. The binary directory (where the OpenTTD executable is)
Windows: C:\Program Files\OpenTTD
Linux: /usr/games
5. The installation directory (Linux only)
Linux: /usr/share/games/openttd
6. The application bundle (Mac OSX only)
It includes the OTTD files (grf+lng) and it will work as long as they aren't touched
Notes:
- Linux in the previous list means .deb, but most paths should be similar for others.
- The previous search order is also used for newgrfs and openttd.cfg.
- If openttd.cfg is not found, then it will be created using the 2, 4, 1, 3, 5 order.
- Savegames will be relative to the config file only if there is no save/
directory in paths with higher priority than the config file path, but
autosaves and screenshots will always be relative to the config file.
The prefered setup:
Place 3rd party files in shared directory (or in personal directory if you don't
have write access on shared directory) and have your openttd.cfg config file in
personal directory (where the game will then also place savegames and screenshots).
4.3) Portable Installations (External Media):
---- ----------------------------------------
You can install OpenTTD on external media so you can take it with you, i.e.
using a USB key, or a USB HDD, etc.
Create a directory where you shall store the game in (i.e. OpenTTD/).
Copy the binary (OpenTTD.exe, OpenTTD.app, openttd, etc), data/ and your
openttd.cfg to this directory.
You can copy binaries for any operating system into this directory, which will
allow you to play the game on nearly any computer you can attach the external
media to.
As always - additional grf files are stored in the data/ dir (for details,
again, see section 4.1).
If you want music you need to copy the gm/ folder from Windows TTD into your
OpenTTD folder, not your data folder.
5.0) OpenTTD features:
@@ -363,7 +285,6 @@ The OpenTTD team (in alphabetical order):
Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles
Matthijs Kooijman (blathijs) - Pathfinder-guru, pool rework
Loïc Guilloux (glx) - General coding
Christoph Elsenhans (frosch) - General coding
Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;)
Jonathan Coome (Maedhros) - High priest of the newGRF Temple
Attila Bán (MiHaMiX) - WebTranslator, Nightlies, Wiki and bugtracker host

View File

@@ -1,10 +1,8 @@
# Source Files
airport.cpp
core/alloc_func.cpp
articulated_vehicles.cpp
autoreplace_cmd.cpp
aystar.cpp
core/bitmath_func.cpp
bmp.cpp
callback_table.cpp
cargopacket.cpp
@@ -12,13 +10,14 @@ cargotype.cpp
command.cpp
console.cpp
console_cmds.cpp
core/bitmath_func.cpp
core/random_func.cpp
currency.cpp
date.cpp
debug.cpp
dedicated.cpp
depot.cpp
driver.cpp
widgets/dropdown.cpp
economy.cpp
elrail.cpp
engine.cpp
@@ -59,7 +58,6 @@ pathfind.cpp
players.cpp
queue.cpp
rail.cpp
core/random_func.cpp
rev.cpp
road.cpp
saveload.cpp
@@ -95,6 +93,7 @@ vehicle.cpp
viewport.cpp
waypoint.cpp
widget.cpp
widgets/dropdown.cpp
#if WIN32
win32.cpp
#end
@@ -104,60 +103,41 @@ window.cpp
aircraft.h
airport.h
airport_movement.h
core/alloc_func.hpp
articulated_vehicles.h
autoreplace_base.h
autoreplace_func.h
autoreplace_gui.h
autoreplace_type.h
autoslope.h
aystar.h
core/bitmath_func.hpp
bmp.h
bridge.h
callback_table.h
cargo_type.h
cargopacket.h
cargotype.h
cmd_helper.h
command_func.h
command_type.h
command.h
console.h
core/bitmath_func.hpp
core/math_func.hpp
core/random_func.hpp
currency.h
date_func.h
date_type.h
date.h
debug.h
video/dedicated_v.h
depot.h
direction_func.h
direction_type.h
direction.h
music/dmusic.h
driver.h
widgets/dropdown_func.h
widgets/dropdown_type.h
economy_func.h
economy_type.h
core/endian_func.hpp
economy.h
engine.h
core/enum_type.hpp
fileio.h
fios.h
fontcache.h
functions.h
genworld.h
core/geometry_type.hpp
gfx_func.h
gfx_type.h
gfx.h
gfxinit.h
group.h
group_gui.h
gui.h
heightmap.h
industry.h
industry_type.h
landscape.h
livery.h
core/math_func.hpp
map.h
md5.h
mixer.h
music.h
@@ -166,7 +146,6 @@ network/network_client.h
network/network_data.h
network/network_gamelist.h
network/network_gui.h
network/network_internal.h
network/network_server.h
network/network_udp.h
newgrf.h
@@ -176,7 +155,6 @@ newgrf_cargo.h
newgrf_commons.h
newgrf_config.h
newgrf_engine.h
newgrf_generic.h
newgrf_house.h
newgrf_industries.h
newgrf_industrytiles.h
@@ -194,79 +172,49 @@ sound/null_s.h
video/null_v.h
oldpool.h
openttd.h
order.h
core/overflowsafe_type.hpp
pathfind.h
player_base.h
player.h
player_face.h
player_func.h
player_gui.h
player_type.h
queue.h
rail.h
rail_gui.h
rail_type.h
core/random_func.hpp
road_cmd.h
road_func.h
road_gui.h
road_internal.h
road_type.h
roadveh.h
saveload.h
screenshot.h
sound/sdl_s.h
video/sdl_v.h
settings_func.h
settings_internal.h
settings_type.h
ship.h
signal_func.h
settings.h
signs.h
slope_func.h
slope_type.h
sound_func.h
sound_type.h
signal_func.h
slope.h
sound.h
sprite.h
spritecache.h
station.h
station_gui.h
stdafx.h
string_func.h
string_type.h
strings_func.h
strings_type.h
terraform_gui.h
textbuf_gui.h
string.h
texteff.hpp
tgp.h
thread.h
tile_cmd.h
tile_type.h
tile.h
timetable.h
town.h
town_type.h
track_func.h
track_type.h
train.h
transparency.h
transparency_gui.h
tunnelbridge.h
unmovable.h
variables.h
vehicle_base.h
vehicle_func.h
vehicle.h
vehicle_gui.h
vehicle_type.h
viewport.h
waypoint.h
music/win32_m.h
sound/win32_s.h
video/win32_v.h
window_func.h
window_gui.h
window_type.h
zoom_func.h
zoom_type.h
window.h
widgets/dropdown.h
widgets/dropdown_type.h
widgets/dropdown_func.h
zoom.hpp
# GUI Source Code
aircraft_gui.cpp
@@ -344,7 +292,7 @@ table/landscape_sprite.h
table/namegen.h
table/palettes.h
table/road_land.h
table/roadveh_movement.h
table/roadveh.h
table/sprites.h
table/station_land.h
../objs/langs/table/strings.h
@@ -406,7 +354,6 @@ newgrf_cargo.cpp
newgrf_commons.cpp
newgrf_config.cpp
newgrf_engine.cpp
newgrf_generic.cpp
newgrf_house.cpp
newgrf_industries.cpp
newgrf_industrytiles.cpp
@@ -427,7 +374,6 @@ rail_map.h
road_map.cpp
road_map.h
station_map.h
tile_map.h
town_map.h
tree_map.h
tunnel_map.cpp
@@ -439,6 +385,8 @@ water_map.h
# Misc
misc/array.hpp
misc/autocopyptr.hpp
misc/autoptr.hpp
misc/binaryheap.hpp
misc/blob.hpp
misc/countedptr.hpp
@@ -464,12 +412,14 @@ network/core/udp.cpp
network/core/udp.h
# YAPF
yapf/follow_track.cpp
yapf/follow_track.hpp
yapf/nodelist.hpp
yapf/track_dir.hpp
yapf/yapf.h
yapf/yapf.hpp
yapf/yapf_base.hpp
yapf/yapf_common.cpp
yapf/yapf_common.hpp
yapf/yapf_costbase.hpp
yapf/yapf_costcache.hpp

View File

@@ -10,7 +10,6 @@
#include "../player_base.h"
#include "ai.h"
#include "default/default.h"
#include "../signal_func.h"
AIStruct _ai;
AIPlayer _ai_player[MAX_PLAYERS];
@@ -160,9 +159,6 @@ static void AI_RunTick(PlayerID player)
AiDoGameLoop(p);
_is_old_ai_player = false;
}
/* AI could change some track, so update signals */
UpdateSignalsInBuffer();
}

View File

@@ -31,7 +31,6 @@
#include "../../player_base.h"
#include "../../settings_type.h"
#include "default.h"
#include "../../tunnelbridge.h"
#include "../../table/ai_rail.h"
@@ -69,9 +68,10 @@ enum {
};
static inline TrackBits GetRailTrackStatus(TileIndex tile)
static TrackBits GetRailTrackStatus(TileIndex tile)
{
return TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0));
uint32 r = GetTileTrackStatus(tile, TRANSPORT_RAIL, 0);
return (TrackBits)(byte) (r | r >> 8);
}
@@ -111,8 +111,8 @@ static void AiStateVehLoop(Player *p)
/* not profitable? */
if (v->age >= 730 &&
v->profit_last_year < _price.station_value * 5 * 256 &&
v->profit_this_year < _price.station_value * 5 * 256) {
v->profit_last_year < _price.station_value * 5 &&
v->profit_this_year < _price.station_value * 5) {
_players_ai[p->index].state_counter = 0;
_players_ai[p->index].state = AIS_SELL_VEHICLE;
_players_ai[p->index].cur_veh = v;
@@ -139,9 +139,10 @@ static EngineID AiChooseTrainToBuild(RailType railtype, Money money, byte flag,
{
EngineID best_veh_index = INVALID_ENGINE;
byte best_veh_score = 0;
CommandCost ret;
EngineID i;
FOR_ALL_ENGINEIDS_OF_TYPE(i, VEH_TRAIN) {
for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
const RailVehicleInfo *rvi = RailVehInfo(i);
const Engine* e = GetEngine(i);
@@ -153,10 +154,7 @@ static EngineID AiChooseTrainToBuild(RailType railtype, Money money, byte flag,
continue;
}
/* Don't choose an engine designated for passenger use for freight. */
if (rvi->ai_passenger_only != 0 && flag == 1) continue;
CommandCost ret = DoCommand(tile, i, 0, 0, CMD_BUILD_RAIL_VEHICLE);
ret = DoCommand(tile, i, 0, 0, CMD_BUILD_RAIL_VEHICLE);
if (CmdSucceeded(ret) && ret.GetCost() <= money && rvi->ai_rank >= best_veh_score) {
best_veh_score = rvi->ai_rank;
best_veh_index = i;
@@ -170,11 +168,14 @@ static EngineID AiChooseRoadVehToBuild(CargoID cargo, Money money, TileIndex til
{
EngineID best_veh_index = INVALID_ENGINE;
int32 best_veh_rating = 0;
EngineID i;
EngineID i = ROAD_ENGINES_INDEX;
EngineID end = i + NUM_ROAD_ENGINES;
FOR_ALL_ENGINEIDS_OF_TYPE(i, VEH_ROAD) {
for (; i != end; i++) {
const RoadVehicleInfo *rvi = RoadVehInfo(i);
const Engine* e = GetEngine(i);
int32 rating;
CommandCost ret;
if (!HasBit(e->player_avail, _current_player) || e->reliability < 0x8A3D) {
continue;
@@ -184,10 +185,10 @@ static EngineID AiChooseRoadVehToBuild(CargoID cargo, Money money, TileIndex til
if (rvi->cargo_type != cargo && !CanRefitTo(i, cargo)) continue;
/* Rate and compare the engine by speed & capacity */
int rating = rvi->max_speed * rvi->capacity;
rating = rvi->max_speed * rvi->capacity;
if (rating <= best_veh_rating) continue;
CommandCost ret = DoCommand(tile, i, 0, 0, CMD_BUILD_ROAD_VEH);
ret = DoCommand(tile, i, 0, 0, CMD_BUILD_ROAD_VEH);
if (CmdFailed(ret)) continue;
/* Add the cost of refitting */
@@ -201,28 +202,23 @@ static EngineID AiChooseRoadVehToBuild(CargoID cargo, Money money, TileIndex til
return best_veh_index;
}
/**
* Choose aircraft to build.
* @param money current AI money
* @param forbidden forbidden flags - AIR_HELI = 0 (always allowed), AIR_CTOL = 1 (bit 0), AIR_FAST = 2 (bit 1)
* @return EngineID of aircraft to build
*/
static EngineID AiChooseAircraftToBuild(Money money, byte forbidden)
static EngineID AiChooseAircraftToBuild(Money money, byte flag)
{
EngineID best_veh_index = INVALID_ENGINE;
Money best_veh_cost = 0;
EngineID i;
FOR_ALL_ENGINEIDS_OF_TYPE(i, VEH_AIRCRAFT) {
for (i = AIRCRAFT_ENGINES_INDEX; i != AIRCRAFT_ENGINES_INDEX + NUM_AIRCRAFT_ENGINES; i++) {
const Engine* e = GetEngine(i);
CommandCost ret;
if (!HasBit(e->player_avail, _current_player) || e->reliability < 0x8A3D) {
continue;
}
if ((AircraftVehInfo(i)->subtype & forbidden) != 0) continue;
if ((AircraftVehInfo(i)->subtype & AIR_CTOL) != flag) continue;
CommandCost ret = DoCommand(0, i, 0, DC_QUERY_COST, CMD_BUILD_AIRCRAFT);
ret = DoCommand(0, i, 0, DC_QUERY_COST, CMD_BUILD_AIRCRAFT);
if (CmdSucceeded(ret) && ret.GetCost() <= money && ret.GetCost() >= best_veh_cost) {
best_veh_cost = ret.GetCost();
best_veh_index = i;
@@ -257,24 +253,8 @@ static EngineID AiChooseRoadVehToReplaceWith(const Player* p, const Vehicle* v)
static EngineID AiChooseAircraftToReplaceWith(const Player* p, const Vehicle* v)
{
Money avail_money = p->player_money + v->value;
/* determine forbidden aircraft bits */
byte forbidden = 0;
const Order *o;
FOR_VEHICLE_ORDERS(v, o) {
if (!o->IsValid()) continue;
if (!IsValidStationID(o->dest)) continue;
const Station *st = GetStation(o->dest);
if (!(st->facilities & FACIL_AIRPORT)) continue;
AirportFTAClass::Flags flags = st->Airport()->flags;
if (!(flags & AirportFTAClass::AIRPLANES)) forbidden |= AIR_CTOL | AIR_FAST; // no planes for heliports / oil rigs
if (flags & AirportFTAClass::SHORT_STRIP) forbidden |= AIR_FAST; // no fast planes for small airports
}
return AiChooseAircraftToBuild(
avail_money, forbidden
avail_money, AircraftVehInfo(v->engine_type)->subtype & AIR_CTOL
);
}
@@ -317,9 +297,9 @@ static void AiHandleGotoDepot(Player *p, int cmd)
static void AiRestoreVehicleOrders(Vehicle *v, BackuppedOrders *bak)
{
if (bak->order == NULL) return;
uint i;
for (uint i = 0; bak->order[i].type != OT_NOTHING; i++) {
for (i = 0; bak->order[i].type != OT_NOTHING; i++) {
if (!DoCommandP(0, v->index + (i << 16), PackOrder(&bak->order[i]), NULL, CMD_INSERT_ORDER | CMD_NO_TEST_IF_IN_NETWORK))
break;
}
@@ -358,7 +338,7 @@ static void AiHandleReplaceTrain(Player *p)
static void AiHandleReplaceRoadVeh(Player *p)
{
const Vehicle* v = _players_ai[p->index].cur_veh;
BackuppedOrders orderbak;
BackuppedOrders orderbak[1];
EngineID veh;
if (!v->IsStoppedInDepot()) {
@@ -370,14 +350,14 @@ static void AiHandleReplaceRoadVeh(Player *p)
if (veh != INVALID_ENGINE) {
TileIndex tile;
BackupVehicleOrders(v, &orderbak);
BackupVehicleOrders(v, orderbak);
tile = v->tile;
if (CmdSucceeded(DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_ROAD_VEH)) &&
CmdSucceeded(DoCommand(tile, veh, 0, DC_EXEC, CMD_BUILD_ROAD_VEH))) {
VehicleID veh = _new_vehicle_id;
AiRestoreVehicleOrders(GetVehicle(veh), &orderbak);
AiRestoreVehicleOrders(GetVehicle(veh), orderbak);
DoCommand(0, veh, 0, DC_EXEC, CMD_START_STOP_ROADVEH);
DoCommand(0, veh, _ai_service_interval, DC_EXEC, CMD_CHANGE_SERVICE_INT);
}
@@ -387,7 +367,7 @@ static void AiHandleReplaceRoadVeh(Player *p)
static void AiHandleReplaceAircraft(Player *p)
{
const Vehicle* v = _players_ai[p->index].cur_veh;
BackuppedOrders orderbak;
BackuppedOrders orderbak[1];
EngineID veh;
if (!v->IsStoppedInDepot()) {
@@ -399,13 +379,13 @@ static void AiHandleReplaceAircraft(Player *p)
if (veh != INVALID_ENGINE) {
TileIndex tile;
BackupVehicleOrders(v, &orderbak);
BackupVehicleOrders(v, orderbak);
tile = v->tile;
if (CmdSucceeded(DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_AIRCRAFT)) &&
CmdSucceeded(DoCommand(tile, veh, 0, DC_EXEC, CMD_BUILD_AIRCRAFT))) {
VehicleID veh = _new_vehicle_id;
AiRestoreVehicleOrders(GetVehicle(veh), &orderbak);
AiRestoreVehicleOrders(GetVehicle(veh), orderbak);
DoCommand(0, veh, 0, DC_EXEC, CMD_START_STOP_AIRCRAFT);
DoCommand(0, veh, _ai_service_interval, DC_EXEC, CMD_CHANGE_SERVICE_INT);
@@ -1389,7 +1369,7 @@ static void AiWantPassengerAircraftRoute(Player *p)
/* Get aircraft that would be bought for this route
* (probably, as conditions may change before the route is fully built,
* like running out of money and having to select different aircraft, etc ...) */
EngineID veh = AiChooseAircraftToBuild(p->player_money, _players_ai[p->index].build_kind != 0 ? AIR_CTOL : 0);
EngineID veh = AiChooseAircraftToBuild(p->player_money, _players_ai[p->index].build_kind != 0 ? 0 : AIR_CTOL);
/* No aircraft buildable mean no aircraft route */
if (veh == INVALID_ENGINE) return;
@@ -1603,7 +1583,7 @@ static void AiStateWantNewRoute(Player *p)
static bool AiCheckTrackResources(TileIndex tile, const AiDefaultBlockData *p, byte cargo)
{
uint rad = (_patches.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
uint rad = (_patches.modified_catchment) ? CA_TRAIN : 4;
for (; p->mode != 4; p++) {
AcceptedCargo values;
@@ -1901,7 +1881,7 @@ struct AiRailPathFindData {
bool flag;
};
static bool AiEnumFollowTrack(TileIndex tile, AiRailPathFindData *a, int track, uint length)
static bool AiEnumFollowTrack(TileIndex tile, AiRailPathFindData *a, int track, uint length, byte *state)
{
if (a->flag) return true;
@@ -1923,7 +1903,7 @@ static bool AiDoFollowTrack(const Player* p)
arpfd.tile2 = _players_ai[p->index].cur_tile_a;
arpfd.flag = false;
arpfd.count = 0;
FollowTrack(_players_ai[p->index].cur_tile_a + TileOffsByDiagDir(_players_ai[p->index].cur_dir_a), TRANSPORT_RAIL, 0, ReverseDiagDir(_players_ai[p->index].cur_dir_a),
FollowTrack(_players_ai[p->index].cur_tile_a + TileOffsByDiagDir(_players_ai[p->index].cur_dir_a), 0x2000 | TRANSPORT_RAIL, 0, ReverseDiagDir(_players_ai[p->index].cur_dir_a),
(TPFEnumProc*)AiEnumFollowTrack, NULL, &arpfd);
return arpfd.count > 8;
}
@@ -2197,55 +2177,26 @@ static void AiBuildRailConstruct(Player *p)
_players_ai[p->index].cur_tile_a += TileOffsByDiagDir(_players_ai[p->index].cur_dir_a);
if (arf.best_ptr[0] & 0x80) {
TileIndex t1 = _players_ai[p->index].cur_tile_a;
TileIndex t2 = arf.bridge_end_tile;
int i;
int32 bridge_len = GetBridgeLength(arf.bridge_end_tile, _players_ai[p->index].cur_tile_a);
int32 bridge_len = GetTunnelBridgeLength(t1, t2);
DiagDirection dir = (TileX(t1) == TileX(t2) ? DIAGDIR_SE : DIAGDIR_SW);
Track track = AxisToTrack(DiagDirToAxis(dir));
if (t2 < t1) dir = ReverseDiagDir(dir);
/* try to build a long rail instead of bridge... */
bool fail = false;
CommandCost cost;
TileIndex t = t1;
/* try to build one rail on each tile - can't use CMD_BUILD_RAILROAD_TRACK now, it can build one part of track without failing */
do {
cost = DoCommand(t, _players_ai[p->index].railtype_to_use, track, DC_AUTO | DC_NO_WATER, CMD_BUILD_SINGLE_RAIL);
/* do not allow building over existing track */
if (CmdFailed(cost) || IsTileType(t, MP_RAILWAY)) {
fail = true;
break;
/* Figure out which (rail)bridge type to build
* start with best bridge, then go down to worse and worse bridges
* unnecessary to check for worst 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 = MAX_BRIDGES - 1; i != 0; i--) {
if (CheckBridge_Stuff(i, bridge_len)) {
CommandCost cost = DoCommand(arf.bridge_end_tile, _players_ai[p->index].cur_tile_a, i | (_players_ai[p->index].railtype_to_use << 8), DC_AUTO, CMD_BUILD_BRIDGE);
if (CmdSucceeded(cost) && cost.GetCost() < (p->player_money >> 5)) break;
}
t += TileOffsByDiagDir(dir);
} while (t != t2);
/* can we build long track? */
if (!fail) cost = DoCommand(t1, t2, _players_ai[p->index].railtype_to_use | (track << 4), DC_AUTO | DC_NO_WATER, CMD_BUILD_RAILROAD_TRACK);
if (!fail && CmdSucceeded(cost) && cost.GetCost() <= p->player_money) {
DoCommand(t1, t2, _players_ai[p->index].railtype_to_use | (track << 4), DC_AUTO | DC_NO_WATER | DC_EXEC, CMD_BUILD_RAILROAD_TRACK);
} else {
/* Figure out which (rail)bridge type to build
* start with best bridge, then go down to worse and worse bridges
* unnecessary to check for worst bridge (i=0), since AI will always build that. */
int i;
for (i = MAX_BRIDGES - 1; i != 0; i--) {
if (CheckBridge_Stuff(i, bridge_len)) {
CommandCost cost = DoCommand(t1, t2, i | (_players_ai[p->index].railtype_to_use << 8), DC_AUTO, CMD_BUILD_BRIDGE);
if (CmdSucceeded(cost) && cost.GetCost() < (p->player_money >> 1) && cost.GetCost() < ((p->player_money + _economy.max_loan - p->current_loan) >> 5)) break;
}
}
/* Build it */
DoCommand(t1, t2, i | (_players_ai[p->index].railtype_to_use << 8), DC_AUTO | DC_EXEC, CMD_BUILD_BRIDGE);
}
_players_ai[p->index].cur_tile_a = t2;
// Build it
DoCommand(arf.bridge_end_tile, _players_ai[p->index].cur_tile_a, i | (_players_ai[p->index].railtype_to_use << 8), DC_AUTO | DC_EXEC, CMD_BUILD_BRIDGE);
_players_ai[p->index].cur_tile_a = arf.bridge_end_tile;
_players_ai[p->index].state_counter = 0;
} else if (arf.best_ptr[0] & 0x40) {
// tunnel
@@ -2282,7 +2233,7 @@ static bool AiRemoveTileAndGoForward(Player *p)
return false;
_players_ai[p->index].cur_tile_a = TILE_MASK(_build_tunnel_endtile - TileOffsByDiagDir(_players_ai[p->index].cur_dir_a));
return true;
} else { // IsBridge(tile)
} else {
// Check if the bridge points in the right direction.
// This is not really needed the first place AiRemoveTileAndGoForward is called.
if (DiagDirToAxis(GetTunnelBridgeDirection(tile)) != (_players_ai[p->index].cur_dir_a & 1)) return false;
@@ -2667,7 +2618,8 @@ static CommandCost AiDoBuildDefaultRoadBlock(TileIndex tile, const AiDefaultBloc
_cleared_town = NULL;
if (p->mode == 2) {
if (IsNormalRoadTile(c) &&
if (IsTileType(c, MP_ROAD) &&
GetRoadTileType(c) == ROAD_TILE_NORMAL &&
(GetRoadBits(c, ROADTYPE_ROAD) & p->attr) != 0) {
roadflag |= 2;
@@ -2709,7 +2661,7 @@ clear_town_stuff:;
if (GetTileSlope(c, NULL) != SLOPE_FLAT) return CMD_ERROR;
if (!IsNormalRoadTile(c)) {
if (!IsTileType(c, MP_ROAD) || GetRoadTileType(c) != ROAD_TILE_NORMAL) {
ret = DoCommand(c, 0, 0, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_LANDSCAPE_CLEAR);
if (CmdFailed(ret)) return CMD_ERROR;
}
@@ -2877,14 +2829,14 @@ static bool AiCheckRoadPathBetter(AiRoadFinder *arf, const byte *p)
}
static bool AiEnumFollowRoad(TileIndex tile, AiRoadEnum *a, int track, uint length)
static bool AiEnumFollowRoad(TileIndex tile, AiRoadEnum *a, int track, uint length, byte *state)
{
uint dist = DistanceManhattan(tile, a->dest);
if (dist <= a->best_dist) {
TileIndex tile2 = TILE_MASK(tile + TileOffsByDiagDir(_dir_by_track[track]));
if (IsNormalRoadTile(tile2)) {
if (IsTileType(tile2, MP_ROAD) && GetRoadTileType(tile2) == ROAD_TILE_NORMAL) {
a->best_dist = dist;
a->best_tile = tile;
a->best_track = track;
@@ -2912,14 +2864,14 @@ static bool AiCheckRoadFinished(Player *p)
tile = TILE_MASK(_players_ai[p->index].cur_tile_a + TileOffsByDiagDir(dir));
if (IsRoadStopTile(tile) || IsTileDepotType(tile, TRANSPORT_ROAD)) return false;
bits = TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, ROADTYPES_ROAD)) & _ai_road_table_and[dir];
bits = GetTileTrackStatus(tile, TRANSPORT_ROAD, ROADTYPES_ROAD) & _ai_road_table_and[dir];
if (bits == 0) return false;
are.best_dist = (uint)-1;
uint i;
FOR_EACH_SET_BIT(i, bits) {
FollowTrack(tile, 0x1000 | TRANSPORT_ROAD, ROADTYPES_ROAD, (DiagDirection)_dir_by_track[i], (TPFEnumProc*)AiEnumFollowRoad, NULL, &are);
FollowTrack(tile, 0x3000 | TRANSPORT_ROAD, ROADTYPES_ROAD, (DiagDirection)_dir_by_track[i], (TPFEnumProc*)AiEnumFollowRoad, NULL, &are);
}
if (DistanceManhattan(tile, are.dest) <= are.best_dist) return false;
@@ -2966,7 +2918,7 @@ static inline void AiCheckBuildRoadBridgeHere(AiRoadFinder *arf, TileIndex tile,
tile_new = TILE_MASK(tile_new + TileOffsByDiagDir(dir2));
type = GetTileType(tile_new);
if (type == MP_CLEAR || type == MP_TREES || GetTileSlope(tile_new, NULL) != SLOPE_FLAT) {
if (type == MP_CLEAR || type == MP_TREES || GetTileSlope(tile, NULL) != SLOPE_FLAT) {
// Allow a bridge if either we have a tile that's water, rail or street,
// or if we found an up tile.
if (!flag) return;
@@ -3115,36 +3067,26 @@ do_some_terraform:
tile = TILE_MASK(_players_ai[p->index].cur_tile_a + TileOffsByDiagDir(_players_ai[p->index].cur_dir_a));
if (arf.best_ptr[0] & 0x80) {
TileIndex t1 = tile;
TileIndex t2 = arf.bridge_end_tile;
int i;
int32 bridge_len;
_players_ai[p->index].cur_tile_a = arf.bridge_end_tile;
bridge_len = GetBridgeLength(tile, _players_ai[p->index].cur_tile_a); // tile
int32 bridge_len = GetTunnelBridgeLength(t1, t2);
Axis axis = (TileX(t1) == TileX(t2) ? AXIS_Y : AXIS_X);
/* try to build a long road instead of bridge - CMD_BUILD_LONG_ROAD has to fail if it couldn't build at least one piece! */
CommandCost cost = DoCommand(t2, t1, (t2 < t1 ? 1 : 2) | (axis << 2) | (ROADTYPE_ROAD << 3), DC_AUTO | DC_NO_WATER, CMD_BUILD_LONG_ROAD);
if (CmdSucceeded(cost) && cost.GetCost() <= p->player_money) {
DoCommand(t2, t1, (t2 < t1 ? 1 : 2) | (axis << 2) | (ROADTYPE_ROAD << 3), DC_AUTO | DC_EXEC | DC_NO_WATER, CMD_BUILD_LONG_ROAD);
} else {
int i;
/* 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 */
for (i = MAX_BRIDGES - 1; i != 0; i--) {
if (CheckBridge_Stuff(i, bridge_len)) {
CommandCost cost = DoCommand(t1, t2, i + ((0x80 | ROADTYPES_ROAD) << 8), DC_AUTO, CMD_BUILD_BRIDGE);
if (CmdSucceeded(cost) && cost.GetCost() < (p->player_money >> 1) && cost.GetCost() < ((p->player_money + _economy.max_loan - p->current_loan) >> 5)) break;
}
/* 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)) {
CommandCost cost = DoCommand(tile, _players_ai[p->index].cur_tile_a, i + ((0x80 | ROADTYPES_ROAD) << 8), DC_AUTO, CMD_BUILD_BRIDGE);
if (CmdSucceeded(cost) && cost.GetCost() < (p->player_money >> 5)) break;
}
/* Build it */
DoCommand(t1, t2, i + ((0x80 | ROADTYPES_ROAD) << 8), DC_AUTO | DC_EXEC, CMD_BUILD_BRIDGE);
}
_players_ai[p->index].cur_tile_a = t2;
// Build it
DoCommand(tile, _players_ai[p->index].cur_tile_a, i + ((0x80 | ROADTYPES_ROAD) << 8), DC_AUTO | DC_EXEC, CMD_BUILD_BRIDGE);
_players_ai[p->index].state_counter = 0;
} else if (arf.best_ptr[0] & 0x40) {
// tunnel
@@ -3447,7 +3389,7 @@ static bool AiCheckAirportResources(TileIndex tile, const AiDefaultBlockData *p,
const AirportFTAClass* airport = GetAirport(p->attr);
uint w = airport->size_x;
uint h = airport->size_y;
uint rad = _patches.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED;
uint rad = _patches.modified_catchment ? airport->catchment : 4;
if (cargo & 0x80) {
GetProductionAroundTiles(values, tile2, w, h, rad);
@@ -3566,20 +3508,7 @@ static void AiStateBuildAircraftVehicles(Player *p)
tile = TILE_ADD(_players_ai[p->index].src.use_tile, ToTileIndexDiff(ptr->tileoffs));
/* determine forbidden aircraft bits */
byte forbidden = 0;
for (i = 0; _players_ai[p->index].order_list_blocks[i] != 0xFF; i++) {
const AiBuildRec *aib = (&_players_ai[p->index].src) + _players_ai[p->index].order_list_blocks[i];
const Station *st = GetStationByTile(aib->use_tile);
if (st == NULL || !(st->facilities & FACIL_AIRPORT)) continue;
AirportFTAClass::Flags flags = st->Airport()->flags;
if (!(flags & AirportFTAClass::AIRPLANES)) forbidden |= AIR_CTOL | AIR_FAST; // no planes for heliports / oil rigs
if (flags & AirportFTAClass::SHORT_STRIP) forbidden |= AIR_FAST; // no fast planes for small airports
}
veh = AiChooseAircraftToBuild(p->player_money, forbidden);
veh = AiChooseAircraftToBuild(p->player_money, _players_ai[p->index].build_kind != 0 ? 0 : AIR_CTOL);
if (veh == INVALID_ENGINE) return;
/* XXX - Have the AI pick the hangar terminal in an airport. Eg get airport-type
@@ -3777,7 +3706,7 @@ pos_3:
if (IsLevelCrossing(tile)) goto is_rail_crossing;
if (IsRoadDepot(tile)) {
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT) {
DiagDirection dir;
TileIndex t;

View File

@@ -15,8 +15,6 @@
#include "../../player_base.h"
#include "../../player_func.h"
#include "../ai.h"
#include "../../tunnelbridge.h"
// Build HQ
// Params:
@@ -60,7 +58,7 @@ CommandCost AiNew_Build_Bridge(Player *p, TileIndex tile_a, TileIndex tile_b, by
int bridge_type, bridge_len, type, type2;
// Find a good bridgetype (the best money can buy)
bridge_len = GetTunnelBridgeLength(tile_a, tile_b);
bridge_len = GetBridgeLength(tile_a, tile_b);
type = type2 = 0;
for (bridge_type = MAX_BRIDGES-1; bridge_type >= 0; bridge_type--) {
if (CheckBridge_Stuff(bridge_type, bridge_len)) {
@@ -236,29 +234,30 @@ EngineID AiNew_PickVehicle(Player *p)
} else {
EngineID best_veh_index = INVALID_ENGINE;
int32 best_veh_rating = 0;
EngineID start = ROAD_ENGINES_INDEX;
EngineID end = ROAD_ENGINES_INDEX + NUM_ROAD_ENGINES;
EngineID i;
/* Loop through all road vehicles */
FOR_ALL_ENGINEIDS_OF_TYPE(i, VEH_ROAD) {
for (i = start; i != end; i++) {
const RoadVehicleInfo *rvi = RoadVehInfo(i);
const Engine* e = GetEngine(i);
int32 rating;
CommandCost ret;
/* Skip vehicles which can't take our cargo type */
if (rvi->cargo_type != _players_ainew[p->index].cargo && !CanRefitTo(i, _players_ainew[p->index].cargo)) continue;
/* Skip trams */
if (HasBit(EngInfo(i)->misc_flags, EF_ROAD_TRAM)) continue;
// Is it availiable?
// Also, check if the reliability of the vehicle is above the AI_VEHICLE_MIN_RELIABILTY
if (!HasBit(e->player_avail, _current_player) || e->reliability * 100 < AI_VEHICLE_MIN_RELIABILTY << 16) continue;
/* Rate and compare the engine by speed & capacity */
int rating = rvi->max_speed * rvi->capacity;
rating = rvi->max_speed * rvi->capacity;
if (rating <= best_veh_rating) continue;
// Can we build it?
CommandCost ret = AI_DoCommand(0, i, 0, DC_QUERY_COST, CMD_BUILD_ROAD_VEH);
ret = AI_DoCommand(0, i, 0, DC_QUERY_COST, CMD_BUILD_ROAD_VEH);
if (CmdFailed(ret)) continue;
best_veh_rating = rating;

View File

@@ -14,7 +14,6 @@
#include "../../variables.h"
#include "../../player_base.h"
#include "../../player_func.h"
#include "../../tunnelbridge.h"
#define TEST_STATION_NO_DIR 0xFF
@@ -321,7 +320,7 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr
new_tile += TileOffsByDiagDir(dir);
// Precheck, is the length allowed?
if (!CheckBridge_Stuff(0, GetTunnelBridgeLength(tile, new_tile))) break;
if (!CheckBridge_Stuff(0, GetBridgeLength(tile, new_tile))) break;
// Check if we hit the station-tile.. we don't like that!
if (TILES_BETWEEN(new_tile, PathFinderInfo->end_tile_tl, PathFinderInfo->end_tile_br)) break;
@@ -341,11 +340,14 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr
// Next, check for tunnels!
// Tunnels can only be built on slopes corresponding to the direction
// For now, we check both sides for this tile.. terraforming gives fuzzy result
if (tileh == InclinedSlope(dir)) {
if ((dir == DIAGDIR_NE && tileh == SLOPE_NE) ||
(dir == DIAGDIR_SE && tileh == SLOPE_SE) ||
(dir == DIAGDIR_SW && tileh == SLOPE_SW) ||
(dir == DIAGDIR_NW && tileh == SLOPE_NW)) {
// Now simply check if a tunnel can be build
ret = AI_DoCommand(tile, (PathFinderInfo->rail_or_road?0:0x200), 0, DC_AUTO, CMD_BUILD_TUNNEL);
tileh = GetTileSlope(_build_tunnel_endtile, NULL);
if (CmdSucceeded(ret) && IsInclinedSlope(tileh)) {
if (CmdSucceeded(ret) && (tileh == SLOPE_SW || tileh == SLOPE_SE || tileh == SLOPE_NW || tileh == SLOPE_NE)) {
aystar->neighbours[aystar->num_neighbours].tile = _build_tunnel_endtile;
aystar->neighbours[aystar->num_neighbours].user_data[0] = AI_PATHFINDER_FLAG_TUNNEL + (dir << 8);
aystar->neighbours[aystar->num_neighbours++].direction = 0;
@@ -357,6 +359,10 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr
extern Foundation GetRailFoundation(Slope tileh, TrackBits bits); // XXX function declaration in .c
extern Foundation GetRoadFoundation(Slope tileh, RoadBits bits); // XXX function declaration in .c
extern Foundation GetBridgeFoundation(Slope tileh, Axis); // XXX function declaration in .c
enum BridgeFoundation {
BRIDGE_NO_FOUNDATION = 1 << 0 | 1 << 3 | 1 << 6 | 1 << 9 | 1 << 12,
};
// The most important function: it calculates the g-value
static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current, OpenListNode *parent)
@@ -399,7 +405,8 @@ static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current,
if (parent->path.node.user_data[0] == 0 && current->user_data[0] == 0) {
if (PathFinderInfo->rail_or_road) {
Foundation f = GetRailFoundation(parent_tileh, (TrackBits)(1 << AiNew_GetRailDirection(parent->path.parent->node.tile, parent->path.node.tile, current->tile)));
if (IsInclinedFoundation(f) || (!IsFoundation(f) && IsInclinedSlope(parent_tileh))) {
// Maybe is BRIDGE_NO_FOUNDATION a bit strange here, but it contains just the right information..
if (IsInclinedFoundation(f) || (!IsFoundation(f) && HasBit(BRIDGE_NO_FOUNDATION, parent_tileh))) {
res += AI_PATHFINDER_TILE_GOES_UP_PENALTY;
} else {
res += AI_PATHFINDER_FOUNDATION_PENALTY;
@@ -407,7 +414,7 @@ static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current,
} else {
if (!IsRoad(parent->path.node.tile) || !IsTileType(parent->path.node.tile, MP_TUNNELBRIDGE)) {
Foundation f = GetRoadFoundation(parent_tileh, (RoadBits)AiNew_GetRoadDirection(parent->path.parent->node.tile, parent->path.node.tile, current->tile));
if (IsInclinedFoundation(f) || (!IsFoundation(f) && IsInclinedSlope(parent_tileh))) {
if (IsInclinedFoundation(f) || (!IsFoundation(f) && HasBit(BRIDGE_NO_FOUNDATION, parent_tileh))) {
res += AI_PATHFINDER_TILE_GOES_UP_PENALTY;
} else {
res += AI_PATHFINDER_FOUNDATION_PENALTY;
@@ -422,19 +429,29 @@ static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current,
int r;
// Tunnels are very expensive when build on long routes..
// Ironicly, we are using BridgeCode here ;)
r = AI_PATHFINDER_TUNNEL_PENALTY * GetTunnelBridgeLength(current->tile, parent->path.node.tile);
r = AI_PATHFINDER_TUNNEL_PENALTY * GetBridgeLength(current->tile, parent->path.node.tile);
res += r + (r >> 8);
}
// Are we part of a bridge?
if ((AI_PATHFINDER_FLAG_BRIDGE & current->user_data[0]) != 0) {
// That means for every length a penalty
res += AI_PATHFINDER_BRIDGE_PENALTY * GetTunnelBridgeLength(current->tile, parent->path.node.tile);
res += AI_PATHFINDER_BRIDGE_PENALTY * GetBridgeLength(current->tile, parent->path.node.tile);
// Check if we are going up or down, first for the starting point
// In user_data[0] is at the 8th bit the direction
if (!HasBridgeFlatRamp(parent_tileh, (Axis)((current->user_data[0] >> 8) & 1))) res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
if (!HasBit(BRIDGE_NO_FOUNDATION, parent_tileh)) {
if (IsLeveledFoundation(GetBridgeFoundation(parent_tileh, (Axis)((current->user_data[0] >> 8) & 1)))) {
res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
}
}
// Second for the end point
if (!HasBridgeFlatRamp(tileh, (Axis)((current->user_data[0] >> 8) & 1))) res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
if (!HasBit(BRIDGE_NO_FOUNDATION, tileh)) {
if (IsLeveledFoundation(GetBridgeFoundation(tileh, (Axis)((current->user_data[0] >> 8) & 1)))) {
res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
}
}
if (parent_tileh == SLOPE_FLAT) res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
if (tileh == SLOPE_FLAT) res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
}
// To prevent the AI from taking the fastest way in tiles, but not the fastest way

View File

@@ -801,7 +801,8 @@ static void AiNew_State_FindDepot(Player *p)
for (j = DIAGDIR_BEGIN; j < DIAGDIR_END; j++) {
TileIndex t = tile + TileOffsByDiagDir(j);
if (IsRoadDepotTile(t) &&
if (IsTileType(t, MP_ROAD) &&
GetRoadTileType(t) == ROAD_TILE_DEPOT &&
IsTileOwner(t, _current_player) &&
GetRoadDepotDirection(t) == ReverseDiagDir(j)) {
_players_ainew[p->index].depot_tile = t;
@@ -1101,7 +1102,7 @@ static void AiNew_State_BuildDepot(Player *p)
CommandCost res;
assert(_players_ainew[p->index].state == AI_STATE_BUILD_DEPOT);
if (IsRoadDepotTile(_players_ainew[p->index].depot_tile)) {
if (IsTileType(_players_ainew[p->index].depot_tile, MP_ROAD) && GetRoadTileType(_players_ainew[p->index].depot_tile) == ROAD_TILE_DEPOT) {
if (IsTileOwner(_players_ainew[p->index].depot_tile, _current_player)) {
// The depot is already built
_players_ainew[p->index].state = AI_STATE_BUILD_VEHICLE;
@@ -1251,7 +1252,7 @@ static void AiNew_CheckVehicle(Player *p, Vehicle *v)
if (v->age > 360) {
// If both years together are not more than AI_MINIMUM_ROUTE_PROFIT,
// it is not worth the line I guess...
if (v->profit_last_year + v->profit_this_year < (Money)256 * AI_MINIMUM_ROUTE_PROFIT ||
if (v->profit_last_year + v->profit_this_year < AI_MINIMUM_ROUTE_PROFIT ||
(v->reliability * 100 >> 16) < 40) {
// There is a possibility that the route is fucked up...
if (v->cargo.DaysInTransit() > AI_VEHICLE_LOST_DAYS) {

View File

@@ -124,7 +124,6 @@ struct Aircraft : public Vehicle {
Money GetRunningCost() const { return AircraftVehInfo(this->engine_type)->running_cost * _price.aircraft_running; }
bool IsInDepot() const { return (this->vehstatus & VS_HIDDEN) != 0 && IsHangarTile(this->tile); }
void Tick();
void OnNewDay();
};
#endif /* AIRCRAFT_H */

View File

@@ -190,17 +190,15 @@ void DrawAircraftEngine(int x, int y, EngineID engine, SpriteID pal)
{
const AircraftVehicleInfo* avi = AircraftVehInfo(engine);
int spritenum = avi->image_index;
SpriteID sprite = 0;
SpriteID sprite = (6 + _aircraft_sprite[spritenum]);
if (is_custom_sprite(spritenum)) {
sprite = GetCustomVehicleIcon(engine, DIR_W);
if (sprite == 0) {
spritenum = _orig_aircraft_vehicle_info[engine - AIRCRAFT_ENGINES_INDEX].image_index;
sprite = (6 + _aircraft_sprite[spritenum]);
}
}
if (sprite == 0) {
sprite = 6 + _aircraft_sprite[spritenum];
}
DrawSprite(sprite, pal, x, y);
@@ -323,8 +321,6 @@ CommandCost CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
u->z_pos = GetSlopeZ(x, y);
v->z_pos = u->z_pos + 1;
v->running_ticks = 0;
// u->delta_x = u->delta_y = 0;
v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
@@ -529,7 +525,7 @@ CommandCost CmdStartStopAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32
/* Check if this aircraft can be started/stopped. The callback will fail or
* return 0xFF if it can. */
uint16 callback = GetVehicleCallback(CBID_VEHICLE_START_STOP_CHECK, 0, 0, v->engine_type, v);
if (callback != CALLBACK_FAILED && GB(callback, 0, 8) != 0xFF) {
if (callback != CALLBACK_FAILED && callback != 0xFF) {
StringID error = GetGRFStringID(GetEngineGRFID(v->engine_type), 0xD000 + callback);
return_cmd_error(error);
}
@@ -541,7 +537,7 @@ CommandCost CmdStartStopAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32
v->vehstatus ^= VS_STOPPED;
v->cur_speed = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
}
@@ -580,7 +576,7 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
if (flags & DC_EXEC) {
ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
return CommandCost();
}
@@ -590,7 +586,7 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
if (v->current_order.flags & OFB_UNLOAD) v->cur_order_index++;
v->current_order.type = OT_DUMMY;
v->current_order.flags = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
} else {
bool next_airport_has_hangar = true;
@@ -614,7 +610,7 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
v->current_order.refit_cargo = CT_INVALID;
v->current_order.dest = next_airport_index;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
if (v->u.air.state == FLYING && !next_airport_has_hangar) {
/* The aircraft is now heading for a different hangar than the next in the orders */
AircraftNextAirportPos_and_Order(v);
@@ -706,7 +702,7 @@ CommandCost CmdRefitAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
static void CheckIfAircraftNeedsService(Vehicle *v)
{
if (_patches.servint_aircraft == 0 || !v->NeedsAutomaticServicing()) return;
if (_patches.servint_aircraft == 0 || !VehicleNeedsService(v)) return;
if (v->IsInDepot()) {
VehicleServiceInDepot(v);
return;
@@ -719,36 +715,35 @@ static void CheckIfAircraftNeedsService(Vehicle *v)
// v->u.air.targetairport = st->index;
v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OFB_NON_STOP;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
} else if (v->current_order.type == OT_GOTO_DEPOT) {
v->current_order.type = OT_DUMMY;
v->current_order.flags = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
}
void Aircraft::OnNewDay()
void OnNewDay_Aircraft(Vehicle *v)
{
if (!IsNormalAircraft(this)) return;
if (!IsNormalAircraft(v)) return;
if ((++this->day_counter & 7) == 0) DecreaseVehicleValue(this);
if ((++v->day_counter & 7) == 0) DecreaseVehicleValue(v);
CheckOrders(this);
CheckOrders(v);
CheckVehicleBreakdown(this);
AgeVehicle(this);
CheckIfAircraftNeedsService(this);
CheckVehicleBreakdown(v);
AgeVehicle(v);
CheckIfAircraftNeedsService(v);
if (this->running_ticks == 0) return;
if (v->vehstatus & VS_STOPPED) return;
CommandCost cost(EXPENSES_AIRCRAFT_RUN, GetVehicleProperty(this, 0x0E, AircraftVehInfo(this->engine_type)->running_cost) * _price.aircraft_running * this->running_ticks / (364 * DAY_TICKS));
CommandCost cost = CommandCost(EXPENSES_AIRCRAFT_RUN, GetVehicleProperty(v, 0x0E, AircraftVehInfo(v->engine_type)->running_cost) * _price.aircraft_running / 364);
this->profit_this_year -= cost.GetCost();
this->running_ticks = 0;
v->profit_this_year -= cost.GetCost() >> 8;
SubtractMoneyFromPlayerFract(this->owner, cost);
SubtractMoneyFromPlayerFract(v->owner, cost);
InvalidateWindow(WC_VEHICLE_DETAILS, this->index);
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
}
@@ -926,10 +921,6 @@ static int UpdateAircraftSpeed(Vehicle *v, uint speed_limit = SPEED_LIMIT_NONE,
uint spd = v->acceleration * 16;
byte t;
/* Adjust speed limits by plane speed factor to prevent taxiing
* and take-off speeds being too low. */
speed_limit *= _patches.plane_speed;
if (v->u.air.cached_max_speed < speed_limit) {
if (v->cur_speed < speed_limit) hard_limit = false;
speed_limit = v->u.air.cached_max_speed;
@@ -939,15 +930,7 @@ static int UpdateAircraftSpeed(Vehicle *v, uint speed_limit = SPEED_LIMIT_NONE,
v->subspeed = (t=v->subspeed) + (byte)spd;
/* Aircraft's current speed is used twice so that very fast planes are
* forced to slow down rapidly in the short distance needed. The magic
* value 16384 was determined to give similar results to the old speed/48
* method at slower speeds. This also results in less reduction at slow
* speeds to that aircraft do not get to taxi speed straight after
* touchdown. */
if (!hard_limit && v->cur_speed > speed_limit) {
speed_limit = v->cur_speed - max(1, ((v->cur_speed * v->cur_speed) / 16384) / _patches.plane_speed);
}
if (!hard_limit && v->cur_speed > speed_limit) speed_limit = v->cur_speed - (v->cur_speed / 48);
spd = min(v->cur_speed + (spd >> 8) + (v->subspeed < t), speed_limit);
@@ -958,12 +941,9 @@ static int UpdateAircraftSpeed(Vehicle *v, uint speed_limit = SPEED_LIMIT_NONE,
if (spd != v->cur_speed) {
v->cur_speed = spd;
if (_patches.vehicle_speed)
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
/* Adjust distance moved by plane speed setting */
if (_patches.plane_speed > 1) spd /= _patches.plane_speed;
if (!(v->direction & 1)) spd = spd * 3 / 4;
spd += v->progress;
@@ -1107,36 +1087,34 @@ static bool AircraftController(Vehicle *v)
/* Helicopter landing. */
if (amd->flag & AMED_HELI_LOWER) {
if (st->airport_tile == 0) {
/* FIXME - AircraftController -> if station no longer exists, do not land
* helicopter will circle until sign disappears, then go to next order
* what to do when it is the only order left, right now it just stays in 1 place */
v->u.air.state = FLYING;
UpdateAircraftCache(v);
AircraftNextAirportPos_and_Order(v);
return false;
}
count = UpdateAircraftSpeed(v);
if (count > 0) {
if (st->airport_tile == 0) {
/* FIXME - AircraftController -> if station no longer exists, do not land
* helicopter will circle until sign disappears, then go to next order
* what to do when it is the only order left, right now it just stays in 1 place */
v->u.air.state = FLYING;
UpdateAircraftCache(v);
AircraftNextAirportPos_and_Order(v);
return false;
}
/* Vehicle is now at the airport. */
v->tile = st->airport_tile;
/* Vehicle is now at the airport. */
v->tile = st->airport_tile;
/* Find altitude of landing position. */
int z = GetSlopeZ(x, y) + 1 + afc->delta_z;
/* Find altitude of landing position. */
int z = GetSlopeZ(x, y) + 1 + afc->delta_z;
if (z == v->z_pos) {
Vehicle *u = v->Next()->Next();
if (z == v->z_pos) {
Vehicle *u = v->Next()->Next();
/* Increase speed of rotors. When speed is 80, we've landed. */
if (u->cur_speed >= 80) return true;
u->cur_speed += 4;
} else {
count = UpdateAircraftSpeed(v);
if (count > 0) {
if (v->z_pos > z) {
SetAircraftPosition(v, v->x_pos, v->y_pos, max(v->z_pos - count, z));
} else {
SetAircraftPosition(v, v->x_pos, v->y_pos, min(v->z_pos + count, z));
}
/* Increase speed of rotors. When speed is 80, we've landed. */
if (u->cur_speed >= 80) return true;
u->cur_speed += 4;
} else if (v->z_pos > z) {
SetAircraftPosition(v, v->x_pos, v->y_pos, max(v->z_pos - count, z));
} else {
SetAircraftPosition(v, v->x_pos, v->y_pos, min(v->z_pos + count, z));
}
}
return false;
@@ -1216,7 +1194,7 @@ static bool AircraftController(Vehicle *v)
v->tile = gp.new_tile;
/* If vehicle is in the air, use tile coordinate 0. */
if (amd->flag & (AMED_TAKEOFF | AMED_SLOWTURN | AMED_LAND)) v->tile = 0;
// if (amd->flag & (AMED_TAKEOFF | AMED_SLOWTURN | AMED_LAND)) v->tile = 0;
/* Adjust Z for land or takeoff? */
uint z = v->z_pos;
@@ -1310,7 +1288,8 @@ static void HandleCrashedAircraft(Vehicle *v)
CLRBITS(st->airport_flags, RUNWAY_IN_OUT_block); // commuter airport
CLRBITS(st->airport_flags, RUNWAY_IN2_block); // intercontinental
MarkSingleVehicleDirty(v);
BeginVehicleMove(v);
EndVehicleMove(v);
DoDeleteAircraft(v);
}
@@ -1370,7 +1349,7 @@ static void ProcessAircraftOrder(Vehicle *v)
case OT_GOTO_DEPOT:
if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return;
if (v->current_order.flags & OFB_SERVICE_IF_NEEDED &&
!v->NeedsServicing()) {
!VehicleNeedsService(v)) {
UpdateVehicleTimetable(v, true);
v->cur_order_index++;
}
@@ -1438,7 +1417,7 @@ void Aircraft::MarkDirty()
{
this->cur_image = this->GetImage(this->direction);
if (this->subtype == AIR_HELICOPTER) this->Next()->Next()->cur_image = GetRotorImage(this);
MarkSingleVehicleDirty(this);
MarkAllViewportsDirty(this->left_coord, this->top_coord, this->right_coord + 1, this->bottom_coord + 1);
}
static void CrashAirplane(Vehicle *v)
@@ -1570,45 +1549,6 @@ static void AircraftLeaveHangar(Vehicle *v)
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
}
/** Checks if an aircraft should head towards a hangar because it needs replacement
* @param *v the vehicle to test
* @return true if the aircraft should head towards a hangar
*/
static inline bool CheckSendAircraftToHangarForReplacement(const Vehicle *v)
{
EngineID new_engine;
Player *p = GetPlayer(v->owner);
if (VehicleHasDepotOrders(v)) return false; // The aircraft will end up in the hangar eventually on it's own
new_engine = EngineReplacementForPlayer(p, v->engine_type, v->group_id);
if (new_engine == INVALID_ENGINE) {
/* There is no autoreplace assigned to this EngineID so we will set it to renew to the same type if needed */
new_engine = v->engine_type;
if (!v->NeedsAutorenewing(p)) {
/* No need to replace the aircraft */
return false;
}
}
if (!HasBit(GetEngine(new_engine)->player_avail, v->owner)) {
/* Engine is not buildable anymore */
return false;
}
if (p->player_money < (p->engine_renew_money + (2 * DoCommand(0, new_engine, 0, DC_QUERY_COST, CMD_BUILD_AIRCRAFT).GetCost()))) {
/* We lack enough money to request the replacement right away.
* We want 2*(the price of the new vehicle) and not looking at the value of the vehicle we are going to sell.
* The reason is that we don't want to send a whole lot of vehicles to the hangars when we only have enough money to replace a single one.
* Remember this happens in the background so the user can't stop this. */
return false;
}
/* We found no reason NOT to send the aircraft to a hangar so we will send it there at once */
return true;
}
////////////////////////////////////////////////////////////////////////////////
/////////////////// AIRCRAFT MOVEMENT SCHEME ////////////////////////////////
@@ -1737,16 +1677,22 @@ static void AircraftEventHandler_EndTakeOff(Vehicle *v, const AirportFTAClass *a
static void AircraftEventHandler_HeliTakeOff(Vehicle *v, const AirportFTAClass *apc)
{
const Player* p = GetPlayer(v->owner);
v->u.air.state = FLYING;
v->UpdateDeltaXY(INVALID_DIR);
/* get the next position to go to, differs per airport */
AircraftNextAirportPos_and_Order(v);
/* Send the helicopter to a hangar if needed for replacement */
if (CheckSendAircraftToHangarForReplacement(v)) {
_current_player = v->owner;
DoCommand(v->tile, v->index, DEPOT_SERVICE | DEPOT_LOCATE_HANGAR, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR);
/* check if the aircraft needs to be replaced or renewed and send it to a hangar if needed
* unless it is due for renewal but the engine is no longer available */
if (v->owner == _local_player && (
EngineHasReplacementForPlayer(p, v->engine_type, v->group_id) ||
((p->engine_renew && v->age - v->max_age > p->engine_renew_months * 30) &&
HasBit(GetEngine(v->engine_type)->player_avail, _local_player))
)) {
_current_player = _local_player;
DoCommandP(v->tile, v->index, DEPOT_SERVICE | DEPOT_LOCATE_HANGAR, NULL, CMD_SEND_AIRCRAFT_TO_HANGAR | CMD_SHOW_NO_ERROR);
_current_player = OWNER_NONE;
}
}
@@ -1796,10 +1742,16 @@ static void AircraftEventHandler_Landing(Vehicle *v, const AirportFTAClass *apc)
AircraftLandAirplane(v); // maybe crash airplane
/* check if the aircraft needs to be replaced or renewed and send it to a hangar if needed */
if (CheckSendAircraftToHangarForReplacement(v)) {
_current_player = v->owner;
DoCommand(v->tile, v->index, DEPOT_SERVICE, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR);
_current_player = OWNER_NONE;
if (v->current_order.type != OT_GOTO_DEPOT && v->owner == _local_player) {
/* only the vehicle owner needs to calculate the rest (locally) */
const Player* p = GetPlayer(v->owner);
if (EngineHasReplacementForPlayer(p, v->engine_type, v->group_id) ||
(p->engine_renew && v->age - v->max_age > (p->engine_renew_months * 30))) {
/* send the aircraft to the hangar at next airport */
_current_player = _local_player;
DoCommandP(v->tile, v->index, DEPOT_SERVICE, NULL, CMD_SEND_AIRCRAFT_TO_HANGAR | CMD_SHOW_NO_ERROR);
_current_player = OWNER_NONE;
}
}
}
@@ -2137,6 +2089,7 @@ static bool AirportFindFreeHelipad(Vehicle *v, const AirportFTAClass *apc)
static void AircraftEventHandler(Vehicle *v, int loop)
{
v->tick_counter++;
v->current_order_time++;
if (v->vehstatus & VS_CRASHED) {
HandleCrashedAircraft(v);
@@ -2150,7 +2103,7 @@ static void AircraftEventHandler(Vehicle *v, int loop)
if (v->breakdown_ctr <= 2) {
HandleBrokenAircraft(v);
} else {
if (v->current_order.type != OT_LOADING) v->breakdown_ctr--;
v->breakdown_ctr--;
}
}
@@ -2167,14 +2120,10 @@ void Aircraft::Tick()
{
if (!IsNormalAircraft(this)) return;
if (!(this->vehstatus & VS_STOPPED)) this->running_ticks++;
if (this->subtype == AIR_HELICOPTER) HelicopterTickHandler(this);
AgeAircraftCargo(this);
this->current_order_time++;
for (uint i = 0; i != 2; i++) {
AircraftEventHandler(this, i);
if (this->type != VEH_AIRCRAFT) // In case it was deleted

View File

@@ -179,19 +179,14 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
airport = GetAirport(_selected_airport_type);
SetTileSelectSize(airport->size_x, airport->size_y);
int rad = _patches.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED;
int rad = _patches.modified_catchment ? airport->catchment : 4;
if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
DrawWindowWidgets(w);
// strings such as 'Size' and 'Coverage Area'
// 'Coverage Area'
int text_end = DrawStationCoverageAreaText(2, 206, SCT_ALL, rad) + 4;
if (text_end > w->widget[6].bottom) {
SetWindowDirty(w);
ResizeWindowForWidget(w, 6, 0, text_end - w->widget[6].bottom);
SetWindowDirty(w);
}
DrawStationCoverageAreaText(2, 206, SCT_ALL, rad);
break;
}

View File

@@ -26,7 +26,7 @@ uint CountArticulatedParts(EngineID engine_type, bool purchase_window)
uint i;
for (i = 1; i < MAX_UVALUE(EngineID); i++) {
uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, engine_type, v);
if (callback == CALLBACK_FAILED || GB(callback, 0, 8) == 0xFF) break;
if (callback == CALLBACK_FAILED || callback == 0xFF) break;
}
delete v;
@@ -34,42 +34,6 @@ uint CountArticulatedParts(EngineID engine_type, bool purchase_window)
return i - 1;
}
uint16 *GetCapacityOfArticulatedParts(EngineID engine, VehicleType type)
{
static uint16 capacity[NUM_CARGO];
memset(capacity, 0, sizeof(capacity));
if (type == VEH_TRAIN) {
const RailVehicleInfo *rvi = RailVehInfo(engine);
capacity[rvi->cargo_type] = rvi->capacity;
if (rvi->railveh_type == RAILVEH_MULTIHEAD) capacity[rvi->cargo_type] += rvi->capacity;
} else if (type == VEH_ROAD) {
const RoadVehicleInfo *rvi = RoadVehInfo(engine);
capacity[rvi->cargo_type] = rvi->capacity;
}
if (!HasBit(EngInfo(engine)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return capacity;
for (uint i = 1; i < MAX_UVALUE(EngineID); i++) {
uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, engine, NULL);
if (callback == CALLBACK_FAILED || GB(callback, 0, 8) == 0xFF) break;
EngineID artic_engine = GetFirstEngineOfType(type) + GB(callback, 0, 7);
if (type == VEH_TRAIN) {
const RailVehicleInfo *rvi = RailVehInfo(artic_engine);
capacity[rvi->cargo_type] += GetEngineProperty(artic_engine, 0x14, rvi->capacity);
} else if (type == VEH_ROAD) {
const RoadVehicleInfo *rvi = RoadVehInfo(artic_engine);
capacity[rvi->cargo_type] += GetEngineProperty(artic_engine, 0x0F, rvi->capacity);
}
}
return capacity;
}
void AddArticulatedParts(Vehicle **vl, VehicleType type)
{
const Vehicle *v = vl[0];
@@ -79,7 +43,7 @@ void AddArticulatedParts(Vehicle **vl, VehicleType type)
for (uint i = 1; i < MAX_UVALUE(EngineID); i++) {
uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, v->engine_type, v);
if (callback == CALLBACK_FAILED || GB(callback, 0, 8) == 0xFF) return;
if (callback == CALLBACK_FAILED || callback == 0xFF) return;
/* Attempt to use pre-allocated vehicles until they run out. This can happen
* if the callback returns different values depending on the cargo type. */

View File

@@ -8,7 +8,6 @@
#include "vehicle_type.h"
uint CountArticulatedParts(EngineID engine_type, bool purchase_window);
uint16 *GetCapacityOfArticulatedParts(EngineID engine, VehicleType type);
void AddArticulatedParts(Vehicle **vl, VehicleType type);
#endif /* ARTICULATED_VEHICLES_H */

View File

@@ -21,11 +21,9 @@
#include "functions.h"
#include "variables.h"
#include "autoreplace_func.h"
#include "articulated_vehicles.h"
#include "table/strings.h"
/*
* move the cargo from one engine to another if possible
*/
@@ -95,7 +93,7 @@ static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type)
if (new_cargo_type == CT_INVALID) return CT_NO_REFIT; // Don't try to refit an engine with no cargo capacity
if (v->cargo_cap != 0 && (v->cargo_type == new_cargo_type || CanRefitTo(engine_type, v->cargo_type))) {
if (v->cargo_type == new_cargo_type || CanRefitTo(engine_type, v->cargo_type)) {
if (VerifyAutoreplaceRefitForOrders(v, engine_type)) {
return v->cargo_type == new_cargo_type ? (CargoID)CT_NO_REFIT : v->cargo_type;
} else {
@@ -140,9 +138,18 @@ static CommandCost ReplaceVehicle(Vehicle **w, byte flags, Money total_cost)
char *vehicle_name = NULL;
CargoID replacement_cargo_type;
/* Check if there is a autoreplacement set for the vehicle */
new_engine_type = EngineReplacementForPlayer(p, old_v->engine_type, old_v->group_id);
/* if not, just renew to the same type */
/* If the vehicle belongs to a group, check if the group is protected from the global autoreplace.
* If not, chek if an global auto replacement is defined */
new_engine_type = (IsValidGroupID(old_v->group_id) && GetGroup(old_v->group_id)->replace_protection) ?
INVALID_ENGINE :
EngineReplacementForPlayer(p, old_v->engine_type, ALL_GROUP);
/* If we don't set new_egnine_type previously, we try to check if an autoreplacement was defined
* for the group and the engine_type of the vehicle */
if (new_engine_type == INVALID_ENGINE && !IsAllGroupID(old_v->group_id)) {
new_engine_type = EngineReplacementForPlayer(p, old_v->engine_type, old_v->group_id);
}
if (new_engine_type == INVALID_ENGINE) new_engine_type = old_v->engine_type;
replacement_cargo_type = GetNewCargoTypeForReplace(old_v, new_engine_type);
@@ -168,10 +175,7 @@ static CommandCost ReplaceVehicle(Vehicle **w, byte flags, Money total_cost)
if (replacement_cargo_type != CT_NO_REFIT) {
/* add refit cost */
CommandCost refit_cost = GetRefitCost(new_engine_type);
if (old_v->type == VEH_TRAIN && RailVehInfo(new_engine_type)->railveh_type == RAILVEH_MULTIHEAD) {
/* Since it's a dualheaded engine we have to pay once more because the rear end is being refitted too. */
refit_cost.AddCost(refit_cost);
}
if (old_v->type == VEH_TRAIN && IsMultiheaded(old_v)) refit_cost.AddCost(refit_cost); // pay for both ends
cost.AddCost(refit_cost);
}
@@ -207,7 +211,7 @@ static CommandCost ReplaceVehicle(Vehicle **w, byte flags, Money total_cost)
DoCommand(0, (front->index << 16) | new_v->index, 1, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
} else {
// copy/clone the orders
DoCommand(0, (old_v->index << 16) | new_v->index, old_v->IsOrderListShared() ? CO_SHARE : CO_COPY, DC_EXEC, CMD_CLONE_ORDER);
DoCommand(0, (old_v->index << 16) | new_v->index, IsOrderListShared(old_v) ? CO_SHARE : CO_COPY, DC_EXEC, CMD_CLONE_ORDER);
new_v->cur_order_index = old_v->cur_order_index;
ChangeVehicleViewWindow(old_v, new_v);
new_v->profit_this_year = old_v->profit_this_year;
@@ -334,9 +338,25 @@ CommandCost MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs)
}
// check if the vehicle should be replaced
if (!w->NeedsAutorenewing(p) || // replace if engine is too old
if (!p->engine_renew ||
w->age - w->max_age < (p->engine_renew_months * 30) || // replace if engine is too old
w->max_age == 0) { // rail cars got a max age of 0
if (!EngineHasReplacementForPlayer(p, w->engine_type, w->group_id)) continue;
/* If the vehicle belongs to a group, check if the group is protected from the global autoreplace.
If not, chek if an global auto remplacement is defined */
if (IsValidGroupID(w->group_id)) {
if (!EngineHasReplacementForPlayer(p, w->engine_type, w->group_id) && (
GetGroup(w->group_id)->replace_protection ||
!EngineHasReplacementForPlayer(p, w->engine_type, ALL_GROUP))) {
continue;
}
} else if (IsDefaultGroupID(w->group_id)) {
if (!EngineHasReplacementForPlayer(p, w->engine_type, DEFAULT_GROUP) &&
!EngineHasReplacementForPlayer(p, w->engine_type, ALL_GROUP)) {
continue;
}
} else if (!EngineHasReplacementForPlayer(p, w->engine_type, ALL_GROUP)) {
continue;
}
}
/* Now replace the vehicle */

View File

@@ -36,24 +36,6 @@ static const StringID _rail_types_list[] = {
INVALID_STRING_ID
};
enum ReplaceVehicleWindowWidgets {
RVW_WIDGET_LEFT_DETAILS = 3,
RVW_WIDGET_START_REPLACE,
RVW_WIDGET_INFO_TAB,
RVW_WIDGET_STOP_REPLACE,
RVW_WIDGET_LEFT_MATRIX,
RVW_WIDGET_LEFT_SCROLLBAR,
RVW_WIDGET_RIGHT_MATRIX,
RVW_WIDGET_RIGHT_SCROLLBAR,
RVW_WIDGET_RIGHT_DETAILS,
RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE,
RVW_WIDGET_TRAIN_FLUFF_LEFT,
RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN,
RVW_WIDGET_TRAIN_FLUFF_RIGHT,
RVW_WIDGET_TRAIN_WAGONREMOVE_TOGGLE,
};
static int CDECL TrainEngineNumberSorter(const void *a, const void *b)
{
const EngineID va = *(const EngineID*)a;
@@ -80,7 +62,7 @@ void InitializeVehiclesGuiList()
void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g)
{
Player *p = GetPlayer(_local_player);
VehicleType type = GetEngine(e)->type;
byte type = GetEngine(e)->type;
uint num_engines = GetGroupNumEngines(_local_player, id_g, e);
if (num_engines == 0 || p->num_engines[e] == 0) {
@@ -175,7 +157,7 @@ static void GenerateReplaceVehList(Window *w, bool draw_left)
{
EngineID e;
EngineID selected_engine = INVALID_ENGINE;
VehicleType type = (VehicleType)w->window_number;
byte type = w->window_number;
byte i = draw_left ? 0 : 1;
EngineList *list = &WP(w, replaceveh_d).list[i];
@@ -282,7 +264,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
* Either list is empty
* or The selected replacement engine has a replacement (to prevent loops)
* or The right list (new replacement) has the existing replacement vehicle selected */
w->SetWidgetDisabledState(RVW_WIDGET_START_REPLACE,
w->SetWidgetDisabledState(4,
selected_id[0] == INVALID_ENGINE ||
selected_id[1] == INVALID_ENGINE ||
EngineReplacementForPlayer(p, selected_id[1], selected_group) != INVALID_ENGINE ||
@@ -291,7 +273,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
/* Disable the "Stop Replacing" button if:
* The left list (existing vehicle) is empty
* or The selected vehicle has no replacement set up */
w->SetWidgetDisabledState(RVW_WIDGET_STOP_REPLACE,
w->SetWidgetDisabledState(6,
selected_id[0] == INVALID_ENGINE ||
!EngineHasReplacementForPlayer(p, selected_id[0], selected_group));
@@ -306,18 +288,18 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
SetDParam(2, WP(w, replaceveh_d).wagon_btnstate ? STR_ENGINES : STR_WAGONS);
/* sets the colour of that art thing */
w->widget[RVW_WIDGET_TRAIN_FLUFF_LEFT].color = _player_colors[_local_player];
w->widget[RVW_WIDGET_TRAIN_FLUFF_RIGHT].color = _player_colors[_local_player];
}
if (w->window_number == VEH_TRAIN) {
/* Show the selected railtype in the pulldown menu */
RailType railtype = _railtype_selected_in_replace_gui;
w->widget[RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN].data = _rail_types_list[railtype];
w->widget[13].color = _player_colors[_local_player];
w->widget[16].color = _player_colors[_local_player];
}
DrawWindowWidgets(w);
if (w->window_number == VEH_TRAIN) {
/* Draw the selected railtype in the pulldown menu */
RailType railtype = _railtype_selected_in_replace_gui;
DrawString(157, w->widget[14].top + 1, _rail_types_list[railtype], TC_BLACK);
}
/* sets up the string for the vehicle that is being replaced to */
if (selected_id[0] != INVALID_ENGINE) {
if (!EngineHasReplacementForPlayer(p, selected_id[0], selected_group)) {
@@ -330,28 +312,22 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
SetDParam(0, STR_NOT_REPLACING_VEHICLE_SELECTED);
}
DrawString(145, w->widget[RVW_WIDGET_INFO_TAB].top + 1, STR_02BD, TC_BLACK);
DrawString(145, w->widget[5].top + 1, STR_02BD, TC_BLACK);
/* Draw the lists */
for(byte i = 0; i < 2; i++) {
uint widget = (i == 0) ? RVW_WIDGET_LEFT_MATRIX : RVW_WIDGET_RIGHT_MATRIX;
uint16 x = i == 0 ? 2 : 230; // at what X offset
EngineList list = WP(w, replaceveh_d).list[i]; // which list to draw
EngineID start = i == 0 ? w->vscroll.pos : w->vscroll2.pos; // what is the offset for the start (scrolling)
EngineID end = min((i == 0 ? w->vscroll.cap : w->vscroll2.cap) + start, EngList_Count(&list));
/* Do the actual drawing */
DrawEngineList((VehicleType)w->window_number, w->widget[widget].left + 2, w->widget[widget].top + 1, list, start, end, WP(w, replaceveh_d).sel_engine[i], i == 0, selected_group);
DrawEngineList((VehicleType)w->window_number, x, 15, list, start, end, WP(w, replaceveh_d).sel_engine[i], i == 0, selected_group);
/* Also draw the details if an engine is selected */
if (WP(w, replaceveh_d).sel_engine[i] != INVALID_ENGINE) {
const Widget *wi = &w->widget[i == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS];
int text_end = DrawVehiclePurchaseInfo(wi->left + 2, wi->top + 1, wi->right - wi->left - 2, WP(w, replaceveh_d).sel_engine[i]);
if (text_end > wi->bottom) {
SetWindowDirty(w);
ResizeWindowForWidget(w, i == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS, 0, text_end - wi->bottom);
SetWindowDirty(w);
}
const Widget *wi = &w->widget[i == 0 ? 3 : 11];
DrawVehiclePurchaseInfo(wi->left + 2, wi->top + 1, wi->right - wi->left - 2, WP(w, replaceveh_d).sel_engine[i]);
}
}
@@ -359,38 +335,39 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
case WE_CLICK: {
switch (e->we.click.widget) {
case RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE:
case 12:
WP(w, replaceveh_d).wagon_btnstate = !(WP(w, replaceveh_d).wagon_btnstate);
WP(w, replaceveh_d).update_left = true;
WP(w, replaceveh_d).init_lists = true;
SetWindowDirty(w);
break;
case RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN: /* Railtype selection dropdown menu */
ShowDropDownMenu(w, _rail_types_list, _railtype_selected_in_replace_gui, RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN, 0, ~GetPlayer(_local_player)->avail_railtypes);
case 14:
case 15: /* Railtype selection dropdown menu */
ShowDropDownMenu(w, _rail_types_list, _railtype_selected_in_replace_gui, 15, 0, ~GetPlayer(_local_player)->avail_railtypes);
break;
case RVW_WIDGET_TRAIN_WAGONREMOVE_TOGGLE: /* toggle renew_keep_length */
case 17: /* toggle renew_keep_length */
DoCommandP(0, 5, GetPlayer(_local_player)->renew_keep_length ? 0 : 1, NULL, CMD_SET_AUTOREPLACE);
break;
case RVW_WIDGET_START_REPLACE: { /* Start replacing */
case 4: { /* Start replacing */
EngineID veh_from = WP(w, replaceveh_d).sel_engine[0];
EngineID veh_to = WP(w, replaceveh_d).sel_engine[1];
DoCommandP(0, 3 + (WP(w, replaceveh_d).sel_group << 16) , veh_from + (veh_to << 16), NULL, CMD_SET_AUTOREPLACE);
} break;
case RVW_WIDGET_STOP_REPLACE: { /* Stop replacing */
case 6: { /* Stop replacing */
EngineID veh_from = WP(w, replaceveh_d).sel_engine[0];
DoCommandP(0, 3 + (WP(w, replaceveh_d).sel_group << 16), veh_from + (INVALID_ENGINE << 16), NULL, CMD_SET_AUTOREPLACE);
} break;
case RVW_WIDGET_LEFT_MATRIX:
case RVW_WIDGET_RIGHT_MATRIX: {
case 7:
case 9: {
uint i = (e->we.click.pt.y - 14) / w->resize.step_height;
uint16 click_scroll_pos = e->we.click.widget == RVW_WIDGET_LEFT_MATRIX ? w->vscroll.pos : w->vscroll2.pos;
uint16 click_scroll_cap = e->we.click.widget == RVW_WIDGET_LEFT_MATRIX ? w->vscroll.cap : w->vscroll2.cap;
byte click_side = e->we.click.widget == RVW_WIDGET_LEFT_MATRIX ? 0 : 1;
uint16 click_scroll_pos = e->we.click.widget == 7 ? w->vscroll.pos : w->vscroll2.pos;
uint16 click_scroll_cap = e->we.click.widget == 7 ? w->vscroll.cap : w->vscroll2.cap;
byte click_side = e->we.click.widget == 7 ? 0 : 1;
uint16 engine_count = EngList_Count(&WP(w, replaceveh_d).list[click_side]);
if (i < click_scroll_cap) {
@@ -428,8 +405,8 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
w->vscroll.cap += e->we.sizing.diff.y / (int)w->resize.step_height;
w->vscroll2.cap += e->we.sizing.diff.y / (int)w->resize.step_height;
w->widget[RVW_WIDGET_LEFT_MATRIX].data = (w->vscroll.cap << 8) + 1;
w->widget[RVW_WIDGET_RIGHT_MATRIX].data = (w->vscroll2.cap << 8) + 1;
w->widget[7].data = (w->vscroll.cap << 8) + 1;
w->widget[9].data = (w->vscroll2.cap << 8) + 1;
break;
case WE_INVALIDATE_DATA:
@@ -461,7 +438,8 @@ static const Widget _replace_rail_vehicle_widgets[] = {
// train specific stuff
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 138, 228, 239, STR_REPLACE_ENGINE_WAGON_SELECT, STR_REPLACE_ENGINE_WAGON_SELECT_HELP}, // widget 12
{ WWT_PANEL, RESIZE_TB, 14, 139, 153, 240, 251, 0x0, STR_NULL},
{ WWT_DROPDOWN, RESIZE_TB, 14, 154, 289, 240, 251, 0x0, STR_REPLACE_HELP_RAILTYPE},
{ WWT_PANEL, RESIZE_TB, 14, 154, 277, 240, 251, 0x0, STR_REPLACE_HELP_RAILTYPE},
{ WWT_TEXTBTN, RESIZE_TB, 14, 278, 289, 240, 251, STR_0225, STR_REPLACE_HELP_RAILTYPE},
{ WWT_PANEL, RESIZE_TB, 14, 290, 305, 240, 251, 0x0, STR_NULL},
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 317, 455, 228, 239, STR_REPLACE_REMOVE_WAGON, STR_REPLACE_REMOVE_WAGON_HELP},
// end of train specific stuff
@@ -528,6 +506,38 @@ static const WindowDesc _replace_ship_aircraft_vehicle_desc = {
};
void ShowReplaceVehicleWindow(VehicleType vehicletype)
{
Window *w;
DeleteWindowById(WC_REPLACE_VEHICLE, vehicletype);
switch (vehicletype) {
case VEH_TRAIN:
w = AllocateWindowDescFront(&_replace_rail_vehicle_desc, vehicletype);
w->vscroll.cap = 8;
w->resize.step_height = 14;
WP(w, replaceveh_d).wagon_btnstate = true;
break;
case VEH_ROAD:
w = AllocateWindowDescFront(&_replace_road_vehicle_desc, vehicletype);
w->vscroll.cap = 8;
w->resize.step_height = 14;
break;
case VEH_SHIP:
case VEH_AIRCRAFT:
w = AllocateWindowDescFront(&_replace_ship_aircraft_vehicle_desc, vehicletype);
w->vscroll.cap = 4;
w->resize.step_height = 24;
break;
default: return;
}
w->caption_color = _local_player;
w->vscroll2.cap = w->vscroll.cap; // these two are always the same
WP(w, replaceveh_d).sel_group = DEFAULT_GROUP;
}
void ShowReplaceGroupVehicleWindow(GroupID id_g, VehicleType vehicletype)
{
Window *w;

View File

@@ -13,6 +13,7 @@
*/
void AddRemoveEngineFromAutoreplaceAndBuildWindows(VehicleType type);
void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g);
void ShowReplaceVehicleWindow(VehicleType vehicletype);
void ShowReplaceGroupVehicleWindow(GroupID group, VehicleType veh);
#endif /* AUTOREPLACE_GUI_H */

View File

@@ -13,30 +13,27 @@ enum {
MAX_BRIDGES = 13
};
typedef uint BridgeType;
/** Struct containing information about a single bridge type
*/
struct BridgeSpec {
Year avail_year; ///< the year where it becomes available
byte min_length; ///< the minimum length (not counting start and end tile)
byte max_length; ///< the maximum length (not counting start and end tile)
uint16 price; ///< the price multiplier
uint16 speed; ///< maximum travel speed
SpriteID sprite; ///< the sprite which is used in the GUI
SpriteID pal; ///< the palette which is used in the GUI
StringID material; ///< the string that contains the bridge description
StringID transport_name[2]; ///< description of the bridge, when built for road or rail
PalSpriteID **sprite_table; ///< table of sprites for drawing the bridge
byte flags; ///< bit 0 set: disable drawing of far pillars.
struct Bridge {
Year avail_year; ///< the year in which the bridge becomes available
byte min_length; ///< the minimum length of the bridge (not counting start and end tile)
byte max_length; ///< the maximum length of the bridge (not counting start and end tile)
uint16 price; ///< the relative price of the bridge
uint16 speed; ///< maximum travel speed
SpriteID sprite; ///< the sprite which is used in the GUI
SpriteID pal; ///< the palette which is used in the GUI
StringID material; ///< the string that contains the bridge description
PalSpriteID **sprite_table; ///< table of sprites for drawing the bridge
byte flags; ///< bit 0 set: disable drawing of far pillars.
};
extern BridgeSpec _bridge[MAX_BRIDGES];
extern const Bridge orig_bridge[MAX_BRIDGES];
extern Bridge _bridge[MAX_BRIDGES];
Foundation GetBridgeFoundation(Slope tileh, Axis axis);
bool HasBridgeFlatRamp(Slope tileh, Axis axis);
static inline const BridgeSpec *GetBridgeSpec(BridgeType i)
static inline const Bridge *GetBridge(uint i)
{
assert(i < lengthof(_bridge));
return &_bridge[i];
@@ -44,9 +41,8 @@ static inline const BridgeSpec *GetBridgeSpec(BridgeType i)
void DrawBridgeMiddle(const TileInfo *ti);
bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len);
bool CheckBridge_Stuff(byte bridge_type, uint bridge_len);
uint32 GetBridgeLength(TileIndex begin, TileIndex end);
int CalcBridgeLenCostFactor(int x);
void ResetBridges();
#endif /* BRIDGE_H */

View File

@@ -16,7 +16,6 @@
#include "map_func.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "tunnelbridge.h"
#include "table/strings.h"
@@ -25,8 +24,8 @@ static struct BridgeData {
uint count;
TileIndex start_tile;
TileIndex end_tile;
uint32 type; ///< Data type for the bridge. Bit 16,15 = transport type, 14..8 = road/rail pieces, 7..0 = type of bridge
BridgeType indexes[MAX_BRIDGES];
uint8 type;
uint8 indexes[MAX_BRIDGES];
Money costs[MAX_BRIDGES];
BridgeData()
@@ -44,7 +43,7 @@ static void BuildBridge(Window *w, int i)
{
DeleteWindow(w);
DoCommandP(_bridgedata.end_tile, _bridgedata.start_tile,
_bridgedata.type | _bridgedata.indexes[i], CcBuildBridge,
_bridgedata.indexes[i] | (_bridgedata.type << 8), CcBuildBridge,
CMD_BUILD_BRIDGE | CMD_MSG(STR_5015_CAN_T_BUILD_BRIDGE_HERE));
}
@@ -79,7 +78,7 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e)
uint y = 15;
for (uint i = 0; (i < w->vscroll.cap) && ((i + w->vscroll.pos) < _bridgedata.count); i++) {
const BridgeSpec *b = GetBridgeSpec(_bridgedata.indexes[i + w->vscroll.pos]);
const Bridge *b = &_bridge[_bridgedata.indexes[i + w->vscroll.pos]];
SetDParam(2, _bridgedata.costs[i + w->vscroll.pos]);
SetDParam(1, b->speed * 10 / 16);
@@ -143,18 +142,38 @@ static const WindowDesc _build_bridge_desc = {
BuildBridgeWndProc
};
void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transport_type, byte bridge_type)
/* Widget definition for the road bridge selection window */
static const Widget _build_road_bridge_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // BBSW_CLOSEBOX
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 199, 0, 13, STR_1803_SELECT_ROAD_BRIDGE, STR_018C_WINDOW_TITLE_DRAG_THIS}, // BBSW_CAPTION
{ WWT_MATRIX, RESIZE_BOTTOM, 7, 0, 187, 14, 101, 0x401, STR_101F_BRIDGE_SELECTION_CLICK}, // BBSW_BRIDGE_LIST
{ WWT_SCROLLBAR, RESIZE_BOTTOM, 7, 188, 199, 14, 89, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // BBSW_SCROLLBAR
{ WWT_RESIZEBOX, RESIZE_TB, 7, 188, 199, 90, 101, 0x0, STR_RESIZE_BUTTON}, // BBSW_RESIZEBOX
{ WIDGETS_END},
};
/* Window definition for the road bridge selection window */
static const WindowDesc _build_road_bridge_desc = {
WDP_AUTO, WDP_AUTO, 200, 102, 200, 102,
WC_BUILD_BRIDGE, WC_BUILD_TOOLBAR,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE,
_build_road_bridge_widgets,
BuildBridgeWndProc
};
void ShowBuildBridgeWindow(TileIndex start, TileIndex end, byte bridge_type)
{
DeleteWindowById(WC_BUILD_BRIDGE, 0);
_bridgedata.type = (transport_type << 15) | (bridge_type << 8); //prepare the parameter for use only once
_bridgedata.type = bridge_type;
_bridgedata.start_tile = start;
_bridgedata.end_tile = end;
/* only query bridge building possibility once, result is the same for all bridges!
* returns CMD_ERROR on failure, and price on success */
StringID errmsg = INVALID_STRING_ID;
CommandCost ret = DoCommand(end, start, _bridgedata.type, DC_AUTO | DC_QUERY_COST, CMD_BUILD_BRIDGE);
CommandCost ret = DoCommand(end, start, (bridge_type << 8), DC_AUTO | DC_QUERY_COST, CMD_BUILD_BRIDGE);
uint8 j = 0;
if (CmdFailed(ret)) {
@@ -163,19 +182,19 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo
/* check which bridges can be built
* get absolute bridge length
* length of the middle parts of the bridge */
const uint bridge_len = GetTunnelBridgeLength(start, end);
const uint bridge_len = GetBridgeLength(start, end);
/* total length of bridge */
const uint tot_bridgedata_len = CalcBridgeLenCostFactor(bridge_len + 2);
/* loop for all bridgetypes */
for (BridgeType brd_type = 0; brd_type != MAX_BRIDGES; brd_type++) {
if (CheckBridge_Stuff(brd_type, bridge_len)) {
for (bridge_type = 0; bridge_type != MAX_BRIDGES; bridge_type++) {
if (CheckBridge_Stuff(bridge_type, bridge_len)) {
/* bridge is accepted, add to list */
const BridgeSpec *b = GetBridgeSpec(brd_type);
const Bridge *b = &_bridge[bridge_type];
/* Add to terraforming & bulldozing costs the cost of the
* bridge itself (not computed with DC_QUERY_COST) */
_bridgedata.costs[j] = ret.GetCost() + (((int64)tot_bridgedata_len * _price.build_bridge * b->price) >> 8);
_bridgedata.indexes[j] = brd_type;
_bridgedata.indexes[j] = bridge_type;
j++;
}
}
@@ -184,9 +203,7 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo
}
if (j != 0) {
Window *w = AllocateWindowDesc(&_build_bridge_desc);
/* Change the data, or the caption of the gui. Set it to road or rail, accordingly */
w->widget[BBSW_CAPTION].data = (transport_type == TRANSPORT_ROAD) ? STR_1803_SELECT_ROAD_BRIDGE : STR_100D_SELECT_RAIL_BRIDGE;
AllocateWindowDesc((_bridgedata.type & 0x80) ? &_build_road_bridge_desc : &_build_bridge_desc);
} else {
ShowErrorMessage(errmsg, STR_5015_CAN_T_BUILD_BRIDGE_HERE, TileX(end) * TILE_SIZE, TileY(end) * TILE_SIZE);
}

View File

@@ -8,7 +8,6 @@
#include "direction_func.h"
#include "rail_type.h"
#include "road_map.h"
#include "bridge.h"
/**
@@ -68,7 +67,7 @@ static inline bool IsBridgeAbove(TileIndex t)
* @pre IsBridgeTile(t)
* @return The bridge type
*/
static inline BridgeType GetBridgeType(TileIndex t)
static inline uint GetBridgeType(TileIndex t)
{
assert(IsBridgeTile(t));
return GB(_m[t].m2, 4, 4);
@@ -164,7 +163,7 @@ static inline void SetBridgeMiddle(TileIndex t, Axis a)
* @param rt the road or rail type
* @note this function should not be called directly.
*/
static inline void MakeBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, DiagDirection d, TransportType tt, uint rt)
static inline void MakeBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, TransportType tt, uint rt)
{
SetTileType(t, MP_TUNNELBRIDGE);
SetTileOwner(t, o);
@@ -182,7 +181,7 @@ static inline void MakeBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, D
* @param d the direction this ramp must be facing
* @param r the road type of the bridge
*/
static inline void MakeRoadBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, DiagDirection d, RoadTypes r)
static inline void MakeRoadBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, RoadTypes r)
{
MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_ROAD, r);
}
@@ -195,7 +194,7 @@ static inline void MakeRoadBridgeRamp(TileIndex t, Owner o, BridgeType bridgetyp
* @param d the direction this ramp must be facing
* @param r the rail type of the bridge
*/
static inline void MakeRailBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, DiagDirection d, RailType r)
static inline void MakeRailBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, RailType r)
{
MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_RAIL, r);
}

View File

@@ -55,6 +55,7 @@ enum BuildVehicleWidgets {
BUILD_VEHICLE_WIDGET_CLOSEBOX = 0,
BUILD_VEHICLE_WIDGET_CAPTION,
BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING,
BUILD_VEHICLE_WIDGET_SORT_TEXT,
BUILD_VEHICLE_WIDGET_SORT_DROPDOWN,
BUILD_VEHICLE_WIDGET_LIST,
BUILD_VEHICLE_WIDGET_SCROLLBAR,
@@ -69,7 +70,8 @@ static const Widget _build_vehicle_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW },
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 239, 0, 13, 0x0, STR_018C_WINDOW_TITLE_DRAG_THIS },
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 80, 14, 25, STR_SORT_BY, STR_SORT_ORDER_TIP},
{ WWT_DROPDOWN, RESIZE_RIGHT, 14, 81, 239, 14, 25, 0x0, STR_SORT_CRITERIA_TIP},
{ WWT_PANEL, RESIZE_RIGHT, 14, 81, 227, 14, 25, 0x0, STR_SORT_CRITERIA_TIP},
{ WWT_TEXTBTN, RESIZE_LR, 14, 228, 239, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP},
{ WWT_MATRIX, RESIZE_RB, 14, 0, 227, 26, 39, 0x101, STR_NULL },
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 228, 239, 26, 39, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST },
{ WWT_PANEL, RESIZE_RTB, 14, 0, 239, 40, 161, 0x0, STR_NULL },
@@ -81,11 +83,9 @@ static const Widget _build_vehicle_widgets[] = {
};
/* Setup widget strings to fit the different types of vehicles */
static void SetupWindowStrings(Window *w, VehicleType type)
static void SetupWindowStrings(Window *w, byte type)
{
switch (type) {
default: NOT_REACHED();
case VEH_TRAIN:
w->widget[BUILD_VEHICLE_WIDGET_CAPTION].data = STR_JUST_STRING;
w->widget[BUILD_VEHICLE_WIDGET_LIST].tooltips = STR_8843_TRAIN_VEHICLE_SELECTION;
@@ -94,7 +94,6 @@ static void SetupWindowStrings(Window *w, VehicleType type)
w->widget[BUILD_VEHICLE_WIDGET_RENAME].data = STR_8820_RENAME;
w->widget[BUILD_VEHICLE_WIDGET_RENAME].tooltips = STR_8845_RENAME_TRAIN_VEHICLE_TYPE;
break;
case VEH_ROAD:
w->widget[BUILD_VEHICLE_WIDGET_CAPTION].data = STR_9006_NEW_ROAD_VEHICLES;
w->widget[BUILD_VEHICLE_WIDGET_LIST].tooltips = STR_9026_ROAD_VEHICLE_SELECTION;
@@ -103,7 +102,6 @@ static void SetupWindowStrings(Window *w, VehicleType type)
w->widget[BUILD_VEHICLE_WIDGET_RENAME].data = STR_9034_RENAME;
w->widget[BUILD_VEHICLE_WIDGET_RENAME].tooltips = STR_9035_RENAME_ROAD_VEHICLE_TYPE;
break;
case VEH_SHIP:
w->widget[BUILD_VEHICLE_WIDGET_CAPTION].data = STR_9808_NEW_SHIPS;
w->widget[BUILD_VEHICLE_WIDGET_LIST].tooltips = STR_9825_SHIP_SELECTION_LIST_CLICK;
@@ -112,7 +110,6 @@ static void SetupWindowStrings(Window *w, VehicleType type)
w->widget[BUILD_VEHICLE_WIDGET_RENAME].data = STR_9836_RENAME;
w->widget[BUILD_VEHICLE_WIDGET_RENAME].tooltips = STR_9837_RENAME_SHIP_TYPE;
break;
case VEH_AIRCRAFT:
w->widget[BUILD_VEHICLE_WIDGET_CAPTION].data = STR_A005_NEW_AIRCRAFT;
w->widget[BUILD_VEHICLE_WIDGET_LIST].tooltips = STR_A025_AIRCRAFT_SELECTION_LIST;
@@ -218,8 +215,8 @@ static int CDECL TrainEnginePowerSorter(const void *a, const void *b)
const RailVehicleInfo *rvi_a = RailVehInfo(*(const EngineID*)a);
const RailVehicleInfo *rvi_b = RailVehInfo(*(const EngineID*)b);
int va = rvi_a->power;
int vb = rvi_b->power;
int va = rvi_a->power << (rvi_a->railveh_type == RAILVEH_MULTIHEAD ? 1 : 0);
int vb = rvi_b->power << (rvi_b->railveh_type == RAILVEH_MULTIHEAD ? 1 : 0);
int r = va - vb;
return _internal_sort_order ? -r : r;
@@ -230,8 +227,8 @@ static int CDECL TrainEngineRunningCostSorter(const void *a, const void *b)
const RailVehicleInfo *rvi_a = RailVehInfo(*(const EngineID*)a);
const RailVehicleInfo *rvi_b = RailVehInfo(*(const EngineID*)b);
Money va = rvi_a->running_cost * GetPriceByIndex(rvi_a->running_cost_class) * (rvi_a->railveh_type == RAILVEH_MULTIHEAD ? 2 : 1);
Money vb = rvi_b->running_cost * GetPriceByIndex(rvi_b->running_cost_class) * (rvi_b->railveh_type == RAILVEH_MULTIHEAD ? 2 : 1);
Money va = rvi_a->running_cost_base * _price.running_rail[rvi_a->running_cost_class] * (rvi_a->railveh_type == RAILVEH_MULTIHEAD ? 2 : 1);
Money vb = rvi_b->running_cost_base * _price.running_rail[rvi_b->running_cost_class] * (rvi_b->railveh_type == RAILVEH_MULTIHEAD ? 2 : 1);
int r = ClampToI32(va - vb);
return _internal_sort_order ? -r : r;
@@ -248,8 +245,8 @@ static int CDECL TrainEnginePowerVsRunningCostSorter(const void *a, const void *
* Because of this, the return value have to be reversed as well and we return b - a instead of a - b.
* Another thing is that both power and running costs should be doubled for multiheaded engines.
* Since it would be multipling with 2 in both numerator and denumerator, it will even themselves out and we skip checking for multiheaded. */
Money va = (rvi_a->running_cost * GetPriceByIndex(rvi_a->running_cost_class)) / max(1U, (uint)rvi_a->power);
Money vb = (rvi_b->running_cost * GetPriceByIndex(rvi_b->running_cost_class)) / max(1U, (uint)rvi_b->power);
Money va = (rvi_a->running_cost_base * _price.running_rail[rvi_a->running_cost_class]) / max(1U, (uint)rvi_a->power);
Money vb = (rvi_b->running_cost_base * _price.running_rail[rvi_b->running_cost_class]) / max(1U, (uint)rvi_b->power);
int r = ClampToI32(vb - va);
return _internal_sort_order ? -r : r;
@@ -312,12 +309,9 @@ static int CDECL RoadVehEngineSpeedSorter(const void *a, const void *b)
static int CDECL RoadVehEngineRunningCostSorter(const void *a, const void *b)
{
const RoadVehicleInfo *rvi_a = RoadVehInfo(*(const EngineID*)a);
const RoadVehicleInfo *rvi_b = RoadVehInfo(*(const EngineID*)b);
Money va = rvi_a->running_cost * GetPriceByIndex(rvi_a->running_cost_class);
Money vb = rvi_b->running_cost * GetPriceByIndex(rvi_b->running_cost_class);
int r = ClampToI32(va - vb);
const int va = RoadVehInfo(*(const EngineID*)a)->running_cost;
const int vb = RoadVehInfo(*(const EngineID*)b)->running_cost;
const int r = va - vb;
if (r == 0) {
/* Use EngineID to sort instead since we want consistent sorting */
@@ -533,26 +527,6 @@ static const StringID _sort_listing[][11] = {{
INVALID_STRING_ID
}};
static int DrawCargoCapacityInfo(int x, int y, EngineID engine, VehicleType type, bool refittable)
{
uint16 *cap = GetCapacityOfArticulatedParts(engine, type);
for (uint c = 0; c < NUM_CARGO; c++) {
if (cap[c] == 0) continue;
SetDParam(0, c);
SetDParam(1, cap[c]);
SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY);
DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING);
y += 10;
/* Only show as refittable once */
refittable = false;
}
return y;
}
/* Draw rail wagon specific details */
static int DrawRailWagonPurchaseInfo(int x, int y, EngineID engine_number, const RailVehicleInfo *rvi)
{
@@ -577,14 +551,6 @@ static int DrawRailWagonPurchaseInfo(int x, int y, EngineID engine_number, const
y += 10;
}
}
/* Running cost */
if (rvi->running_cost_class != 0xFF) {
SetDParam(0, GetEngineProperty(engine_number, 0x0D, rvi->running_cost) * GetPriceByIndex(rvi->running_cost_class) >> 8);
DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING);
y += 10;
}
return y;
}
@@ -602,7 +568,7 @@ static int DrawRailEnginePurchaseInfo(int x, int y, EngineID engine_number, cons
/* Max speed - Engine power */
SetDParam(0, GetEngineProperty(engine_number, 0x09, rvi->max_speed) * 10 / 16);
SetDParam(1, GetEngineProperty(engine_number, 0x0B, rvi->power));
SetDParam(1, GetEngineProperty(engine_number, 0x0B, rvi->power) << multihead);
DrawString(x, y, STR_PURCHASE_INFO_SPEED_POWER, TC_FROMSTRING);
y += 10;
@@ -614,11 +580,9 @@ static int DrawRailEnginePurchaseInfo(int x, int y, EngineID engine_number, cons
}
/* Running cost */
if (rvi->running_cost_class != 0xFF) {
SetDParam(0, GetEngineProperty(engine_number, 0x0D, rvi->running_cost) * GetPriceByIndex(rvi->running_cost_class) >> 8);
DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING);
y += 10;
}
SetDParam(0, (GetEngineProperty(engine_number, 0x0D, rvi->running_cost_base) * _price.running_rail[rvi->running_cost_class] >> 8) << multihead);
DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING);
y += 10;
/* Powered wagons power - Powered wagons extra weight */
if (rvi->pow_wag_power != 0) {
@@ -643,12 +607,18 @@ static int DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number, const R
y += 10;
/* Running cost */
SetDParam(0, rvi->running_cost * GetPriceByIndex(rvi->running_cost_class) >> 8);
SetDParam(0, rvi->running_cost * _price.roadveh_running >> 8);
DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING);
y += 10;
/* Cargo type + capacity */
return DrawCargoCapacityInfo(x, y, engine_number, VEH_ROAD, refittable);
SetDParam(0, rvi->cargo_type);
SetDParam(1, GetEngineProperty(engine_number, 0x0F, rvi->capacity));
SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY);
DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING);
y += 10;
return y;
}
/* Draw ship specific details */
@@ -739,18 +709,20 @@ int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number)
}
/* Cargo type + capacity, or N/A */
int new_y = DrawCargoCapacityInfo(x, y, engine_number, VEH_TRAIN, refitable);
if (new_y == y) {
if (rvi->capacity == 0) {
SetDParam(0, CT_INVALID);
SetDParam(2, STR_EMPTY);
DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING);
y += 10;
} else {
y = new_y;
int multihead = (rvi->railveh_type == RAILVEH_MULTIHEAD ? 1 : 0);
SetDParam(0, rvi->cargo_type);
SetDParam(1, (capacity * (CountArticulatedParts(engine_number, true) + 1)) << multihead);
SetDParam(2, refitable ? STR_9842_REFITTABLE : STR_EMPTY);
}
break;
DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING);
y += 10;
}
break;
case VEH_ROAD:
y = DrawRoadVehPurchaseInfo(x, y, engine_number, RoadVehInfo(engine_number));
refitable = true;
@@ -803,8 +775,7 @@ static void GenerateBuildTrainList(Window *w)
* Also check to see if the previously selected engine is still available,
* and if not, reset selection to INVALID_ENGINE. This could be the case
* when engines become obsolete and are removed */
EngineID eid;
FOR_ALL_ENGINEIDS_OF_TYPE(eid, VEH_TRAIN) {
for (EngineID eid = 0; eid < NUM_TRAIN_ENGINES; eid++) {
const RailVehicleInfo *rvi = RailVehInfo(eid);
if (bv->filter.railtype != RAILTYPE_END && !HasPowerOnRail(rvi->railtype, bv->filter.railtype)) continue;
@@ -842,8 +813,7 @@ static void GenerateBuildRoadVehList(Window *w)
EngList_RemoveAll(&bv->eng_list);
EngineID eid;
FOR_ALL_ENGINEIDS_OF_TYPE(eid, VEH_ROAD) {
for (EngineID eid = ROAD_ENGINES_INDEX; eid < ROAD_ENGINES_INDEX + NUM_ROAD_ENGINES; eid++) {
if (!IsEngineBuildable(eid, VEH_ROAD, _local_player)) continue;
if (!HasBit(bv->filter.roadtypes, HasBit(EngInfo(eid)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD)) continue;
EngList_Add(&bv->eng_list, eid);
@@ -861,8 +831,7 @@ static void GenerateBuildShipList(Window *w)
EngList_RemoveAll(&bv->eng_list);
EngineID eid;
FOR_ALL_ENGINEIDS_OF_TYPE(eid, VEH_SHIP) {
for (EngineID eid = SHIP_ENGINES_INDEX; eid < SHIP_ENGINES_INDEX + NUM_SHIP_ENGINES; eid++) {
if (!IsEngineBuildable(eid, VEH_SHIP, _local_player)) continue;
EngList_Add(&bv->eng_list, eid);
@@ -883,8 +852,7 @@ static void GenerateBuildAircraftList(Window *w)
* Also check to see if the previously selected plane is still available,
* and if not, reset selection to INVALID_ENGINE. This could be the case
* when planes become obsolete and are removed */
EngineID eid;
FOR_ALL_ENGINEIDS_OF_TYPE(eid, VEH_AIRCRAFT) {
for (EngineID eid = AIRCRAFT_ENGINES_INDEX; eid < AIRCRAFT_ENGINES_INDEX + NUM_AIRCRAFT_ENGINES; eid++) {
if (!IsEngineBuildable(eid, VEH_AIRCRAFT, _local_player)) continue;
/* First VEH_END window_numbers are fake to allow a window open for all different types at once */
if (w->window_number > VEH_END && !CanAircraftUseStation(eid, w->window_number)) continue;
@@ -920,7 +888,7 @@ static void GenerateBuildList(Window *w)
EngList_Sort(&bv->eng_list, _sorter[bv->vehicle_type][bv->sort_criteria]);
}
static void DrawVehicleEngine(VehicleType type, int x, int y, EngineID engine, SpriteID pal)
static void DrawVehicleEngine(byte type, int x, int y, EngineID engine, SpriteID pal)
{
switch (type) {
case VEH_TRAIN: DrawTrainEngine( x, y, engine, pal); break;
@@ -988,6 +956,23 @@ void DrawEngineList(VehicleType type, int x, int y, const EngineList eng_list, u
}
}
static void ExpandPurchaseInfoWidget(Window *w, int expand_by)
{
Widget *wi = &w->widget[BUILD_VEHICLE_WIDGET_PANEL];
SetWindowDirty(w);
wi->bottom += expand_by;
for (uint i = BUILD_VEHICLE_WIDGET_BUILD; i < BUILD_VEHICLE_WIDGET_END; i++) {
wi = &w->widget[i];
wi->top += expand_by;
wi->bottom += expand_by;
}
w->height += expand_by;
SetWindowDirty(w);
}
static void DrawBuildVehicleWindow(Window *w)
{
const buildvehicle_d *bv = &WP(w, buildvehicle_d);
@@ -997,26 +982,19 @@ static void DrawBuildVehicleWindow(Window *w)
SetVScrollCount(w, EngList_Count(&bv->eng_list));
SetDParam(0, bv->filter.railtype + STR_881C_NEW_RAIL_VEHICLES); // This should only affect rail vehicles
/* Set text of sort by dropdown */
w->widget[BUILD_VEHICLE_WIDGET_SORT_DROPDOWN].data = _sort_listing[bv->vehicle_type][bv->sort_criteria];
DrawWindowWidgets(w);
DrawEngineList(bv->vehicle_type, w->widget[BUILD_VEHICLE_WIDGET_LIST].left + 2, w->widget[BUILD_VEHICLE_WIDGET_LIST].top + 1, bv->eng_list, w->vscroll.pos, max, bv->sel_engine, false, DEFAULT_GROUP);
DrawEngineList(bv->vehicle_type, 2, 27, bv->eng_list, w->vscroll.pos, max, bv->sel_engine, false, DEFAULT_GROUP);
if (bv->sel_engine != INVALID_ENGINE) {
const Widget *wi = &w->widget[BUILD_VEHICLE_WIDGET_PANEL];
int text_end = DrawVehiclePurchaseInfo(2, wi->top + 1, wi->right - wi->left - 2, bv->sel_engine);
if (text_end > wi->bottom) {
SetWindowDirty(w);
ResizeWindowForWidget(w, BUILD_VEHICLE_WIDGET_PANEL, 0, text_end - wi->bottom);
SetWindowDirty(w);
}
if (text_end > wi->bottom) ExpandPurchaseInfoWidget(w, text_end - wi->bottom);
}
DrawSortButtonState(w, BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING, bv->descending_sort_order ? SBS_DOWN : SBS_UP);
DrawString(85, 15, _sort_listing[bv->vehicle_type][bv->sort_criteria], TC_BLACK);
DoDrawString(bv->descending_sort_order ? DOWNARROW : UPARROW, 69, 15, TC_BLACK);
}
static void BuildVehicleClickEvent(Window *w, WindowEvent *e)
@@ -1032,14 +1010,14 @@ static void BuildVehicleClickEvent(Window *w, WindowEvent *e)
break;
case BUILD_VEHICLE_WIDGET_LIST: {
uint i = (e->we.click.pt.y - w->widget[BUILD_VEHICLE_WIDGET_LIST].top) / GetVehicleListHeight(bv->vehicle_type) + w->vscroll.pos;
uint i = (e->we.click.pt.y - 26) / GetVehicleListHeight(bv->vehicle_type) + w->vscroll.pos;
uint num_items = EngList_Count(&bv->eng_list);
bv->sel_engine = (i < num_items) ? bv->eng_list[i] : INVALID_ENGINE;
SetWindowDirty(w);
break;
}
case BUILD_VEHICLE_WIDGET_SORT_DROPDOWN: // Select sorting criteria dropdown menu
case BUILD_VEHICLE_WIDGET_SORT_TEXT: case BUILD_VEHICLE_WIDGET_SORT_DROPDOWN: // Select sorting criteria dropdown menu
ShowDropDownMenu(w, _sort_listing[bv->vehicle_type], bv->sort_criteria, BUILD_VEHICLE_WIDGET_SORT_DROPDOWN, 0, 0);
break;

View File

@@ -37,7 +37,7 @@ CargoPacket::~CargoPacket()
this->count = 0;
}
bool CargoPacket::SameSource(const CargoPacket *cp) const
bool CargoPacket::SameSource(CargoPacket *cp)
{
return this->source_xy == cp->source_xy && this->days_in_transit == cp->days_in_transit && this->paid_for == cp->paid_for;
}

View File

@@ -1,6 +1,6 @@
/* $Id$ */
/** @file cargopacket.h */
/** @file cargotype.h */
#ifndef CARGOPACKET_H
#define CARGOPACKET_H
@@ -53,7 +53,7 @@ struct CargoPacket : PoolItem<CargoPacket, CargoPacketID, &_CargoPacket_pool> {
* @param cp the cargo packet to compare to
* @return true if and only if days_in_transit and source_xy are equal
*/
bool SameSource(const CargoPacket *cp) const;
bool SameSource(CargoPacket *cp);
};
/**

View File

@@ -315,7 +315,7 @@ static void ClickTile_Clear(TileIndex tile)
/* not used */
}
static TrackStatus GetTileTrackStatus_Clear(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
static uint32 GetTileTrackStatus_Clear(TileIndex tile, TransportType mode, uint sub_mode)
{
return 0;
}

View File

@@ -20,7 +20,6 @@
#include "debug.h"
#include "player_func.h"
#include "player_base.h"
#include "signal_func.h"
#include "table/strings.h"
@@ -209,145 +208,160 @@ DEF_COMMAND(CmdAutofillTimetable);
* as the value from the CMD_* enums.
*/
static const Command _command_proc_table[] = {
{CmdBuildRailroadTrack, CMD_AUTO}, /* CMD_BUILD_RAILROAD_TRACK */
{CmdRemoveRailroadTrack, CMD_AUTO}, /* CMD_REMOVE_RAILROAD_TRACK */
{CmdBuildSingleRail, CMD_AUTO}, /* CMD_BUILD_SINGLE_RAIL */
{CmdRemoveSingleRail, CMD_AUTO}, /* CMD_REMOVE_SINGLE_RAIL */
{CmdLandscapeClear, 0}, /* CMD_LANDSCAPE_CLEAR */
{CmdBuildBridge, CMD_AUTO}, /* CMD_BUILD_BRIDGE */
{CmdBuildRailroadStation, CMD_AUTO}, /* CMD_BUILD_RAILROAD_STATION */
{CmdBuildTrainDepot, CMD_AUTO}, /* CMD_BUILD_TRAIN_DEPOT */
{CmdBuildSingleSignal, CMD_AUTO}, /* CMD_BUILD_SIGNALS */
{CmdRemoveSingleSignal, CMD_AUTO}, /* CMD_REMOVE_SIGNALS */
{CmdTerraformLand, CMD_AUTO}, /* CMD_TERRAFORM_LAND */
{CmdPurchaseLandArea, CMD_AUTO}, /* CMD_PURCHASE_LAND_AREA */
{CmdSellLandArea, 0}, /* CMD_SELL_LAND_AREA */
{CmdBuildTunnel, CMD_AUTO}, /* CMD_BUILD_TUNNEL */
{CmdRemoveFromRailroadStation, 0}, /* CMD_REMOVE_FROM_RAILROAD_STATION */
{CmdConvertRail, 0}, /* CMD_CONVERT_RAILD */
{CmdBuildTrainWaypoint, 0}, /* CMD_BUILD_TRAIN_WAYPOINT */
{CmdRenameWaypoint, 0}, /* CMD_RENAME_WAYPOINT */
{CmdRemoveTrainWaypoint, 0}, /* CMD_REMOVE_TRAIN_WAYPOINT */
{CmdBuildRailroadTrack, CMD_AUTO}, /* 0, CMD_BUILD_RAILROAD_TRACK */
{CmdRemoveRailroadTrack, CMD_AUTO}, /* 1, CMD_REMOVE_RAILROAD_TRACK */
{CmdBuildSingleRail, CMD_AUTO}, /* 2, CMD_BUILD_SINGLE_RAIL */
{CmdRemoveSingleRail, CMD_AUTO}, /* 3, CMD_REMOVE_SINGLE_RAIL */
{CmdLandscapeClear, 0}, /* 4, CMD_LANDSCAPE_CLEAR */
{CmdBuildBridge, CMD_AUTO}, /* 5, CMD_BUILD_BRIDGE */
{CmdBuildRailroadStation, CMD_AUTO}, /* 6, CMD_BUILD_RAILROAD_STATION */
{CmdBuildTrainDepot, CMD_AUTO}, /* 7, CMD_BUILD_TRAIN_DEPOT */
{CmdBuildSingleSignal, CMD_AUTO}, /* 8, CMD_BUILD_SIGNALS */
{CmdRemoveSingleSignal, CMD_AUTO}, /* 9, CMD_REMOVE_SIGNALS */
{CmdTerraformLand, CMD_AUTO}, /* 10, CMD_TERRAFORM_LAND */
{CmdPurchaseLandArea, CMD_AUTO}, /* 11, CMD_PURCHASE_LAND_AREA */
{CmdSellLandArea, 0}, /* 12, CMD_SELL_LAND_AREA */
{CmdBuildTunnel, CMD_AUTO}, /* 13, CMD_BUILD_TUNNEL */
{CmdRemoveFromRailroadStation, 0}, /* 14, CMD_REMOVE_FROM_RAILROAD_STATION */
{CmdConvertRail, 0}, /* 15, CMD_CONVERT_RAILD */
{CmdBuildTrainWaypoint, 0}, /* 16, CMD_BUILD_TRAIN_WAYPOINT */
{CmdRenameWaypoint, 0}, /* 17, CMD_RENAME_WAYPOINT */
{CmdRemoveTrainWaypoint, 0}, /* 18, CMD_REMOVE_TRAIN_WAYPOINT */
{NULL, 0}, /* 19, unused */
{NULL, 0}, /* 20, unused */
{CmdBuildRoadStop, CMD_AUTO}, /* 21, CMD_BUILD_ROAD_STOP */
{CmdRemoveRoadStop, 0}, /* 22, CMD_REMOVE_ROAD_STOP */
{CmdBuildLongRoad, CMD_AUTO}, /* 23, CMD_BUILD_LONG_ROAD */
{CmdRemoveLongRoad, CMD_AUTO}, /* 24, CMD_REMOVE_LONG_ROAD */
{CmdBuildRoad, 0}, /* 25, CMD_BUILD_ROAD */
{CmdRemoveRoad, 0}, /* 26, CMD_REMOVE_ROAD */
{CmdBuildRoadDepot, CMD_AUTO}, /* 27, CMD_BUILD_ROAD_DEPOT */
{NULL, 0}, /* 28, unused */
{CmdBuildAirport, CMD_AUTO}, /* 29, CMD_BUILD_AIRPORT */
{CmdBuildDock, CMD_AUTO}, /* 30, CMD_BUILD_DOCK */
{CmdBuildShipDepot, CMD_AUTO}, /* 31, CMD_BUILD_SHIP_DEPOT */
{CmdBuildBuoy, CMD_AUTO}, /* 32, CMD_BUILD_BUOY */
{CmdPlantTree, CMD_AUTO}, /* 33, CMD_PLANT_TREE */
{CmdBuildRailVehicle, 0}, /* 34, CMD_BUILD_RAIL_VEHICLE */
{CmdMoveRailVehicle, 0}, /* 35, CMD_MOVE_RAIL_VEHICLE */
{CmdStartStopTrain, 0}, /* 36, CMD_START_STOP_TRAIN */
{NULL, 0}, /* 37, unused */
{CmdSellRailWagon, 0}, /* 38, CMD_SELL_RAIL_WAGON */
{CmdSendTrainToDepot, 0}, /* 39, CMD_SEND_TRAIN_TO_DEPOT */
{CmdForceTrainProceed, 0}, /* 40, CMD_FORCE_TRAIN_PROCEED */
{CmdReverseTrainDirection, 0}, /* 41, CMD_REVERSE_TRAIN_DIRECTION */
{CmdBuildRoadStop, CMD_AUTO}, /* CMD_BUILD_ROAD_STOP */
{CmdRemoveRoadStop, 0}, /* CMD_REMOVE_ROAD_STOP */
{CmdBuildLongRoad, CMD_AUTO}, /* CMD_BUILD_LONG_ROAD */
{CmdRemoveLongRoad, CMD_AUTO}, /* CMD_REMOVE_LONG_ROAD */
{CmdBuildRoad, 0}, /* CMD_BUILD_ROAD */
{CmdRemoveRoad, 0}, /* CMD_REMOVE_ROAD */
{CmdBuildRoadDepot, CMD_AUTO}, /* CMD_BUILD_ROAD_DEPOT */
{CmdModifyOrder, 0}, /* 42, CMD_MODIFY_ORDER */
{CmdSkipToOrder, 0}, /* 43, CMD_SKIP_TO_ORDER */
{CmdDeleteOrder, 0}, /* 44, CMD_DELETE_ORDER */
{CmdInsertOrder, 0}, /* 45, CMD_INSERT_ORDER */
{CmdBuildAirport, CMD_AUTO}, /* CMD_BUILD_AIRPORT */
{CmdBuildDock, CMD_AUTO}, /* CMD_BUILD_DOCK */
{CmdBuildShipDepot, CMD_AUTO}, /* CMD_BUILD_SHIP_DEPOT */
{CmdBuildBuoy, CMD_AUTO}, /* CMD_BUILD_BUOY */
{CmdPlantTree, CMD_AUTO}, /* CMD_PLANT_TREE */
{CmdBuildRailVehicle, 0}, /* CMD_BUILD_RAIL_VEHICLE */
{CmdMoveRailVehicle, 0}, /* CMD_MOVE_RAIL_VEHICLE */
{CmdStartStopTrain, 0}, /* CMD_START_STOP_TRAIN */
{CmdChangeServiceInt, 0}, /* 46, CMD_CHANGE_SERVICE_INT */
{CmdSellRailWagon, 0}, /* CMD_SELL_RAIL_WAGON */
{CmdSendTrainToDepot, 0}, /* CMD_SEND_TRAIN_TO_DEPOT */
{CmdForceTrainProceed, 0}, /* CMD_FORCE_TRAIN_PROCEED */
{CmdReverseTrainDirection, 0}, /* CMD_REVERSE_TRAIN_DIRECTION */
{CmdBuildIndustry, 0}, /* 47, CMD_BUILD_INDUSTRY */
{CmdBuildCompanyHQ, CMD_AUTO}, /* 48, CMD_BUILD_COMPANY_HQ */
{CmdSetPlayerFace, 0}, /* 49, CMD_SET_PLAYER_FACE */
{CmdSetPlayerColor, 0}, /* 50, CMD_SET_PLAYER_COLOR */
{CmdModifyOrder, 0}, /* CMD_MODIFY_ORDER */
{CmdSkipToOrder, 0}, /* CMD_SKIP_TO_ORDER */
{CmdDeleteOrder, 0}, /* CMD_DELETE_ORDER */
{CmdInsertOrder, 0}, /* CMD_INSERT_ORDER */
{CmdIncreaseLoan, 0}, /* 51, CMD_INCREASE_LOAN */
{CmdDecreaseLoan, 0}, /* 52, CMD_DECREASE_LOAN */
{CmdChangeServiceInt, 0}, /* CMD_CHANGE_SERVICE_INT */
{CmdWantEnginePreview, 0}, /* 53, CMD_WANT_ENGINE_PREVIEW */
{CmdBuildIndustry, 0}, /* CMD_BUILD_INDUSTRY */
{CmdBuildCompanyHQ, CMD_AUTO}, /* CMD_BUILD_COMPANY_HQ */
{CmdSetPlayerFace, 0}, /* CMD_SET_PLAYER_FACE */
{CmdSetPlayerColor, 0}, /* CMD_SET_PLAYER_COLOR */
{CmdNameVehicle, 0}, /* 54, CMD_NAME_VEHICLE */
{CmdRenameEngine, 0}, /* 55, CMD_RENAME_ENGINE */
{CmdIncreaseLoan, 0}, /* CMD_INCREASE_LOAN */
{CmdDecreaseLoan, 0}, /* CMD_DECREASE_LOAN */
{CmdChangeCompanyName, 0}, /* 56, CMD_CHANGE_COMPANY_NAME */
{CmdChangePresidentName, 0}, /* 57, CMD_CHANGE_PRESIDENT_NAME */
{CmdWantEnginePreview, 0}, /* CMD_WANT_ENGINE_PREVIEW */
{CmdRenameStation, 0}, /* 58, CMD_RENAME_STATION */
{CmdNameVehicle, 0}, /* CMD_NAME_VEHICLE */
{CmdRenameEngine, 0}, /* CMD_RENAME_ENGINE */
{CmdSellAircraft, 0}, /* 59, CMD_SELL_AIRCRAFT */
{CmdStartStopAircraft, 0}, /* 60, CMD_START_STOP_AIRCRAFT */
{CmdChangeCompanyName, 0}, /* CMD_CHANGE_COMPANY_NAME */
{CmdChangePresidentName, 0}, /* CMD_CHANGE_PRESIDENT_NAME */
{CmdBuildAircraft, 0}, /* 61, CMD_BUILD_AIRCRAFT */
{CmdSendAircraftToHangar, 0}, /* 62, CMD_SEND_AIRCRAFT_TO_HANGAR */
{NULL, 0}, /* 63, unused */
{CmdRefitAircraft, 0}, /* 64, CMD_REFIT_AIRCRAFT */
{CmdRenameStation, 0}, /* CMD_RENAME_STATION */
{CmdPlaceSign, 0}, /* 65, CMD_PLACE_SIGN */
{CmdRenameSign, 0}, /* 66, CMD_RENAME_SIGN */
{CmdSellAircraft, 0}, /* CMD_SELL_AIRCRAFT */
{CmdStartStopAircraft, 0}, /* CMD_START_STOP_AIRCRAFT */
{CmdBuildRoadVeh, 0}, /* 67, CMD_BUILD_ROAD_VEH */
{CmdStartStopRoadVeh, 0}, /* 68, CMD_START_STOP_ROADVEH */
{CmdSellRoadVeh, 0}, /* 69, CMD_SELL_ROAD_VEH */
{CmdSendRoadVehToDepot, 0}, /* 70, CMD_SEND_ROADVEH_TO_DEPOT */
{CmdTurnRoadVeh, 0}, /* 71, CMD_TURN_ROADVEH */
{CmdRefitRoadVeh, 0}, /* 72, CMD_REFIT_ROAD_VEH */
{CmdBuildAircraft, 0}, /* CMD_BUILD_AIRCRAFT */
{CmdSendAircraftToHangar, 0}, /* CMD_SEND_AIRCRAFT_TO_HANGAR */
{CmdRefitAircraft, 0}, /* CMD_REFIT_AIRCRAFT */
{CmdPause, CMD_SERVER}, /* 73, CMD_PAUSE */
{CmdPlaceSign, 0}, /* CMD_PLACE_SIGN */
{CmdRenameSign, 0}, /* CMD_RENAME_SIGN */
{CmdBuyShareInCompany, 0}, /* 74, CMD_BUY_SHARE_IN_COMPANY */
{CmdSellShareInCompany, 0}, /* 75, CMD_SELL_SHARE_IN_COMPANY */
{CmdBuyCompany, 0}, /* 76, CMD_BUY_COMANY */
{CmdBuildRoadVeh, 0}, /* CMD_BUILD_ROAD_VEH */
{CmdStartStopRoadVeh, 0}, /* CMD_START_STOP_ROADVEH */
{CmdSellRoadVeh, 0}, /* CMD_SELL_ROAD_VEH */
{CmdSendRoadVehToDepot, 0}, /* CMD_SEND_ROADVEH_TO_DEPOT */
{CmdTurnRoadVeh, 0}, /* CMD_TURN_ROADVEH */
{CmdRefitRoadVeh, 0}, /* CMD_REFIT_ROAD_VEH */
{CmdBuildTown, CMD_OFFLINE}, /* 77, CMD_BUILD_TOWN */
{NULL, 0}, /* 78, unused */
{NULL, 0}, /* 79, unused */
{CmdRenameTown, CMD_SERVER}, /* 80, CMD_RENAME_TOWN */
{CmdDoTownAction, 0}, /* 81, CMD_DO_TOWN_ACTION */
{CmdPause, CMD_SERVER}, /* CMD_PAUSE */
{CmdSetRoadDriveSide, CMD_SERVER}, /* 82, CMD_SET_ROAD_DRIVE_SIDE */
{NULL, 0}, /* 83, unused */
{NULL, 0}, /* 84, unused */
{CmdChangeDifficultyLevel, CMD_SERVER}, /* 85, CMD_CHANGE_DIFFICULTY_LEVEL */
{CmdBuyShareInCompany, 0}, /* CMD_BUY_SHARE_IN_COMPANY */
{CmdSellShareInCompany, 0}, /* CMD_SELL_SHARE_IN_COMPANY */
{CmdBuyCompany, 0}, /* CMD_BUY_COMANY */
{CmdStartStopShip, 0}, /* 86, CMD_START_STOP_SHIP */
{CmdSellShip, 0}, /* 87, CMD_SELL_SHIP */
{CmdBuildShip, 0}, /* 88, CMD_BUILD_SHIP */
{CmdSendShipToDepot, 0}, /* 89, CMD_SEND_SHIP_TO_DEPOT */
{NULL, 0}, /* 90, unused */
{CmdRefitShip, 0}, /* 91, CMD_REFIT_SHIP */
{CmdBuildTown, CMD_OFFLINE}, /* CMD_BUILD_TOWN */
{CmdRenameTown, CMD_SERVER}, /* CMD_RENAME_TOWN */
{CmdDoTownAction, 0}, /* CMD_DO_TOWN_ACTION */
{NULL, 0}, /* 92, unused */
{NULL, 0}, /* 93, unused */
{NULL, 0}, /* 94, unused */
{NULL, 0}, /* 95, unused */
{NULL, 0}, /* 96, unused */
{NULL, 0}, /* 97, unused */
{CmdSetRoadDriveSide, CMD_SERVER}, /* CMD_SET_ROAD_DRIVE_SIDE */
{CmdChangeDifficultyLevel, CMD_SERVER}, /* CMD_CHANGE_DIFFICULTY_LEVEL */
{CmdOrderRefit, 0}, /* 98, CMD_ORDER_REFIT */
{CmdCloneOrder, 0}, /* 99, CMD_CLONE_ORDER */
{CmdStartStopShip, 0}, /* CMD_START_STOP_SHIP */
{CmdSellShip, 0}, /* CMD_SELL_SHIP */
{CmdBuildShip, 0}, /* CMD_BUILD_SHIP */
{CmdSendShipToDepot, 0}, /* CMD_SEND_SHIP_TO_DEPOT */
{CmdRefitShip, 0}, /* CMD_REFIT_SHIP */
{CmdClearArea, 0}, /* 100, CMD_CLEAR_AREA */
{NULL, 0}, /* 101, unused */
{CmdOrderRefit, 0}, /* CMD_ORDER_REFIT */
{CmdCloneOrder, 0}, /* CMD_CLONE_ORDER */
{CmdMoneyCheat, CMD_OFFLINE}, /* 102, CMD_MONEY_CHEAT */
{CmdBuildCanal, CMD_AUTO}, /* 103, CMD_BUILD_CANAL */
{CmdPlayerCtrl, 0}, /* 104, CMD_PLAYER_CTRL */
{CmdClearArea, 0}, /* CMD_CLEAR_AREA */
{CmdLevelLand, CMD_AUTO}, /* 105, CMD_LEVEL_LAND */
{CmdMoneyCheat, CMD_OFFLINE}, /* CMD_MONEY_CHEAT */
{CmdBuildCanal, CMD_AUTO}, /* CMD_BUILD_CANAL */
{CmdPlayerCtrl, 0}, /* CMD_PLAYER_CTRL */
{CmdLevelLand, CMD_AUTO}, /* CMD_LEVEL_LAND */
{CmdRefitRailVehicle, 0}, /* CMD_REFIT_RAIL_VEHICLE */
{CmdRestoreOrderIndex, 0}, /* CMD_RESTORE_ORDER_INDEX */
{CmdBuildLock, CMD_AUTO}, /* CMD_BUILD_LOCK */
{CmdBuildSignalTrack, CMD_AUTO}, /* CMD_BUILD_SIGNAL_TRACK */
{CmdRemoveSignalTrack, CMD_AUTO}, /* CMD_REMOVE_SIGNAL_TRACK */
{CmdGiveMoney, 0}, /* CMD_GIVE_MONEY */
{CmdChangePatchSetting, CMD_SERVER}, /* CMD_CHANGE_PATCH_SETTING */
{CmdSetAutoReplace, 0}, /* CMD_SET_AUTOREPLACE */
{CmdCloneVehicle, 0}, /* CMD_CLONE_VEHICLE */
{CmdMassStartStopVehicle, 0}, /* CMD_MASS_START_STOP */
{CmdDepotSellAllVehicles, 0}, /* CMD_DEPOT_SELL_ALL_VEHICLES */
{CmdDepotMassAutoReplace, 0}, /* CMD_DEPOT_MASS_AUTOREPLACE */
{CmdCreateGroup, 0}, /* CMD_CREATE_GROUP */
{CmdDeleteGroup, 0}, /* CMD_DELETE_GROUP */
{CmdRenameGroup, 0}, /* CMD_RENAME_GROUP */
{CmdAddVehicleGroup, 0}, /* CMD_ADD_VEHICLE_GROUP */
{CmdAddSharedVehicleGroup, 0}, /* CMD_ADD_SHARE_VEHICLE_GROUP */
{CmdRemoveAllVehiclesGroup, 0}, /* CMD_REMOVE_ALL_VEHICLES_GROUP */
{CmdSetGroupReplaceProtection, 0}, /* CMD_SET_GROUP_REPLACE_PROTECTION */
{CmdMoveOrder, 0}, /* CMD_MOVE_ORDER */
{CmdChangeTimetable, 0}, /* CMD_CHANGE_TIMETABLE */
{CmdSetVehicleOnTime, 0}, /* CMD_SET_VEHICLE_ON_TIME */
{CmdAutofillTimetable, 0}, /* CMD_AUTOFILL_TIMETABLE */
{CmdRefitRailVehicle, 0}, /* 106, CMD_REFIT_RAIL_VEHICLE */
{CmdRestoreOrderIndex, 0}, /* 107, CMD_RESTORE_ORDER_INDEX */
{CmdBuildLock, CMD_AUTO}, /* 108, CMD_BUILD_LOCK */
{NULL, 0}, /* 109, unused */
{CmdBuildSignalTrack, CMD_AUTO}, /* 110, CMD_BUILD_SIGNAL_TRACK */
{CmdRemoveSignalTrack, CMD_AUTO}, /* 111, CMD_REMOVE_SIGNAL_TRACK */
{NULL, 0}, /* 112, unused */
{CmdGiveMoney, 0}, /* 113, CMD_GIVE_MONEY */
{CmdChangePatchSetting, CMD_SERVER}, /* 114, CMD_CHANGE_PATCH_SETTING */
{CmdSetAutoReplace, 0}, /* 115, CMD_SET_AUTOREPLACE */
{CmdCloneVehicle, 0}, /* 116, CMD_CLONE_VEHICLE */
{CmdMassStartStopVehicle, 0}, /* 117, CMD_MASS_START_STOP */
{CmdDepotSellAllVehicles, 0}, /* 118, CMD_DEPOT_SELL_ALL_VEHICLES */
{CmdDepotMassAutoReplace, 0}, /* 119, CMD_DEPOT_MASS_AUTOREPLACE */
{CmdCreateGroup, 0}, /* 120, CMD_CREATE_GROUP */
{CmdDeleteGroup, 0}, /* 121, CMD_DELETE_GROUP */
{CmdRenameGroup, 0}, /* 122, CMD_RENAME_GROUP */
{CmdAddVehicleGroup, 0}, /* 123, CMD_ADD_VEHICLE_GROUP */
{CmdAddSharedVehicleGroup, 0}, /* 124, CMD_ADD_SHARE_VEHICLE_GROUP */
{CmdRemoveAllVehiclesGroup, 0}, /* 125, CMD_REMOVE_ALL_VEHICLES_GROUP */
{CmdSetGroupReplaceProtection, 0}, /* 126, CMD_SET_GROUP_REPLACE_PROTECTION */
{CmdMoveOrder, 0}, /* 127, CMD_MOVE_ORDER */
{CmdChangeTimetable, 0}, /* 128, CMD_CHANGE_TIMETABLE */
{CmdSetVehicleOnTime, 0}, /* 129, CMD_SET_VEHICLE_ON_TIME */
{CmdAutofillTimetable, 0}, /* 130, CMD_AUTOFILL_TIMETABLE */
};
/*!
@@ -399,7 +413,7 @@ CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint32
CommandProc *proc;
/* Do not even think about executing out-of-bounds tile-commands */
if (!IsValidTile(tile)) {
if (tile >= MapSize() || IsTileType(tile, MP_VOID)) {
_cmd_text = NULL;
return CMD_ERROR;
}
@@ -411,7 +425,7 @@ CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint32
_docommand_recursive++;
/* only execute the test call if it's toplevel, or we're not execing. */
if (_docommand_recursive == 1 || !(flags & DC_EXEC) ) {
if (_docommand_recursive == 1 || !(flags & DC_EXEC) || (flags & DC_FORCETEST) ) {
SetTownRatingTestMode(true);
res = proc(tile, flags & ~DC_EXEC, p1, p2);
SetTownRatingTestMode(false);
@@ -422,7 +436,6 @@ CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint32
if (_docommand_recursive == 1 &&
!(flags & DC_QUERY_COST) &&
!(flags & DC_BANKRUPT) &&
res.GetCost() != 0 &&
!CheckPlayerHasMoney(res)) {
goto error;
@@ -447,7 +460,7 @@ error:
}
/* if toplevel, subtract the money. */
if (--_docommand_recursive == 0 && !(flags & DC_BANKRUPT)) {
if (--_docommand_recursive == 0) {
SubtractMoneyFromPlayer(res);
/* XXX - Old AI hack which doesn't use DoCommandDP; update last build coord of player */
if (tile != 0 && IsValidPlayer(_current_player)) {
@@ -499,7 +512,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
int y = TileY(tile) * TILE_SIZE;
/* Do not even think about executing out-of-bounds tile-commands */
if (!IsValidTile(tile)) {
if (tile >= MapSize() || IsTileType(tile, MP_VOID)) {
_cmd_text = NULL;
return false;
}
@@ -558,9 +571,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
!(cmd & (CMD_NETWORK_COMMAND | CMD_SHOW_NO_ERROR)) &&
(cmd & 0xFF) != CMD_PAUSE) {
/* estimate the cost. */
SetTownRatingTestMode(true);
res = proc(tile, flags, p1, p2);
SetTownRatingTestMode(false);
if (CmdFailed(res)) {
res.SetGlobalErrorMessage();
ShowErrorMessage(_error_message, error_part1, x, y);
@@ -631,9 +642,6 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
SubtractMoneyFromPlayer(res2);
/* update signals if needed */
UpdateSignalsInBuffer();
if (IsLocalPlayer() && _game_mode != GM_EDITOR) {
if (res2.GetCost() != 0 && tile != 0) ShowCostOrIncomeAnimation(x, y, GetSlopeZ(x, y), res2.GetCost());
if (_additional_cash_required != 0) {

View File

@@ -106,156 +106,156 @@ public:
* @see _command_proc_table
*/
enum {
CMD_BUILD_RAILROAD_TRACK, ///< build a rail track
CMD_REMOVE_RAILROAD_TRACK, ///< remove a rail track
CMD_BUILD_SINGLE_RAIL, ///< build a single rail track
CMD_REMOVE_SINGLE_RAIL, ///< remove a single rail track
CMD_LANDSCAPE_CLEAR, ///< demolish a tile
CMD_BUILD_BRIDGE, ///< build a bridge
CMD_BUILD_RAILROAD_STATION, ///< build a railroad station
CMD_BUILD_TRAIN_DEPOT, ///< build a train depot
CMD_BUILD_SIGNALS, ///< build a signal
CMD_REMOVE_SIGNALS, ///< remove a signal
CMD_TERRAFORM_LAND, ///< terraform a tile
CMD_PURCHASE_LAND_AREA, ///< purchase a tile
CMD_SELL_LAND_AREA, ///< sell a bought tile before
CMD_BUILD_TUNNEL, ///< build a tunnel
CMD_BUILD_RAILROAD_TRACK = 0, ///< build a rail track
CMD_REMOVE_RAILROAD_TRACK = 1, ///< remove a rail track
CMD_BUILD_SINGLE_RAIL = 2, ///< build a single rail track
CMD_REMOVE_SINGLE_RAIL = 3, ///< remove a single rail track
CMD_LANDSCAPE_CLEAR = 4, ///< demolish a tile
CMD_BUILD_BRIDGE = 5, ///< build a bridge
CMD_BUILD_RAILROAD_STATION = 6, ///< build a railroad station
CMD_BUILD_TRAIN_DEPOT = 7, ///< build a train depot
CMD_BUILD_SIGNALS = 8, ///< build a signal
CMD_REMOVE_SIGNALS = 9, ///< remove a signal
CMD_TERRAFORM_LAND = 10, ///< terraform a tile
CMD_PURCHASE_LAND_AREA = 11, ///< purchase a tile
CMD_SELL_LAND_AREA = 12, ///< sell a bought tile before
CMD_BUILD_TUNNEL = 13, ///< build a tunnel
CMD_REMOVE_FROM_RAILROAD_STATION, ///< remove a tile station
CMD_CONVERT_RAIL, ///< convert a rail type
CMD_REMOVE_FROM_RAILROAD_STATION = 14, ///< remove a tile station
CMD_CONVERT_RAIL = 15, ///< convert a rail type
CMD_BUILD_TRAIN_WAYPOINT, ///< build a waypoint
CMD_RENAME_WAYPOINT, ///< rename a waypoint
CMD_REMOVE_TRAIN_WAYPOINT, ///< remove a waypoint
CMD_BUILD_TRAIN_WAYPOINT = 16, ///< build a waypoint
CMD_RENAME_WAYPOINT = 17, ///< rename a waypoint
CMD_REMOVE_TRAIN_WAYPOINT = 18, ///< remove a waypoint
CMD_BUILD_ROAD_STOP, ///< build a road stop
CMD_REMOVE_ROAD_STOP, ///< remove a road stop
CMD_BUILD_LONG_ROAD, ///< build a complete road (not a "half" one)
CMD_REMOVE_LONG_ROAD, ///< remove a complete road (not a "half" one)
CMD_BUILD_ROAD, ///< build a "half" road
CMD_REMOVE_ROAD, ///< remove a "half" road
CMD_BUILD_ROAD_DEPOT, ///< build a road depot
CMD_BUILD_ROAD_STOP = 21, ///< build a road stop
CMD_REMOVE_ROAD_STOP = 22, ///< remove a road stop
CMD_BUILD_LONG_ROAD = 23, ///< build a complete road (not a "half" one)
CMD_REMOVE_LONG_ROAD = 24, ///< remove a complete road (not a "half" one)
CMD_BUILD_ROAD = 25, ///< build a "half" road
CMD_REMOVE_ROAD = 26, ///< remove a "half" road
CMD_BUILD_ROAD_DEPOT = 27, ///< build a road depot
CMD_BUILD_AIRPORT, ///< build an airport
CMD_BUILD_AIRPORT = 29, ///< build an airport
CMD_BUILD_DOCK, ///< build a dock
CMD_BUILD_DOCK = 30, ///< build a dock
CMD_BUILD_SHIP_DEPOT, ///< build a ship depot
CMD_BUILD_BUOY, ///< build a buoy
CMD_BUILD_SHIP_DEPOT = 31, ///< build a ship depot
CMD_BUILD_BUOY = 32, ///< build a buoy
CMD_PLANT_TREE, ///< plant a tree
CMD_PLANT_TREE = 33, ///< plant a tree
CMD_BUILD_RAIL_VEHICLE, ///< build a rail vehicle
CMD_MOVE_RAIL_VEHICLE, ///< move a rail vehicle (in the depot)
CMD_BUILD_RAIL_VEHICLE = 34, ///< build a rail vehicle
CMD_MOVE_RAIL_VEHICLE = 35, ///< move a rail vehicle (in the depot)
CMD_START_STOP_TRAIN, ///< start or stop a train
CMD_START_STOP_TRAIN = 36, ///< start or stop a train
CMD_SELL_RAIL_WAGON, ///< sell a rail wagon
CMD_SELL_RAIL_WAGON = 38, ///< sell a rail wagon
CMD_SEND_TRAIN_TO_DEPOT, ///< send a train to a depot
CMD_FORCE_TRAIN_PROCEED, ///< proceed a train to pass a red signal
CMD_REVERSE_TRAIN_DIRECTION, ///< turn a train around
CMD_SEND_TRAIN_TO_DEPOT = 39, ///< send a train to a depot
CMD_FORCE_TRAIN_PROCEED = 40, ///< proceed a train to pass a red signal
CMD_REVERSE_TRAIN_DIRECTION = 41, ///< turn a train around
CMD_MODIFY_ORDER, ///< modify an order (like set full-load)
CMD_SKIP_TO_ORDER, ///< skip an order to the next of specific one
CMD_DELETE_ORDER, ///< delete an order
CMD_INSERT_ORDER, ///< insert a new order
CMD_MODIFY_ORDER = 42, ///< modify an order (like set full-load)
CMD_SKIP_TO_ORDER = 43, ///< skip an order to the next of specific one
CMD_DELETE_ORDER = 44, ///< delete an order
CMD_INSERT_ORDER = 45, ///< insert a new order
CMD_CHANGE_SERVICE_INT, ///< change the server interval of a vehicle
CMD_CHANGE_SERVICE_INT = 46, ///< change the server interval of a vehicle
CMD_BUILD_INDUSTRY, ///< build a new industry
CMD_BUILD_INDUSTRY = 47, ///< build a new industry
CMD_BUILD_COMPANY_HQ, ///< build the company headquarter
CMD_SET_PLAYER_FACE, ///< set the face of the player/company
CMD_SET_PLAYER_COLOR, ///< set the color of the player/company
CMD_BUILD_COMPANY_HQ = 48, ///< build the company headquarter
CMD_SET_PLAYER_FACE = 49, ///< set the face of the player/company
CMD_SET_PLAYER_COLOR = 50, ///< set the color of the player/company
CMD_INCREASE_LOAN, ///< increase the loan from the bank
CMD_DECREASE_LOAN, ///< decrease the loan from the bank
CMD_INCREASE_LOAN = 51, ///< increase the loan from the bank
CMD_DECREASE_LOAN = 52, ///< decrease the loan from the bank
CMD_WANT_ENGINE_PREVIEW, ///< confirm the preview of an engine
CMD_WANT_ENGINE_PREVIEW = 53, ///< confirm the preview of an engine
CMD_NAME_VEHICLE, ///< rename a whole vehicle
CMD_RENAME_ENGINE, ///< rename a engine (in the engine list)
CMD_CHANGE_COMPANY_NAME, ///< change the company name
CMD_CHANGE_PRESIDENT_NAME, ///< change the president name
CMD_RENAME_STATION, ///< rename a station
CMD_NAME_VEHICLE = 54, ///< rename a whole vehicle
CMD_RENAME_ENGINE = 55, ///< rename a engine (in the engine list)
CMD_CHANGE_COMPANY_NAME = 56, ///< change the company name
CMD_CHANGE_PRESIDENT_NAME = 57, ///< change the president name
CMD_RENAME_STATION = 58, ///< rename a station
CMD_SELL_AIRCRAFT, ///< sell an aircraft
CMD_START_STOP_AIRCRAFT, ///< start/stop an aircraft
CMD_BUILD_AIRCRAFT, ///< build an aircraft
CMD_SEND_AIRCRAFT_TO_HANGAR, ///< send an aircraft to a hanger
CMD_REFIT_AIRCRAFT, ///< refit the cargo space of an aircraft
CMD_SELL_AIRCRAFT = 59, ///< sell an aircraft
CMD_START_STOP_AIRCRAFT = 60, ///< start/stop an aircraft
CMD_BUILD_AIRCRAFT = 61, ///< build an aircraft
CMD_SEND_AIRCRAFT_TO_HANGAR = 62, ///< send an aircraft to a hanger
CMD_REFIT_AIRCRAFT = 64, ///< refit the cargo space of an aircraft
CMD_PLACE_SIGN, ///< place a sign
CMD_RENAME_SIGN, ///< rename a sign
CMD_PLACE_SIGN = 65, ///< place a sign
CMD_RENAME_SIGN = 66, ///< rename a sign
CMD_BUILD_ROAD_VEH, ///< build a road vehicle
CMD_START_STOP_ROADVEH, ///< start/stop a road vehicle
CMD_SELL_ROAD_VEH, ///< sell a road vehicle
CMD_SEND_ROADVEH_TO_DEPOT, ///< send a road vehicle to the depot
CMD_TURN_ROADVEH, ///< turn a road vehicle around
CMD_REFIT_ROAD_VEH, ///< refit the cargo space of a road vehicle
CMD_BUILD_ROAD_VEH = 67, ///< build a road vehicle
CMD_START_STOP_ROADVEH = 68, ///< start/stop a road vehicle
CMD_SELL_ROAD_VEH = 69, ///< sell a road vehicle
CMD_SEND_ROADVEH_TO_DEPOT = 70, ///< send a road vehicle to the depot
CMD_TURN_ROADVEH = 71, ///< turn a road vehicle around
CMD_REFIT_ROAD_VEH = 72, ///< refit the cargo space of a road vehicle
CMD_PAUSE, ///< pause the game
CMD_PAUSE = 73, ///< pause the game
CMD_BUY_SHARE_IN_COMPANY, ///< buy a share from a company
CMD_SELL_SHARE_IN_COMPANY, ///< sell a share from a company
CMD_BUY_COMPANY, ///< buy a company which is bankrupt
CMD_BUY_SHARE_IN_COMPANY = 74, ///< buy a share from a company
CMD_SELL_SHARE_IN_COMPANY = 75, ///< sell a share from a company
CMD_BUY_COMPANY = 76, ///< buy a company which is bankrupt
CMD_BUILD_TOWN, ///< build a town
CMD_BUILD_TOWN = 77, ///< build a town
CMD_RENAME_TOWN, ///< rename a town
CMD_DO_TOWN_ACTION, ///< do a action from the town detail window (like advertises or bribe)
CMD_RENAME_TOWN = 80, ///< rename a town
CMD_DO_TOWN_ACTION = 81, ///< do a action from the town detail window (like advertises or bribe)
CMD_SET_ROAD_DRIVE_SIDE, ///< set the side where the road vehicles drive
CMD_SET_ROAD_DRIVE_SIDE = 82, ///< set the side where the road vehicles drive
CMD_CHANGE_DIFFICULTY_LEVEL, ///< change the difficult of a game (each setting for it own)
CMD_CHANGE_DIFFICULTY_LEVEL = 85, ///< change the difficult of a game (each setting for it own)
CMD_START_STOP_SHIP, ///< start/stop a ship
CMD_SELL_SHIP, ///< sell a ship
CMD_BUILD_SHIP, ///< build a new ship
CMD_SEND_SHIP_TO_DEPOT, ///< send a ship to a depot
CMD_REFIT_SHIP, ///< refit the cargo space of a ship
CMD_START_STOP_SHIP = 86, ///< start/stop a ship
CMD_SELL_SHIP = 87, ///< sell a ship
CMD_BUILD_SHIP = 88, ///< build a new ship
CMD_SEND_SHIP_TO_DEPOT = 89, ///< send a ship to a depot
CMD_REFIT_SHIP = 91, ///< refit the cargo space of a ship
CMD_ORDER_REFIT, ///< change the refit informaction of an order (for "goto depot" )
CMD_CLONE_ORDER, ///< clone (and share) an order
CMD_CLEAR_AREA, ///< clear an area
CMD_ORDER_REFIT = 98, ///< change the refit informaction of an order (for "goto depot" )
CMD_CLONE_ORDER = 99, ///< clone (and share) an order
CMD_CLEAR_AREA = 100, ///< clear an area
CMD_MONEY_CHEAT, ///< do the money cheat
CMD_BUILD_CANAL, ///< build a canal
CMD_MONEY_CHEAT = 102, ///< do the money cheat
CMD_BUILD_CANAL = 103, ///< build a canal
CMD_PLAYER_CTRL, ///< used in multiplayer to create a new player etc.
CMD_LEVEL_LAND, ///< level land
CMD_PLAYER_CTRL = 104, ///< used in multiplayer to create a new player etc.
CMD_LEVEL_LAND = 105, ///< level land
CMD_REFIT_RAIL_VEHICLE, ///< refit the cargo space of a train
CMD_RESTORE_ORDER_INDEX, ///< restore vehicle order-index and service interval
CMD_BUILD_LOCK, ///< build a lock
CMD_REFIT_RAIL_VEHICLE = 106, ///< refit the cargo space of a train
CMD_RESTORE_ORDER_INDEX = 107, ///< restore vehicle order-index and service interval
CMD_BUILD_LOCK = 108, ///< build a lock
CMD_BUILD_SIGNAL_TRACK, ///< add signals along a track (by dragging)
CMD_REMOVE_SIGNAL_TRACK, ///< remove signals along a track (by dragging)
CMD_BUILD_SIGNAL_TRACK = 110, ///< add signals along a track (by dragging)
CMD_REMOVE_SIGNAL_TRACK = 111, ///< remove signals along a track (by dragging)
CMD_GIVE_MONEY, ///< give money to an other player
CMD_CHANGE_PATCH_SETTING, ///< change a patch setting
CMD_GIVE_MONEY = 113, ///< give money to an other player
CMD_CHANGE_PATCH_SETTING = 114, ///< change a patch setting
CMD_SET_AUTOREPLACE, ///< set an autoreplace entry
CMD_SET_AUTOREPLACE = 115, ///< set an autoreplace entry
CMD_CLONE_VEHICLE, ///< clone a vehicle
CMD_MASS_START_STOP, ///< start/stop all vehicles (in a depot)
CMD_DEPOT_SELL_ALL_VEHICLES, ///< sell all vehicles which are in a given depot
CMD_DEPOT_MASS_AUTOREPLACE, ///< force the autoreplace to take action in a given depot
CMD_CLONE_VEHICLE = 116, ///< clone a vehicle
CMD_MASS_START_STOP = 117, ///< start/stop all vehicles (in a depot)
CMD_DEPOT_SELL_ALL_VEHICLES = 118, ///< sell all vehicles which are in a given depot
CMD_DEPOT_MASS_AUTOREPLACE = 119, ///< force the autoreplace to take action in a given depot
CMD_CREATE_GROUP, ///< create a new group
CMD_DELETE_GROUP, ///< delete a group
CMD_RENAME_GROUP, ///< rename a group
CMD_ADD_VEHICLE_GROUP, ///< add a vehicle to a group
CMD_ADD_SHARED_VEHICLE_GROUP, ///< add all other shared vehicles to a group which are missing
CMD_REMOVE_ALL_VEHICLES_GROUP, ///< remove all vehicles from a group
CMD_SET_GROUP_REPLACE_PROTECTION, ///< set the autoreplace-protection for a group
CMD_CREATE_GROUP = 120, ///< create a new group
CMD_DELETE_GROUP = 121, ///< delete a group
CMD_RENAME_GROUP = 122, ///< rename a group
CMD_ADD_VEHICLE_GROUP = 123, ///< add a vehicle to a group
CMD_ADD_SHARED_VEHICLE_GROUP = 124, ///< add all other shared vehicles to a group which are missing
CMD_REMOVE_ALL_VEHICLES_GROUP = 125, ///< remove all vehicles from a group
CMD_SET_GROUP_REPLACE_PROTECTION = 126, ///< set the autoreplace-protection for a group
CMD_MOVE_ORDER, ///< move an order
CMD_CHANGE_TIMETABLE, ///< change the timetable for a vehicle
CMD_SET_VEHICLE_ON_TIME, ///< set the vehicle on time feature (timetable)
CMD_AUTOFILL_TIMETABLE, ///< autofill the timetable
CMD_MOVE_ORDER = 127, ///< move an order
CMD_CHANGE_TIMETABLE = 128, ///< change the timetable for a vehicle
CMD_SET_VEHICLE_ON_TIME = 129, ///< set the vehicle on time feature (timetable)
CMD_AUTOFILL_TIMETABLE = 130, ///< autofill the timetable
};
/**
@@ -271,7 +271,7 @@ enum {
DC_NO_RAIL_OVERLAP = 0x10, ///< don't allow overlap of rails (used in buildrail)
DC_AI_BUILDING = 0x20, ///< special building rules for AI
DC_NO_TOWN_RATING = 0x40, ///< town rating does not disallow you from building
DC_BANKRUPT = 0x80, ///< company bankrupts, skip money check, skip vehicle on tile check in some cases
DC_FORCETEST = 0x80, ///< force test too.
};
/**

View File

@@ -537,11 +537,7 @@ DEF_CONSOLE_CMD(ConRcon)
if (argc < 3) return false;
if (_network_server) {
IConsoleCmdExec(argv[2]);
} else {
SEND_COMMAND(PACKET_CLIENT_RCON)(argv[1], argv[2]);
}
SEND_COMMAND(PACKET_CLIENT_RCON)(argv[1], argv[2]);
return true;
}
@@ -814,7 +810,7 @@ DEF_CONSOLE_CMD(ConExec)
if (argc < 2) return false;
_script_file = FioFOpenFile(argv[1], "r", BASE_DIR);
_script_file = fopen(argv[1], "r");
if (_script_file == NULL) {
if (argc == 2 || atoi(argv[2]) != 0) IConsoleError("script file not found");
@@ -838,7 +834,7 @@ DEF_CONSOLE_CMD(ConExec)
IConsoleError("Encountered errror while trying to read from script file");
_script_running = false;
FioFCloseFile(_script_file);
fclose(_script_file);
return true;
}

View File

@@ -1,24 +0,0 @@
/* $Id$ */
/** @file alloc_func.cpp functions to 'handle' memory allocation errors */
#include "../stdafx.h"
#include "alloc_func.hpp"
/**
* Function to exit with an error message after malloc() or calloc() have failed
* @param size number of bytes we tried to allocate
*/
void MallocError(size_t size)
{
error("Out of memory. Cannot allocate %i bytes", size);
}
/**
* Function to exit with an error message after realloc() have failed
* @param size number of bytes we tried to allocate
*/
void ReallocError(size_t size)
{
error("Out of memory. Cannot reallocate %i bytes", size);
}

View File

@@ -5,15 +5,6 @@
#ifndef ALLOC_FUNC_HPP
#define ALLOC_FUNC_HPP
/**
* Functions to exit badly with an error message.
* It has to be linked so the error messages are not
* duplicated in each object file making the final
* binary needlessly large.
*/
void MallocError(size_t size);
void ReallocError(size_t size);
/**
* Simplified allocation function that allocates the specified number of
* elements of the given type. It also explicitly casts it to the requested
@@ -34,7 +25,7 @@ template <typename T> FORCEINLINE T* MallocT(size_t num_elements)
if (num_elements == 0) return NULL;
T *t_ptr = (T*)malloc(num_elements * sizeof(T));
if (t_ptr == NULL) MallocError(num_elements * sizeof(T));
if (t_ptr == NULL) error("Out of memory. Cannot allocate %i bytes", num_elements * sizeof(T));
return t_ptr;
}
@@ -58,7 +49,7 @@ template <typename T> FORCEINLINE T* CallocT(size_t num_elements)
if (num_elements == 0) return NULL;
T *t_ptr = (T*)calloc(num_elements, sizeof(T));
if (t_ptr == NULL) MallocError(num_elements * sizeof(T));
if (t_ptr == NULL) error("Out of memory. Cannot allocate %i bytes", num_elements * sizeof(T));
return t_ptr;
}
@@ -86,39 +77,8 @@ template <typename T> FORCEINLINE T* ReallocT(T *t_ptr, size_t num_elements)
}
t_ptr = (T*)realloc(t_ptr, num_elements * sizeof(T));
if (t_ptr == NULL) ReallocError(num_elements * sizeof(T));
if (t_ptr == NULL) error("Out of memory. Cannot reallocate %i bytes", num_elements * sizeof(T));
return t_ptr;
}
/**
* A small 'wrapper' for allocations that can be done on most OSes on the
* stack, but are just too large to fit in the stack on devices with a small
* stack such as the NDS.
* So when it is possible a stack allocation is made, otherwise a heap
* allocation is made and this is freed once the struct goes out of scope.
* @param T the type to make the allocation for
* @param length the amount of items to allocate
*/
template <typename T, size_t length>
struct SmallStackSafeStackAlloc {
#if !defined(__NDS__)
/** Storing the data on the stack */
T data[length];
#else
/** Storing it on the heap */
T *data;
/** Allocating the memory */
SmallStackSafeStackAlloc() : data(MallocT<T>(length)) {}
/** And freeing when it goes out of scope */
~SmallStackSafeStackAlloc() { free(data); }
#endif
/**
* Gets a pointer to the data stored in this wrapper.
* @return the pointer.
*/
operator T* () { return data; }
};
#endif /* ALLOC_FUNC_HPP */

View File

@@ -168,18 +168,6 @@ static inline int32 ClampToI32(const int64 a)
return (int32)a;
}
/**
* Reduce an usigned 64-bit int to an unsigned 16-bit one
*
* @param a The 64-bit value to clamp
* @return The 64-bit value reduced to a 16-bit value
* @see ClampU(uint, uint, uint)
*/
static inline uint16 ClampToU16(const uint64 a)
{
return (uint16)(a <= 0xFFFFU ? a : 0xFFFFU);
}
/**
* Returns the (absolute) difference between two (scalar) variables
*

View File

@@ -6,26 +6,20 @@
#include "random_func.hpp"
#include "bitmath_func.hpp"
Randomizer _random, _interactive_random;
uint32 _random_seeds[2][2];
uint32 Randomizer::Next()
uint32 InteractiveRandom()
{
const uint32 s = this->state[0];
const uint32 t = this->state[1];
const uint32 s = _random_seeds[1][0];
const uint32 t = _random_seeds[1][1];
this->state[0] = s + ROR(t ^ 0x1234567F, 7) + 1;
return this->state[1] = ROR(s, 3) - 1;
_random_seeds[1][0] = s + ROR(t ^ 0x1234567F, 7) + 1;
return _random_seeds[1][1] = ROR(s, 3) - 1;
}
uint32 Randomizer::Next(uint16 max)
uint InteractiveRandomRange(uint max)
{
return GB(this->Next(), 0, 16) * max >> 16;
}
void Randomizer::SetSeed(uint32 seed)
{
this->state[0] = seed;
this->state[1] = seed;
return GB(InteractiveRandom(), 0, 16) * max >> 16;
}
#ifdef MERSENNE_TWISTER
@@ -125,24 +119,28 @@ uint32 Random()
#else /* MERSENNE_TWISTER */
void SetRandomSeed(uint32 seed)
{
_random.SetSeed(seed);
_interactive_random.SetSeed(seed * 0x1234567);
_random_seeds[0][0] = seed;
_random_seeds[0][1] = seed;
_random_seeds[1][0] = seed * 0x1234567;
_random_seeds[1][1] = _random_seeds[1][0];
}
#ifdef RANDOM_DEBUG
#include "../network/network_data.h"
#include "../variables.h" /* _frame_counter */
#include "../player_func.h"
uint32 DoRandom(int line, const char *file)
{
if (_networking && (DEREF_CLIENT(0)->status != STATUS_INACTIVE || !_network_server)) {
if (_networking && (DEREF_CLIENT(0)->status != STATUS_INACTIVE || !_network_server))
printf("Random [%d/%d] %s:%d\n",_frame_counter, (byte)_current_player, file, line);
}
return _random.Next();
}
#else /* RANDOM_DEBUG */
uint32 Random()
{
#endif /* RANDOM_DEBUG */
const uint32 s = _random_seeds[0][0];
const uint32 t = _random_seeds[0][1];
_random_seeds[0][0] = s + ROR(t ^ 0x1234567F, 7) + 1;
return _random_seeds[0][1] = ROR(s, 3) - 1;
}
#endif /* MERSENNE_TWISTER */
#if defined(RANDOM_DEBUG) && !defined(MERSENNE_TWISTER)
@@ -150,4 +148,9 @@ uint DoRandomRange(uint max, int line, const char *file)
{
return GB(DoRandom(line, file), 0, 16) * max >> 16;
}
#else /* RANDOM_DEBUG & !MERSENNE_TWISTER */
uint RandomRange(uint max)
{
return GB(Random(), 0, 16) * max >> 16;
}
#endif /* RANDOM_DEBUG & !MERSENNE_TWISTER */

View File

@@ -1,6 +1,6 @@
/* $Id$ */
/** @file random_func.hpp */
/** @file random_func.h */
#ifndef RANDOM_FUNC_HPP
#define RANDOM_FUNC_HPP
@@ -27,35 +27,6 @@
// Doesn't work with network yet.
// #define MERSENNE_TWISTER
/**
* Structure to encapsulate the pseudo random number generators.
*/
struct Randomizer {
/** The state of the randomizer */
uint32 state[2];
/**
* Generate the next pseudo random number
* @return the random number
*/
uint32 Next();
/**
* Generate the next pseudo random number scaled to max
* @param max the maximum value of the returned random number
* @return the random number
*/
uint32 Next(uint16 max);
/**
* (Re)set the state of the random number generator.
* @param seed the new state
*/
void SetSeed(uint32 seed);
};
extern Randomizer _random; ///< Random used in the game state calculations
extern Randomizer _interactive_random; ///< Random used every else where is does not (directly) influence the game state
void SetRandomSeed(uint32 seed);
#ifdef RANDOM_DEBUG
#define Random() DoRandom(__LINE__, __FILE__)
@@ -63,12 +34,12 @@ void SetRandomSeed(uint32 seed);
#define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__)
uint DoRandomRange(uint max, int line, const char *file);
#else
static inline uint32 Random() { return _random.Next(); }
static inline uint32 RandomRange(uint16 max) { return _random.Next(max); }
uint32 Random();
uint RandomRange(uint max);
#endif
static inline uint32 InteractiveRandom() { return _interactive_random.Next(); }
static inline uint32 InteractiveRandomRange(uint16 max) { return _interactive_random.Next(max); }
uint32 InteractiveRandom(); // Used for random sequences that are not the same on the other end of the multiplayer link
uint InteractiveRandomRange(uint max);
/**
* Checks if a given randomize-number is below a given probability.
@@ -88,7 +59,7 @@ static inline uint32 InteractiveRandomRange(uint16 max) { return _interactive_ra
static inline bool Chance16I(const uint a, const uint b, const uint32 r)
{
assert(b != 0);
return (uint16)r < (uint16)(((a << 16) + b / 2) / b);
return (uint16)r < (uint16)((a << 16) / b);
}
/**
@@ -129,4 +100,6 @@ static inline bool Chance16R(const uint a, const uint b, uint32 &r)
return Chance16I(a, b, r);
}
extern uint32 _random_seeds[2][2];
#endif /* RANDOM_FUNC_HPP */

View File

@@ -165,6 +165,24 @@ Date ConvertYMDToDate(Year year, Month month, Day day)
/** Functions used by the IncreaseDate function */
extern void OnNewDay_Train(Vehicle *v);
extern void OnNewDay_RoadVeh(Vehicle *v);
extern void OnNewDay_Aircraft(Vehicle *v);
extern void OnNewDay_Ship(Vehicle *v);
static void OnNewDay_EffectVehicle(Vehicle *v) { /* empty */ }
extern void OnNewDay_DisasterVehicle(Vehicle *v);
typedef void OnNewVehicleDayProc(Vehicle *v);
static OnNewVehicleDayProc * _on_new_vehicle_day_proc[] = {
OnNewDay_Train,
OnNewDay_RoadVeh,
OnNewDay_Ship,
OnNewDay_Aircraft,
OnNewDay_EffectVehicle,
OnNewDay_DisasterVehicle,
};
extern void WaypointsDailyLoop();
extern void ChatMessageDailyLoop();
extern void EnginesDailyLoop();
@@ -207,7 +225,7 @@ static void RunVehicleDayProc(uint daytick)
if (v->IsValid()) {
/* Call the 32-day callback if needed */
CheckVehicle32Day(v);
v->OnNewDay();
_on_new_vehicle_day_proc[v->type](v);
}
}
}

View File

@@ -59,34 +59,50 @@ struct DebugLevel {
#if !defined(NO_DEBUG_MESSAGES)
/** Functionized DEBUG macro for compilers that don't support
* variadic macros (__VA_ARGS__) such as...yes MSVC2003 and lower */
#if defined(NO_VARARG_MACRO)
void CDECL DEBUG(int name, int level, ...)
{
va_list va;
const char *dbg;
const DebugLevel *dl = &debug_level[name];
if (level != 0 && *dl->level < level) return;
dbg = dl->name;
va_start(va, level);
#else
void CDECL debug(const char *dbg, ...)
{
va_list va;
va_start(va, dbg);
const char *s;
char buf[1024];
s = va_arg(va, const char*);
vsnprintf(buf, lengthof(buf), s, va);
va_end(va);
#if defined(ENABLE_NETWORK)
if (_debug_socket != INVALID_SOCKET) {
char buf2[lengthof(buf) + 32];
snprintf(buf2, lengthof(buf2), "dbg: [%s] %s\n", dbg, buf);
send(_debug_socket, buf2, strlen(buf2), 0);
} else
#endif /* ENABLE_NETWORK */
#endif /* NO_VARARG_MACRO */
{
const char *s;
char buf[1024];
s = va_arg(va, const char*);
vsnprintf(buf, lengthof(buf), s, va);
va_end(va);
#if defined(ENABLE_NETWORK)
if (_debug_socket != INVALID_SOCKET) {
char buf2[lengthof(buf) + 32];
snprintf(buf2, lengthof(buf2), "dbg: [%s] %s\n", dbg, buf);
send(_debug_socket, buf2, strlen(buf2), 0);
} else
#endif /* ENABLE_NETWORK */
{
#if defined(WINCE)
/* We need to do OTTD2FS twice, but as it uses a static buffer, we need to store one temporary */
TCHAR tbuf[512];
_sntprintf(tbuf, sizeof(tbuf), _T("%s"), OTTD2FS(dbg));
NKDbgPrintfW(_T("dbg: [%s] %s\n"), tbuf, OTTD2FS(buf));
/* We need to do OTTD2FS twice, but as it uses a static buffer, we need to store one temporary */
TCHAR tbuf[512];
_sntprintf(tbuf, sizeof(tbuf), _T("%s"), OTTD2FS(dbg));
NKDbgPrintfW(_T("dbg: [%s] %s\n"), tbuf, OTTD2FS(buf));
#else
fprintf(stderr, "dbg: [%s] %s\n", dbg, buf);
fprintf(stderr, "dbg: [%s] %s\n", dbg, buf);
#endif
IConsoleDebug(dbg, buf);
IConsoleDebug(dbg, buf);
}
}
}
#endif /* NO_DEBUG_MESSAGES */

View File

@@ -19,14 +19,44 @@
* 6.. - extremely detailed spamming
*/
/* Of course MSVC 2003 and lower has no support for variadic macros
* so we need to work around this... *sigh* */
#if defined(_MSC_VER) && (_MSC_VER < 1400)
#define NO_VARARG_MACRO
#endif
#if defined(NO_VARARG_MACRO)
enum DebugLevelType {
ai,
driver,
grf,
map,
misc,
ms,
net,
sprite,
oldloader,
ntp,
npf,
yapf,
freetype,
sl,
station,
};
#endif /* NO_VARARG_MACRO */
#ifdef NO_DEBUG_MESSAGES
#if defined(__GNUC__) && (__GNUC__ < 3)
#if defined(NO_VARARG_MACRO)
static inline void DEBUG(int name, int level, ...) {}
#elif defined(__GNUC__) && (__GNUC__ < 3)
#define DEBUG(name, level, args...)
#else
#define DEBUG(name, level, ...)
#endif
#else /* NO_DEBUG_MESSAGES */
#if defined(__GNUC__) && (__GNUC__ < 3)
#if defined(NO_VARARG_MACRO)
void CDECL DEBUG(int name, int level, ...);
#elif defined(__GNUC__) && (__GNUC__ < 3)
#define DEBUG(name, level, args...) if ((level == 0) || ( _debug_ ## name ## _level >= level)) debug(#name, args)
#else
#define DEBUG(name, level, ...) if (level == 0 || _debug_ ## name ## _level >= level) debug(#name, __VA_ARGS__)
@@ -48,7 +78,9 @@
extern int _debug_sl_level;
extern int _debug_station_level;
void CDECL debug(const char *dbg, ...);
#if !defined(NO_VARARG_MACRO)
void CDECL debug(const char *dbg, ...);
#endif /* NO_VARARG_MACRO */
#endif /* NO_DEBUG_MESSAGES */
void SetDebugString(const char *s);

View File

@@ -45,7 +45,7 @@ static inline bool IsTileDepotType(TileIndex tile, TransportType type)
return IsTileType(tile, MP_RAILWAY) && GetRailTileType(tile) == RAIL_TILE_DEPOT;
case TRANSPORT_ROAD:
return IsRoadDepotTile(tile);
return IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_DEPOT;
case TRANSPORT_WATER:
return IsTileType(tile, MP_WATER) && GetWaterTileType(tile) == WATER_TILE_DEPOT;
@@ -64,7 +64,7 @@ static inline bool IsTileDepotType(TileIndex tile, TransportType type)
static inline bool IsDepotTile(TileIndex tile)
{
switch (GetTileType(tile)) {
case MP_ROAD: return IsRoadDepot(tile);
case MP_ROAD: return GetRoadTileType(tile) == ROAD_TILE_DEPOT;
case MP_WATER: return GetWaterTileType(tile) == WATER_TILE_DEPOT;
case MP_RAILWAY: return GetRailTileType(tile) == RAIL_TILE_DEPOT;
case MP_STATION: return IsHangar(tile);

View File

@@ -519,11 +519,9 @@ static void ResizeDepotButtons(Window *w)
* Only use this if it's the same widget, that's used for more than one vehicle type and it needs different text/sprites
* Vehicle specific text/sprites, that's in a widget, that's only shown for one vehicle type (like sell whole train) is set in the widget array
*/
static void SetupStringsForDepotWindow(Window *w, VehicleType type)
static void SetupStringsForDepotWindow(Window *w, byte type)
{
switch (type) {
default: NOT_REACHED();
case VEH_TRAIN:
w->widget[DEPOT_WIDGET_CAPTION].data = STR_8800_TRAIN_DEPOT;
w->widget[DEPOT_WIDGET_STOP_ALL].tooltips = STR_MASS_STOP_DEPOT_TRAIN_TIP;
@@ -860,13 +858,8 @@ static void DepotWndProc(Window *w, WindowEvent *e)
} break;
case WE_ABORT_PLACE_OBJ: {
/* abort clone */
w->RaiseWidget(DEPOT_WIDGET_CLONE);
w->InvalidateWidget(DEPOT_WIDGET_CLONE);
/* abort drag & drop */
WP(w, depot_d).sel = INVALID_VEHICLE;
w->InvalidateWidget(DEPOT_WIDGET_MATRIX);
} break;
/* check if a vehicle in a depot was clicked.. */

View File

@@ -72,9 +72,6 @@ static void DisasterClearSquare(TileIndex tile)
_current_player = OWNER_WATER;
DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
_current_player = p;
/* update signals in buffer */
UpdateSignalsInBuffer();
}
break;
@@ -141,7 +138,8 @@ static void InitializeDisasterVehicle(Vehicle *v, int x, int y, byte z, Directio
DisasterVehicleUpdateImage(v);
VehiclePositionChanged(v);
MarkSingleVehicleDirty(v);
BeginVehicleMove(v);
EndVehicleMove(v);
}
static void DeleteDisasterVeh(Vehicle *v)
@@ -549,7 +547,8 @@ static void DisasterTick_Helicopter_Rotors(Vehicle *v)
if (++v->cur_image > SPR_ROTOR_MOVING_3) v->cur_image = SPR_ROTOR_MOVING_1;
VehiclePositionChanged(v);
MarkSingleVehicleDirty(v);
BeginVehicleMove(v);
EndVehicleMove(v);
}
/**
@@ -707,7 +706,8 @@ static void DisasterTick_Submarine(Vehicle *v)
if (++v->age > 8880) {
VehiclePositionChanged(v);
MarkSingleVehicleDirty(v);
BeginVehicleMove(v);
EndVehicleMove(v);
delete v;
return;
}
@@ -716,8 +716,9 @@ static void DisasterTick_Submarine(Vehicle *v)
tile = v->tile + TileOffsByDiagDir(DirToDiagDir(v->direction));
if (IsValidTile(tile)) {
TrackBits trackbits = TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_WATER, 0));
if (trackbits == TRACK_BIT_ALL && !Chance16(1, 90)) {
TrackdirBits r = (TrackdirBits)GetTileTrackStatus(tile, TRANSPORT_WATER, 0);
if (TrackdirBitsToTrackBits(r) == TRACK_BIT_ALL && !Chance16(1, 90)) {
GetNewVehiclePosResult gp = GetNewVehiclePos(v);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
return;
@@ -748,6 +749,12 @@ void DisasterVehicle::Tick()
_disastervehicle_tick_procs[this->subtype](this);
}
void OnNewDay_DisasterVehicle(Vehicle *v)
{
// not used
}
typedef void DisasterInitProc();

View File

@@ -19,7 +19,6 @@
#include "viewport_func.h"
#include "gfx_func.h"
#include "player_func.h"
#include "slope_func.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -190,11 +189,14 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
TileIndex tile_from;
TileIndex tile_to;
tile_from = e->we.place.tile;
DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile_from, NULL));
tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile_from, ReverseDiagDir(dir)) : tile_from);
tile_from = tile_to = e->we.place.tile;
switch (GetTileSlope(tile_from, NULL)) {
case SLOPE_SW: tile_to += TileDiffXY(-1, 0); break;
case SLOPE_SE: tile_to += TileDiffXY( 0, -1); break;
case SLOPE_NW: tile_to += TileDiffXY( 0, 1); break;
case SLOPE_NE: tile_to += TileDiffXY( 1, 0); break;
default: break;
}
VpSetPresizeRange(tile_from, tile_to);
} break;
@@ -243,7 +245,7 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
case WE_CREATE: w->LowerWidget(_station_show_coverage + 3); break;
case WE_PAINT: {
int rad = (_patches.modified_catchment) ? CA_DOCK : CA_UNMODIFIED;
int rad = (_patches.modified_catchment) ? CA_DOCK : 4;
if (WP(w, def_d).close) return;
DrawWindowWidgets(w);
@@ -254,13 +256,7 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
SetTileSelectSize(1, 1);
}
int text_end = DrawStationCoverageAreaText(4, 50, SCT_ALL, rad) + 4;
if (text_end > w->widget[2].bottom) {
SetWindowDirty(w);
ResizeWindowForWidget(w, 2, 0, text_end - w->widget[2].bottom);
SetWindowDirty(w);
}
DrawStationCoverageAreaText(4, 50, SCT_ALL, rad);
break;
}

View File

@@ -64,7 +64,7 @@ static void ChangeTileOwner_Dummy(TileIndex tile, PlayerID old_player, PlayerID
/* not used */
}
static TrackStatus GetTileTrackStatus_Dummy(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
static uint32 GetTileTrackStatus_Dummy(TileIndex tile, TransportType mode, uint sub_mode)
{
return 0;
}

View File

@@ -41,11 +41,9 @@
#include "sound_func.h"
#include "track_type.h"
#include "track_func.h"
#include "road_func.h"
#include "rail_map.h"
#include "signal_func.h"
#include "gfx_func.h"
#include "autoreplace_func.h"
#include "table/strings.h"
#include "table/sprites.h"
@@ -164,16 +162,16 @@ int UpdateCompanyRatingAndValue(Player *p, bool update)
num++;
if (v->age > 730) {
/* Find the vehicle with the lowest amount of profit */
if (min_profit_first || min_profit > v->profit_last_year) {
if (min_profit_first == true) {
min_profit = v->profit_last_year;
min_profit_first = false;
} else if (min_profit > v->profit_last_year) {
min_profit = v->profit_last_year;
}
}
}
}
min_profit >>= 8; // remove the fract part
_score_part[owner][SCORE_VEHICLES] = num;
/* Don't allow negative min_profit to show */
if (min_profit > 0)
@@ -434,9 +432,7 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player)
if (new_player != PLAYER_SPECTATOR) {
/* Update all signals because there can be new segment that was owned by two players
* and signals were not propagated
* Similiar with crossings - it is needed to bar crossings that weren't before
* because of different owner of crossing and approaching train */
* and signals were not propagated */
tile = 0;
do {
@@ -444,29 +440,11 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player)
TrackBits tracks = GetTrackBits(tile);
do { // there may be two tracks with signals for TRACK_BIT_HORZ and TRACK_BIT_VERT
Track track = RemoveFirstTrack(&tracks);
if (HasSignalOnTrack(tile, track)) AddTrackToSignalBuffer(tile, track, new_player);
if (HasSignalOnTrack(tile, track)) SetSignalsOnBothDir(tile, track, new_player);
} while (tracks != TRACK_BIT_NONE);
} else if (IsLevelCrossingTile(tile) && IsTileOwner(tile, new_player)) {
UpdateLevelCrossing(tile);
}
} while (++tile != MapSize());
}
/* update signals in buffer */
UpdateSignalsInBuffer();
}
/* In all cases clear replace engine rules.
* Even if it was copied, it could interfere with new owner's rules */
RemoveAllEngineReplacementForPlayer(GetPlayer(old_player));
if (new_player == PLAYER_SPECTATOR) {
RemoveAllGroupsForPlayer(old_player);
} else {
Group *g;
FOR_ALL_GROUPS(g) {
if (g->owner == old_player) g->owner = new_player;
}
}
/* Change color of existing windows */
@@ -860,9 +838,9 @@ static const Money _price_base[NUM_PRICES] = {
55, ///< remove_dock
1600, ///< remove_house
40, ///< remove_road
5600, ///< running_rail[0] steam
5200, ///< running_rail[1] diesel
4800, ///< running_rail[2] electric
5600, ///< running_rail[0] railroad
5200, ///< running_rail[1] monorail
4800, ///< running_rail[2] maglev
9600, ///< aircraft_running
1600, ///< roadveh_running
5600, ///< ship_running
@@ -928,15 +906,6 @@ void StartupEconomy()
_economy.fluct = GB(Random(), 0, 8) + 168;
}
Money GetPriceByIndex(uint8 index)
{
if (index > NUM_PRICES) return 0;
return ((Money*)&_price)[index];
}
Pair SetupSubsidyDecodeParam(const Subsidy* s, bool mode)
{
TileIndex tile;
@@ -1528,7 +1497,7 @@ void VehiclePayment(Vehicle *front_v)
cp->days_in_transit,
v->cargo_type);
front_v->profit_this_year += profit << 8;
front_v->profit_this_year += profit;
virtual_profit += profit; // accumulate transfer profits for whole vehicle
cp->feeder_share += profit; // account for the (virtual) profit already made for the cargo packet
cp->paid_for = true; // record that the cargo has been paid for to eliminate double counting
@@ -1546,7 +1515,7 @@ void VehiclePayment(Vehicle *front_v)
}
if (route_profit != 0) {
front_v->profit_this_year += vehicle_profit << 8;
front_v->profit_this_year += vehicle_profit;
SubtractMoneyFromPlayer(CommandCost(front_v->GetExpenseType(true), -route_profit));
if (IsLocalPlayer() && !PlayVehicleSound(front_v, VSE_LOAD_UNLOAD)) {
@@ -1611,7 +1580,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
byte load_amount = EngInfo(v->engine_type)->load_amount;
if (_patches.gradual_loading && HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_LOAD_AMOUNT)) {
uint16 cb_load_amount = GetVehicleCallback(CBID_VEHICLE_LOAD_AMOUNT, 0, 0, v->engine_type, v);
if (cb_load_amount != CALLBACK_FAILED && GB(cb_load_amount, 0, 8) != 0) load_amount = GB(cb_load_amount, 0, 8);
if (cb_load_amount != CALLBACK_FAILED && cb_load_amount != 0) load_amount = cb_load_amount & 0xFF;
}
GoodsEntry *ge = &st->goods[v->cargo_type];
@@ -1894,7 +1863,7 @@ CommandCost CmdBuyShareInCompany(TileIndex tile, uint32 flags, uint32 p1, uint32
if (!p->is_active) return CMD_ERROR;
/* Protect new companies from hostile takeovers */
if (_cur_year - p->inaugurated_year < 6) return_cmd_error(STR_PROTECTED);
if (_cur_year - p->inaugurated_year < 6) return_cmd_error(STR_7080_PROTECTED);
/* Those lines are here for network-protection (clients can be slow) */
if (GetAmountOwnedBy(p, PLAYER_SPECTATOR) == 0) return cost;

View File

@@ -41,6 +41,4 @@ uint MoveGoodsToStation(TileIndex tile, int w, int h, CargoID type, uint amount)
void VehiclePayment(Vehicle *front_v);
void LoadUnloadStation(Station *st);
Money GetPriceByIndex(uint8 index);
#endif /* ECONOMY_FUNC_H */

View File

@@ -112,19 +112,18 @@ assert_compile(NUM_PRICES * sizeof(Money) == sizeof(Prices));
enum ExpensesType {
EXPENSES_CONSTRUCTION = 0,
EXPENSES_NEW_VEHICLES,
EXPENSES_TRAIN_RUN,
EXPENSES_ROADVEH_RUN,
EXPENSES_AIRCRAFT_RUN,
EXPENSES_SHIP_RUN,
EXPENSES_PROPERTY,
EXPENSES_TRAIN_INC,
EXPENSES_ROADVEH_INC,
EXPENSES_AIRCRAFT_INC,
EXPENSES_SHIP_INC,
EXPENSES_LOAN_INT,
EXPENSES_OTHER,
EXPENSES_END,
EXPENSES_NEW_VEHICLES = 1,
EXPENSES_TRAIN_RUN = 2,
EXPENSES_ROADVEH_RUN = 3,
EXPENSES_AIRCRAFT_RUN = 4,
EXPENSES_SHIP_RUN = 5,
EXPENSES_PROPERTY = 6,
EXPENSES_TRAIN_INC = 7,
EXPENSES_ROADVEH_INC = 8,
EXPENSES_AIRCRAFT_INC = 9,
EXPENSES_SHIP_INC = 10,
EXPENSES_LOAN_INT = 11,
EXPENSES_OTHER = 12,
INVALID_EXPENSES = 0xFF,
};

View File

@@ -64,7 +64,6 @@
#include "tunnelbridge_map.h"
#include "vehicle_func.h"
#include "player_base.h"
#include "tunnelbridge.h"
#include "table/sprites.h"
#include "table/elrail_data.h"
@@ -74,11 +73,8 @@ static inline TLG GetTLG(TileIndex t)
return (TLG)((HasBit(TileX(t), 0) << 1) + HasBit(TileY(t), 0));
}
/**
* Finds which Electrified Rail Bits are present on a given tile.
* @param t tile to check
* @param override pointer to PCP override, can be NULL
* @return trackbits of tile if it is electrified
/** Finds which Rail Bits are present on a given tile. For bridge tiles,
* returns track bits under the bridge
*/
static TrackBits GetRailTrackBitsUniversal(TileIndex t, byte *override)
{
@@ -97,13 +93,13 @@ static TrackBits GetRailTrackBitsUniversal(TileIndex t, byte *override)
case MP_TUNNELBRIDGE:
if (GetRailType(t) != RAILTYPE_ELECTRIC) return TRACK_BIT_NONE;
if (override != NULL && (IsTunnel(t) || GetTunnelBridgeLength(t, GetOtherBridgeEnd(t)) > 0)) {
if (override != NULL && (IsTunnel(t) || DistanceMax(t, GetOtherBridgeEnd(t)) > 1)) {
*override = 1 << GetTunnelBridgeDirection(t);
}
return AxisToTrackBits(DiagDirToAxis(GetTunnelBridgeDirection(t)));
case MP_ROAD:
if (!IsLevelCrossing(t)) return TRACK_BIT_NONE;
if (GetRoadTileType(t) != ROAD_TILE_CROSSING) return TRACK_BIT_NONE;
if (GetRailType(t) != RAILTYPE_ELECTRIC) return TRACK_BIT_NONE;
return GetCrossingRailBits(t);
@@ -130,7 +126,13 @@ static void AdjustTileh(TileIndex tile, Slope *tileh)
} else if (*tileh != SLOPE_FLAT) {
*tileh = SLOPE_FLAT;
} else {
*tileh = InclinedSlope(GetTunnelBridgeDirection(tile));
switch (GetTunnelBridgeDirection(tile)) {
case DIAGDIR_NE: *tileh = SLOPE_NE; break;
case DIAGDIR_SE: *tileh = SLOPE_SE; break;
case DIAGDIR_SW: *tileh = SLOPE_SW; break;
case DIAGDIR_NW: *tileh = SLOPE_NW; break;
default: NOT_REACHED();
}
}
}
}
@@ -189,7 +191,7 @@ void DrawCatenaryOnTunnel(const TileInfo *ti)
sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
BB_data[2] - sss->x_offset, BB_data[3] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset + 1,
GetTileZ(ti->tile) + sss->z_offset,
IsTransparencySet(TO_CATENARY),
IsTransparencySet(TO_BUILDINGS),
BB_data[0] - sss->x_offset, BB_data[1] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset
);
}
@@ -336,7 +338,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
AddSortableSpriteToDraw(pylon_sprites[temp], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE,
GetPCPElevation(ti->tile, i),
IsTransparencySet(TO_CATENARY), -1, -1);
IsTransparencySet(TO_BUILDINGS), -1, -1);
break; /* We already have drawn a pylon, bail out */
}
}
@@ -344,7 +346,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
}
/* Don't draw a wire under a low bridge */
if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !IsTransparencySet(TO_CATENARY)) {
if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !IsTransparencySet(TO_BUILDINGS)) {
uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile));
if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return;
@@ -371,7 +373,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
*/
AddSortableSpriteToDraw(sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
sss->x_size, sss->y_size, sss->z_size, GetSlopeZ(ti->x + sss->x_offset, ti->y + sss->y_offset) + sss->z_offset,
IsTransparencySet(TO_CATENARY));
IsTransparencySet(TO_BUILDINGS));
}
}
}
@@ -381,8 +383,8 @@ static void DrawCatenaryOnBridge(const TileInfo *ti)
TileIndex end = GetSouthernBridgeEnd(ti->tile);
TileIndex start = GetOtherBridgeEnd(end);
uint length = GetTunnelBridgeLength(start, end);
uint num = GetTunnelBridgeLength(ti->tile, start) + 1;
uint length = GetBridgeLength(start, end);
uint num = DistanceMax(ti->tile, start);
uint height;
const SortableSpriteStruct *sss;
@@ -404,7 +406,7 @@ static void DrawCatenaryOnBridge(const TileInfo *ti)
AddSortableSpriteToDraw(sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
sss->x_size, sss->y_size, sss->z_size, height + sss->z_offset,
IsTransparencySet(TO_CATENARY)
IsTransparencySet(TO_BUILDINGS)
);
/* Finished with wires, draw pylons */
@@ -415,17 +417,17 @@ static void DrawCatenaryOnBridge(const TileInfo *ti)
if (HasBit(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos);
uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos];
uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos];
AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), -1, -1);
AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_BUILDINGS), -1, -1);
}
/* need a pylon on the southern end of the bridge */
if (GetTunnelBridgeLength(ti->tile, start) + 1 == length) {
if (DistanceMax(ti->tile, start) == length) {
DiagDirection PCPpos = (axis == AXIS_X ? DIAGDIR_SW : DIAGDIR_SE);
Direction PPPpos = (axis == AXIS_X ? DIR_NW : DIR_NE);
if (HasBit(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos);
uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos];
uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos];
AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), -1, -1);
AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_BUILDINGS), -1, -1);
}
}
@@ -451,7 +453,7 @@ void DrawCatenary(const TileInfo *ti)
sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
sss->x_size, sss->y_size, sss->z_size,
GetTileMaxZ(ti->tile) + sss->z_offset,
IsTransparencySet(TO_CATENARY)
IsTransparencySet(TO_BUILDINGS)
);
return;
}
@@ -469,6 +471,7 @@ void DrawCatenary(const TileInfo *ti)
int32 SettingsDisableElrail(int32 p1)
{
EngineID e_id;
Vehicle *v;
Player *p;
bool disable = (p1 != 0);
@@ -478,9 +481,8 @@ int32 SettingsDisableElrail(int32 p1)
const RailType new_railtype = disable ? RAILTYPE_RAIL : RAILTYPE_ELECTRIC;
/* walk through all train engines */
EngineID eid;
FOR_ALL_ENGINEIDS_OF_TYPE(eid, VEH_TRAIN) {
RailVehicleInfo *rv_info = &_rail_vehicle_info[eid];
for (e_id = 0; e_id < NUM_TRAIN_ENGINES; e_id++) {
RailVehicleInfo *rv_info = &_rail_vehicle_info[e_id];
/* if it is an electric rail engine and its railtype is the wrong one */
if (rv_info->engclass == 2 && rv_info->railtype == old_railtype) {
/* change it to the proper one */

View File

@@ -16,6 +16,7 @@
#include "aircraft.h"
#include "newgrf_cargo.h"
#include "group.h"
#include "misc/autoptr.hpp"
#include "strings_func.h"
#include "gfx_func.h"
#include "functions.h"
@@ -90,9 +91,8 @@ static void CalcEngineReliability(Engine *e)
/* Check for early retirement */
if (e->player_avail != 0 && !_patches.never_expire_vehicles) {
int retire_early = EngInfo(e - _engines)->retire_early;
uint retire_early_max_age = max(0, e->duration_phase_1 + e->duration_phase_2 - retire_early * 12);
if (retire_early != 0 && age >= retire_early_max_age) {
uint retire_early = EngInfo(e - _engines)->retire_early;
if (retire_early > 0 && age >= e->duration_phase_1 + e->duration_phase_2 - retire_early * 12) {
/* Early retirement is enabled and we're past the date... */
e->player_avail = 0;
AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type);
@@ -172,6 +172,12 @@ void StartupEngines()
e->flags |= ENGINE_AVAILABLE;
e->player_avail = 0;
}
/* This sets up type for the engine
* It is needed if you want to ask the engine what type it is
* It should hopefully be the same as when you ask a vehicle what it is
* but using this, you can ask what type an engine number is
* even if it is not a vehicle (yet)*/
}
}
@@ -190,13 +196,13 @@ static void AcceptEnginePreview(EngineID eid, PlayerID player)
SetBit(p->avail_roadtypes, HasBit(EngInfo(eid)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
}
e->preview_player_rank = 0xFF;
e->preview_player = INVALID_PLAYER;
if (player == _local_player) {
AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type);
}
}
static PlayerID GetBestPlayer(uint8 pp)
static PlayerID GetBestPlayer(PlayerID pp)
{
const Player *p;
int32 best_hist;
@@ -217,7 +223,7 @@ static PlayerID GetBestPlayer(uint8 pp)
if (best_player == PLAYER_SPECTATOR) return PLAYER_SPECTATOR;
SetBit(mask, best_player);
} while (--pp != 0);
} while (pp--, pp != 0);
return best_player;
}
@@ -233,16 +239,16 @@ void EnginesDailyLoop()
if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) {
if (e->flags & ENGINE_OFFER_WINDOW_OPEN) {
if (e->preview_player_rank != 0xFF && !--e->preview_wait) {
if (e->preview_player != 0xFF && !--e->preview_wait) {
e->flags &= ~ENGINE_OFFER_WINDOW_OPEN;
DeleteWindowById(WC_ENGINE_PREVIEW, i);
e->preview_player_rank++;
e->preview_player++;
}
} else if (e->preview_player_rank != 0xFF) {
PlayerID best_player = GetBestPlayer(e->preview_player_rank);
} else if (e->preview_player != 0xFF) {
PlayerID best_player = GetBestPlayer(e->preview_player);
if (best_player == PLAYER_SPECTATOR) {
e->preview_player_rank = 0xFF;
e->preview_player = INVALID_PLAYER;
continue;
}
@@ -272,7 +278,7 @@ CommandCost CmdWantEnginePreview(TileIndex tile, uint32 flags, uint32 p1, uint32
if (!IsEngineIndex(p1)) return CMD_ERROR;
e = GetEngine(p1);
if (GetBestPlayer(e->preview_player_rank) != _current_player) return CMD_ERROR;
if (GetBestPlayer(e->preview_player) != _current_player) return CMD_ERROR;
if (flags & DC_EXEC) AcceptEnginePreview(p1, _current_player);
@@ -342,9 +348,10 @@ static void NewVehicleAvailable(Engine *e)
void EnginesMonthlyLoop()
{
Engine *e;
if (_cur_year < YEAR_ENGINE_AGING_STOPS) {
Engine *e;
FOR_ALL_ENGINES(e) {
for (e = _engines; e != endof(_engines); e++) {
/* Age the vehicle */
if (e->flags & ENGINE_AVAILABLE && e->age != 0xFFFF) {
e->age++;
@@ -360,7 +367,7 @@ void EnginesMonthlyLoop()
/* Do not introduce new rail wagons */
if (!IsWagon(e - _engines))
e->preview_player_rank = 1; // Give to the player with the highest rating.
e->preview_player = (PlayerID)1; // Give to the player with the highest rating.
}
}
}
@@ -403,19 +410,22 @@ CommandCost CmdRenameEngine(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
/** Check if an engine is buildable.
* @param engine index of the engine to check.
* @param type the type the engine should be.
* @param player index of the player.
* @return True if an engine is valid, of the specified type, and buildable by
* the given player.
/*
* returns true if an engine is valid, of the specified type, and buildable by
* the given player, false otherwise
*
* engine = index of the engine to check
* type = the type the engine should be of (VEH_xxx)
* player = index of the player
*/
bool IsEngineBuildable(EngineID engine, VehicleType type, PlayerID player)
bool IsEngineBuildable(EngineID engine, byte type, PlayerID player)
{
const Engine *e;
/* check if it's an engine that is in the engine array */
if (!IsEngineIndex(engine)) return false;
const Engine *e = GetEngine(engine);
e = GetEngine(engine);
/* check if it's an engine of specified type */
if (e->type != type) return false;
@@ -497,10 +507,6 @@ void RemoveAllEngineReplacement(EngineRenewList *erl)
EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group)
{
const EngineRenew *er = GetEngineReplacement(erl, engine, group);
if (er == NULL && (group == DEFAULT_GROUP || (IsValidGroupID(group) && !GetGroup(group)->replace_protection))) {
/* We didn't find anything useful in the vehicle's own group so we will try ALL_GROUP */
er = GetEngineReplacement(erl, engine, ALL_GROUP);
}
return er == NULL ? INVALID_ENGINE : er->to;
}
@@ -515,15 +521,19 @@ CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, Engi
return CommandCost();
}
if (!EngineRenew::CanAllocateItem()) return CMD_ERROR;
er = new EngineRenew(old_engine, new_engine);
if (er == NULL) return CMD_ERROR;
AutoPtrT<EngineRenew> er_auto_delete = er;
if (flags & DC_EXEC) {
er = new EngineRenew(old_engine, new_engine);
er->group_id = group;
/* Insert before the first element */
er->next = (EngineRenew *)(*erl);
*erl = (EngineRenewList)er;
er_auto_delete.Detach();
}
return CommandCost();
@@ -608,7 +618,7 @@ static const SaveLoad _engine_desc[] = {
SLE_VAR(Engine, lifelength, SLE_UINT8),
SLE_VAR(Engine, flags, SLE_UINT8),
SLE_VAR(Engine, preview_player_rank, SLE_UINT8),
SLE_VAR(Engine, preview_player, SLE_UINT8),
SLE_VAR(Engine, preview_wait, SLE_UINT8),
SLE_CONDNULL(1, 0, 44),
SLE_VAR(Engine, player_avail, SLE_UINT8),

View File

@@ -36,13 +36,12 @@ struct RailVehicleInfo {
uint16 max_speed;
uint16 power;
uint16 weight;
byte running_cost;
byte running_cost_base;
byte running_cost_class;
EngineClass engclass; ///< Class of engine for this vehicle
byte capacity;
CargoID cargo_type;
byte ai_rank;
byte ai_passenger_only; ///< Bit value to tell AI that this engine is for passenger use only
uint16 pow_wag_power;
byte pow_wag_weight;
byte visual_effect; // NOTE: this is not 100% implemented yet, at the moment it is only used as a 'fallback' value
@@ -90,7 +89,6 @@ struct RoadVehicleInfo {
byte image_index;
byte base_cost;
byte running_cost;
byte running_cost_class;
SoundFxByte sfx;
byte max_speed;
byte capacity;
@@ -111,7 +109,7 @@ struct EngineInfo {
byte refit_cost;
byte misc_flags;
byte callbackmask;
int8 retire_early; ///< Number of years early to retire vehicle
byte retire_early; ///< Number of years early to retire vehicle
StringID string_id; ///< Default name of engine
};
@@ -125,7 +123,7 @@ struct Engine {
uint16 duration_phase_1, duration_phase_2, duration_phase_3;
byte lifelength;
byte flags;
uint8 preview_player_rank;
PlayerByte preview_player;
byte preview_wait;
byte player_avail;
VehicleType type; ///< type, ie VEH_ROAD, VEH_TRAIN, etc.
@@ -169,7 +167,7 @@ void DrawAircraftEngine(int x, int y, EngineID engine, SpriteID pal);
void LoadCustomEngineNames();
void DeleteCustomEngineNames();
bool IsEngineBuildable(EngineID engine, VehicleType type, PlayerID player);
bool IsEngineBuildable(EngineID engine, byte type, PlayerID player);
CargoID GetEngineCargoType(EngineID engine);
enum {
@@ -186,14 +184,14 @@ enum {
ROAD_ENGINES_INDEX = NUM_TRAIN_ENGINES,
};
static inline EngineID GetFirstEngineOfType(VehicleType type)
static inline EngineID GetFirstEngineOfType(byte type)
{
const EngineID start[] = {0, ROAD_ENGINES_INDEX, SHIP_ENGINES_INDEX, AIRCRAFT_ENGINES_INDEX};
return start[type];
}
static inline EngineID GetLastEngineOfType(VehicleType type)
static inline EngineID GetLastEngineOfType(byte type)
{
const EngineID end[] = {
NUM_TRAIN_ENGINES,

View File

@@ -126,7 +126,7 @@ static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw)
SetDParam(3, rvi->power << multihead);
SetDParam(1, rvi->weight << multihead);
SetDParam(4, rvi->running_cost * GetPriceByIndex(rvi->running_cost_class) >> 8 << multihead);
SetDParam(4, rvi->running_cost_base * _price.running_rail[rvi->running_cost_class] >> 8 << multihead);
if (rvi->capacity != 0) {
SetDParam(5, rvi->cargo_type);
@@ -155,7 +155,7 @@ static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw)
SetDParam(0, (_price.roadveh_base >> 3) * rvi->base_cost >> 5);
SetDParam(1, rvi->max_speed * 10 / 32);
SetDParam(2, rvi->running_cost * GetPriceByIndex(rvi->running_cost_class) >> 8);
SetDParam(2, rvi->running_cost * _price.roadveh_running >> 8);
SetDParam(3, rvi->cargo_type);
SetDParam(4, rvi->capacity);

View File

@@ -33,7 +33,6 @@ struct Fio {
FILE *handles[MAX_FILE_SLOTS]; ///< array of file handles we can have open
byte buffer_start[FIO_BUFFER_SIZE]; ///< local buffer when read from file
const char *filenames[MAX_FILE_SLOTS]; ///< array of filenames we (should) have open
char *shortnames[MAX_FILE_SLOTS];///< array of short names for spriteloader's use
#if defined(LIMITED_FDS)
uint open_handles; ///< current amount of open handles
uint usage_count[MAX_FILE_SLOTS]; ///< count how many times this file has been opened
@@ -48,9 +47,9 @@ uint32 FioGetPos()
return _fio.pos + (_fio.buffer - _fio.buffer_start) - FIO_BUFFER_SIZE;
}
const char *FioGetFilename(uint8 slot)
const char *FioGetFilename()
{
return _fio.shortnames[slot];
return _fio.filename;
}
void FioSeekTo(uint32 pos, int mode)
@@ -132,10 +131,6 @@ static inline void FioCloseFile(int slot)
{
if (_fio.handles[slot] != NULL) {
fclose(_fio.handles[slot]);
free(_fio.shortnames[slot]);
_fio.shortnames[slot] = NULL;
_fio.handles[slot] = NULL;
#if defined(LIMITED_FDS)
_fio.open_handles--;
@@ -189,14 +184,6 @@ void FioOpenFile(int slot, const char *filename)
FioCloseFile(slot); // if file was opened before, close it
_fio.handles[slot] = f;
_fio.filenames[slot] = filename;
/* Store the filename without path and extension */
const char *t = strrchr(filename, PATHSEPCHAR);
_fio.shortnames[slot] = strdup(t == NULL ? filename : t);
char *t2 = strrchr(_fio.shortnames[slot], '.');
if (t2 != NULL) *t2 = '\0';
strtolower(_fio.shortnames[slot]);
#if defined(LIMITED_FDS)
_fio.usage_count[slot] = 0;
_fio.open_handles++;
@@ -315,7 +302,7 @@ FILE *FioFOpenFileSp(const char *filename, const char *mode, Searchpath sp, Subd
f = fopen(buf, mode);
#if !defined(WIN32)
if (f == NULL) {
strtolower(buf + ((subdir == NO_DIRECTORY) ? 0 : strlen(_searchpaths[sp]) - 1));
strtolower(buf + strlen(_searchpaths[sp]) - 1);
f = fopen(buf, mode);
}
#endif

View File

@@ -12,7 +12,7 @@
void FioSeekTo(uint32 pos, int mode);
void FioSeekToFile(uint8 slot, uint32 pos);
uint32 FioGetPos();
const char *FioGetFilename(uint8 slot);
const char *FioGetFilename();
byte FioReadByte();
uint16 FioReadWord();
uint32 FioReadDword();

View File

@@ -19,8 +19,6 @@
#ifdef WIN32
# include <tchar.h>
# include <io.h>
# define access _taccess
# define unlink _tunlink
#else
# include <unistd.h>
#endif /* WIN32 */
@@ -204,7 +202,7 @@ bool FileExists(const char *filename)
CloseHandle(hand);
return 0;
#else
return access(OTTD2FS(filename), 0) == 0;
return access(filename, 0) == 0;
#endif
}

View File

@@ -518,38 +518,34 @@ void SetUnicodeGlyph(FontSize size, uint32 key, SpriteID sprite)
void InitializeUnicodeGlyphMap()
{
for (FontSize size = FS_NORMAL; size != FS_END; size++) {
FontSize size;
SpriteID base;
SpriteID sprite;
uint i;
for (size = FS_NORMAL; size != FS_END; size++) {
/* Clear out existing glyph map if it exists */
if (_unicode_glyph_map[size] != NULL) {
for (uint i = 0; i < 256; i++) {
for (i = 0; i < 256; i++) {
if (_unicode_glyph_map[size][i] != NULL) free(_unicode_glyph_map[size][i]);
}
free(_unicode_glyph_map[size]);
_unicode_glyph_map[size] = NULL;
}
SpriteID base = GetFontBase(size);
for (uint i = ASCII_LETTERSTART; i < 256; i++) {
SpriteID sprite = base + i - ASCII_LETTERSTART;
base = GetFontBase(size);
for (i = ASCII_LETTERSTART; i < 256; i++) {
sprite = base + i - ASCII_LETTERSTART;
if (!SpriteExists(sprite)) continue;
SetUnicodeGlyph(size, i, sprite);
SetUnicodeGlyph(size, i + SCC_SPRITE_START, sprite);
}
for (uint i = 0; i < lengthof(_default_unicode_map); i++) {
byte key = _default_unicode_map[i].key;
if (key == CLRA || key == CLRL) {
/* Clear the glyph. This happens if the glyph at this code point
* is non-standard and should be accessed by an SCC_xxx enum
* entry only. */
if (key == CLRA || size == FS_LARGE) {
SetUnicodeGlyph(size, _default_unicode_map[i].code, 0);
}
} else {
SpriteID sprite = base + key - ASCII_LETTERSTART;
SetUnicodeGlyph(size, _default_unicode_map[i].code, sprite);
}
for (i = 0; i < lengthof(_default_unicode_map); i++) {
sprite = base + _default_unicode_map[i].key - ASCII_LETTERSTART;
SetUnicodeGlyph(size, _default_unicode_map[i].code, sprite);
}
}
}

View File

@@ -24,7 +24,6 @@
#include "engine.h"
#include "settings_type.h"
#include "newgrf_storage.h"
#include "water.h"
#include "table/sprites.h"
@@ -90,7 +89,7 @@ static void *_GenerateWorld(void *arg)
if (_network_dedicated) DEBUG(net, 0, "Generating map, please wait...");
/* Set the Random() seed to generation_seed so we produce the same map with the same seed */
if (_patches.generation_seed == GENERATE_NEW_SEED) _patches.generation_seed = _patches_newgame.generation_seed = InteractiveRandom();
_random.SetSeed(_patches.generation_seed);
_random_seeds[0][0] = _random_seeds[0][1] = _patches.generation_seed;
SetGeneratingWorldProgress(GWP_MAP_INIT, 2);
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0);

File diff suppressed because it is too large Load Diff

View File

@@ -37,7 +37,7 @@ bool _screen_disable_anim = false; ///< Disable palette animation (important f
bool _exit_game;
bool _networking; ///< are we in networking mode?
byte _game_mode;
int8 _pause_game;
byte _pause_game;
int _pal_first_dirty;
int _pal_count_dirty;

View File

@@ -65,11 +65,12 @@ extern uint16 _cur_resolution[2];
extern Colour _cur_palette[256];
void HandleKeypress(uint32 key);
void HandleCtrlChanged();
void HandleMouseEvents();
void CSleep(int milliseconds);
void UpdateWindows();
uint32 InteractiveRandom(); //< Used for random sequences that are not the same on the other end of the multiplayer link
uint InteractiveRandomRange(uint max);
void DrawChatMessage();
void DrawMouseCursor();
void ScreenSizeChanged();
@@ -82,6 +83,12 @@ void GfxScroll(int left, int top, int width, int height, int xo, int yo);
void DrawSprite(SpriteID img, SpriteID pal, int x, int y, const SubSprite *sub = NULL);
/* XXX doesn't really belong here, but the only
* consumers always use it in conjunction with DoDrawString() */
#define UPARROW "\xEE\x8A\x80"
#define DOWNARROW "\xEE\x8A\xAA"
int DrawStringCentered(int x, int y, StringID str, uint16 color);
int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, uint16 color);
int DoDrawStringCentered(int x, int y, const char *str, uint16 color);

View File

@@ -30,6 +30,7 @@ struct FileList {
MD5File basic[2]; ///< GRF files that always have to be loaded
MD5File landscape[3]; ///< Landscape specific grf files
MD5File sound; ///< Sound samples
MD5File chars; ///< GRF File with character replacements
MD5File openttd; ///< GRF File with OTTD specific graphics
};
@@ -70,15 +71,20 @@ void LoadSpritesIndexed(int file_index, uint *sprite_id, const SpriteID *index_t
while ((start = *index_tbl++) != END) {
uint end = *index_tbl++;
do {
#ifdef NDEBUG
LoadNextSprite(start, file_index, *sprite_id);
#else
bool b = LoadNextSprite(start, file_index, *sprite_id);
assert(b);
#endif
(*sprite_id)++;
} while (++start <= end);
if (start == SKIP) { // skip sprites (amount in second var)
SkipSprites(end);
(*sprite_id) += end;
} else { // load sprites and use indexes from start to end
do {
#ifdef NDEBUG
LoadNextSprite(start, file_index, *sprite_id);
#else
bool b = LoadNextSprite(start, file_index, *sprite_id);
assert(b);
#endif
(*sprite_id)++;
} while (++start <= end);
}
}
}
@@ -186,6 +192,10 @@ void CheckExternalFiles()
add_pos += snprintf(add_pos, ERROR_MESSAGE_LENGTH, "Your 'sample.cat' file is corrupted or missing! You can find 'sample.cat' on your Transport Tycoon Deluxe CD-ROM.\n");
}
if (!FileMD5(files->chars)) {
add_pos += snprintf(add_pos, ERROR_MESSAGE_LENGTH, "Your '%s' file is corrupted or missing! The file was part of your installation.\n", files->chars.filename);
}
if (!FileMD5(files->openttd)) {
add_pos += snprintf(add_pos, ERROR_MESSAGE_LENGTH, "Your '%s' file is corrupted or missing! The file was part of your installation.\n", files->openttd.filename);
}
@@ -194,12 +204,142 @@ void CheckExternalFiles()
}
static const SpriteID trg1idx[] = {
0, 1, ///< Mouse cursor, ZZZ
/* Medium font */
2, 92, ///< ' ' till 'z'
SKIP, 36,
160, 160, ///< Move Ÿ to the correct position
98, 98, ///< Up arrow
131, 133,
SKIP, 1, ///< skip currency sign
135, 135,
SKIP, 1,
137, 137,
SKIP, 1,
139, 139,
140, 140, ///< @todo Down arrow
141, 141,
142, 142, ///< @todo Check mark
143, 143, ///< @todo Cross
144, 144,
145, 145, ///< @todo Right arrow
146, 149,
118, 122, ///< Transport markers
SKIP, 2,
157, 157,
114, 115, ///< Small up/down arrows
SKIP, 1,
161, 225,
/* Small font */
226, 316, ///< ' ' till 'z'
SKIP, 36,
384, 384, ///< Move Ÿ to the correct position
322, 322, ///< Up arrow
355, 357,
SKIP, 1, ///< skip currency sign
359, 359,
SKIP, 1,
361, 361,
SKIP, 1,
363, 363,
364, 364, ////< @todo Down arrow
365, 366,
SKIP, 1,
368, 368,
369, 369, ///< @todo Right arrow
370, 373,
SKIP, 7,
381, 381,
SKIP, 3,
385, 449,
/* Big font */
450, 540, ///< ' ' till 'z'
SKIP, 36,
608, 608, ///< Move Ÿ to the correct position
SKIP, 1,
579, 581,
SKIP, 1,
583, 583,
SKIP, 5,
589, 589,
SKIP, 15,
605, 605,
SKIP, 3,
609, 625,
SKIP, 1,
627, 632,
SKIP, 1,
634, 639,
SKIP, 1,
641, 657,
SKIP, 1,
659, 664,
SKIP, 2,
667, 671,
SKIP, 1,
673, 673,
/* Graphics */
674, 4792,
END
};
/** Replace some letter sprites with some other letters */
static const SpriteID _chars_grf_indexes[] = {
134, 134, ///< euro symbol medium size
582, 582, ///< euro symbol large size
358, 358, ///< euro symbol tiny
648, 648, ///< nordic char: æ
616, 616, ///< nordic char: Æ
666, 666, ///< nordic char: ø
634, 634, ///< nordic char: Ø
382, 383, ///< Œ œ tiny
158, 159, ///< Œ œ medium
606, 607, ///< Œ œ large
360, 360, ///< Š tiny
362, 362, ///< š tiny
136, 136, ///< Š medium
138, 138, ///< š medium
584, 584, ///< Š large
586, 586, ///< š large
626, 626, ///< Ð large
658, 658, ///< ð large
374, 374, ///< Ž tiny
378, 378, ///< ž tiny
150, 150, ///< Ž medium
154, 154, ///< ž medium
598, 598, ///< Ž large
602, 602, ///< ž large
640, 640, ///< Þ large
672, 672, ///< þ large
380, 380, ///< º tiny
156, 156, ///< º medium
604, 604, ///< º large
317, 320, ///< { | } ~ tiny
93, 96, ///< { | } ~ medium
541, 544, ///< { | } ~ large
585, 585, ///< § large
587, 587, ///< © large
592, 592, ///< ® large
594, 597, ///< ° ± ² ³ large
633, 633, ///< × large
665, 665, ///< ÷ large
377, 377, ///< · small
153, 153, ///< · medium
601, 601, ///< · large
END
};
static void LoadSpriteTables()
{
const FileList *files = _use_dos_palette ? &files_dos : &files_win;
uint i = FIRST_GRF_SLOT;
LoadGrfFile(files->basic[0].filename, 0, i++);
LoadGrfIndexed(files->basic[0].filename, trg1idx, i++);
DupSprite( 2, 130); // non-breaking space medium
DupSprite(226, 354); // non-breaking space tiny
DupSprite(450, 578); // non-breaking space large
/*
* The second basic file always starts at the given location and does
@@ -222,6 +362,8 @@ static void LoadSpriteTables()
);
}
LoadGrfIndexed(files->chars.filename, _chars_grf_indexes, i++);
/* Initialize the unicode to sprite mapping table */
InitializeUnicodeGlyphMap();

View File

@@ -43,7 +43,7 @@ enum {
};
/* Apparently these don't play well with enums. */
static const OverflowSafeInt64 INVALID_DATAPOINT(INT64_MAX); // Value used for a datapoint that shouldn't be drawn.
static const OverflowSafeInt64 INVALID_DATAPOINT = INT64_MAX; // Value used for a datapoint that shouldn't be drawn.
static const uint INVALID_DATAPOINT_POS = UINT_MAX; // Used to determine if the previous point was drawn.
struct GraphDrawer {

View File

@@ -12,7 +12,7 @@
enum {
ALL_GROUP = 0xFFFD,
DEFAULT_GROUP = 0xFFFE, ///< ungrouped vehicles are in this group.
DEFAULT_GROUP = 0xFFFE,
INVALID_GROUP = 0xFFFF,
};
@@ -23,7 +23,7 @@ struct Group : PoolItem<Group, GroupID, &_Group_pool> {
char *name; ///< Group Name
uint16 num_vehicle; ///< Number of vehicles wich belong to the group
PlayerByte owner; ///< Group Owner
PlayerID owner; ///< Group Owner
VehicleTypeByte vehicle_type; ///< Vehicle type of the group
bool replace_protection; ///< If set to true, the global autoreplace have no effect on the group

View File

@@ -12,6 +12,7 @@
#include "train.h"
#include "aircraft.h"
#include "vehicle_gui.h"
#include "misc/autoptr.hpp"
#include "strings_func.h"
#include "functions.h"
#include "window_func.h"
@@ -91,14 +92,20 @@ CommandCost CmdCreateGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
VehicleType vt = (VehicleType)p1;
if (!IsPlayerBuildableVehicleType(vt)) return CMD_ERROR;
if (!Group::CanAllocateItem()) return CMD_ERROR;
AutoPtrT<Group> g_auto_delete;
Group *g = new Group(_current_player);
if (g == NULL) return CMD_ERROR;
g_auto_delete = g;
if (flags & DC_EXEC) {
Group *g = new Group(_current_player);
g->replace_protection = false;
g->vehicle_type = vt;
InvalidateWindowData(GetWCForVT(vt), (vt << 11) | VLW_GROUP_LIST | _current_player);
g_auto_delete.Detach();
}
return CommandCost();
@@ -127,9 +134,6 @@ CommandCost CmdDeleteGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (v->group_id == g->index && v->type == g->vehicle_type) v->group_id = DEFAULT_GROUP;
}
/* Update backupped orders if needed */
if (_backup_orders_data.group == g->index) _backup_orders_data.group = DEFAULT_GROUP;
/* If we set an autoreplace for the group we delete, remove it. */
if (_current_player < MAX_PLAYERS) {
Player *p;

View File

@@ -23,7 +23,6 @@
#include "viewport_func.h"
#include "gfx_func.h"
#include "player_func.h"
#include "widgets/dropdown_type.h"
#include "widgets/dropdown_func.h"
#include "table/strings.h"
@@ -115,6 +114,7 @@ enum GroupListWidgets {
GRP_WIDGET_LIST_GROUP,
GRP_WIDGET_LIST_GROUP_SCROLLBAR,
GRP_WIDGET_SORT_BY_ORDER,
GRP_WIDGET_SORT_BY_TEXT,
GRP_WIDGET_SORT_BY_DROPDOWN,
GRP_WIDGET_EMPTY_TOP_RIGHT,
GRP_WIDGET_LIST_VEHICLE,
@@ -126,6 +126,7 @@ enum GroupListWidgets {
GRP_WIDGET_REPLACE_PROTECTION,
GRP_WIDGET_EMPTY2,
GRP_WIDGET_AVAILABLE_VEHICLES,
GRP_WIDGET_MANAGE_VEHICLES,
GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN,
GRP_WIDGET_STOP_ALL,
GRP_WIDGET_START_ALL,
@@ -144,7 +145,8 @@ static const Widget _group_widgets[] = {
{ WWT_MATRIX, RESIZE_BOTTOM, 14, 0, 188, 52, 168, 0x701, STR_GROUPS_CLICK_ON_GROUP_FOR_TIP},
{ WWT_SCROLLBAR, RESIZE_BOTTOM, 14, 189, 200, 52, 168, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 201, 281, 14, 25, STR_SORT_BY, STR_SORT_ORDER_TIP},
{ WWT_DROPDOWN, RESIZE_NONE, 14, 282, 447, 14, 25, 0x0, STR_SORT_CRITERIA_TIP},
{ WWT_PANEL, RESIZE_NONE, 14, 282, 435, 14, 25, 0x0, STR_SORT_CRITERIA_TIP},
{ WWT_TEXTBTN, RESIZE_NONE, 14, 436, 447, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP},
{ WWT_PANEL, RESIZE_RIGHT, 14, 448, 459, 14, 25, 0x0, STR_NULL},
{ WWT_MATRIX, RESIZE_RB, 14, 201, 447, 26, 181, 0x701, STR_NULL},
{ WWT_SCROLL2BAR, RESIZE_LRB, 14, 448, 459, 26, 181, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
@@ -155,7 +157,8 @@ static const Widget _group_widgets[] = {
{ WWT_PUSHIMGBTN, RESIZE_TB, 14, 165, 188, 169, 193, 0x0, STR_GROUP_REPLACE_PROTECTION_TIP},
{ WWT_PANEL, RESIZE_TB, 14, 189, 200, 169, 193, 0x0, STR_NULL},
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 201, 306, 182, 193, 0x0, STR_AVAILABLE_ENGINES_TIP},
{ WWT_DROPDOWN, RESIZE_TB, 14, 307, 423, 182, 193, STR_MANAGE_LIST, STR_MANAGE_LIST_TIP},
{ WWT_TEXTBTN, RESIZE_TB, 14, 307, 411, 182, 193, STR_MANAGE_LIST, STR_MANAGE_LIST_TIP},
{ WWT_TEXTBTN, RESIZE_TB, 14, 412, 423, 182, 193, STR_0225, STR_MANAGE_LIST_TIP},
{ WWT_PUSHIMGBTN, RESIZE_TB, 14, 424, 435, 182, 193, SPR_FLAG_VEH_STOPPED, STR_MASS_STOP_LIST_TIP},
{ WWT_PUSHIMGBTN, RESIZE_TB, 14, 436, 447, 182, 193, SPR_FLAG_VEH_RUNNING, STR_MASS_START_LIST_TIP},
{ WWT_PANEL, RESIZE_RTB, 14, 448, 447, 182, 193, 0x0, STR_NULL},
@@ -255,33 +258,28 @@ static void CreateVehicleGroupWindow(Window *w)
}
}
enum GroupActionListFunction {
GALF_REPLACE,
GALF_SERVICE,
GALF_DEPOT,
GALF_ADD_SHARED,
GALF_REMOVE_ALL,
};
/**
* Update/redraw the group action dropdown
* @param w the window the dropdown belongs to
* @param gid the currently selected group in the window
*/
static void ShowGroupActionDropdown(Window *w, GroupID gid)
static void UpdateGroupActionDropdown(Window *w, GroupID gid, bool refresh = true)
{
DropDownList *list = new DropDownList();
if (refresh && !w->IsWidgetLowered(GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN)) return;
list->push_back(new DropDownListStringItem(STR_REPLACE_VEHICLES, GALF_REPLACE, false));
list->push_back(new DropDownListStringItem(STR_SEND_FOR_SERVICING, GALF_SERVICE, false));
list->push_back(new DropDownListStringItem(STR_SEND_TRAIN_TO_DEPOT, GALF_DEPOT, false));
static StringID action_str[] = {
STR_REPLACE_VEHICLES,
STR_SEND_FOR_SERVICING,
STR_SEND_TRAIN_TO_DEPOT,
STR_NULL,
STR_NULL,
INVALID_STRING_ID
};
if (IsValidGroupID(gid)) {
list->push_back(new DropDownListStringItem(STR_GROUP_ADD_SHARED_VEHICLE, GALF_ADD_SHARED, false));
list->push_back(new DropDownListStringItem(STR_GROUP_REMOVE_ALL_VEHICLES, GALF_REMOVE_ALL, false));
}
action_str[3] = IsValidGroupID(gid) ? STR_GROUP_ADD_SHARED_VEHICLE : INVALID_STRING_ID;
action_str[4] = IsValidGroupID(gid) ? STR_GROUP_REMOVE_ALL_VEHICLES : INVALID_STRING_ID;
ShowDropDownList(w, list, 0, GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN);
ShowDropDownMenu(w, action_str, 0, GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN, 0, 0);
}
/**
@@ -301,10 +299,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
case WE_INVALIDATE_DATA:
gv->l.flags |= VL_REBUILD;
gl->l.flags |= VL_REBUILD;
if (!(IsAllGroupID(gv->group_sel) || IsDefaultGroupID(gv->group_sel) || IsValidGroupID(gv->group_sel))) {
gv->group_sel = ALL_GROUP;
HideDropDownMenu(w);
}
UpdateGroupActionDropdown(w, gv->group_sel);
SetWindowDirty(w);
break;
@@ -341,6 +336,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
w->SetWidgetsDisabledState(gv->l.list_length == 0 || _local_player != owner,
GRP_WIDGET_STOP_ALL,
GRP_WIDGET_START_ALL,
GRP_WIDGET_MANAGE_VEHICLES,
GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN,
WIDGET_LIST_END);
@@ -415,8 +411,6 @@ static void GroupWndProc(Window *w, WindowEvent *e)
}
}
/* Set text of sort by dropdown */
w->widget[GRP_WIDGET_SORT_BY_DROPDOWN].data = _vehicle_sort_listing[gv->l.sort_type];
DrawWindowWidgets(w);
@@ -466,9 +460,10 @@ static void GroupWndProc(Window *w, WindowEvent *e)
DrawStringRightAligned(187, y1 + 1, STR_GROUP_TINY_NUM, (gv->group_sel == g->index) ? TC_WHITE : TC_BLACK);
}
DrawSortButtonState(w, GRP_WIDGET_SORT_BY_ORDER, gv->l.flags & VL_DESC ? SBS_DOWN : SBS_UP);
/* Draw Matrix Vehicle according to the vehicle list built before */
DrawString(285, 15, _vehicle_sort_listing[gv->l.sort_type], TC_BLACK);
DoDrawString(gv->l.flags & VL_DESC ? DOWNARROW : UPARROW, 269, 15, TC_BLACK);
max = min(w->vscroll2.pos + w->vscroll2.cap, gv->l.list_length);
for (i = w->vscroll2.pos ; i < max ; ++i) {
const Vehicle* v = gv->sort_list[i];
@@ -483,8 +478,8 @@ static void GroupWndProc(Window *w, WindowEvent *e)
if (w->resize.step_height == PLY_WND_PRC__SIZE_OF_ROW_BIG2) DrawSmallOrderList(v, x + 138, y2);
SetDParam(0, v->GetDisplayProfitThisYear());
SetDParam(1, v->GetDisplayProfitLastYear());
SetDParam(0, v->profit_this_year);
SetDParam(1, v->profit_last_year);
DrawString(x + 19, y2 + w->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, TC_FROMSTRING);
if (IsValidGroupID(v->group_id)) {
@@ -499,8 +494,6 @@ static void GroupWndProc(Window *w, WindowEvent *e)
}
case WE_CLICK:
if (e->we.click.widget != GRP_WIDGET_SORT_BY_DROPDOWN && e->we.click.widget != GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN) HideDropDownMenu(w);
switch(e->we.click.widget) {
case GRP_WIDGET_SORT_BY_ORDER: // Flip sorting method ascending/descending
gv->l.flags ^= VL_DESC;
@@ -510,6 +503,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
SetWindowDirty(w);
break;
case GRP_WIDGET_SORT_BY_TEXT:
case GRP_WIDGET_SORT_BY_DROPDOWN: // Select sorting criteria dropdown menu
ShowDropDownMenu(w, _vehicle_sort_listing, gv->l.sort_type, GRP_WIDGET_SORT_BY_DROPDOWN, 0, 0);
return;
@@ -518,6 +512,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
if (!IsAllGroupID(gv->group_sel)) {
gv->group_sel = ALL_GROUP;
gv->l.flags |= VL_REBUILD;
UpdateGroupActionDropdown(w, gv->group_sel);
SetWindowDirty(w);
}
break;
@@ -526,6 +521,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
if (!IsDefaultGroupID(gv->group_sel)) {
gv->group_sel = DEFAULT_GROUP;
gv->l.flags |= VL_REBUILD;
UpdateGroupActionDropdown(w, gv->group_sel);
SetWindowDirty(w);
}
break;
@@ -542,6 +538,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
gv->group_sel = gl->sort_list[id_g]->index;;
gv->l.flags |= VL_REBUILD;
UpdateGroupActionDropdown(w, gv->group_sel);
SetWindowDirty(w);
break;
}
@@ -594,9 +591,12 @@ static void GroupWndProc(Window *w, WindowEvent *e)
ShowBuildVehicleWindow(0, gv->vehicle_type);
break;
case GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN:
ShowGroupActionDropdown(w, gv->group_sel);
case GRP_WIDGET_MANAGE_VEHICLES:
case GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN: {
UpdateGroupActionDropdown(w, gv->group_sel, false);
break;
}
case GRP_WIDGET_START_ALL:
case GRP_WIDGET_STOP_ALL: { // Start/stop all vehicles of the list
@@ -709,24 +709,24 @@ static void GroupWndProc(Window *w, WindowEvent *e)
assert(gv->l.list_length != 0);
switch (e->we.dropdown.index) {
case GALF_REPLACE: // Replace window
case 0: // Replace window
ShowReplaceGroupVehicleWindow(gv->group_sel, gv->vehicle_type);
break;
case GALF_SERVICE: // Send for servicing
case 1: // Send for servicing
DoCommandP(0, gv->group_sel, ((IsAllGroupID(gv->group_sel) ? VLW_STANDARD : VLW_GROUP_LIST) & VLW_MASK)
| DEPOT_MASS_SEND
| DEPOT_SERVICE, NULL, GetCmdSendToDepot(gv->vehicle_type));
break;
case GALF_DEPOT: // Send to Depots
case 2: // Send to Depots
DoCommandP(0, gv->group_sel, ((IsAllGroupID(gv->group_sel) ? VLW_STANDARD : VLW_GROUP_LIST) & VLW_MASK)
| DEPOT_MASS_SEND, NULL, GetCmdSendToDepot(gv->vehicle_type));
break;
case GALF_ADD_SHARED: // Add shared Vehicles
case 3: // Add shared Vehicles
assert(IsValidGroupID(gv->group_sel));
DoCommandP(0, gv->group_sel, gv->vehicle_type, NULL, CMD_ADD_SHARED_VEHICLE_GROUP | CMD_MSG(STR_GROUP_CAN_T_ADD_SHARED_VEHICLE));
break;
case GALF_REMOVE_ALL: // Remove all Vehicles from the selected group
case 4: // Remove all Vehicles from the selected group
assert(IsValidGroupID(gv->group_sel));
DoCommandP(0, gv->group_sel, gv->vehicle_type, NULL, CMD_REMOVE_ALL_VEHICLES_GROUP | CMD_MSG(STR_GROUP_CAN_T_REMOVE_ALL_VEHICLES));
@@ -761,13 +761,6 @@ static void GroupWndProc(Window *w, WindowEvent *e)
SetWindowDirty(w);
}
break;
case WE_ABORT_PLACE_OBJ: // called when new object to place is selected from keyboard
/* abort drag & drop */
gv->vehicle_sel = INVALID_VEHICLE;
w->InvalidateWidget(GRP_WIDGET_LIST_VEHICLE);
break;
}
}

View File

@@ -60,7 +60,6 @@ enum {
DDSP_CREATE_DESERT,
DDSP_CREATE_ROCKS,
DDSP_CREATE_WATER,
DDSP_CREATE_RIVER,
DDSP_PLANT_TREES,
DDSP_BUILD_BRIDGE,
@@ -106,7 +105,7 @@ void SetFiosType(const byte fiostype);
extern const TextColour _fios_colors[];
/* bridge_gui.cpp */
void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transport_type, byte bridge_type);
void ShowBuildBridgeWindow(uint start, uint end, byte type);
void ShowBuildIndustryWindow();
void ShowMusicWindow();

View File

@@ -179,7 +179,6 @@ struct IndustrySpec {
GRFMappedStringID closure_text; ///< Message appearing when the industry closes
GRFMappedStringID production_up_text; ///< Message appearing when the industry's production is increasing
GRFMappedStringID production_down_text; ///< Message appearing when the industry's production is decreasing
GRFMappedStringID station_name; ///< Default name for nearby station
byte appear_ingame[NUM_LANDSCAPE]; ///< Probability of appearance in game
byte appear_creation[NUM_LANDSCAPE]; ///< Probability of appearance during map creation
uint8 number_of_sounds; ///< Number of sounds available in the sounds array

View File

@@ -25,6 +25,7 @@
#include "newgrf_industries.h"
#include "newgrf_industrytiles.h"
#include "newgrf_callbacks.h"
#include "misc/autoptr.hpp"
#include "autoslope.h"
#include "transparency.h"
#include "water.h"
@@ -814,7 +815,7 @@ static void ClickTile_Industry(TileIndex tile)
ShowIndustryViewWindow(GetIndustryIndex(tile));
}
static TrackStatus GetTileTrackStatus_Industry(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
static uint32 GetTileTrackStatus_Industry(TileIndex tile, TransportType mode, uint sub_mode)
{
return 0;
}
@@ -840,7 +841,7 @@ static bool IsBadFarmFieldTile(TileIndex tile)
{
switch (GetTileType(tile)) {
case MP_CLEAR: return IsClearGround(tile, CLEAR_FIELDS) || IsClearGround(tile, CLEAR_SNOW) || IsClearGround(tile, CLEAR_DESERT);
case MP_TREES: return (GetTreeGround(tile) == TREE_GROUND_SHORE);
case MP_TREES: return false;
default: return true;
}
}
@@ -849,7 +850,7 @@ static bool IsBadFarmFieldTile2(TileIndex tile)
{
switch (GetTileType(tile)) {
case MP_CLEAR: return IsClearGround(tile, CLEAR_SNOW) || IsClearGround(tile, CLEAR_DESERT);
case MP_TREES: return (GetTreeGround(tile) == TREE_GROUND_SHORE);
case MP_TREES: return false;
default: return true;
}
}
@@ -1024,9 +1025,6 @@ static void ProduceIndustryGoods(Industry *i)
if (cut) ChopLumberMillTrees(i);
}
TriggerIndustry(i, INDUSTRY_TRIGGER_INDUSTRY_TICK);
StartStopIndustryTileAnimation(i, IAT_INDUSTRY_TICK);
}
}
@@ -1048,6 +1046,8 @@ void OnTick_Industry()
if (_game_mode == GM_EDITOR) return;
FOR_ALL_INDUSTRIES(i) {
TriggerIndustry(i, INDUSTRY_TRIGGER_INDUSTRY_TICK);
StartStopIndustryTileAnimation(i, IAT_INDUSTRY_TICK);
ProduceIndustryGoods(i);
}
}
@@ -1383,7 +1383,7 @@ static bool CheckIfFarEnoughFromIndustry(TileIndex tile, int type)
const IndustrySpec *indspec = GetIndustrySpec(type);
const Industry *i;
if (_patches.same_industry_close && indspec->IsRawIndustry())
if (_patches.same_industry_close && indspec->accepts_cargo[0] == CT_INVALID)
/* Allow primary industries to be placed close to any other industry */
return true;
@@ -1393,7 +1393,7 @@ static bool CheckIfFarEnoughFromIndustry(TileIndex tile, int type)
/* check if an industry that accepts the same goods is nearby */
if (in_low_distance &&
!indspec->IsRawIndustry() && // not a primary industry?
indspec->accepts_cargo[0] != CT_INVALID && // not a primary industry?
indspec->accepts_cargo[0] == i->accepts_cargo[0] && (
/* at least one of those options must be true */
_game_mode != GM_EDITOR || // editor must not be stopped
@@ -1415,16 +1415,6 @@ static bool CheckIfFarEnoughFromIndustry(TileIndex tile, int type)
return true;
}
/** Production level maximum, minimum and default values.
* It is not a value been really used in order to change, but rather an indicator
* of how the industry is behaving. */
enum ProductionLevels {
PRODLEVEL_CLOSURE = 0x00, ///< signal set to actually close the industry
PRODLEVEL_MINIMUM = 0x04, ///< below this level, the industry is set to be closing
PRODLEVEL_DEFAULT = 0x10, ///< default level set when the industry is created
PRODLEVEL_MAXIMUM = 0x80, ///< the industry is running at full speed
};
static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const IndustryTileTable *it, byte layout, const Town *t, Owner owner)
{
const IndustrySpec *indspec = GetIndustrySpec(type);
@@ -1513,7 +1503,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind
if (!_generating_world) i->last_month_production[0] = i->last_month_production[1] = 0;
i->prod_level = PRODLEVEL_DEFAULT;
i->prod_level = 0x10;
do {
TileIndex cur_tile = tile + ToTileIndexDiff(it->ti);
@@ -1534,11 +1524,11 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind
SetIndustryConstructionCounter(cur_tile, 3);
SetIndustryConstructionStage(cur_tile, 2);
}
/* it->gfx is stored in the map. But the translated ID cur_gfx is the interesting one */
IndustryGfx cur_gfx = GetTranslatedIndustryTileID(it->gfx);
const IndustryTileSpec *its = GetIndustryTileSpec(cur_gfx);
if (its->animation_info != 0xFFFF) AddAnimatedTile(cur_tile);
if (it->gfx >= NEW_INDUSTRYTILEOFFSET) {
/* New industry */
const IndustryTileSpec *its = GetIndustryTileSpec(it->gfx);
if (its->animation_info != 0xFFFF) AddAnimatedTile(cur_tile);
}
}
} while ((++it)->ti.x != -0x80);
@@ -1558,10 +1548,9 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind
* @param flags of operations to conduct
* @param indspec pointer to industry specifications
* @param itspec_index the index of the itsepc to build/fund
* @param seed random seed (possibly) used by industries
* @return the pointer of the newly created industry, or NULL if it failed
*/
static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, uint32 flags, const IndustrySpec *indspec, uint itspec_index, uint32 seed)
static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, uint32 flags, const IndustrySpec *indspec, uint itspec_index)
{
const IndustryTileTable *it = indspec->table[itspec_index];
bool custom_shape_check = false;
@@ -1569,7 +1558,7 @@ static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, uint
if (!CheckIfIndustryTilesAreFree(tile, it, itspec_index, type, &custom_shape_check)) return NULL;
if (HasBit(GetIndustrySpec(type)->callback_flags, CBM_IND_LOCATION)) {
if (!CheckIfCallBackAllowsCreation(tile, type, itspec_index, seed)) return NULL;
if (!CheckIfCallBackAllowsCreation(tile, type, itspec_index)) return NULL;
} else {
if (!_check_new_industry_procs[indspec->check_proc](tile)) return NULL;
}
@@ -1583,33 +1572,31 @@ static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, uint
if (!CheckIfIndustryIsAllowed(tile, type, t)) return NULL;
if (!CheckSuitableIndustryPos(tile)) return NULL;
if (!Industry::CanAllocateItem()) return NULL;
Industry *i = new Industry(tile);
if (i == NULL) return NULL;
AutoPtrT<Industry> i_auto_delete = i;
if (flags & DC_EXEC) {
Industry *i = new Industry(tile);
if (!custom_shape_check) CheckIfCanLevelIndustryPlatform(tile, DC_EXEC, it, type);
DoCreateNewIndustry(i, tile, type, it, itspec_index, t, OWNER_NONE);
return i;
i_auto_delete.Detach();
}
/* We need to return a non-NULL pointer to tell we have created an industry.
* However, we haven't created a real one (no DC_EXEC), so return a fake one. */
return GetIndustry(0);
return i;
}
/** Build/Fund an industry
* @param tile tile where industry is built
* @param flags of operations to conduct
* @param p1 various bitstuffed elements
* - p1 = (bit 0 - 15) - industry type see build_industry.h and see industry.h
* - p1 = (bit 16 - 31) - first layout to try
* @param p2 seed to use for variable 8F
* @param p1 industry type see build_industry.h and see industry.h
* @param p2 first layout to try
* @return index of the newly create industry, or CMD_ERROR if it failed
*/
CommandCost CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
const IndustrySpec *indspec = GetIndustrySpec(GB(p1, 0, 16));
const IndustrySpec *indspec;
indspec = GetIndustrySpec(p1);
/* Check if the to-be built/founded industry is available for this climate. */
if (!indspec->enabled) {
@@ -1633,7 +1620,7 @@ CommandCost CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
* because parameter evaluation order is not guaranteed in the c++ standard
*/
tile = RandomTile();
const Industry *ind = CreateNewIndustryHelper(tile, p1, flags, indspec, RandomRange(indspec->num_table), p2);
const Industry *ind = CreateNewIndustryHelper(tile, p1, flags, indspec, RandomRange(indspec->num_table));
if (ind != NULL) {
SetDParam(0, indspec->name);
if (indspec->new_industry_text > STR_LAST_STRINGID) {
@@ -1652,7 +1639,7 @@ CommandCost CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
} else {
int count = indspec->num_table;
const IndustryTileTable * const *itt = indspec->table;
int num = Clamp(GB(p1, 16, 16), 0, count - 1);
int num = Clamp(p2, 0, count - 1);
_error_message = STR_0239_SITE_UNSUITABLE;
do {
@@ -1660,7 +1647,7 @@ CommandCost CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (--num < 0) num = indspec->num_table - 1;
} while (!CheckIfIndustryTilesAreFree(tile, itt[num], num, p1));
if (CreateNewIndustryHelper(tile, p1, flags, indspec, num, p2) == NULL) return CMD_ERROR;
if (CreateNewIndustryHelper(tile, p1, flags, indspec, num) == NULL) return CMD_ERROR;
}
return CommandCost(EXPENSES_OTHER, indspec->GetConstructionCost());
@@ -1671,8 +1658,7 @@ Industry *CreateNewIndustry(TileIndex tile, IndustryType type)
{
const IndustrySpec *indspec = GetIndustrySpec(type);
uint32 seed = Random();
return CreateNewIndustryHelper(tile, type, DC_EXEC, indspec, RandomRange(indspec->num_table), seed);
return CreateNewIndustryHelper(tile, type, DC_EXEC, indspec, RandomRange(indspec->num_table));
}
enum {
@@ -1896,8 +1882,7 @@ static void CanCargoServiceIndustry(CargoID cargo, Industry *ind, bool *c_accept
const IndustrySpec *indspec = GetIndustrySpec(ind->type);
/* Check for acceptance of cargo */
for (byte j = 0; j < lengthof(ind->accepts_cargo); j++) {
if (ind->accepts_cargo[j] == CT_INVALID) continue;
for (uint j = 0; j < lengthof(ind->accepts_cargo) && ind->accepts_cargo[j] != CT_INVALID; j++) {
if (cargo == ind->accepts_cargo[j]) {
if (HasBit(indspec->callback_flags, CBM_IND_REFUSE_CARGO)) {
uint16 res = GetIndustryCallback(CBID_INDUSTRY_REFUSE_CARGO,
@@ -1911,8 +1896,7 @@ static void CanCargoServiceIndustry(CargoID cargo, Industry *ind, bool *c_accept
}
/* Check for produced cargo */
for (byte j = 0; j < lengthof(ind->produced_cargo); j++) {
if (ind->produced_cargo[j] == CT_INVALID) continue;
for (uint j = 0; j < lengthof(ind->produced_cargo) && ind->produced_cargo[j] != CT_INVALID; j++) {
if (cargo == ind->produced_cargo[j]) {
*c_produces = true;
break;
@@ -2023,6 +2007,7 @@ enum {
*/
static void ChangeIndustryProduction(Industry *i, bool monthly)
{
extern StringID MapGRFStringID(uint32 grfid, StringID str);
StringID str = STR_NULL;
bool closeit = false;
const IndustrySpec *indspec = GetIndustrySpec(i->type);
@@ -2074,8 +2059,7 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
if (smooth_economy) {
closeit = true;
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
if (i->produced_cargo[j] == CT_INVALID) continue;
for (byte j = 0; j < 2 && i->produced_cargo[j] != CT_INVALID; j++){
uint32 r = Random();
int old_prod, new_prod, percent;
/* If over 60% is transported, mult is 1, else mult is -1. */
@@ -2140,8 +2124,8 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
}
/* Increase if needed */
while (mul-- != 0 && i->prod_level < PRODLEVEL_MAXIMUM) {
i->prod_level = min(i->prod_level * 2, PRODLEVEL_MAXIMUM);
while (mul-- != 0 && i->prod_level < 0x80) {
i->prod_level <<= 1;
i->production_rate[0] = min(i->production_rate[0] * 2, 0xFF);
i->production_rate[1] = min(i->production_rate[1] * 2, 0xFF);
if (str == STR_NULL) str = indspec->production_up_text;
@@ -2149,28 +2133,24 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
/* Decrease if needed */
while (div-- != 0 && !closeit) {
if (i->prod_level == PRODLEVEL_MINIMUM) {
if (i->prod_level == 4) {
closeit = true;
} else {
i->prod_level = max(i->prod_level / 2, (int)PRODLEVEL_MINIMUM); // typecast to int required to please MSVC
i->production_rate[0] = (i->production_rate[0] + 1) / 2;
i->production_rate[1] = (i->production_rate[1] + 1) / 2;
i->prod_level >>= 1;
i->production_rate[0] = (i->production_rate[0] + 1) >> 1;
i->production_rate[1] = (i->production_rate[1] + 1) >> 1;
if (str == STR_NULL) str = indspec->production_down_text;
}
}
/* Increase or Decreasing the production level if needed */
if (increment != 0) {
if (increment < 0 && i->prod_level == PRODLEVEL_MINIMUM) {
closeit = true;
} else {
i->prod_level = ClampU(i->prod_level + increment, PRODLEVEL_MINIMUM, PRODLEVEL_MAXIMUM);
}
i->prod_level = ClampU(i->prod_level + increment, 4, 0x80);
if (i->prod_level == 4) closeit = true;
}
/* Close if needed and allowed */
if (closeit && !CheckIndustryCloseDownProtection(i->type)) {
i->prod_level = PRODLEVEL_CLOSURE;
i->prod_level = 0;
str = indspec->closure_text;
}
@@ -2214,7 +2194,7 @@ void IndustryMonthlyLoop()
FOR_ALL_INDUSTRIES(i) {
UpdateIndustryStatistics(i);
if (i->prod_level == PRODLEVEL_CLOSURE) {
if (i->prod_level == 0) {
delete i;
} else {
ChangeIndustryProduction(i, true);
@@ -2320,12 +2300,12 @@ static const SaveLoad _industry_desc[] = {
SLE_VAR(Industry, width, SLE_UINT8),
SLE_VAR(Industry, height, SLE_UINT8),
SLE_REF(Industry, town, REF_TOWN),
SLE_CONDNULL( 2, 0, 60), ///< used to be industry's produced_cargo
SLE_CONDNULL( 2, 2, 60), ///< used to be industry's produced_cargo
SLE_CONDARR(Industry, produced_cargo, SLE_UINT8, 2, 78, SL_MAX_VERSION),
SLE_CONDARR(Industry, incoming_cargo_waiting, SLE_UINT16, 3, 70, SL_MAX_VERSION),
SLE_ARR(Industry, produced_cargo_waiting, SLE_UINT16, 2),
SLE_ARR(Industry, production_rate, SLE_UINT8, 2),
SLE_CONDNULL( 3, 0, 60), ///< used to be industry's accepts_cargo
SLE_CONDNULL( 3, 2, 60), ///< used to be industry's accepts_cargo
SLE_CONDARR(Industry, accepts_cargo, SLE_UINT8, 3, 78, SL_MAX_VERSION),
SLE_VAR(Industry, prod_level, SLE_UINT8),
SLE_ARR(Industry, this_month_production, SLE_UINT16, 2),

View File

@@ -57,62 +57,13 @@ static struct IndustryData {
bool enabled[NUM_INDUSTRYTYPES + 1]; ///< availability state, coming from CBID_INDUSTRY_AVAILABLE (if ever)
} _fund_gui;
assert_compile(lengthof(_fund_gui.index) == lengthof(_fund_gui.text));
assert_compile(lengthof(_fund_gui.index) == lengthof(_fund_gui.enabled));
static void SetupFundArrays(Window *w)
{
IndustryType ind;
const IndustrySpec *indsp;
_fund_gui.count = 0;
for (uint i = 0; i < lengthof(_fund_gui.index); i++) {
_fund_gui.index[i] = INVALID_INDUSTRYTYPE;
_fund_gui.text[i] = STR_NULL;
_fund_gui.enabled[i] = false;
}
if (_game_mode == GM_EDITOR) { // give room for the Many Random "button"
_fund_gui.index[_fund_gui.count] = INVALID_INDUSTRYTYPE;
_fund_gui.count++;
WP(w, fnd_d).timer_enabled = false;
}
/* Fill the arrays with industries.
* The tests performed after the enabled allow to load the industries
* In the same way they are inserted by grf (if any)
*/
for (ind = 0; ind < NUM_INDUSTRYTYPES; ind++) {
indsp = GetIndustrySpec(ind);
if (indsp->enabled){
/* Rule is that editor mode loads all industries.
* In game mode, all non raw industries are loaded too
* and raw ones are loaded only when setting allows it */
if (_game_mode != GM_EDITOR && indsp->IsRawIndustry() && _patches.raw_industry_construction == 0) {
/* Unselect if the industry is no longer in the list */
if (WP(w, fnd_d).select == ind) WP(w, fnd_d).index = -1;
continue;
}
_fund_gui.index[_fund_gui.count] = ind;
_fund_gui.enabled[_fund_gui.count] = (_game_mode == GM_EDITOR) || CheckIfCallBackAllowsAvailability(ind, IACT_USERCREATION);
/* Keep the selection to the correct line */
if (WP(w, fnd_d).select == ind) WP(w, fnd_d).index = _fund_gui.count;
_fund_gui.count++;
}
}
/* first indutry type is selected if the current selection is invalid.
* I'll be damned if there are none available ;) */
if (WP(w, fnd_d).index == -1) {
WP(w, fnd_d).index = 0;
WP(w, fnd_d).select = _fund_gui.index[0];
}
}
static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
case WE_CREATE: {
IndustryType ind;
const IndustrySpec *indsp;
/* Shorten the window to the equivalant of the additionnal purchase
* info coming from the callback. SO it will only be available to tis full
* height when newindistries are loaded */
@@ -127,15 +78,42 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e)
WP(w, fnd_d).timer_enabled = _loaded_newgrf_features.has_newindustries;
/* Initilialize structures */
memset(&_fund_gui.index, 0xFF, NUM_INDUSTRYTYPES);
memset(&_fund_gui.text, STR_NULL, NUM_INDUSTRYTYPES);
memset(&_fund_gui.enabled, false, NUM_INDUSTRYTYPES);
_fund_gui.count = 0;
w->vscroll.cap = 8; // rows in grid, same in scroller
w->resize.step_height = 13;
WP(w, fnd_d).index = -1;
WP(w, fnd_d).select = INVALID_INDUSTRYTYPE;
if (_game_mode == GM_EDITOR) { // give room for the Many Random "button"
_fund_gui.index[_fund_gui.count] = INVALID_INDUSTRYTYPE;
_fund_gui.count++;
WP(w, fnd_d).timer_enabled = false;
}
/* Initialize arrays */
SetupFundArrays(w);
/* Fill the _fund_gui structure with industries.
* The tests performed after the enabled allow to load the industries
* In the same way they are inserted by grf (if any)
*/
for (ind = 0; ind < NUM_INDUSTRYTYPES; ind++) {
indsp = GetIndustrySpec(ind);
if (indsp->enabled){
/* Rule is that editor mode loads all industries.
* In game mode, all non raw industries are loaded too
* and raw ones are loaded only when setting allows it */
if (_game_mode != GM_EDITOR && indsp->IsRawIndustry() && _patches.raw_industry_construction == 0) continue;
_fund_gui.index[_fund_gui.count] = ind;
_fund_gui.enabled[_fund_gui.count] = (_game_mode == GM_EDITOR) || CheckIfCallBackAllowsAvailability(ind, IACT_USERCREATION);
_fund_gui.count++;
}
}
/* first indutry type is selected.
* I'll be damned if there are none available ;) */
WP(w, fnd_d).index = 0;
WP(w, fnd_d).select = _fund_gui.index[0];
WP(w, fnd_d).callback_timer = DAY_TICKS;
} break;
@@ -275,7 +253,7 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e)
_generating_world = false;
}
} else if (_game_mode != GM_EDITOR && _patches.raw_industry_construction == 2 && GetIndustrySpec(WP(w, fnd_d).select)->IsRawIndustry()) {
DoCommandP(0, WP(w, fnd_d).select, InteractiveRandom(), NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY));
DoCommandP(0, WP(w, fnd_d).select, 0, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY));
w->HandleButtonClick(DPIW_FUND_WIDGET);
} else {
HandlePlacePushButton(w, DPIW_FUND_WIDGET, SPR_CURSOR_INDUSTRY, VHM_RECT, NULL);
@@ -294,7 +272,6 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e)
bool success = true;
/* We do not need to protect ourselves against "Random Many Industries" in this mode */
const IndustrySpec *indsp = GetIndustrySpec(WP(w, fnd_d).select);
uint32 seed = InteractiveRandom();
if (_game_mode == GM_EDITOR) {
/* Show error if no town exists at all */
@@ -307,7 +284,7 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e)
_current_player = OWNER_NONE;
_generating_world = true;
_ignore_restrictions = true;
success = DoCommandP(e->we.place.tile, (InteractiveRandomRange(indsp->num_table) << 16) | WP(w, fnd_d).select, seed, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY));
success = DoCommandP(e->we.place.tile, WP(w, fnd_d).select, InteractiveRandomRange(indsp->num_table), NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY));
if (!success) {
SetDParam(0, indsp->name);
ShowErrorMessage(_error_message, STR_0285_CAN_T_BUILD_HERE, e->we.place.pt.x, e->we.place.pt.y);
@@ -316,7 +293,7 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e)
_ignore_restrictions = false;
_generating_world = false;
} else {
success = DoCommandP(e->we.place.tile, (InteractiveRandomRange(indsp->num_table) << 16) | WP(w, fnd_d).select, seed, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY));
success = DoCommandP(e->we.place.tile, WP(w, fnd_d).select, InteractiveRandomRange(indsp->num_table), NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY));
}
/* If an industry has been built, just reset the cursor and the system */
@@ -349,10 +326,6 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e)
case WE_ABORT_PLACE_OBJ:
w->RaiseButtons();
break;
case WE_INVALIDATE_DATA:
SetupFundArrays(w);
SetWindowDirty(w);
}
}
@@ -411,7 +384,6 @@ enum IndustryViewWidgets {
IVW_INFO,
IVW_GOTO,
IVW_SPACER,
IVW_RESIZE_WIDGET,
};
/** Information to store about the industry window */
@@ -465,27 +437,13 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
lines++;
}
if (HasBit(ind->callback_flags, CBM_IND_WINDOW_MORE_TEXT)) {
lines += 2;
} else {
/* Remove the resizing option from the widgets. Do it before the Hiding since it will be overwritten */
for (byte j = IVW_INFO; j <= IVW_RESIZE_WIDGET; j++) {
w->widget[j].display_flags = RESIZE_NONE;
}
/* Hide the resize button and enlarge the spacer so it will take its place */
w->HideWidget(IVW_RESIZE_WIDGET);
w->widget[IVW_SPACER].right = w->widget[IVW_RESIZE_WIDGET].right;
}
if (HasBit(ind->callback_flags, CBM_IND_WINDOW_MORE_TEXT)) lines += 2;
lines *= 10;
/* Resize the widgets for the new size, given by the addition of cargos */
for (byte j = IVW_INFO; j <= IVW_RESIZE_WIDGET; j++) {
if (j != IVW_INFO) w->widget[j].top += lines;
w->widget[j].bottom += lines;
for (byte j = 5; j <= 7; j++) {
if (j != 5) w->widget[j].top += lines * 10;
w->widget[j].bottom += lines * 10;
}
w->height += lines;
w->resize.height += lines;
w->height += lines * 10;
} break;
case WE_PAINT: {
@@ -557,12 +515,10 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
if (callback_res != CALLBACK_FAILED) {
StringID message = GetGRFStringID(ind->grf_prop.grffile->grfid, 0xD000 + callback_res);
if (message != STR_NULL && message != STR_UNDEFINED) {
const Widget *wi = &w->widget[IVW_INFO];
y += 10;
PrepareTextRefStackUsage(6);
/* Use all the available space left from where we stand up to the end of the window */
DrawStringMultiLine(2, y, message, wi->right - wi->left - 4, wi->bottom - y);
DrawString(2, y, message, TC_FROMSTRING);
StopTextRefStackUsage();
}
}
@@ -651,10 +607,9 @@ static const Widget _industry_view_widgets[] = {
{ WWT_STICKYBOX, RESIZE_NONE, 9, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON}, // IVW_STICKY
{ WWT_PANEL, RESIZE_NONE, 9, 0, 259, 14, 105, 0x0, STR_NULL}, // IVW_BACKGROUND
{ WWT_INSET, RESIZE_NONE, 9, 2, 257, 16, 103, 0x0, STR_NULL}, // IVW_VIEWPORT
{ WWT_PANEL, RESIZE_BOTTOM, 9, 0, 259, 106, 147, 0x0, STR_NULL}, // IVW_INFO
{ WWT_PUSHTXTBTN, RESIZE_TB, 9, 0, 129, 148, 159, STR_00E4_LOCATION, STR_482C_CENTER_THE_MAIN_VIEW_ON}, // IVW_GOTO
{ WWT_PANEL, RESIZE_TB, 9, 130, 247, 148, 159, 0x0, STR_NULL}, // IVW_SPACER
{ WWT_RESIZEBOX, RESIZE_TB, 9, 248, 259, 148, 159, 0x0, STR_RESIZE_BUTTON}, // IVW_RESIZE_WIDGET
{ WWT_PANEL, RESIZE_NONE, 9, 0, 259, 106, 147, 0x0, STR_NULL}, // IVW_INFO
{ WWT_PUSHTXTBTN, RESIZE_NONE, 9, 0, 129, 148, 159, STR_00E4_LOCATION, STR_482C_CENTER_THE_MAIN_VIEW_ON}, // IVW_GOTO
{ WWT_PANEL, RESIZE_NONE, 9, 130, 259, 148, 159, 0x0, STR_NULL}, // IVW_SPACER
{ WIDGETS_END},
};
@@ -662,7 +617,7 @@ static const Widget _industry_view_widgets[] = {
static const WindowDesc _industry_view_desc = {
WDP_AUTO, WDP_AUTO, 260, 160, 260, 160,
WC_INDUSTRY_VIEW, WC_NONE,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
_industry_view_widgets,
IndustryViewWndProc
};
@@ -826,6 +781,10 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
case WE_PAINT: {
int n;
uint p;
static const uint16 _indicator_positions[4] = {88, 187, 284, 387};
if (_industry_sort_dirty) {
_industry_sort_dirty = false;
MakeSortedIndustryList();
@@ -834,10 +793,10 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
SetVScrollCount(w, _num_industry_sort);
DrawWindowWidgets(w);
DrawSortButtonState(w, IDW_SORTBYNAME + (_industry_sort_order >> 1), _industry_sort_order & 1 ? SBS_DOWN : SBS_UP);
DoDrawString(_industry_sort_order & 1 ? DOWNARROW : UPARROW, _indicator_positions[_industry_sort_order >> 1], 15, TC_BLACK);
uint p = w->vscroll.pos;
int n = 0;
p = w->vscroll.pos;
n = 0;
while (p < _num_industry_sort) {
const Industry* i = _industry_sort[p];

View File

@@ -52,73 +52,51 @@ static inline void SetNewLandscapeType(byte landscape)
InvalidateWindowClasses(WC_SELECT_GAME);
}
enum SelectGameIntroWidgets {
SGI_GENERATE_GAME = 2,
SGI_LOAD_GAME,
SGI_PLAY_SCENARIO,
SGI_PLAY_HEIGHTMAP,
SGI_EDIT_SCENARIO,
SGI_PLAY_NETWORK,
SGI_TEMPERATE_LANDSCAPE,
SGI_ARCTIC_LANDSCAPE,
SGI_TROPIC_LANDSCAPE,
SGI_TOYLAND_LANDSCAPE,
SGI_OPTIONS,
SGI_DIFFICULTIES,
SGI_PATCHES_OPTIONS,
SGI_GRF_SETTINGS,
SGI_EXIT,
};
static void SelectGameWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
case WE_CREATE: w->LowerWidget(_opt_newgame.landscape + 8); break;
case WE_CREATE: w->LowerWidget(_opt_newgame.landscape + 8); break;
case WE_PAINT:
w->SetWidgetLoweredState(SGI_TEMPERATE_LANDSCAPE, _opt_newgame.landscape == LT_TEMPERATE);
w->SetWidgetLoweredState(SGI_ARCTIC_LANDSCAPE, _opt_newgame.landscape == LT_ARCTIC);
w->SetWidgetLoweredState(SGI_TROPIC_LANDSCAPE, _opt_newgame.landscape == LT_TROPIC);
w->SetWidgetLoweredState(SGI_TOYLAND_LANDSCAPE, _opt_newgame.landscape == LT_TOYLAND);
SetDParam(0, STR_6801_EASY + _opt_newgame.diff_level);
DrawWindowWidgets(w);
break;
case WE_PAINT:
w->SetWidgetLoweredState(8, _opt_newgame.landscape == LT_TEMPERATE);
w->SetWidgetLoweredState(9, _opt_newgame.landscape == LT_ARCTIC);
w->SetWidgetLoweredState(10, _opt_newgame.landscape == LT_TROPIC);
w->SetWidgetLoweredState(11, _opt_newgame.landscape == LT_TOYLAND);
SetDParam(0, STR_6801_EASY + _opt_newgame.diff_level);
DrawWindowWidgets(w);
break;
case WE_CLICK:
case WE_CLICK:
#ifdef ENABLE_NETWORK
/* Do not create a network server when you (just) have closed one of the game
* creation/load windows for the network server. */
if (SGI_GENERATE_GAME <= e->we.click.widget && e->we.click.widget <= SGI_EDIT_SCENARIO) _is_network_server = false;
/* Do not create a network server when you (just) have closed one of the game
* creation/load windows for the network server. */
if (2 <= e->we.click.widget && e->we.click.widget <= 6) _is_network_server = false;
#endif /* ENABLE_NETWORK */
switch (e->we.click.widget) {
case SGI_GENERATE_GAME: ShowGenerateLandscape(); break;
case SGI_LOAD_GAME: ShowSaveLoadDialog(SLD_LOAD_GAME); break;
case SGI_PLAY_SCENARIO: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break;
case SGI_PLAY_HEIGHTMAP: ShowSaveLoadDialog(SLD_LOAD_HEIGHTMAP); break;
case SGI_EDIT_SCENARIO: StartScenarioEditor(); break;
case SGI_PLAY_NETWORK:
if (!_network_available) {
ShowErrorMessage(INVALID_STRING_ID, STR_NETWORK_ERR_NOTAVAILABLE, 0, 0);
} else {
ShowNetworkGameWindow();
}
break;
case SGI_TEMPERATE_LANDSCAPE: case SGI_ARCTIC_LANDSCAPE:
case SGI_TROPIC_LANDSCAPE: case SGI_TOYLAND_LANDSCAPE:
w->RaiseWidget(_opt_newgame.landscape + SGI_TEMPERATE_LANDSCAPE);
SetNewLandscapeType(e->we.click.widget - SGI_TEMPERATE_LANDSCAPE);
break;
case SGI_OPTIONS: ShowGameOptions(); break;
case SGI_DIFFICULTIES: ShowGameDifficulty(); break;
case SGI_PATCHES_OPTIONS: ShowPatchesSelection(); break;
case SGI_GRF_SETTINGS: ShowNewGRFSettings(true, true, false, &_grfconfig_newgame); break;
case SGI_EXIT: HandleExitGameRequest(); break;
switch (e->we.click.widget) {
case 2: ShowGenerateLandscape(); break;
case 3: ShowSaveLoadDialog(SLD_LOAD_GAME); break;
case 4: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break;
case 5: ShowSaveLoadDialog(SLD_LOAD_HEIGHTMAP); break;
case 6: StartScenarioEditor(); break;
case 7:
if (!_network_available) {
ShowErrorMessage(INVALID_STRING_ID, STR_NETWORK_ERR_NOTAVAILABLE, 0, 0);
} else {
ShowNetworkGameWindow();
}
break;
case 8: case 9: case 10: case 11:
w->RaiseWidget(_opt_newgame.landscape + 8);
SetNewLandscapeType(e->we.click.widget - 8);
break;
case 12: ShowGameOptions(); break;
case 13: ShowGameDifficulty(); break;
case 14: ShowPatchesSelection(); break;
case 15: ShowNewGRFSettings(true, true, false, &_grfconfig_newgame); break;
case 16: HandleExitGameRequest(); break;
}
break;
}
}
@@ -143,9 +121,9 @@ static void AskExitGameCallback(Window *w, bool confirmed)
void AskExitGame()
{
#if defined(_WIN32)
SetDParam(0, STR_OSNAME_WINDOWS);
SetDParam(0, STR_0133_WINDOWS);
#elif defined(__APPLE__)
SetDParam(0, STR_OSNAME_OSX);
SetDParam(0, STR_0135_OSX);
#elif defined(__BEOS__)
SetDParam(0, STR_OSNAME_BEOS);
#elif defined(__MORPHOS__)
@@ -157,7 +135,7 @@ void AskExitGame()
#elif defined(SUNOS)
SetDParam(0, STR_OSNAME_SUNOS);
#else
SetDParam(0, STR_OSNAME_UNIX);
SetDParam(0, STR_0134_UNIX);
#endif
ShowQuery(
STR_00C7_QUIT,

View File

@@ -23,7 +23,6 @@
#include "date_func.h"
#include "vehicle_func.h"
#include "settings_type.h"
#include "water.h"
#include "table/sprites.h"
@@ -142,7 +141,7 @@ uint GetPartialZ(int x, int y, Slope corners)
int z = 0;
switch (RemoveHalftileSlope(corners)) {
switch (corners & ~SLOPE_HALFTILE_MASK) {
case SLOPE_W:
if (x - y >= 0)
z = (x - y) >> 1;
@@ -254,7 +253,10 @@ uint GetSlopeZ(int x, int y)
int GetSlopeZInCorner(Slope tileh, Corner corner)
{
assert(!IsHalftileSlope(tileh));
return ((tileh & SlopeWithOneCornerRaised(corner)) != 0 ? TILE_HEIGHT : 0) + (tileh == SteepSlope(corner) ? TILE_HEIGHT : 0);
static const int _corner_slopes[4][2] = {
{ SLOPE_W, SLOPE_STEEP_W }, { SLOPE_S, SLOPE_STEEP_S }, { SLOPE_E, SLOPE_STEEP_E }, { SLOPE_N, SLOPE_STEEP_N }
};
return ((tileh & _corner_slopes[corner][0]) != 0 ? TILE_HEIGHT : 0) + (tileh == _corner_slopes[corner][1] ? TILE_HEIGHT : 0);
}
/**
@@ -286,24 +288,15 @@ void GetSlopeZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2)
if ((tileh & corners[edge][0]) != 0) *z1 += TILE_HEIGHT; // z1 is raised
if ((tileh & corners[edge][1]) != 0) *z2 += TILE_HEIGHT; // z2 is raised
if (RemoveHalftileSlope(tileh) == corners[edge][2]) *z1 += TILE_HEIGHT; // z1 is highest corner of a steep slope
if (RemoveHalftileSlope(tileh) == corners[edge][3]) *z2 += TILE_HEIGHT; // z2 is highest corner of a steep slope
if ((tileh & ~SLOPE_HALFTILE_MASK) == corners[edge][2]) *z1 += TILE_HEIGHT; // z1 is highest corner of a steep slope
if ((tileh & ~SLOPE_HALFTILE_MASK) == corners[edge][3]) *z2 += TILE_HEIGHT; // z2 is highest corner of a steep slope
}
/**
* Get slope of a tile on top of a (possible) foundation
* If a tile does not have a foundation, the function returns the same as GetTileSlope.
*
* @param tile The tile of interest.
* @param z returns the z of the foundation slope. (Can be NULL, if not needed)
* @return The slope on top of the foundation.
*/
Slope GetFoundationSlope(TileIndex tile, uint* z)
static Slope GetFoundationSlope(TileIndex tile, uint* z)
{
Slope tileh = GetTileSlope(tile, z);
Foundation f = _tile_type_procs[GetTileType(tile)]->get_foundation_proc(tile, tileh);
uint z_inc = ApplyFoundationToSlope(f, &tileh);
if (z != NULL) *z += z_inc;
*z += ApplyFoundationToSlope(f, &tileh);
return tileh;
}
@@ -437,18 +430,9 @@ void DoClearSquare(TileIndex tile)
MarkTileDirtyByTile(tile);
}
/** Returns information about trackdirs and signal states.
* If there is any trackbit at 'side', return all trackdirbits.
* For TRANSPORT_ROAD, return no trackbits if there is no roadbit (of given subtype) at given side.
* @param tile tile to get info about
* @param mode transport type
* @param sub_mode for TRANSPORT_ROAD, roadtypes to check
* @param side side we are entering from, INVALID_DIAGDIR to return all trackbits
* @return trackdirbits and other info depending on 'mode'
*/
TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
uint32 GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode)
{
return _tile_type_procs[GetTileType(tile)]->get_tile_track_status_proc(tile, mode, sub_mode, side);
return _tile_type_procs[GetTileType(tile)]->get_tile_track_status_proc(tile, mode, sub_mode);
}
void ChangeTileOwner(TileIndex tile, PlayerID old_player, PlayerID new_player)
@@ -645,7 +629,7 @@ void InitializeLandscape()
for (x = 0; x < maxx; x++) {
MakeClear(sizex * y + x, CLEAR_GRASS, 3);
SetTileHeight(sizex * y + x, 0);
SetTropicZone(sizex * y + x, TROPICZONE_NORMAL);
SetTropicZone(sizex * y + x, TROPICZONE_INVALID);
ClearBridgeMiddle(sizex * y + x);
}
MakeVoid(sizex * y + x);
@@ -653,6 +637,53 @@ void InitializeLandscape()
for (x = 0; x < sizex; x++) MakeVoid(sizex * y + x);
}
void ConvertGroundTilesIntoWaterTiles()
{
TileIndex tile;
uint z;
Slope slope;
for (tile = 0; tile < MapSize(); ++tile) {
slope = GetTileSlope(tile, &z);
if (IsTileType(tile, MP_CLEAR) && z == 0) {
/* Make both water for tiles at level 0
* and make shore, as that looks much better
* during the generation. */
switch (slope) {
case SLOPE_FLAT:
MakeWater(tile);
break;
case SLOPE_N:
case SLOPE_E:
case SLOPE_S:
case SLOPE_W:
MakeShore(tile);
break;
case SLOPE_NW:
if (GetTileSlope(TileAddByDiagDir(tile, DIAGDIR_SE), NULL) != SLOPE_SE) MakeShore(tile);
break;
case SLOPE_SW:
if (GetTileSlope(TileAddByDiagDir(tile, DIAGDIR_NE), NULL) != SLOPE_NE) MakeShore(tile);
break;
case SLOPE_SE:
if (GetTileSlope(TileAddByDiagDir(tile, DIAGDIR_NW), NULL) != SLOPE_NW) MakeShore(tile);
break;
case SLOPE_NE:
if (GetTileSlope(TileAddByDiagDir(tile, DIAGDIR_SW), NULL) != SLOPE_SW) MakeShore(tile);
break;
default:
break;
}
}
}
}
static const byte _genterrain_tbl_1[5] = { 10, 22, 33, 37, 4 };
static const byte _genterrain_tbl_2[5] = { 0, 0, 0, 0, 33 };
@@ -919,3 +950,8 @@ TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng)
TileY(a) + (GB(r, 8, 8) * rn * 2 >> 8) - rn
));
}
bool IsValidTile(TileIndex tile)
{
return (tile < MapSizeX() * MapMaxY() && TileX(tile) != MapMaxX());
}

View File

@@ -26,11 +26,12 @@ 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);
void GetSlopeZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2);
int GetSlopeZInCorner(Slope tileh, Corner corner);
Slope GetFoundationSlope(TileIndex tile, uint* z);
static inline Point RemapCoords(int x, int y, int z)
{
@@ -54,6 +55,8 @@ void RunTileLoop();
void InitializeLandscape();
void GenerateLandscape(byte mode);
void ConvertGroundTilesIntoWaterTiles();
TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng);
#endif /* LANDSCAPE_H */

View File

@@ -15,6 +15,8 @@ STR_EMPTY :
STR_0007_FLAT_LAND_REQUIRED :{WHITE}Plat daal vereis
STR_0008_WAITING :{BLACK}Wag: {WHITE}{STRING}
STR_0009 :{WHITE}{CARGO}
STR_000A_EN_ROUTE_FROM :{WHITE}{CARGO}{YELLOW} (en-roete van
STR_000B :{YELLOW}{STATION})
STR_000C_ACCEPTS :{BLACK}Aanvaar: {WHITE}
STR_000D_ACCEPTS :{BLACK}Aanvaar: {GOLD}
STR_000E :
@@ -272,9 +274,9 @@ STR_0130_RENAME :{BLACK}Hernoem
STR_0131_TOO_MANY_NAMES_DEFINED :{WHITE}Te veel name bepaal
STR_0132_CHOSEN_NAME_IN_USE_ALREADY :{WHITE}Gekies naam alreeds in gebruik
STR_OSNAME_WINDOWS :Windows
STR_OSNAME_UNIX :Unix
STR_OSNAME_OSX :OS X
STR_0133_WINDOWS :Windows
STR_0134_UNIX :Unix
STR_0135_OSX :OS X
STR_OSNAME_BEOS :BeOS
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
@@ -285,11 +287,11 @@ STR_013B_OWNED_BY :{WHITE}...besit
STR_013C_CARGO :{BLACK}Vrag
STR_013D_INFORMATION :{BLACK}Inligting
STR_013E_CAPACITIES :{BLACK}Kapasiteite
STR_TOTAL_CARGO :{BLACK}Totaale Vrag
STR_013E_TOTAL_CARGO :{BLACK}Totaale Vrag
STR_013F_CAPACITY :{BLACK}Kapasiteit: {LTBLUE}{CARGO}
STR_CAPACITY_MULT :{BLACK}Kapasiteit: {LTBLUE}{CARGO} (x{NUM})
STR_TOTAL_CAPACITY_TEXT :{BLACK}Totaale vrag kapasitiet van die trein:
STR_TOTAL_CAPACITY :{LTBLUE}- {CARGO} ({SHORTCARGO})
STR_013F_TOTAL_CAPACITY_TEXT :{BLACK}Totaale vrag kapasitiet van die trein:
STR_013F_TOTAL_CAPACITY :{LTBLUE}- {CARGO} ({SHORTCARGO})
STR_TOTAL_CAPACITY_MULT :{LTBLUE}- {CARGO} ({SHORTCARGO}) (x{NUM})
STR_0140_NEW_GAME :{BLACK}Nuwe Speletjie
STR_0141_LOAD_GAME :{BLACK}Laai Speletjie
@@ -297,6 +299,12 @@ STR_SINGLE_PLAYER :{BLACK}Enkel sp
STR_MULTIPLAYER :{BLACK}Veelspeler
STR_SCENARIO_EDITOR :{BLACK}Draaiboek Redakteur
STR_64 :64
STR_128 :128
STR_256 :256
STR_512 :512
STR_1024 :1024
STR_2048 :2048
STR_MAPSIZE :{BLACK}Werfkaart groote:
STR_BY :{BLACK}*
STR_0148_GAME_OPTIONS :{BLACK}Speletjie Opsies
@@ -725,7 +733,7 @@ STR_0290_DELETE :{BLACK}Uitvee
STR_0291_DELETE_THIS_TOWN_COMPLETELY :{BLACK}Uitvee hierdie dorp heeltemal
STR_0292_SAVE_SCENARIO :Spaar draaiboek
STR_0293_LOAD_SCENARIO :Laai draaiboek
STR_MENU_LOAD_HEIGHTMAP :Laai Hoogtekaart
STR_LOAD_HEIGHTMAP :Laai Hoogtekaart
STR_0294_QUIT_EDITOR :Laat vaar redigeerder
STR_0295 :
STR_0296_QUIT :Laat vaar
@@ -765,9 +773,9 @@ STR_02C2_SAVE_CUSTOMIZED_VEHICLE :{BLACK}Spaar pa
STR_CHECKMARK :{CHECKMARK}
############ range for menu starts
STR_02C4_GAME_OPTIONS :Speletjie opsies
STR_02C6_DIFFICULTY_SETTINGS :Moeite stellings
STR_MENU_CONFIG_PATCHES :Konfigureer laslappe
STR_02C3_GAME_OPTIONS :Speletjie opsies
STR_02C5_DIFFICULTY_SETTINGS :Moeite stellings
STR_02C7_CONFIG_PATCHES :Konfigureer laslappe
STR_NEWGRF_SETTINGS :NewGRF stellings
STR_TRANSPARENCY_OPTIONS :Deursigtigheid opsies
STR_GAMEOPTMENU_0A :
@@ -867,8 +875,8 @@ STR_SAVING_GAME :{RED}* * BESP
STR_SAVE_STILL_IN_PROGRESS :{WHITE}Spaar nog in vorder, {}wag asb tot dit klaar is!
STR_0330_SELECT_EZY_STREET_STYLE :{BLACK}Kies 'Ezy Straat styl musiek' musiek lys
STR_6 :{BLACK}6
STR_7 :{BLACK}7
STR_0335_6 :{BLACK}6
STR_0336_7 :{BLACK}7
############ start of townname region
STR_TOWNNAME_ORIGINAL_ENGLISH :Engels (Oorspronkilik)
@@ -1043,6 +1051,7 @@ STR_CONFIG_PATCHES_BRIBE :{LTBLUE}Laattoe
STR_CONFIG_PATCHES_ALLOW_EXCLUSIVE :{LTBLUE}Laattoe die koop van eksklusief vervoer regte: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ALLOW_GIVE_MONEY :{LTBLUE}Laattoe die stuur van geld na ander maatskappye: {ORANGE}{STRING}
STR_CONFIG_PATCHES_NONUNIFORM_STATIONS :{LTBLUE}Ongelyk stasies: {ORANGE}{STRING}
STR_CONFIG_PATCHES_NEW_PATHFINDING_ALL :{LTBLUE}Nuwe wêreldwyd padvind (NPF, oorbrug NTP): {ORANGE}{STRING}
STR_CONFIG_PATCHES_FREIGHT_TRAINS :{LTBLUE}Gewig vermenivoud vir vrag om swaar treine te simuleer: {ORANGE}{STRING}
STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD :{LTBLUE}Laattoe skyf-deur pad stop op dorp besit paaie: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ADJACENT_STATIONS :{LTBLUE}Laattoe gebou van aangrensend stasies: {ORANGE}{STRING}
@@ -1196,6 +1205,9 @@ STR_CONFIG_PATCHES_CURRENCY :{CURRENCY}
STR_CONFIG_PATCHES_QUERY_CAPT :{WHITE}Verander stel waarde
STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE :{WHITE}Sommige of almal van die verstek diens pouse(s) onder is onversoenbaar met die gekies stel! 5-90% en 30-800 dae is geldig
STR_CONFIG_PATCHES_YAPF_SHIPS :{LTBLUE}Gebruik YAPF vir skepe: {ORANGE}{STRING}
STR_CONFIG_PATCHES_YAPF_ROAD :{LTBLUE}Gebruik YAPF vir pad voertuie: {ORANGE}{STRING}
STR_CONFIG_PATCHES_YAPF_RAIL :{LTBLUE}Gebruik YAPF vir treine: {ORANGE}{STRING}
STR_TEMPERATE_LANDSCAPE :Magtig landskap
STR_SUB_ARCTIC_LANDSCAPE :Onder-noordpool landskap
@@ -1637,41 +1649,41 @@ STR_MUST_REMOVE_RAILWAY_STATION_FIRST :{WHITE}Moet eer
STR_1801_MUST_REMOVE_ROAD_FIRST :{WHITE}Moet pad eers verwyder
STR_ROAD_WORKS_IN_PROGRESS :{WHITE}Pad werke in vorder
STR_1802_ROAD_CONSTRUCTION :{WHITE}Pad Konstruksie
STR_WHITE_TRAMWAY_CONSTRUCTION :{WHITE}Tremweg Konstruksie
STR_1802_TRAMWAY_CONSTRUCTION :{WHITE}Tremweg Konstruksie
STR_1803_SELECT_ROAD_BRIDGE :{WHITE}Kies Pad Brug
STR_ERR_ONEWAY_ROADS_CAN_T_HAVE_JUNCTION :{WHITE}... een rigting paaie kan nie aansluitings hê nie
STR_1804_CAN_T_BUILD_ROAD_HERE :{WHITE}Kan nie pad hier bou nie...
STR_CAN_T_BUILD_TRAMWAY_HERE :{WHITE}Kan nie tremweg hier bou nie...
STR_1804_CAN_T_BUILD_TRAMWAY_HERE :{WHITE}Kan nie tremweg hier bou nie...
STR_1805_CAN_T_REMOVE_ROAD_FROM :{WHITE}Kan nie pad van hier verwyder nie...
STR_CAN_T_REMOVE_TRAMWAY_FROM :{WHITE}Kan nie tremweg van hier af verwyder nie...
STR_1805_CAN_T_REMOVE_TRAMWAY_FROM :{WHITE}Kan nie tremweg van hier af verwyder nie...
STR_1806_ROAD_DEPOT_ORIENTATION :{WHITE}Pad Depot Ori<72>tering
STR_TRAM_DEPOT_ORIENTATION :{WHITE}Trem Depot Orientasie
STR_1806_TRAM_DEPOT_ORIENTATION :{WHITE}Trem Depot Orientasie
STR_1807_CAN_T_BUILD_ROAD_VEHICLE :{WHITE}Kan nie pad voertuig depot hier bou nie...
STR_CAN_T_BUILD_TRAM_VEHICLE :{WHITE}Kan nie trem voertuig depot hier bou nie...
STR_1807_CAN_T_BUILD_TRAM_VEHICLE :{WHITE}Kan nie trem voertuig depot hier bou nie...
STR_1808_CAN_T_BUILD_BUS_STATION :{WHITE}Kan nie bus stasie hier bou nie...
STR_1809_CAN_T_BUILD_TRUCK_STATION :{WHITE}Kan nie vragmotor stasie bou nie...
STR_CAN_T_BUILD_PASSENGER_TRAM_STATION :{WHITE}Kan nie passasier trem stasie bou nie...
STR_CAN_T_BUILD_CARGO_TRAM_STATION :{WHITE}Kan nie vrag trem stasie bou nie...
STR_1808_CAN_T_BUILD_PASSENGER_TRAM_STATION :{WHITE}Kan nie passasier trem stasie bou nie...
STR_1809_CAN_T_BUILD_CARGO_TRAM_STATION :{WHITE}Kan nie vrag trem stasie bou nie...
STR_180A_ROAD_CONSTRUCTION :Pad konstruksie
STR_TRAMWAY_CONSTRUCTION :Tremweg konstruksie
STR_180A_TRAMWAY_CONSTRUCTION :Tremweg konstruksie
STR_180B_BUILD_ROAD_SECTION :{BLACK}Bou pad afdeling
STR_BUILD_AUTOROAD_TIP :{BLACK}Bou pad seksie gebruikend Outopad metode
STR_BUILD_TRAMWAY_SECTION :{BLACK}Bou tremweg afdeling
STR_180B_BUILD_TRAMWAY_SECTION :{BLACK}Bou tremweg afdeling
STR_BUILD_AUTOTRAM_TIP :{BLACK}Bou tremweg gebruikend die Outotrem metode
STR_180C_BUILD_ROAD_VEHICLE_DEPOT :{BLACK}Bou pad voertuig depot (vir bou en diens van voertuie)
STR_BUILD_TRAM_VEHICLE_DEPOT :{BLACK}Bou trem voertuig depot (vir bou en diens van voertuie)
STR_180C_BUILD_TRAM_VEHICLE_DEPOT :{BLACK}Bou trem voertuig depot (vir bou en diens van voertuie)
STR_180D_BUILD_BUS_STATION :{BLACK}Bou bus stasie
STR_180E_BUILD_TRUCK_LOADING_BAY :{BLACK}Bou vraagmotor laai area
STR_BUILD_PASSENGER_TRAM_STATION :{BLACK}Bou passasier trem stasie
STR_BUILD_CARGO_TRAM_STATION :{BLACK}Bou vrag trem stasie
STR_180D_BUILD_PASSENGER_TRAM_STATION :{BLACK}Bou passasier trem stasie
STR_180E_BUILD_CARGO_TRAM_STATION :{BLACK}Bou vrag trem stasie
STR_180F_BUILD_ROAD_BRIDGE :{BLACK}Bou pad brug
STR_BUILD_TRAMWAY_BRIDGE :{BLACK}Bou tremweg brug
STR_180F_BUILD_TRAMWAY_BRIDGE :{BLACK}Bou tremweg brug
STR_1810_BUILD_ROAD_TUNNEL :{BLACK}Bou pad tonnel
STR_BUILD_TRAMWAY_TUNNEL :{BLACK}Bou tremweg tonnel
STR_1810_BUILD_TRAMWAY_TUNNEL :{BLACK}Bou tremweg tonnel
STR_1811_TOGGLE_BUILD_REMOVE_FOR :{BLACK}Tokkel bou/verwyder vir pad bou
STR_TOGGLE_BUILD_REMOVE_FOR_TRAMWAYS :{BLACK}Tokkel bou/verwyder vir tremweg konstruksie
STR_1811_TOGGLE_BUILD_REMOVE_FOR_TRAMWAYS :{BLACK}Tokkel bou/verwyder vir tremweg konstruksie
STR_1813_SELECT_ROAD_VEHICLE_DEPOT :{BLACK}Kies pad voertuig depot orientasie
STR_SELECT_TRAM_VEHICLE_DEPOT :{BLACK}Kies trem voertuig depot orientasie
STR_1813_SELECT_TRAM_VEHICLE_DEPOT :{BLACK}Kies trem voertuig depot orientasie
STR_1814_ROAD :Pad
STR_1815_ROAD_WITH_STREETLIGHTS :Pad met straatligte
STR_1816_TREE_LINED_ROAD :Boom-belynde pad
@@ -1813,8 +1825,8 @@ STR_3005_TOO_CLOSE_TO_ANOTHER_RAILROAD :{WHITE}Te naby
STR_3006_ADJOINS_MORE_THAN_ONE_EXISTING :{WHITE}Grens aan meer as een bestaande stasie/laai area
STR_3007_TOO_MANY_STATIONS_LOADING :{WHITE}Te veel stasies/laai areas in die stad
STR_3008_TOO_MANY_STATIONS_LOADING :{WHITE}Te veel stasies/laai areas
STR_TOO_MANY_BUS_STOPS :{WHITE}Te veel bushalte
STR_TOO_MANY_TRUCK_STOPS :{WHITE}Te veel vragmotor stasies
STR_3008A_TOO_MANY_BUS_STOPS :{WHITE}Te veel bushalte
STR_3008B_TOO_MANY_TRUCK_STOPS :{WHITE}Te veel vragmotor stasies
STR_3009_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Te naby aan 'n ander stasie/laai area
STR_300A_0 :{WHITE}{STATION} {STATIONFEATURES}
STR_300B_MUST_DEMOLISH_RAILROAD :{WHITE}Moet eers spoorweg stasie afbreek
@@ -1845,12 +1857,12 @@ STR_3040_NOW_ACCEPTS :{WHITE}{STATION
STR_3041_NOW_ACCEPTS_AND :{WHITE}{STATION} aanvaar nou {STRING} en {STRING}
STR_3042_BUS_STATION_ORIENTATION :{WHITE}Bus Stasie Orientasie
STR_3043_TRUCK_STATION_ORIENT :{WHITE}Vragmotor Stasie Orientasie
STR_PASSENGER_TRAM_STATION_ORIENTATION :{WHITE}Passasier Trem Orientasie
STR_CARGO_TRAM_STATION_ORIENT :{WHITE}Vrag Trem Orientasie
STR_3042_PASSENGER_TRAM_STATION_ORIENTATION :{WHITE}Passasier Trem Orientasie
STR_3043_CARGO_TRAM_STATION_ORIENT :{WHITE}Vrag Trem Orientasie
STR_3046_MUST_DEMOLISH_BUS_STATION :{WHITE}Moet eers bus stasie afbreek
STR_3047_MUST_DEMOLISH_TRUCK_STATION :{WHITE}Moet eers vragmotor stasie afbreek
STR_MUST_DEMOLISH_PASSENGER_TRAM_STATION :{WHITE}Moet eers passasier trem stasie afbreek
STR_MUST_DEMOLISH_CARGO_TRAM_STATION :{WHITE}Moet eers vrag trem stasie afbreek
STR_3046_MUST_DEMOLISH_PASSENGER_TRAM_STATION :{WHITE}Moet eers passasier trem stasie afbreek
STR_3047_MUST_DEMOLISH_CARGO_TRAM_STATION :{WHITE}Moet eers vrag trem stasie afbreek
STR_3048_STATIONS :{WHITE}{COMPANY} - {COMMA} Stasie{P "" s}
STR_3049_0 :{YELLOW}{STATION} {STATIONFEATURES}
STR_304A_NONE :{YELLOW}- Geen -
@@ -1862,8 +1874,8 @@ STR_304F_SELECT_NUMBER_OF_PLATFORMS :{BLACK}Kies nom
STR_3050_SELECT_LENGTH_OF_RAILROAD :{BLACK}Kies lengte van spoorweg stasie
STR_3051_SELECT_BUS_STATION_ORIENTATION :{BLACK}Kies bus stasie orientasie
STR_3052_SELECT_TRUCK_LOADING_BAY :{BLACK}Kies vragmotor laai area orientasie
STR_SELECT_PASSENGER_TRAM_STATION_ORIENTATION :{BLACK}Kies passasier trem stasie orientasie
STR_SELECT_CARGO_TRAM_STATION_ORIENTATION :{BLACK}Kies vrag trem stasie orientasie
STR_3051_SELECT_PASSENGER_TRAM_STATION_ORIENTATION :{BLACK}Kies passasier trem stasie orientasie
STR_3052_SELECT_CARGO_TRAM_STATION_ORIENTATION :{BLACK}Kies vrag trem stasie orientasie
STR_3053_CENTER_MAIN_VIEW_ON_STATION :{BLACK}Senter skerm op stasie
STR_3054_SHOW_STATION_RATINGS :{BLACK}Toon stasie graderings
STR_3055_CHANGE_NAME_OF_STATION :{BLACK}Verander naam van stasie
@@ -1885,7 +1897,7 @@ STR_3068_DOCK :{WHITE}Werf
STR_3069_BUOY :Baken
STR_306A_BUOY_IN_THE_WAY :{WHITE}...baken in die pad
STR_306C_STATION_TOO_SPREAD_OUT :{WHITE}...Stasie te ver van mekaar af
STR_NONUNIFORM_STATIONS_DISALLOWED :{WHITE}...ongelyk stasies is versper
STR_306D_NONUNIFORM_STATIONS_DISALLOWED :{WHITE}...ongelyk stasies is versper
STR_USE_CTRL_TO_SELECT_MORE :{BLACK}Hou in CTRL om meer as een item te selekteer
STR_UNDEFINED :(undefined string)
@@ -1926,7 +1938,7 @@ STR_400D_SAVE_THE_CURRENT_GAME_USING :{BLACK}Spaar di
STR_400E_SELECT_NEW_GAME_TYPE :{WHITE}Kies Nuwe Speletjie Tipe
STR_400F_SELECT_SCENARIO_GREEN_PRE :{BLACK}Kies draaiboek (groen), vooraf-stel speletjie (blou), of lukraak nuwe speletjie
STR_4010_GENERATE_RANDOM_NEW_GAME :Opwek lukraak nuwe speletjie
STR_LOAD_HEIGHTMAP :{WHITE}Laai Hoogtekaart
STR_4011_LOAD_HEIGHTMAP :{WHITE}Laai Hoogtekaart
##id 0x4800
STR_4800_IN_THE_WAY :{WHITE}{STRING} in die pad
@@ -2130,10 +2142,10 @@ STR_6812_QUANTITY_OF_SEA_LAKES :{LTBLUE}Hoeveel
STR_6813_ECONOMY :{LTBLUE}Ekonomie: {ORANGE}{STRING}
STR_6814_TRAIN_REVERSING :{LTBLUE}Trein omkeer: {ORANGE}{STRING}
STR_6815_DISASTERS :{LTBLUE}Rampe: {ORANGE}{STRING}
STR_CITY_APPROVAL :{LTBLUE}Stad raad se houding na area herstruktuuring: {ORANGE}{STRING}
STR_16816_CITY_APPROVAL :{LTBLUE}Stad raad se houding na area herstruktuuring: {ORANGE}{STRING}
############ range for difficulty settings ends
STR_NONE :Geen
STR_26816_NONE :Geen
STR_NUM_VERY_LOW :Baie laag
STR_6816_LOW :Laag
STR_6817_NORMAL :Normaal
@@ -2171,9 +2183,9 @@ STR_6835_AT_END_OF_LINE_ONLY :Slegs op die en
STR_6836_OFF :Af
STR_6837_ON :Aan
STR_6838_SHOW_HI_SCORE_CHART :{BLACK}Wys ho<68>telling tabel
STR_PERMISSIVE :Permissief
STR_TOLERANT :Toelaatbaar
STR_HOSTILE :Vyandelik
STR_6839_PERMISSIVE :Permissief
STR_683A_TOLERANT :Toelaatbaar
STR_683B_HOSTILE :Vyandelik
##id 0x7000
STR_7000 :
@@ -2305,7 +2317,7 @@ STR_707B_CAN_T_BUY_25_SHARE_IN_THIS :{WHITE}Kan nie
STR_707C_CAN_T_SELL_25_SHARE_IN :{WHITE}Kan nie 25% aandeel in die maatskappy verkoop nie...
STR_707D_OWNED_BY :{WHITE}({COMMA}% besit by {COMPANY})
STR_707F_HAS_BEEN_TAKEN_OVER_BY :{BLACK}{BIGFONT}{COMPANY} is deur {COMPANY} oorgevat!
STR_PROTECTED :{WHITE}Die maatskappy is nie oud genoeg om aandeele te handel nie...
STR_7080_PROTECTED :{WHITE}Die maatskappy is nie oud genoeg om aandeele te handel nie...
STR_LIVERY_DEFAULT :Standaard Lewery
STR_LIVERY_STEAM :Stoom Enjin
@@ -2612,17 +2624,17 @@ STR_8803_TRAIN_IN_THE_WAY :{WHITE}Trein in
STR_8804 :{SETX 10}{COMMA}: {STRING} {STRING}
STR_8805 :{RIGHTARROW}{SETX 10}{COMMA}: {STRING} {STRING}
STR_8806_GO_TO :Gaan na {STATION}
STR_GO_TO_TRANSFER :Gaan na {STATION} (Oordrag en vat vrag)
STR_8807_GO_TO_UNLOAD :Gaan na {STATION} (Aflaai)
STR_GO_TO_TRANSFER_UNLOAD :Gaan na {STATION} (Oordrag en verlaat leeg)
STR_8808_GO_TO_LOAD :Gaan na {STATION} (Laai)
STR_GO_TO_TRANSFER_LOAD :Gaan na {STATION} (Oordrag en wag vir volle lading)
STR_880A_GO_NON_STOP_TO :Gaan deurgaande na {STATION}
STR_GO_TO_NON_STOP_TRANSFER :Gaan deurgaande na {STATION} (Oordra en neem vrag)
STR_880B_GO_NON_STOP_TO_UNLOAD :Gaan deurgaande na {STATION} (Aflaai)
STR_GO_TO_NON_STOP_TRANSFER_UNLOAD :Gaan deurgaande na {STATION} (Oordra en verlaat leë)
STR_880C_GO_NON_STOP_TO_LOAD :Gaan deurgaande na {STATION} (Laai)
STR_GO_TO_NON_STOP_TRANSFER_LOAD :Gaan deurgaande na {STATION} (Oordra en wag vir volle lading)
STR_8807_GO_TO_TRANSFER :Gaan na {STATION} (Oordrag en vat vrag)
STR_8808_GO_TO_UNLOAD :Gaan na {STATION} (Aflaai)
STR_8809_GO_TO_TRANSFER_UNLOAD :Gaan na {STATION} (Oordrag en verlaat leeg)
STR_880A_GO_TO_LOAD :Gaan na {STATION} (Laai)
STR_880B_GO_TO_TRANSFER_LOAD :Gaan na {STATION} (Oordrag en wag vir volle lading)
STR_880C_GO_NON_STOP_TO :Gaan deurgaande na {STATION}
STR_880D_GO_TO_NON_STOP_TRANSFER :Gaan deurgaande na {STATION} (Oordra en neem vrag)
STR_880E_GO_NON_STOP_TO_UNLOAD :Gaan deurgaande na {STATION} (Aflaai)
STR_880F_GO_TO_NON_STOP_TRANSFER_UNLOAD :Gaan deurgaande na {STATION} (Oordra en verlaat leë)
STR_8810_GO_NON_STOP_TO_LOAD :Gaan deurgaande na {STATION} (Laai)
STR_8811_GO_TO_NON_STOP_TRANSFER_LOAD :Gaan deurgaande na {STATION} (Oordra en wag vir volle lading)
STR_GO_TO_TRAIN_DEPOT :Gaan na {TOWN} Trein Depot
STR_SERVICE_AT_TRAIN_DEPOT :Diens by {TOWN} Trein Depot
STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT :Gaan deurgaande na {TOWN} Trein Depot
@@ -2726,7 +2738,7 @@ STR_884E_DECREASE_SERVICING_INTERVAL :{BLACK}Verminde
STR_884F_SHOW_DETAILS_OF_CARGO_CARRIED :{BLACK}Toon besonderhede van vrag gedra
STR_8850_SHOW_DETAILS_OF_TRAIN_VEHICLES :{BLACK}Toon besonderhede van trein voertuie
STR_8851_SHOW_CAPACITIES_OF_EACH :{BLACK}Toon kapasiteite van elke voertuig
STR_SHOW_TOTAL_CARGO :{BLACK}Toon totaale kapasitiet van trein, verdeel by vrag tipe
STR_8852_SHOW_TOTAL_CARGO :{BLACK}Toon totaale kapasitiet van trein, verdeel by vrag tipe
STR_8852_ORDERS_LIST_CLICK_ON_ORDER :{BLACK}Opdraglys - kliek op 'n opdrag om dit te verlig. CTRL + kliek senter op stasie
STR_8853_SKIP_THE_CURRENT_ORDER :{BLACK}Sprong die huidige opdraag, en begin die volgende. CTRL + kliek sprong na verkieste opdrag
STR_8854_DELETE_THE_HIGHLIGHTED :{BLACK}Vee uit die verlig opdrag
@@ -2757,8 +2769,8 @@ STR_8868_TRAIN_CRASH_DIE_IN_FIREBALL :{BLACK}{BIGFONT
STR_8869_CAN_T_REVERSE_DIRECTION :{WHITE}Kan nie rigting van trein omkeer nie...
STR_886A_RENAME_TRAIN_VEHICLE_TYPE :{WHITE}Hernoem trein voertuig tipe
STR_886B_CAN_T_RENAME_TRAIN_VEHICLE :{WHITE}Trein voertuig tipe kan nie hernoem word nie...
STR_MAKE_THE_HIGHLIGHTED_ORDER :{BLACK}Maak die verlig opdrag forseer die voertuig om sy vrag te stort
STR_TRANSFER :{BLACK}Oordra
STR_886D_MAKE_THE_HIGHLIGHTED_ORDER :{BLACK}Maak die verlig opdrag forseer die voertuig om sy vrag te stort
STR_886F_TRANSFER :{BLACK}Oordra
STR_CLEAR_TIME :{BLACK}Reinig Tyd
STR_RESET_LATENESS :{BLACK}Herstel Laat Teller
@@ -2835,8 +2847,8 @@ STR_902D_CAN_T_NAME_ROAD_VEHICLE :{WHITE}Pad voer
STR_902E_NAME_ROAD_VEHICLE :{BLACK}Benaam pad voertuig
STR_902F_CITIZENS_CELEBRATE_FIRST :{BLACK}{BIGFONT}Burgers herdenk . . .{}Eerste bus arriveer by {STATION}!
STR_9030_CITIZENS_CELEBRATE_FIRST :{BLACK}{BIGFONT}Burgers herdenk . . .{}Eerste trok arriveer by {STATION}!
STR_CITIZENS_CELEBRATE_FIRST_PASSENGER_TRAM :{BLACK}{BIGFONT}Burgers herdenk . . .{}Eerste passasier trein arriveer by {STATION}!
STR_CITIZENS_CELEBRATE_FIRST_CARGO_TRAM :{BLACK}{BIGFONT}Burgers herdenk . . .{}Eerste vrag trein arriveer by {STATION}!
STR_902F_CITIZENS_CELEBRATE_FIRST_TRAM :{BLACK}{BIGFONT}Burgers herdenk . . .{}Eerste passasier trein arriveer by {STATION}!
STR_9030_CITIZENS_CELEBRATE_FIRST_TRAM :{BLACK}{BIGFONT}Burgers herdenk . . .{}Eerste vrag trein arriveer by {STATION}!
STR_9031_ROAD_VEHICLE_CRASH_DRIVER :{BLACK}{BIGFONT}Pad Voertuig Botsing!{}Bestuurder sterf in vuurbol na botsing met trein
STR_9032_ROAD_VEHICLE_CRASH_DIE :{BLACK}{BIGFONT}Pad voertuig Botsing!{}{COMMA} sterf in vuurbol na botsing met trein
STR_9033_CAN_T_MAKE_VEHICLE_TURN :{WHITE}Kan nie voertuig forseer om te omdraai nie...
@@ -2845,7 +2857,7 @@ STR_9034_RENAME :{BLACK}Hernoem
STR_9035_RENAME_ROAD_VEHICLE_TYPE :{BLACK}Hernoem pad voertuig tipe
STR_9036_RENAME_ROAD_VEHICLE_TYPE :{WHITE}Hernoem pad voertuig tipe
STR_9037_CAN_T_RENAME_ROAD_VEHICLE :{WHITE}Pad voertuig tipe kan nie hernoem word nie...
STR_GO_TO_ROADVEH_DEPOT :Gaan na {TOWN} Pad Voertuig Depot
STR_9038_GO_TO_ROADVEH_DEPOT :Gaan na {TOWN} Pad Voertuig Depot
STR_SERVICE_AT_ROADVEH_DEPOT :Diens by {TOWN} Pad Voertuig Depot
STR_REFIT_ROAD_VEHICLE_TO_CARRY :{BLACK}Herpas pad voertuig om 'n ander vrag tipe te ontvoer
@@ -3244,6 +3256,7 @@ STR_HEIGHTMAP_SCALE_WARNING_CAPTION :{WHITE}Skaal wa
STR_HEIGHTMAP_SCALE_WARNING_MESSAGE :{YELLOW}Om te verstel oorsprong werfkaart te is nie aanbeveel. Voortgaan met die generasie?
STR_TOWN_LAYOUT_WARNING_CAPTION :{WHITE}Dorp uitleg waarskuwing
STR_TOWN_LAYOUT_WARNING_MESSAGE :{YELLOW}Die dorp uitleg "geen meer paaie" is nie aanbeveel nie. Gaan aan met generasie?
STR_SNOW_LINE_HEIGHT_NUM :{NUM}
STR_HEIGHTMAP_NAME :{BLACK}Hoogtekaart name:
STR_HEIGHTMAP_SIZE :{BLACK}Groote: {ORANGE}{NUM} x {NUM}
STR_GENERATION_WORLD :{WHITE}Genereer wêreld...
@@ -3269,6 +3282,7 @@ STR_FLAT_WORLD_HEIGHT_DOWN :{BLACK}Beweeg d
STR_FLAT_WORLD_HEIGHT_UP :{BLACK}Beweeg die hoogte van platte daal bo een
STR_FLAT_WORLD_HEIGHT_QUERY_CAPT :{WHITE}Verander die hoogte van platte daal
STR_FLAT_WORLD_HEIGHT :{BLACK}Hoogte van platte daal:
STR_FLAT_WORLD_HEIGHT_NUM :{NUM}
STR_SMALLMAP_CENTER :{BLACK}Senter die kleinwerfkaart op die huidige posisie

Some files were not shown because too many files have changed in this diff Show More