truelight
96e9fd333b
(svn r6157) -Codechange: DeleteVehicle removes a vehicle from the pool
...
-Codechange: DestroyVehicle is called by DeleteVehicle to remove all things where a vehicle depends on.
Last 2 changes to prepare for new pool system. Not pretty now, will be soon.
18 years ago
truelight
db8dfcd6e9
(svn r6142) -Codechange: added WaypointID (sorry DV, couldn't splits it anymore)
...
-Codechange: introduced DestinationID, which is in fact an union of several types
Used in Order struct, so no longer StationID is abused for all targets.
Hangars are a big exception, as they use a station-id with GOTO_DEPOT (go figure)
18 years ago
truelight
b23f719ab9
(svn r6053) -Codechange: renamed all IsXXXIndex to IsValidXXXID
...
-Codechange: IsValidXXXID now also checks if XXX is really valid, not if the number is within range
Both changes again in preperation of the new mem-pool system, which requires this.
IsValidXXXID is not a bit less pretty, but that will be cleaned up after the new mem-pool system
18 years ago
truelight
0461d89612
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
...
-Codechange: use IsValidXXX where ever possible
Note: both changes to prepare for new pool system, which needs those changes.
For every pool there are 2 ugly lines, which will be removed when done
implementing new pool system.
Based on FS#13 by blathijs, partly implemented.
18 years ago
rubidium
480af9c917
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
18 years ago
rubidium
28a0843707
(svn r5999) -Feature: change the original date format to a 32 bits format based at the year 0.
...
The game date subsystem now allows someone to start in the year 0 and continue
up to the year 5 000 000. However, you currently cannot build anything before
1920 as there is no newgrf support for dates before 1920 or after 2090 yet.
18 years ago
bjarni
08fd0bed1f
(svn r5917) -Fix: [clone vehicles] FS#275 Bugfix: Cloned Road Vehicles Are Not Refitted To Correct Cargo (Mart3p)
18 years ago
Darkvater
a35511dc9b
(svn r5898) -Fix [FS#249]: Bugfix: Goto Depot not always working for road vehicles. (mart3p)
18 years ago
bjarni
4b82897e25
(svn r5891) -Code cleanup: cleaned up the code added in revision 5888
18 years ago
bjarni
37f94c7557
(svn r5888) -Fix: [autoreplace] if vehicles breakdowns and service are turned off, the vehicles failed to enter any depots
...
now they will quickly go to a depot if set to be replaced
the tradeoff is that a vehicle set to be replaced and without a depot in the orders will forget about the orders and head for a depot. If the replace fails (lack of money), it will exit and try to head for the depot again
also all vehicles of that type will rush to the depots at once, risking causing traffic jams. This is because there is no way to even it out like normal depot visits offers
Tip: add a depot to the orders of all vehicles, set it to service only and it will always be skipped unless the vehicle is set to be replaced. This should help on the jam issue and if the replace fails, the vehicle will go though a whole round of the orders and make more money before trying again
18 years ago
rubidium
243872b4fd
(svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
...
-Cleanup: fix whitespace related coding style issues in date.[ch]
-Cleanup: make original comments doxygen compatible and remove/change outdated comments
18 years ago
tron
0973dc78cd
(svn r5614) Move a type declaration to its only user
18 years ago
tron
16bf3e35cd
(svn r5613) Rename VS_DISASTER to VS_SHADOW, because this is what this flag actually means
18 years ago
tron
3aa408ee02
(svn r5612) Restructure some code which uses the vehicle position hash to make it a bit clearer what's going on
18 years ago
tron
c4ed8e9ec4
(svn r5599) GetPrevVehicleInChain() may never fail to find a valid vehicle. Reflect this in the code
18 years ago
KUDr
b14c5fdf74
(svn r5483) -Fix: [YAPF] desync - for MP games invalidate YAPF cache on every tick to keep it exactly the same on server and clients (it doesn't fix the real source of the problem, but should solve it). Thanks TrueLight for hunting this bug.
18 years ago
bjarni
446804c19d
(svn r5468) -Fix: fixed declaration after statement added in 5465 (I wonder why the makefile failed to warn about this)
...
also removed a few lines of debug code
18 years ago
bjarni
356954ca26
(svn r5465) -Feature: [autoreplace] replacing from a train engine without cargo capacity to one with cargo capacity will now make autoreplace refit the engine to carry the cargo type from the last wagon in the train
...
if the train is carrying the type of cargo, that is default for the engine, it will not be refitted
if the last wagon do not carry cargo, the refit will be to the type of the last wagon, that do carry cargo
18 years ago
bjarni
0df769f3ed
(svn r5428) -Fix: [vehicles] sovled crash when trying to build a vehicle type, that is set to max 0 (spotted by roboman)
...
somebody might add a better string than "too many vehicles in game" since none are allowed, but at least it will not crash anymore
18 years ago
tron
2b27073156
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
18 years ago
peter1138
e679cfe802
(svn r5191) - NewGRF: add cargo refit support for road vehicles
19 years ago
peter1138
d286235a6a
(svn r5146) - NewGRF: Support selection of aircraft default cargo type by checking its refit mask. If aircraft can be refitted to passengers, no change happens, else the first refittable type is chosen. Also use refit capacity to determine the default capacity.
19 years ago
tron
cb13a1e43d
(svn r5120) Add IsShipInDepot{Stopped,}() and remove some redundant checks
19 years ago
tron
eeeb8172e8
(svn r5118) Add IsRoadVehInDepot{Stopped,}()
19 years ago
tron
4f5c84e720
(svn r5116) Move the overly generic GetDepotDirection() from a header to its only consumer
19 years ago
tron
fa74002356
(svn r5101) Add a function to convert an axis and a flag for north/south into a DiagDirection. Use it for bridge ramps and ship depots
19 years ago
tron
a0caafeb50
(svn r5094) Remove _new_{aircraft,roadveh,ship,train,wagon}_id. _new_vehicle_id is enough.
19 years ago
bjarni
4557832c9c
(svn r4967) -Fix: [clone vehicles] a cloned train engine heads the same way as the original (pointed out by bobingabout)
...
[autoreplace] the same applies to autoreplaced trains if the engine is a single unit (not dualheaded or articulated)
19 years ago
tron
1706164ff7
(svn r4937) Reduce the use of _error_message a bit
19 years ago
bjarni
13d9690f3a
(svn r4829) -Codechage: [clone vehilces] only check for a free unitnumber for the first engine in the test run as well as execute run (to improve speed. The result should be unchanged)
19 years ago
bjarni
2e05a16959
(svn r4826) -Fix: [autoreplace] fixed possible problem when autoreplacing and was number of vehicles (of a type, not total) was reached
...
now the new vehicle gets the same number as the old one, completely removing the problem where we could run out of numbers
since we don't have to find free numbers for the new vehicles, autoreplace should be somewhat faster, specially in late games
NOTE: in CmdBuildRailVehicle(), bit 0 and 1 in p2 have been switched to make the meaning of bit 0 consistent with the other build commands. CmdCloneVehicle() is modified to follow this as well
19 years ago
bjarni
06156142d4
(svn r4825) - Fix [clone FS#159]: Game crashes when cloning reaches train-limit.
19 years ago
tron
c9defc0fea
(svn r4790) Remove slope magic from EnsureNoVehicleZ() and rename it to EnsureNoVehicleOnGround() to make more clear what it does
19 years ago
bjarni
246e53d206
(svn r4599) -Fix: [Cloning, autoreplace] FS#141 clone service-interval
...
now cloned vehicles get the same service interval as the original vehicle
I applied this to autoreplace as well even though it's not mentioned in the bug report (autorenew should not alter service interval)
19 years ago
tron
18ad0ae50e
(svn r4572) Remove vehicle_leave_tile_proc
...
There's exactly one implemented function (unbarring a level crossing) and one place where it can be triggered (a train leaves a level crossing)
It's a bit overkill, so just handle this one case where it can happen
19 years ago
tron
c1dc517dab
(svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE}
19 years ago
tron
0347fb2ab6
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
19 years ago
peter1138
ae7ec5cd0d
(svn r4471) - Pools: Add a facility for calling a custom function during pool block clean up.
19 years ago
tron
81e6d68f95
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
...
Remove DoCommandByTile(), because now it does the same as DoCommand()
19 years ago
celestar
6926bd55fd
(svn r4341) -Fix (FS#101) When a player got bankrupt, slots were not cleared, because vehicles got deleted directly by DeleteVehicle
19 years ago
celestar
5931b34aff
(svn r4259) -[multistop] Fix/Feature/Codechange:
...
1) Improved the road vehicle allocation (aka slotting) for multistop. Stops can now accept unlimited, er... 256, vehicles.
2) Removed the "wait for stop" feature, because it did not work in practise.
3) Slotting now ignores unreachable stations. Uses NPF at the moment because the old pathfinder cannot do it (yet)
4) Now matter how many vehicles approach a station, they will always be distributed evenly over existing stops.
5) Hopefully the last fundamental change to multistop
19 years ago
peter1138
9d5e052bbc
(svn r4256) - Codechange: Replace lone map access in vehicle.c with its map accessor.
19 years ago
celestar
cc87f682b9
(svn r4249) -Codechange: Replace more occurences of 16 by TILE_SIZE and of 8 by TILE_HEIGHT. Reverted one change from the previous commit because it was faulty
19 years ago
celestar
3aa1e38be6
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
19 years ago
bjarni
7c64aa4142
(svn r4228) -Fix: [autoreplace] allow replacement of wagons even when the engine fails to be replaced
19 years ago
peter1138
96288ee39a
(svn r4227) - Fix: Wagon replace nows checks if the cargo types are the same before seeing if it can refit.
19 years ago
celestar
446493149c
(svn r4215) -Codechange: Renamed *RoadStation* functions to *RoadStop* and moved them to station_map.h to keep consistency
19 years ago
peter1138
cd0a67dc65
(svn r4201) - Codechange: Do for _engine_info[] what we do for _*_vehicle_info[]; create and use a function to retrieve data, and ensure constness.
19 years ago
bjarni
0151ab0379
(svn r4159) added missing comments about refitting in CmdCloneVehicle
19 years ago
bjarni
0c64cecc66
(svn r4158) -Fix: [autoreplace] cost for refitting the new vehicle is now added to the cost animation. The player always paid for it, but it was not displayed until now
19 years ago
celestar
a7d8ad0004
(svn r4150) -Feature: Merged elrails into trunk. Thanks to Tron for lots of code and proofreading, thanks to peter1138 for another lot of code and ideas.
19 years ago
belugas
26a5b62865
(svn r4092) CodeChange : Named sprites instead of magic numbers plus create/use helper macro/enum for recoloring scheme
19 years ago
Darkvater
d9ee10d3b8
(svn r3895) - Add proper SLE(G)_CONDNULL macros for the empty space reservation in savegames and update where used
...
- Also add this capability to settings
19 years ago
tron
12d252d9bd
(svn r3831) Add and use GetRailDepotDirection()
19 years ago
tron
929fae7b68
(svn r3816) Use existing accessors
19 years ago
bjarni
96641f462e
(svn r3811) -Fix: [autoreplace]: (FS#67) autoreplacing trains now keep their tile length instead of their pixel length
19 years ago
peter1138
9c7f09322e
(svn r3805) - [FS#62] Fix doxygen comments to refer to the correct parameter. (sulai)
19 years ago
tron
2181a72e9e
(svn r3787) Use DirToDiagDir() instead of >> 1
19 years ago
tron
ecabf8a5f0
(svn r3784) Add a type and functions to handle direction changes
19 years ago
tron
fbe939b31f
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
19 years ago
tron
4270026b42
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
...
This is used to delete
- all news about a vehicle, when it gets deleted
- "vehicle has stopped in depot" news, when it gets started
- "vehicle has invalid orders" news, when the orders get changed
19 years ago
tron
40fd4377b0
(svn r3747) Change HASBIT() to return 0/1 instead of 0/value of tested bit, because the name suggests it does the former and current behavior broke in some places in very subtle ways (for example HASBIT(x, 0) != HASBIT(y, 1) doesn't work, returning a bool after HASBIT(x, 9) neither)
19 years ago
peter1138
741fc26522
(svn r3717) - [2cc] Add 2cc colour maps and use for newgrf engines requiring them. Currently the second colour is fixed to be the player's colour.
19 years ago
peter1138
24217d5c8d
(svn r3701) [2cc] move vehicle/engine palette functions out of header file and document the remaining definitions
19 years ago
Darkvater
45e85d2eb2
(svn r3627) - Change all hardcoded 255 max-saveload versions with the define SL_MAX_VERSION
19 years ago
peter1138
4f9ea7640a
(svn r3620) - 2cc: Replace use of macro to determine colour map with a function call for drawing of vehicles.
19 years ago
Darkvater
4c8c1e8f6a
(svn r3619) - Codechange: Simplify a NullStruct initialization in the vehicle array (merge the two together to avoid confusion)
19 years ago
truelight
0068f19605
(svn r3598) -Fix: suppress invalid warning by assigning value to variable
19 years ago
peter1138
efe76c22e6
(svn r3589) - Rename u.road.unk2 to u.road.blocked_ctr
19 years ago
peter1138
f4215cf6a0
(svn r3579) v->u.rail.first_engine holds an engine type, not a vehicle index, so use INVALID_ENGINE.
19 years ago
peter1138
2265915e6c
(svn r3576) - Allow unused wagons have their ->first set. This fixes the faulty cache warning message, and noticably speeds up depot operations in large games.
19 years ago
peter1138
9dba135f79
(svn r3573) - Replace assert(0) with NOT_REACHED(). This commit sponsored by "giving Darkvater credit for the last three".
19 years ago
peter1138
59333131a5
(svn r3572) - Rewrite GetFreeUnitNumber() so that only one loop of vehicles is required. Instead a list of used/unused numbers is created and the first unused number is chosen. This significantly improves performance in large games.
19 years ago
peter1138
66fcdc5e6d
(svn r3571) - When loading a game, call TrainConsistChanged() for each train head separately before updating images, as v->first is used extensively in GetTrainImage() for custom graphics. This gives a significant speed improvement on loading a game.
19 years ago
bjarni
78b51cbec2
(svn r3535) -Feature: [autoreplace] allow autoreplacing of train wagons
...
currently ALL available wagons are displayed in the right menu in the replace window
however the replacement will only be done if the new wagon can be refitted to carry same cargo as the old one is currently carrying
Since the standard vehicles do not have any valid wagon replacements, this feature can only be used when using newgrf sets
19 years ago
tron
84fb96fe85
(svn r3511) More whitespace ([FS#46] by Rubidium)
19 years ago
tron
22dc05faf2
(svn r3510) Fiddle with whitespace and parentheses
19 years ago
tron
4e2bb34be3
(svn r3498) Fix the edge case for r3419/r3488: when a vehicle just enters a tile, the height difference can be 8
19 years ago
tron
7d03773383
(svn r3488) Simplify the check in r3419
19 years ago
Darkvater
e6d16d17dc
(svn r3482) - Fix: since multiheaded links are not saved anymore do NOT save them anymore at all, return the extra space. Since Bjarni's fix for this was abominable, the weird situation arises of 2 NULL structs of free space, of which the first isn't usable.
19 years ago
Darkvater
4e09974975
(svn r3472) - [PBS] Remove from trunk. Anyone interested can still find it in branch/pbs. This reverts revisions r3158, r3140, r3075, r2977, r2674, r2625, r2621, r2529, r2528, r2525, r2524, r2519, r2517, r2516, r2507, r2499. (in conjunction with Tron)
...
- The only change is that the nsignalsw.grf file is kept and that existing nightlies with PBS signals get those signals converted to combo-signals.
19 years ago
Darkvater
188352ea3e
(svn r3419) - Fix: [FS#40] (Possible) game crash on removing track/road under bridge. This was caused by a wrong tile-occupancy testing where it was assumed that a vehicle's height is only a multitude of 8 (a single height-difference). This is incorrect as a vehicle on a slope will assume all height levels between the lower-and upper-bounds. The crash is still possible as seen in the Flyspray bugreport but this has a different cause.
19 years ago
bjarni
e35a131153
(svn r3403) -Codechange: [multiheaded engines] the references between the front and rear engines are no longer saved
...
instead the pointers are generated on load
19 years ago
peter1138
90aff7a026
(svn r3396) - Autoreplace changes:
...
- Change fixed array per player to a single pool. This avoids future problems
with vehicle numbers and decreases savegame size. Engine replacements from
previous savegames will be lost.
- Move engine replacement code from players.c to engine.c.
(thanks to blathijs for rewriting this)
19 years ago
bjarni
4bf1741783
(svn r3390) -Fix: [autoreplace] fixed issue where autoreplace failed to attach the cars if the front engine was replaced
...
and the front engine was multiheaded and the first vehicle after it was the rear part of that engine
19 years ago
tron
af70b49bf7
(svn r3367) Unify the 4 distinct CMD_CHANGE_{AIRCRAFT,ROADVEH,SHIP,TRAIN}_SERVICE_INT commands into one CMD_CHANGE_SERVICE_INT command.
...
As side effect this is a
-Fix: The default AI tried to change the service intervals of vehicles via the CMD_CHANGE_TRAIN_SERVICE_INT command - regardless of the type of the vehicle - which of course failed for non-trains
19 years ago
tron
e272b03fee
(svn r3365) Staticise 36 functions
19 years ago
peter1138
4b464093e7
(svn r3362) Fix issue with loading old (TTD) savegames:
...
- move call to convert from old to new train subtypes.
- ensure AI is started for AI players.
19 years ago
peter1138
911a8aa08d
(svn r3361) - Clone Vehicle: Disallow cloning of crashed rail vehicles after starting removal process.
19 years ago
tron
246c126d25
(svn r3353) Simplify the automatic length adjustment algorithm for replacing trains: Use the length of the train before the replacement as reference length
19 years ago
peter1138
1ffc700797
(svn r3352) - NewGRF: Move initialization of vehicle random_bits to DC_EXEC blocks to allow use of Random() instead of InteractiveRandom(), which will alleviate some possible network desyncs.
19 years ago
tron
fa78c057ee
(svn r3339) Remove unnecessary includes
19 years ago
tron
bf98086de8
(svn r3298) Remove unused and write-only variables
19 years ago
tron
23bfc03054
(svn r3297) Staticise
19 years ago
peter1138
414481cdd8
(svn r3261) - Autoreplace: If a replaced vehicle had a custom name, transfer it to the new vehicle. Fixes "[ 1370039 ] Autoreplaced vehicles lose their names"
19 years ago
peter1138
fde99748c0
(svn r3248) - Codechange: Change interface of CanRefitTo() to supply the engine type directly instead of getting it from a vehicle. This allows the function to be used before vehicles are involved.
19 years ago
peter1138
87f54ebf92
(svn r3239) - Codechange: Introduce and use helper functions for engine replacement code.
19 years ago
truelight
4845ff063b
(svn r3227) -Codechange: [Savegame] removed 'minor' version, and renamed 'major' version to just: version.
19 years ago
bjarni
c7f3192f6b
(svn r3223) -Fix: [autoreplace] fixed crash when replacing a train engine without any cars (introduced in r3220)
19 years ago
bjarni
24eda23b80
(svn r3220) -Fix: [autoreplace] Autoreplaced trains now replace their cargo to the train instead of just the new engine
...
This applies to wagon removal during autoreplace too
19 years ago