Commit Graph

362 Commits (e08dfce57ccff647a008a30393cb4e16d66e30d0)

Author SHA1 Message Date
KUDr c758f7d812 (svn r6800) -Feature change: [train is lost] message is now generated immediately when pathfinder can't find the path. (thanks MeusH, peter1138 and Brianetta for ideas and help). 18 years ago
peter1138 a01ae2bafe (svn r6782) - Fix (r3947): Invalidate depot & vehicle windows when reversing a single engine with ctrl-click. 18 years ago
peter1138 35b059210d (svn r6765) - Fix: Don't add up running cost of articulated engine parts. 18 years ago
peter1138 fd3fd176e5 (svn r6755) - Fix: Pass the newly created vehicle when checking for articulated engines. As this could result in more parts being added than previously counted, we check to see if we need to allocate more vehicles as we add parts. 18 years ago
bjarni 9cf0fa3238 (svn r6728) -Fix r6651: solved issue where moving rail vehicles in a depot could read from a NULL pointer 18 years ago
bjarni ea075f78e0 (svn r6651) -Coding feature: added the windowevent WE_INVALIDATE_DATA
This gives the ability to invalidate some window data and recalculate as needed instead of doing it for each WE_PAINT

   This event is called right away when using InvalidateWindowData(), so it may be a good idea to set a bool or similar in the window
     or similar and then act on that bool in WE_PAINT instead of doing a lot of stuff in WE_INVALIDATE_DATA as it might be called more than once before WE_PAINT is called

   InvalidateWindowData() will not automatically repaint the window, so if you want to repaint it as well, you need to mark it dirty as well.

   Made the depot windows use WE_INVALIDATE_DATA to set when to generate the engine and wagon lists instead of at each redraw
   It makes no sense to regenerate the list when say using the scrollbar if we know that no vehicle have entered or left the list

   NOTE: currently there is a piece of code to generate the list when it's not needed and compare it to the stored list and assert if they mismatch
    This check is somewhat slow and kills the whole idea of WE_INVALIDATE_DATA, so it's a short lived one to verify that InvalidateWindowData() is used everywhere where it's needed
18 years ago
peter1138 cdfac3d7b7 (svn r6649) - Codechange: Show more correct capacity of articulated wagons in the train purchase list. 18 years ago
bjarni f8f0bd4943 (svn r6637) -Codechange: merged all (vehicle type)EnterDepot into VehicleEnterDepot()
This revealed duplicated code like aircraft lists got invalidated twice
   Moved invalidation of the vehicle detail window to VehicleServiceInDepot() as it should always be updated when serviced
18 years ago
bjarni ea63050d5f (svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
Example: make a train transport iron ore from A to B, then it visits a depot and refits to steel
     It then transport steel back to A or near A if there is a factory and then it visits another depot to refit to iron ore again

   This is controlled in the orders. If a goto depot order is lightlighted, then "Unload" changes to "Refit"
   Control click "Refit" removes the refit part of the order (as the tooltip says)
   The player will still pay the normal refit costs

   Known issues:
      If a vehicle is not in a depot, then the refit window will fail to tell refitted cargo capacity
      Refit costs in the refit window can sometimes print 0 when it should not because the refit calculation is unaware that the vehicle will be refitted in between

   Warning: autoreplace got a protection against replacing something so you get a new cargo type, but it can fail here. In the iron ore/steel example, it can see that
      the vehicle carries iron ore and the new one can be refitted to iron ore, then it will replace. It will not check to see that it's valid for steel as well.
      This is something to look into in the future
18 years ago
peter1138 e383584988 (svn r6618) - After refitting a train, update its cached variables as they may change. 18 years ago
peter1138 653e7fa548 (svn r6532) - Feature: Add support for NewGRF sound effects. Currently sound priority isn't supported. 18 years ago
bjarni 5dbfb5c272 (svn r6524) -Code cleanup r6515: cleaned up the command to start/stop all vehicles in a depot.
IsWholeTrainInDepot() is removed as CheckTrainInDepot() could be used instead
  Cleaned up the check to see if a vehicle is valid for start/stop
18 years ago
glx bae85177d4 (svn r6496) -Codechange: removed direct map access in train_cmd.c (Rubidium) 18 years ago
bjarni 00a08601c9 (svn r6424) -Codechange: [autoreplace] removed a loop though all vehicles from each time the window is redrawn
To do this, the player struct contains an array, that contains the count of each engine type that the player owns
   Those arrays are updated each time a vehicle is build or deleted and is calculated on load (it's not saved)
   It's possible to access the arrays outside of the autoreplace GUI, so feel free to read from them in other patches as well
18 years ago
Darkvater 80814dbb1d (svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts
DiagDirections, and add TileOffsByDir that handles Directions.
-Codechange: Make the treeloop use TileOffsByDir().
18 years ago
glx ec6189081d (svn r6395) -Fix: when converting a depot from/to elrail, update the power of trains that are in it 18 years ago
rubidium 63687763e9 (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
-Cleanup: whitespace alignment of a few tables.
18 years ago
Darkvater b7f36808ac (svn r6378) -Codechange: Rename VLW_FLAGS to VLW_MASK as it is a mask 18 years ago
bjarni 1a0476535d (svn r6376) -Codechange: [vehicle refit] moved all refit cost calculations into GetRefitCost()
Now it's possible to tell refit costs for an EngineID without actually having build a vehicle
18 years ago
bjarni 6baf488839 (svn r6356) -Fix: FS#263 planes come out of hangar and drive back into hangar
Now all vehicles are serviced when it's time for service and they are in a depot
   This will avoid the goto depot order from ever showing up when in a depot
18 years ago
tron 1c21c645ae (svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
DestinationID being a union of these types is just hassle without benefit and cannot be handled correctly everywhere because of local lack of information
18 years ago
bjarni 302772883c (svn r6352) -Fix: FS#322 Send to depot bug
now vehicles can't be sent to a depot when they are already inside a depot
   before they would remember the order and try to turn around when leaving the depot
18 years ago
bjarni 61e2fa3cd2 (svn r6304) -Codechange r6295: Use !! instead of (bool) in commands to send vehicles to depots 18 years ago
bjarni 26c10adbfc (svn r6295) -Feature: using goto depot with a different control selection will now alter the service/stopping in depot flag instead of cancelling the goto depot order 18 years ago
bjarni d7e1d08d53 (svn r6291) -Feature: Vehicle lists from the station window now also got the goto depot button
-Codechange: unified the code for mass goto depot to avoid duplicated code
-Fix: Vehicles already on the way to depots will not be cancelled by mass goto depot (made it really hard to send all vehicles at once)
18 years ago
bjarni 744840c3da (svn r6246) -Feature: added the many times requested "send all vehicle to depot" button
it's located in the vehicle list screen and does the same as in the shared orders window (send all vehicles in list to a depot)
	it will still not inform the player if a vehicle failed to find a depot, so don't take for granted that all of them go
18 years ago
bjarni 15f9208302 (svn r6229) -Feature: Shared order lists now got a "goto depot" button
this will try to send all vehicles in the list to depots/hangars
	currently if one fails to find a depot, it will not tell the player
18 years ago
rubidium 27cee58ab8 (svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc. 18 years ago
rubidium bee83fb3e4 (svn r6195) -Codechange: do not use '//' in '/* ... */' style comments and '/*' or '*/' in '//' style comments. 18 years ago
bjarni 6cbd4cc167 (svn r6165) -Feature: control click Goto Depot will now make the vehicle service
at the depot and leave right away.
 To tell the difference the status of stopping vehicles will be in red,
 while servicing vehicles will be green.
-Codechange: remove some dead code in CmdSendAircraftToHangar() since it is
 conflicting with new functionality. Now p2 means the same for all types
18 years ago
Darkvater 45fa300208 (svn r6159) -Fix: FindClosestTrainDepot hardly ever found a depot with NPF off due to absence of distance-normalization (Rojer) 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 1331b4aa9a (svn r6052) -Codechange: change OrderType (order->type) in a typedef
-Codechange: renamed DeleteDestinationFromVehicleOrder to RemoveOrderFromAllVehicles to reflect his function better
-Codechange: changed the params of RemoveOrderFromAllVehicles, to avoid unneeded variable-creation
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 893d4ba9d4 (svn r6002) -Cleanup: remove the now redundant BASE_YEAR constant. 18 years ago
rubidium 3cab5f30c0 (svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
-Codechange: store all year related variables that are _not_ stored in a savegame/transported over the network in the same format as _cur_year
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
bjarni de4a96fd7a (svn r5854) -Fix: [elrails] now electric engines are stopped if they enter a non-electrified depot even if they would have left right away if the depot had catenary
this solves the issue where electric engines in a certain situation could leave non-electrified depots, turn around and enter all the time
18 years ago
bjarni 466452c351 (svn r5853) -Fix: [elrails] FS#178 Electric Trains can leave Conventional Depot
now the user will get an error if he tries to start the train and the status bar will say "no power" instead of "stopped"
	Electric trains already driving in and out of non-electrified depots will still do so, but you can't start new ones
18 years ago
peter1138 08ae2cf6e5 (svn r5822) - NewGRF: add support for callback 31, vehicle start/stop check. This allows a set to disallow a vehicle from being started, i.e. to not be able to leave the depot. This is almost a partner to callback 1D. 18 years ago
peter1138 42bcee22bd (svn r5819) - NewGRF: add support for refit costs specified in NewGRF. This may affect the default refit costs for the default rail vehicles. 18 years ago
Darkvater f0951cf82f (svn r5665) - Codechange: check pointers against NULL, coding style, tabulation; nothing serious. 18 years ago
bjarni 6224c7485c (svn r5664) -Fix: [SF 1518090 ] moving train engines in depot - crash (svn r5463)
this was present long before 5463
	Darkvater deserves some of the credit for this fix since he discovered where the first pointer got set incorrectly
18 years ago
tron 2bb9fd3901 (svn r5624) Use {IsPlainRailTile,IsRailDepot,IsRailWaypoint,HasSignals}() instead of GetRailTile{T,Subt}ype() - this is more concise and a bit more flexible if/when the rail tile encoding changes 18 years ago
peter1138 2e0498dce0 (svn r5427) - Codechange: testing for "== true" is redundant. 18 years ago
peter1138 02bde34b2b (svn r5240) - NewGRF: when there is more than one engine in a consist, base livery overrides and powered wagon weight/power on the last engine before the wagon. 18 years ago
peter1138 d6ebfb8338 (svn r5187) - NewGRF: temporarily change a vehicle's cargo subtype when calling the refit capacity callback. 18 years ago
bjarni ffeb87763f (svn r5176) fixing the typo, that should have been fixed in last commit 18 years ago
bjarni bbe4285a03 (svn r5175) -Fix: [autoreplace] FS#186 autoreplaced trains can leave all wagons in depot
also fixed a serious typo in peter1138's comments
18 years ago