Commit Graph

216 Commits

Author SHA1 Message Date
bjarni 7cdf6d1cbe (svn r11045) -Codechange: added a function to tell if a vehicle is the rear part of a dualheaded train engine 2007-09-05 10:15:23 +00:00
rubidium 2c8e50f20c (svn r11017) -Codechange: unify determining whether a vehicle needs/can be service a little more. 2007-08-31 17:13:39 +00:00
rubidium aba867d78d (svn r11011) -Fix [FS#1129]: GetFirstVehicleInChain did change the game state while being marked const.
-Codechange: do not brute force determine the first vehicle in the chain or previous vehicle, but do it by properly accounting the previous and first pointers when updating the next pointer. This gives a performance increase of about 15% when there are a lot of vehicles in the game.
2007-08-30 21:11:12 +00:00
rubidium 9b65bc430c (svn r11004) -Codechange: some reworks of the saveload mechanism to be able to save and load private and protected variables in the vehicle struct. 2007-08-30 13:09:44 +00:00
rubidium cb7eaff353 (svn r11003) -Codechange: replace Vehicle->next to Vehicle->Next() and Vehicle->SetNext() so we can trap instances that change a next pointer and (in the future) update the first/previous pointers based on that. 2007-08-30 13:03:56 +00:00
rubidium 3f3b013b99 (svn r10999) -Codechange: unify the way the running cost of a vehicle is determined. Patch by nycom. 2007-08-29 21:27:16 +00:00
rubidium 5d628e6135 (svn r10997) -Codechange: unify the vehicle view window. Patch by PhilSophus. 2007-08-29 20:50:58 +00:00
rubidium a5b32d8d72 (svn r10984) -Codechange: unify the way one can get the current speed in the same forwat so we can display it. 2007-08-26 20:43:22 +00:00
rubidium a83ccad6bd (svn r10983) -Codechange: use vehstatus & VS_CRASHED instead of some other "methods" custom to each vehicle to determine whether the vehicle is crashed. 2007-08-26 20:16:02 +00:00
bjarni a973c893fb (svn r10823) -Fix r8610 [FS#1097]: the autoreplace window vehicle count didn't always update correctly) (Matthias) 2007-08-07 23:07:10 +00:00
rubidium 836105864c (svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
-Codechange: do not force "special" vehicles to be allocated in the low 1024 vehicle slots and non "special" vehicles in the rest of the slots.
2007-08-03 19:36:00 +00:00
peter1138 92061aba4e (svn r10734) -Fix [FS#1030]: Revert r10513) and add special cases for collision detection on bridges/tunnels. 2007-07-30 08:49:41 +00:00
rubidium 5bd241eb5b (svn r10697) -Codechange: give a more sensible names to some of the unkX variables. 2007-07-26 15:37:19 +00:00
rubidium efc7fdf2fd (svn r10587) -Codechange: move the string/dparam related stuff from variables.h to strings.h 2007-07-16 09:16:58 +00:00
rubidium b876be0064 (svn r10493) -Codechange: update some callback ID enums to reflect their changed usage, add a few and update the comments. 2007-07-09 19:38:12 +00:00
rubidium 7ba2e75f3e (svn r10474) -Fix [FS#995]: wrong group count after train crash. 2007-07-08 09:29:28 +00:00
rubidium 90f85c957a (svn r10409) -Codechange: replace (Aircraft|RoadVeh|Ship|Train)_Tick with a Tick method in the Vehicle class. 2007-07-01 19:24:54 +00:00
rubidium 83a880c882 (svn r10408) -Codechange: make GetImage a class method of Vehicle instead of Get(Aircraft|RoadVeh|Ship|Train)Image. 2007-07-01 19:11:47 +00:00
rubidium 3a82c1e9ea (svn r10381) -Fix [FS#951]: skipping an order made train reverse immediatelly. Patch by boekabart. 2007-06-28 22:03:34 +00:00
peter1138 de357c74c1 (svn r10363) -Fix [FS#911]: invalidating autoreplace windows didn't take account of vehicle group (Matthias Wolf) 2007-06-27 20:40:20 +00:00
peter1138 a6da8c9519 (svn r10344) -Fix (r10317): confusion between TRACK_n and TRACK_BIT_n stopped NW/SE slopes being picked up, and compare middle of tile against current z, not previous. 2007-06-26 20:03:17 +00:00
maedhros fb284a9264 (svn r10335) -Fix (r10331): Increment the current order index *after* using it in UpdateVehicleTimetable. 2007-06-25 23:14:13 +00:00
rubidium 9c0ccadbe0 (svn r10317) -Fix [FS#786]: acceleration not calculated properly when a train goes up a hill between tunnels. 2007-06-25 08:24:03 +00:00
truelight 34723257f0 (svn r10288) -Fix [FS#202]: also age engines that aren't front-engines (based on a patch by kaan) 2007-06-22 22:42:18 +00:00
rubidium 117368a5a9 (svn r10287) -Fix (r10266): some surprises from that (almost always) complaining compiler... 2007-06-22 22:28:15 +00:00
rubidium e5c352818d (svn r10266) -Codechange: keep track of the origin, time of travel and accumulated feeder share (transfers) of individual pieces of cargo. This means that cargo isn't thrown on a big pile when it's put in a station or unloaded at a station, however the GUI does not reflect these changes yet so you will not actually see it. 2007-06-22 11:58:59 +00:00
rubidium 9c0944aa09 (svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
-Fix: some displays of money were wrong.
2007-06-21 17:25:17 +00:00
rubidium eb1472a82d (svn r10247) -Fix (r10210): *always* call SetDParamMoney when you want to place money in some string. 2007-06-21 14:54:51 +00:00
rubidium f806b46cc9 (svn r10246) -Fix (r10297): some forgotten money conversions and truncation issues. Thanks to benc for providing the patch. 2007-06-21 14:32:27 +00:00
maedhros cf0118ee63 (svn r10236) -Feature: Introduce a form of timetabling for vehicles. 2007-06-20 19:17:22 +00:00
peter1138 e7191fc57a (svn r10222) -Fix [FS#892]: Only 2 trains could crash at one time as collision checking stopped on the first hit. This could cause desyncs in network games as the collision hash order is not guaranteed. (patch by B. N. Smatz) 2007-06-19 16:40:59 +00:00
rubidium 2ee73b50b8 (svn r10208) -Codechange: replace int32 with Money where appropriate. 2007-06-18 21:44:47 +00:00
rubidium 49220cc6f1 (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified. 2007-06-18 19:53:50 +00:00
rubidium 966e2738b9 (svn r10197) -Codechange: replace int32 with CommandCost where appropriate. 2007-06-18 10:48:15 +00:00
peter1138 94bd08fc17 (svn r10177) -Fix: Passengers has one A and two Es (ln) 2007-06-17 10:47:30 +00:00
peter1138 78d797a6b7 (svn r10111) -Codechange: Add new vehicle hash table for collision detection and finding vehicles on a tile. The hash area scanned is far smaller than the old hash table, which is now used for viewport updates only. This should give a significant performance improvement for games with many vehicles. (Based on work by 'B. N. SmatZ!' and 'madman2003') 2007-06-12 11:22:32 +00:00
maedhros 3e326085fa (svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
road vehicles for those who prefer the technical explanation.
2007-06-11 14:00:16 +00:00
peter1138 43482d22d0 (svn r10028) -Fix (r2270/r2951): When deleting the first engine of a train with multiple engines, only reopen the train window if the player had the original train window open. This fixes 'random' windows opening for multiple players of the same company. 2007-06-02 20:08:23 +00:00
bjarni e129438139 (svn r10026) -Fix: unlinking a rail vehicle didn't clear the first pointer
After r9973, this could cause some asserts as some vehicles could end up with first pointers to chains they didn't belong to
2007-06-02 17:23:31 +00:00
maedhros 229e311cb9 (svn r10023) -Fix (r3218): When selling trains, if there were no wagons between multiheaded
engines the rear part could be checked despite having already been deleted,
triggering an assert.
2007-06-02 14:42:25 +00:00
maedhros 1e7b8190f2 (svn r10022) -Fix (r10007): Set the type of multiheaded trains before the subtype. 2007-06-02 11:15:38 +00:00
maedhros ab8503f5a5 (svn r10008) -Codechange: Move a couple of functions related to articulated vehicles to a file of their own. 2007-06-01 11:41:02 +00:00
maedhros dce1101039 (svn r10007) -Codechange: Add some asserts to IsFrontEngine and friends to ensure that only trains use them. 2007-06-01 11:17:30 +00:00
rubidium bc41dc4966 (svn r9987) -Fix [FS#818]: a train under a bridge could collide with a train on the bridge. 2007-05-30 13:27:56 +00:00
bjarni 77f5c1e25e (svn r9973) -Cleanup: removed some code that kept both ends of a dualheaded engine in the same train (when moving wagons in a depot)
NormaliseTrainConsist() is called later in the same command and it will take care of this issue
2007-05-29 10:35:52 +00:00
bjarni a6bea527a3 (svn r9967) -Fix (r9938): autoreplace would in certain conditions move dualheaded engines in a train (usually to the rear)
-Change: moving an engine in between the two ends of a dualheaded engine will now move the rear dualheaded engine to the front of the newly added engine (instead of moving the new engine to the rear of the rear dualheaded engine)
   This can make a difference if there are wagons in the train
2007-05-28 21:40:40 +00:00
rubidium 440d723d84 (svn r9914) -Codechange: prepare GTTS and the pathfinders to handle multiple road types on a single tile. 2007-05-24 22:41:50 +00:00
peter1138 60a2c5280e (svn r9875) -Fix (r9828): Only set carriage capacity if the wagon has not been refitted. 2007-05-19 10:29:51 +00:00
rubidium 7d4be11516 (svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13. 2007-05-19 09:40:18 +00:00
peter1138 1d5135830a (svn r9828) -Codechange: [NewGRF] Add support for changing cargo capacity with callback 36. This is set on construction for ships and roadvehicles, and whenever carriages are attached for trains. 2007-05-12 07:05:34 +00:00
peter1138 dc2073b96e (svn r9818) -Codechange: Cache wagon override sprite set whenever consist is changed, instead of 'recalculating' it every time it is used or just tested. 2007-05-10 06:42:43 +00:00
rubidium 2efecd34c4 (svn r9808) -Codechange: unify the Handle<VehicleType>Loading functions. 2007-05-07 16:21:34 +00:00
rubidium 161786e222 (svn r9807) -Codechange: unify playing of sound when vehicle has been loaded and leaves the station. 2007-05-07 15:58:05 +00:00
peter1138 4591fb5b0d (svn r9806) -Codechange: [NewGRF] Add callback 36 support for purchase cost, for all vehicle types. 2007-05-07 13:26:10 +00:00
rubidium feadd86819 (svn r9802) -Fix: a vehicle without visual effects isn't per definition unpowered (mart3p). 2007-05-06 20:00:36 +00:00
rubidium 411985b13a (svn r9801) -Fix: do not assume that trains running on monorail/maglev cannot smoke/spark (mart3p). 2007-05-06 19:58:34 +00:00
rubidium 208e40a839 (svn r9800) -Codechange: play sound effects based on the engine class, not the rail type (mart3p). 2007-05-06 19:51:25 +00:00
rubidium abbaa1691e (svn r9794) -Codechange: refactor the question whether a vehicle can be loaded into LoadUnloadVehicle instead of duplicating it for each vehicle. 2007-05-06 14:59:01 +00:00
rubidium b76cc8c96b (svn r9784) -Codechange: remove unused variable. 2007-05-04 22:38:36 +00:00
peter1138 e81906c62d (svn r9780) -Codechange: [NewGRF] Add support for variable vehicle weight for trains (callback 36, property 16) 2007-05-04 19:24:01 +00:00
rubidium 981bf52bdd (svn r9770) -Codechange: perform the payment of cargo when loading/unloading, but when arriving at the station. 2007-05-02 18:29:11 +00:00
rubidium a4e045a3fb (svn r9760) -Codechange: remove the need for saving some vehicle variables. 2007-05-01 16:35:14 +00:00
rubidium cbd9a1bf0d (svn r9756) -Fix [FS#755]: LeaveStation wasn't always called when a station was left. 2007-04-29 22:51:12 +00:00
rubidium ec9ac99d01 (svn r9755) -Codechange: refactor some more of the begin loading stuff. 2007-04-29 22:33:51 +00:00
rubidium 202009522c (svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches. 2007-04-29 21:24:08 +00:00
rubidium 6440440f12 (svn r9752) -Codechange: remove some duplication related to BeginLoading. 2007-04-29 18:21:24 +00:00
maedhros 02e770ff2c (svn r9742) -Fix (r9689) [FS#739]: Fix cloning with refit costs again, hopefully for good this time. 2007-04-29 08:43:00 +00:00
maedhros 034f3591cf (svn r9685) -Fix (r9683): Call v->LeaveStation() when a vehicle in a station is sent to a depot. 2007-04-20 11:39:01 +00:00
rubidium 80c259f64f (svn r9672) -Cleanup: lots of coding style fixes around operands. 2007-04-18 22:10:36 +00:00
peter1138 41cf2fa69b (svn r9671) -Codechange: Implement NewGRF callback 36, which allows changing of various properties which were previously static. Vehicle max speed and train power/te/running costs are adjustable. 2007-04-18 18:37:40 +00:00
belugas d6651c1741 (svn r9665) -Documentation: Doxygen corrections,errors, corrections of corrections... 2007-04-18 00:41:09 +00:00
maedhros ccaaa7d33a (svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist. 2007-04-12 13:07:15 +00:00
belugas f81217bcf4 (svn r9558) -Documentation: doxygen and comment changes: 'T' now. Almost done 2007-04-04 03:21:14 +00:00
maedhros eae03e0f72 (svn r9543) -Fix [FS#691]: Split up STR_ENGINE_NOT_BUILDABLE into four strings so it can be
translated properly and remove "buildable", since it isn't actually a word.
2007-04-02 11:35:08 +00:00
belugas 06d3669bb5 (svn r9400) -Codechange: Use some more representative enum names for landscape types. 2007-03-22 03:42:43 +00:00
peter1138 457930c483 (svn r9322) -Codechange: Use cargo class to count crash/flood victims 2007-03-19 12:40:51 +00:00
rubidium 84d9f832c3 (svn r9277) -Fix [FS#685]: shared orders got messed up when the 'first' trains got removed in the depot. 2007-03-18 15:32:42 +00:00
peter1138 92486ac980 (svn r9259) -Codechange: NUM_CARGO isn't a valid cargo type... 2007-03-16 21:42:11 +00:00
KUDr c7bcdb69b1 (svn r9146) -Fix [NTP][FS#676](r6800): "Train is lost" message is generated incorrectly. Forgot to set the best bird distance to zero in case we found the destination to indicate success. (de_zeurkous) 2007-03-13 21:04:22 +00:00
bjarni c2b7d0192d (svn r9072) -Codechange: [Orders] added methods to orders to free them and check if they are in use 2007-03-08 21:39:34 +00:00
rubidium ce919e8c71 (svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code). 2007-03-08 16:27:54 +00:00
rubidium 24c4d5b06d (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {}; 2007-03-07 12:11:48 +00:00
rubidium 36bb92ae24 (svn r9050) -Codechange: Foo(void) -> Foo() 2007-03-07 11:47:46 +00:00
maedhros 469fbc912c (svn r8946) -Feature: [NewGRF] Add support for vehicle variables 0xFE and 0xFF bit 10,
which is set when a vehicle was built during the exclusive testing phase.
2007-02-28 17:59:05 +00:00
maedhros aadd8a4b44 (svn r8945) -Codechange: Rename v->load_status to v->vehicle_flags so it can be used for more than just the gradual loading status. 2007-02-28 17:18:36 +00:00
rubidium 4908115355 (svn r8935) -Codechange: unification of track type between road and rail tiles, unification of ground type between normal rail tiles and depots/waypoints and removing the need for RailTileSubType. 2007-02-27 23:36:28 +00:00
tron 311af1a956 (svn r8900) -Fix
Get rid of DECLARE_ENUM_AS_BIT_INDEX(Track, TrackBits)
2007-02-25 11:49:43 +00:00
tron 3ce4baa9fc (svn r8899) -Fix
Remove the unused second parameter from GetTileRailType()
2007-02-25 11:36:19 +00:00
tron 1ce43c1a37 (svn r8897) -Fix
Change the signature of GetNewVehiclePos():
-void GetNewVehiclePos(const Vehicle *v, GetNewVehiclePosResult *gp);
+GetNewVehiclePosResult GetNewVehiclePos(const Vehicle *v);
2007-02-25 10:49:13 +00:00
tron 696b895b77 (svn r8896) -Fix
Most (i.e. 13 of 15) callers of GetNewVehiclePos() do not care for the return and the others can figure it out by inspecting the information returned in struct GetNewVehiclePosResult.
Therefore remove the return value.
2007-02-25 10:25:25 +00:00
tron 1864d28cb8 (svn r8894) -Fix
Slightly simplify the control flow of TrainController()
2007-02-25 09:47:46 +00:00
tron e949a956bd (svn r8893) -Fix
variable scope, const, misc.
2007-02-25 09:27:03 +00:00
tron 12b1804d4e (svn r8884) -Fix
Replace SetSpeedLimitOnBridge() by something simpler
2007-02-24 18:44:30 +00:00
tron caa129958d (svn r8878) -Fix
-Fix: Do a better job when checking the parameters of CmdMoveRailVehicle()
NOTE: 0.5 candidate
2007-02-24 14:36:14 +00:00
peter1138 89613b6cc4 (svn r8850) -Codechange: Use the cargo type's is_freight flag instead of checking the cargo type to determine if the cargo type is freight cargo type cargo type. 2007-02-22 22:53:49 +00:00
peter1138 ef2daa5060 (svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels. 2007-02-20 22:09:21 +00:00
celestar d9385f2798 (svn r8709) -Fix/Codechange: Rename the function GetStationPlatforms into GetPlatformLength because that is what it really does. Overload it because there is already a GetPlatformLength (one gives the length of the whole platform, the other gives the remaining length in a given direction). Turned both functions into methods of Station. While messing around with it, fix a problem where loading times for overhanging trains are miscomputed. 2007-02-13 16:36:38 +00:00
rubidium d1d1d170f3 (svn r8703) -Codechange/cleanup: some magic numbers -> enums and other small coding style changes to the ShipController and TrainController. 2007-02-13 11:29:20 +00:00
rubidium 4ec7eb2201 (svn r8701) -Codechange: replace magic numbers with enums for u.rail.track. 2007-02-13 10:46:45 +00:00
rubidium af3001b988 (svn r8700) -Fix (8698): replaced a magic number with the wrong enum :( 2007-02-13 10:43:50 +00:00
rubidium a419f4aeda (svn r8698) -Codechange: enumify the returns of VehicleEnterTile 2007-02-13 10:26:53 +00:00
bjarni 80125fd934 (svn r8610) -Codechange/Feature: rewrote the list handling in the autoreplace window
-The user will notice the following changes:
      All vehicle types behaves in the same way
      Adding/removing an engine (new design and so on) can no longer result in the window selecting a new engine
      All valid replacements will be displayed since it looks at refitting options as well (this solves the missing ships with the newships GRF)
      Since you can't replace an engine into itself, the engine selected in the left list will no longer appear in the right list

   -The code changes:
      Instead of looping all engines all the time, each list generates a list like the build windows
        This ensures consistent list generation since only one function can loop all engines
      Unified code for all vehicle types
      It now use the lists to call the drawing code in the build vehicle window
      Works on selected EngineIDs instead of selected index in the list
2007-02-06 11:11:12 +00:00
tron c326ff3795 (svn r8550) -Fix
Building a vehicle does not involve allocating orders, so do not check whether orders could be allocated
2007-02-03 09:05:43 +00:00
belugas 0c45071bb0 (svn r8455) -Codechange: Give a more meaningful name (railveh_type)to member flags of RailVehInfo, as well as changing the code to reflect the fact that it was not a flag but rather a one value only variable. Doing so, some evaluations have been simplified.
-Codechange: Add and use RAILVEH_SINGLEHEAD when railveh_type is set to 0, which was implicit before.
-Cleanup: Remove some extraneous parenthesis.
2007-01-30 11:53:35 +00:00
peter1138 60ddc05925 (svn r8434) -Fix (r8430): Missing braces caused compilation failure for some (most?) compilers... 2007-01-27 22:28:28 +00:00
tron 430e64c848 (svn r8430) -Fix
Replace the rather obscure control flow for handling aircraft/ship/train orders by something remotly comprehensible (see r3584)
2007-01-27 16:45:16 +00:00
tron 18effde565 (svn r8393) -Fix
-Codechange: CheckCompatibleRail() is only called for tiles which are known to contain a piece of rail. Simplify the function accordingly by eliminating unnecessary checks.
-Fix (?): Also fix an inconsistency in deciding what a compatible rail type is between level crossings and other rail tiles. It is unknown if this caused any problems.
2007-01-24 18:03:36 +00:00
tron 0996de79df (svn r8385) -Fix
-Regression (r8314): I only did half the necessary changes to move railtype from Engine to RailVehicleInfo. Now do the rest.
2007-01-24 07:14:09 +00:00
tron fb8b0557f9 (svn r8320) -Fix
Simplify TrainPowerChanged() somewhat by eleminating code duplication
2007-01-21 18:46:19 +00:00
tron b2def96248 (svn r8276) -Fix
Change the signature of Swap() to be less error prone, i.e. pass the variables to be swapped by reference instead of passing pointers to the variables.
Just do Swap(x, y) instead of Swap(&x, &y). This prevents accidents when the variables are pointers.
2007-01-19 11:47:48 +00:00
peter1138 92d418b031 (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
This lets us increase the sprite width from 14 to up to 29 bits, 
effectively nulling the old sprite limit. Table changes in next commit.
2007-01-14 19:57:49 +00:00
KUDr 9bfb3f08d9 (svn r8110) -Codechange: direct Vehicle::current_order.type changes (to OT_LOADING and OT_LEAVESTATION) replaced by v->BeginLoading() and v->LeaveStation() calls. This should allow easy hooking of those state transitions in order to maintain vehicle loading queue. 2007-01-13 18:55:54 +00:00
celestar 1691b2da61 (svn r8056) -Codechange: Remove swap_byte, swap_byte, and siblings (some were not used anyway) and replace them by our SwapT implementation 2007-01-11 12:32:10 +00:00
celestar 2ac0410767 (svn r8055) -Codechange: Replace the different max, dmax, maxu whatever macros by a simple template function max(), that requires two arguments of the same type. While I'm at it change a variable called "max" to "maxval" in a function that calls max(). 2007-01-11 11:05:01 +00:00
rubidium f35ed4bbc2 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b. 2007-01-10 18:56:51 +00:00
KUDr e373ea7096 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp) 2007-01-10 18:12:09 +00:00
Renamed from src/train_cmd.c (Browse further)