peter1138
c5b039960d
(svn r4860) - NewGRF: remove a missed extern for _traininfo_vehicle_pitch
19 years ago
bjarni
f17a23e06a
(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
37ec349dec
(svn r4825) - Fix [clone FS#159]: Game crashes when cloning reaches train-limit.
19 years ago
rubidium
3dae1a9bba
(svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
19 years ago
tron
ebcf2ee3b1
(svn r4765) Add GetTileMaxZ(), which returns the height of the highest corner of a tile, and use it to simplify the code in a few places
19 years ago
tron
cd9821fb39
(svn r4750) -Fix: Trains could enter certain sloped rail tiles under bridges with incompatible rail type
19 years ago
peter1138
744e917c34
(svn r4706) - NewGRF: add the correct default error message for the wagon attach callback.
19 years ago
peter1138
2fdce8ee8c
(svn r4703) - NewGRF: add support for callback 0x1D, "can wagon be attached". This can be used to disallow freight wagons to be placed in passenger trains, along with other uses.
19 years ago
tron
b57640e28a
(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
6dbc9c9ced
(svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE}
19 years ago
tron
dd180a1e18
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
19 years ago
celestar
f80454d5ce
(svn r4501) -Fix: (FS#129) When, in a train that head multiple engines in front, the _first_ of those engines is sold, all the orders are copied to the second engine (to ensure "seamless" operation). However, during this operation, it was forgotten to update the prev_shared and next_shared pointers of the new head engine AND the next_shared and prev_shared of the share partners.
19 years ago
celestar
cc29d3dcb4
(svn r4479) -Fix (FS#90) electric engines (or rather their pantographs) no longer emit sparks when engine is pulled on convrail (MeusH)
...
P.S. Credit for previous commit goes to the bug reporter, nycom, who submitted the fix as well.
19 years ago
Darkvater
fd8e02119c
(svn r4435) - Fix: an assertion triggered when trying to remove a bridge with the remove-tool (r4348 surfaced this). In CmdRemoveRoad tiletype was not checked for ownership. Intorudce IsLevelCrossingTile() which checks if a tile is a crossing without knowing the type. Suggested by peter1138 and Tron.
19 years ago
tron
a3b8eb37b8
(svn r4412) When a vehicle is in a depot or tunnel it's always flagged as VS_HIDDEN. So after checking for VS_HIDDEN and the result is false there's no need to check if it's flagged as being in a depot or tunnel
19 years ago
tron
35e93e451f
(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
896466db31
(svn r4338) -Fix (FS#105): Bug introduced in r4290. IsLevelCrossing does NOT check the tile type, it assumes the tile type IS MP_STREET
19 years ago
celestar
60fdfa9f0e
(svn r4290) -Fix: fixed power computation for mixed consists on level crossings (michi_cc)
19 years ago
bjarni
9b44cd5dad
(svn r4226) -Fix: [elrails] it's no longer possible to build electric engines in non-electric depots
...
this prevents autoreplace to replace to electric engines before the line in question got catenary
19 years ago
peter1138
77d1dafa4f
(svn r4198) - NewGRF: Rename GetCallBackResult() to GetVehicleCallback(), as other types will exist later, and use separate parameters instead of bitshifting.
19 years ago
celestar
6c44bf5012
(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
Darkvater
c9bf9b7553
(svn r4125) - Feature: Add a general TIC() TOC() mechanism using rdtsc or something similar on non-i386 architectures to performance-tune (critical) code. Some systems are probably missing, but those can be added later.
19 years ago
celestar
9b3b545259
(svn r4113) Moved all relevant map functions for stations to station_map.[ch]
...
Some work with animated tiles remains. Thanks to Tron for parts of the code and lots of proof-reading and suggesting
19 years ago
celestar
db9706cb80
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
19 years ago
tron
f6285a659c
(svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
19 years ago
tron
a90e46bf03
(svn r3981) More work for the rail accessing functions and enums
19 years ago
tron
bf3811122d
(svn r3979) Move GetRailFoundation() to rail_map.h and use it and friends to get information about rail tiles
19 years ago
bjarni
69399cfcb5
(svn r3947) use TOGGLEBIT() instead of manual bit toggling in CmdReverseTrainDirection (pointed out by glx)
19 years ago
bjarni
8f89819460
(svn r3945) cleaned the layout in CmdReverseTrainDirection a bit (made a bit messy in last commit)
19 years ago
bjarni
aa22bfb178
(svn r3944) -Feature: it's now possible to turn a single unit in a train
...
control-click on a unit in a train in a depot will make the click unit turn around
this is useful if you want "normal" engines to act as dualheaded (one each way) or similar
this only works on single unit units. Multiheaded and articulated engines get a red error box
this is based on a quick hack peter1138 while I made it network safe and correctly handling of multible unit engines
19 years ago
tron
7b1c7c31fb
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
19 years ago
tron
6e988259a4
(svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
19 years ago
tron
8505f4ed41
(svn r3851) Rail depots only have an entrance at one side, therefore use UpdateSignalsOnSegment() instead of SetSignalsOnBothDir()
19 years ago
tron
00cf5c9acf
(svn r3832) Replace some magic numbers by (Diag)Direction enums
19 years ago
tron
eeb5bf41a1
(svn r3831) Add and use GetRailDepotDirection()
19 years ago
tron
0100871412
(svn r3830) Move IsTunnelTile() from tile.h to tunnel_map.h and add IsTunnel(), which just checks for a tunnel, but not the tile type as IsTunnelTile() does
19 years ago
tron
7a0071cc53
(svn r3829) Reduce the use of _error_message by directly returning error codes instead of using this global variable
19 years ago
tron
ee03f15f27
(svn r3803) Change the second parameter of UpdateSignalsOnSegment() from Direction to DiagDirection as that's what it really operates on
19 years ago
tron
70f9516015
(svn r3789) Add an enum and function to handle DiagDirection changes
19 years ago
tron
ab9af3b05d
(svn r3787) Use DirToDiagDir() instead of >> 1
19 years ago
tron
fa6632ec32
(svn r3786) More work for DirDiff
19 years ago
tron
9273d0d2b9
(svn r3784) Add a type and functions to handle direction changes
19 years ago
tron
8cfcdaa733
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
19 years ago
tron
af42610321
(svn r3777) Add some functions to handle tunnels
19 years ago
tron
49cb8eb470
(svn r3776) Replace many ints and magic numbers by Direction, DiagDirection and friends
19 years ago
tron
ca0862c3f4
(svn r3758) Remove the news validation callback. It is superseded by r3757.
19 years ago
tron
332b54d5a6
(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
peter1138
ee9f64ecf4
(svn r3602) - Move _railveh_score data to _rail_vehicle_info->ai_rank and remove global variable to return data as we can now access this directly.
19 years ago
tron
5352e9fbcb
(svn r3597) Miscellaneous (I like that word) changes: Fix some indentation, add consts, reduce indentation level by short-circuit logic, convert if cascades to switch, whitespace, bracing, plus some minor stuff
19 years ago
peter1138
f9b4537228
(svn r3588) - Refit: Use only one global to return the refit capacity rather than one per vehicle type.
19 years ago
peter1138
6d855f3a53
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
19 years ago
tron
50fd9c8f73
(svn r3585) Similar changes to the order handlers of the other vehicle types like r3584
19 years ago
peter1138
bc0b97ea2f
(svn r3579) v->u.rail.first_engine holds an engine type, not a vehicle index, so use INVALID_ENGINE.
19 years ago
peter1138
f491fa733b
(svn r3570) - Explicitly update v->first in TrainConsistChanged() if necessary, as this is far faster than brute forcing it later.
19 years ago
tron
087fe86ed2
(svn r3564) Several smaller changes:
...
- Don't treat non-booleans as booleans
- Reduce variable scope
- Bracing
- Use DeMorgan's law to make conditionals easier to read
- if cascade -> switch
- Replace some magic numbers by symbolic names
- Avoid assignments within other statements
19 years ago
peter1138
bb016cdff6
(svn r3557) - NewGRF: move callback enums to a new file as more than just engines will use them
19 years ago
bjarni
c77c99b3c7
(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
peter1138
6c28b1cec7
(svn r3524) - Split newgrf features from engine.[ch] into newgrf_engine.[ch], and add the new files to project files.
19 years ago
tron
1c3e8630fe
(svn r3511) More whitespace ([FS#46] by Rubidium)
19 years ago
tron
9712d6f639
(svn r3510) Fiddle with whitespace and parentheses
19 years ago
bjarni
6f183780c9
(svn r3484) -fix: fixed issue in last commit where loading savegame versions 18 and 19 didn't init the multiheaded engine pointers
19 years ago
Darkvater
4014e36aec
(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
peter1138
575d80442e
(svn r3431) - Fix crash when moving vehicles around in a train depot under certain conditions.
19 years ago
peter1138
21ba849dbd
(svn r3422) - Fix: If an engine reaches the rear of a depot, make the engine turn around before it reaches the tile end (same as a normal end of line.) This fixes a bug whereby the engine could poke into the depot and crash with another engine just leaving it.
19 years ago
bjarni
a4d1725de7
(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
bjarni
2b31f5fe7e
(svn r3402) -Fix: [building/cloning] added a string telling if build failed due to not being able to build a vehicle. Triggered when cloning a retired design
19 years ago
peter1138
9c17d0ec93
(svn r3392) Train depot fixes:
...
- Only count the parts from the source train that will be moved, not the whole train.
- Don't count articulated parts of an engine. This alleviates issues with autoreplacing very long trains.
19 years ago
peter1138
e1f9b72c82
(svn r3388) - NewGRF: Allow train running cost class to differ from engine class. Also fix typo in r3384.
19 years ago
truelight
58acfeacaa
(svn r3381) -Fix: r3374 left one bug: allow moving around wagons in a 100 long train
19 years ago
peter1138
5e68953907
(svn r3378) - NewGRF Fix: Use order status to determine whether a vehicle is loading instead
...
of speed, and get that state from first vehicle in a train consist.
19 years ago
truelight
59bea21c2c
(svn r3374) -Fix: [ FS#36 ] Don't allow trains to get bigger than 100 via drag and drop
19 years ago
truelight
a165a40803
(svn r3373) -Fix: don't link a wagon to itself, which resulted in a wagon disapearing, and a depot which was unable to remove
19 years ago
tron
2053685fb5
(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
318fe153eb
(svn r3365) Staticise 36 functions
19 years ago
tron
ed4b89ee36
(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
901068fd6e
(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
peter1138
c5adf63d77
(svn r3303) Change #if PF_BENCHMARK to #ifdef PF_BENCHMARK
19 years ago
tron
9822b4d755
(svn r3297) Staticise
19 years ago
peter1138
0b48a69e02
(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
bjarni
bc06997bbe
(svn r3219) -Codechange: removed the now obsolite code in the build train command to make half multiheaded engines
19 years ago
bjarni
16e65960b9
(svn r3218) -Feature: Multiheaded train engines will now stay in the same train
...
This means that any user attempt to remove a rear engine will tell the user to move the front engine instead
This fixes the assert when moving multiheaded engines (introduced in r3144)
Note: to make old savegames use this feature, some engines might be turned around in order to link engines in pairs
-Codechange: train subtype is now a bitmask
This allows fast access to info like if it is a wagon or engine and if it is in front and so on
Note: savegame version bump
19 years ago
tron
96dea28eae
(svn r3208) Don't explicitly pass the engine type to look for to GetRearEngine(), because it's the engine type of the vehicle which gets passed as first parameter
19 years ago
tron
d09db07ca1
(svn r3204) Make handling of clicking on vehicles a bit less ugly by avoiding function declarations in .c files and unnecessary indirection
19 years ago
tron
9d0e7b6458
(svn r3181) -Bracing
...
-Indentation
-Whitespace
-DeMorgan's Law
-Test with NULL or 0 for non-booleans
-'\0' instead of 0 for chars
-Remove redundantly redundant comments (like DoFoo(); // Do foo)
-Join multiple short lines with a single statement
-Split single lines with multiple statements
-Avoid assignments in if
19 years ago
tron
6509e42db3
(svn r3179) - RandomRange() and RandomTile() instead of home brewed versions
...
- CHANCE*() instead of mumbling strange numbers
19 years ago
tron
524fd25cbd
(svn r3177) GB, CLRBIT, HASBIT, TOGGLEBIT
19 years ago
tron
b34de09e62
(svn r3176) Use proper types, not some variants of int
19 years ago
tron
81e5b16d71
(svn r3172) static, const
19 years ago
bjarni
1b3e626ff9
(svn r3156) -Fix: removed some cases where autoreplace windows were redrawn when nothing was changed
...
due to the FOR_ALL_VEHICLES(), redrawing those windows are slow
19 years ago
bjarni
df6c48fdba
(svn r3155) -Feature: [autoreplace] autoreplace can now remove cars from too long trains
...
-Trains will now remember the length of stations it visits and sell cars
when being autoreplaced if they became too long
-If it needs to remove cars, then it starts from the front and sells
all it can find until the train is short enough
-This only works for trains, that knows the station length of the route
so a full uninterrupted run is needed
-a train needs 1-2 runs to detect if the shortest station is expanded
-This feature can be turned on and off in the train replace window
and each company can have it's own setting
-NOTE: minor savegame version bump
19 years ago
peter1138
d91a4df8d7
(svn r3150) Unify some code duplication in HandleLocomotiveSmokeCloud()
19 years ago
peter1138
1fecb61566
(svn r3147) Fix crash when building dual-head rail vehicles...
19 years ago
peter1138
b88564b6be
(svn r3146) Avoid use of variable size declared arrays when allocating articulated rail vehicles.
19 years ago
peter1138
3610c0474b
(svn r3145) Fix two off-by-one errors in building articulated rail vehicles.
19 years ago
bjarni
a3c06f20fa
(svn r3144) -Fix: a new train is now made if the front unit is an engine and the former front engine is moved away (Meush)
19 years ago
peter1138
0d9379f904
(svn r3139) -NewGRF, Feature: support for articulated rail vehicles. This is used, for example, by coal tenders.
19 years ago
bjarni
7715deec3d
(svn r3136) -Fix: [autoreplace] all cargo in engines that consists of more than one vehicle will try to move cargo from all vehicles
...
currently this applies to planes and multiheaded train engines (no more lost airmail)
added GetNextEnginePart() that returns the next vehicle in an engine nomatter what type it is
when more types of multivehicle engines are added, they will have to be added here too or autoreplace will not remove all cargo
19 years ago
peter1138
8ece7ab107
(svn r3132) -NewGRF: support positioning of rail vehicle visual effects.
19 years ago
peter1138
44f06c8bf0
(svn r3124) Alter train loading/unloading time to use the actual length of the train instead of the number of wagons. The actual length is cached in the first vehicle of the train.
19 years ago
bjarni
fa5ca040e9
(svn r3111) -Fix: [autoreplace] [ 1341783 ] Assertion failure in vehicle.c line 378
...
running MaybeReplaceVehicle() is now delayed until after the loop in CallVehicleTicks()
This avoids selling the vehicle the loop currently works with (and continues to work with afterwards)
19 years ago