summaryrefslogtreecommitdiff
path: root/vehicle.c
AgeCommit message (Collapse)Author
2006-01-18(svn r3403) -Codechange: [multiheaded engines] the references between the ↵bjarni
front and rear engines are no longer saved instead the pointers are generated on load
2006-01-12(svn r3396) - Autoreplace changes:peter1138
- 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)
2006-01-08(svn r3390) -Fix: [autoreplace] fixed issue where autoreplace failed to ↵bjarni
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
2006-01-05(svn r3367) Unify the 4 distinct ↵tron
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
2006-01-05(svn r3365) Staticise 36 functionstron
2006-01-04(svn r3362) Fix issue with loading old (TTD) savegames:peter1138
- move call to convert from old to new train subtypes. - ensure AI is started for AI players.
2006-01-04(svn r3361) - Clone Vehicle: Disallow cloning of crashed rail vehicles after ↵peter1138
starting removal process.
2005-12-29(svn r3353) Simplify the automatic length adjustment algorithm for replacing ↵tron
trains: Use the length of the train before the replacement as reference length
2005-12-28(svn r3352) - NewGRF: Move initialization of vehicle random_bits to DC_EXEC ↵peter1138
blocks to allow use of Random() instead of InteractiveRandom(), which will alleviate some possible network desyncs.
2005-12-24(svn r3339) Remove unnecessary includestron
2005-12-14(svn r3298) Remove unused and write-only variablestron
2005-12-14(svn r3297) Staticisetron
2005-12-05(svn r3261) - Autoreplace: If a replaced vehicle had a custom name, transfer ↵peter1138
it to the new vehicle. Fixes "[ 1370039 ] Autoreplaced vehicles lose their names"
2005-11-29(svn r3248) - Codechange: Change interface of CanRefitTo() to supply the ↵peter1138
engine type directly instead of getting it from a vehicle. This allows the function to be used before vehicles are involved.
2005-11-26(svn r3239) - Codechange: Introduce and use helper functions for engine ↵peter1138
replacement code.
2005-11-22(svn r3227) -Codechange: [Savegame] removed 'minor' version, and renamed ↵truelight
'major' version to just: version.
2005-11-19(svn r3223) -Fix: [autoreplace] fixed crash when replacing a train engine ↵bjarni
without any cars (introduced in r3220)
2005-11-19(svn r3220) -Fix: [autoreplace] Autoreplaced trains now replace their cargo ↵bjarni
to the train instead of just the new engine This applies to wagon removal during autoreplace too
2005-11-19(svn r3219) -Codechange: removed the now obsolite code in the build train ↵bjarni
command to make half multiheaded engines
2005-11-18(svn r3218) -Feature: Multiheaded train engines will now stay in the same trainbjarni
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
2005-11-16(svn r3208) Don't explicitly pass the engine type to look for to ↵tron
GetRearEngine(), because it's the engine type of the vehicle which gets passed as first parameter
2005-11-16(svn r3193) Staticise the vehicle position hashtron
2005-11-14(svn r3181) -Bracingtron
-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
2005-11-14(svn r3177) GB, CLRBIT, HASBIT, TOGGLEBITtron
2005-11-13(svn r3173) Use the trinary operator and switch to improve readabilitytron
Also align short cases nicely
2005-11-13(svn r3172) static, consttron
2005-11-07(svn r3155) -Feature: [autoreplace] autoreplace can now remove cars from too ↵bjarni
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
2005-11-06(svn r3148) -NewGRF, Feature: Add support for cargo refitting specification ↵peter1138
by cargo classes.
2005-11-05(svn r3143) -Codechange: greatly increased speed when allocating vehiclesbjarni
This increases the speed greatly when allocating more than one at a time (planes, artic engines, cloning...) and when adding another block of vehicles to the vehicle pool (adding 512 vehicles each time)
2005-11-05(svn r3139) -NewGRF, Feature: support for articulated rail vehicles. This is ↵peter1138
used, for example, by coal tenders.
2005-11-05(svn r3138) -Fix: [clone vehicles] fixed assert when it was possible to ↵bjarni
allocate some vehicles to clone a train, but not for all cars Now it gives "too many vehicles" error message instead To make this work, AllocateVehicles() needed to be moved to vehicle.c (from aircraft_cmd.c) and made non-static
2005-11-04(svn r3137) -Fix: [autoreplace] fixed assert that was triggerable when a ↵bjarni
vehicle entered a depot even though the goto depot was canceled this assert could be reached by clicking on the goto depot button to cancel goto depot from the orders and the vehicle still entered the depot. The flags in that case would not be "normal" anymore. An additional check is added to prevent this
2005-11-04(svn r3136) -Fix: [autoreplace] all cargo in engines that consists of more ↵bjarni
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
2005-11-03(svn r3129) -Fix: [autoreplace] fixed bug that made the player pay twice for ↵bjarni
autoreplacing and could end up with negative money this is not the same bug as in rev 3128, which means you actually paid 3 times. Now it pays correctly
2005-11-03(svn r3128) -Fix: [autoreplace] fixed bug that made the player pay twice for ↵bjarni
autoreplacing and could end up with negative money
2005-11-03(svn r3127) -Fix: [autoreplace] fixed a condition where a vehicle could fail ↵bjarni
to stop when autoreplacing this would result in the construction of a new vehicle while the old one just continued added an assert to make sure it's always stopped before trying to sell the old vehicle
2005-11-01(svn r3116) -Fix: [autoreplace] fixed issue where autorenewing/autoreplacing ↵bjarni
a plane could lock up an airport this will not fix already locked up airports this bug was introduced in rev 3111
2005-10-31(svn r3112) -Feature: [autoreplace] profit counters are now remembered too ↵bjarni
(request by Darkvater)
2005-10-31(svn r3111) -Fix: [autoreplace] [ 1341783 ] Assertion failure in vehicle.c ↵bjarni
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)
2005-10-29(svn r3101) -Codechange: added _new_vehicle_idbjarni
this var works like _new_train_id and the rest of that kind of vars, except it is set each time a vehicle is build, nomatter what type this is a nice tool to code vehicle independent code, which in turn can reduce code duplication Right now it's used in ReplaceVehicle() and CmdCloneVehicle()
2005-10-29(svn r3100) -Codechange [Clone vehicles] Major change to clone vehiclesbjarni
removed duplicated code and added DoCommand, which used the define build commands added with autoreplace This should not affect gameplay at all
2005-10-27(svn r3093) -Fix: [autoreplace] fixed issue where the money limit message ↵bjarni
showed up in some cases when no replace was needed
2005-10-24(svn r3081) -Codechange: [autoreplace] complete rewrite of autoreplacebjarni
this is a complete rewrite, that makes use of existing commands like build and sell this means that multiheaded train engines are replaced correctly
2005-10-23(svn r3078) Some more stuff, which piled up:tron
- const, whitespace, indentation, bracing, GB/SB, pointless casts - use the trinary operator where appropriate - data types (uint[] -> AcceptedCargo, ...) - if cascade -> switch - if (ptr) -> if (ptr != NULL) - DeMorgan's Law - Fix some comments - 0 -> '\0', change magic numbers to symbolic constants
2005-10-07(svn r3024) -Codechange: Another batch of replacements of ↵tron
int/uint/int16/byte/-1 with proper types and constants
2005-09-28(svn r2995) Replace 0xFF/0xFFFF with ↵tron
CT_INVALID/OWNER_SPECTATOR/INVALID_STATION where appropriate
2005-09-27(svn r2993) Fix: Reset aircraft images differently. Fixes assertion ↵peter1138
introduced in r2991.
2005-09-26(svn r2991) Reset vehicle images on game load. Allows savegames with NewGRFs ↵peter1138
saved prior to r2868 to load.
2005-09-18(svn r2962) - const correctness for all Get* functions and most Draw* ↵Darkvater
functions that don't change their pointer parameters - change a lot of byte player types to PlayerID - beautify header files, same "#endif /* filename */" ending
2005-09-14(svn r2951) - Fix: [ 1259345 ] Changing engine in netgame opens train window ↵Darkvater
for everyone - Add IsLocalPlayer() which substitutes _local_player == _current_player