Commit Graph

212 Commits

Author SHA1 Message Date
bjarni
1f02a49721 (svn r7389) -Fix: when forcing a vehicle to go to a depot, clear refit orders from current orders (caused refit error popup when not having no orders) 2006-12-05 23:57:04 +00:00
bjarni
666abc0e15 (svn r7386) -Codechange r7385: moved deletion of the vehicle highlight from DeleteVehicle to the sell commands as they are not called as often
Also added a return to the window loop prevent looking at the rest of the windows once the right depot window is found
2006-12-05 22:59:42 +00:00
peter1138
00e9e3e9e6 (svn r7330) -Fix (r7304): Data invalidation doesn't always happen as the local
player, resulting in an empty vehicle purchase list. Specify the player 
as an argument to IsEngineBuildable()
2006-12-03 15:48:21 +00:00
peter1138
acac44820b (svn r7326) -Feature: Add support for gradual (un)loading of vehicles (Maedhros) 2006-12-02 16:56:32 +00:00
Darkvater
fc1a90b663 (svn r7313) -Codechange: Calling invalidate data on a window will surely warrant a redraw, so call
that after the WE_INVALIDATE_DATA event and remove (some of) the superflouous calls.
2006-12-01 00:09:13 +00:00
peter1138
cd6f86c4bf (svn r7032) - Fix (r1704): Sprite index wasn't updated with correct image number if
custom image lookup fails.
2006-11-01 22:27:16 +00:00
tron
a8809d7de8 (svn r6994) -Regression (r6291): When sending an aircrafts to a hangar the wrong bit gets tested to determine if a aircraft should stop there or just get serviced
Also remove a stale comment
Both spotted and fixed by Mart3p
2006-10-28 14:37:33 +00:00
Darkvater
68c0320be6 (svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
IS_INTERACTIVE_PLAYER
2006-10-14 15:15:56 +00:00
Darkvater
8044c4aff7 (svn r6769) -Codechange: Minor syntax, const correctness, variable localization, coding
style changes to airport code, and cleanup of airport.c. Should not change
 any functionality.
2006-10-14 09:51:04 +00:00
Darkvater
4765127db8 (svn r6768) -Cleanup: For airports change *Airport to *apc (variable naming coding style
conformance (AirportFTAClass), *FA to *apFA (to better reflect its type 
 AirportFTAbuildup), and ->next_in_chain into ->next.
2006-10-13 23:08:55 +00:00
bjarni
b31bfb25ca (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
2006-10-05 12:59:28 +00:00
belugas
b0444e6a50 (svn r6644) -Fix(r6637): remove inline to allow MSVC compilation
-Fix(r5124): Add aircraft.h to MSVC projects
2006-10-05 02:26:27 +00:00
bjarni
db9cdd6749 (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
2006-10-04 12:01:59 +00:00
bjarni
71ca65588c (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
2006-10-03 14:52:39 +00:00
peter1138
8b2e4e970a (svn r6532) - Feature: Add support for NewGRF sound effects. Currently sound priority isn't supported. 2006-09-27 18:17:01 +00:00
bjarni
c545edf46f (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
2006-09-08 10:47:39 +00:00
rubidium
21ac20aeca (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
-Cleanup: whitespace alignment of a few tables.
2006-09-04 20:40:33 +00:00
Darkvater
52fa30022a (svn r6378) -Codechange: Rename VLW_FLAGS to VLW_MASK as it is a mask 2006-09-04 15:16:58 +00:00
bjarni
21195804c3 (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
2006-09-04 09:07:52 +00:00
bjarni
fa7309cded (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
2006-09-03 11:49:38 +00:00
tron
d5e5a78cf4 (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
2006-09-03 08:25:27 +00:00
bjarni
5a86b502c2 (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
2006-09-02 22:47:45 +00:00
bjarni
14e8615cf2 (svn r6304) -Codechange r6295: Use !! instead of (bool) in commands to send vehicles to depots 2006-09-02 09:35:03 +00:00
bjarni
545584ec51 (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 2006-09-01 12:37:03 +00:00
bjarni
71da9f3abc (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)
2006-09-01 10:24:15 +00:00
bjarni
1d011b57d2 (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
2006-08-30 21:39:01 +00:00
bjarni
386468dc72 (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
2006-08-29 23:39:57 +00:00
rubidium
86dc219b4b (svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc. 2006-08-28 18:53:03 +00:00
bjarni
422d073910 (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
2006-08-27 09:28:52 +00:00
truelight
65f5ec13f6 (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)
2006-08-26 16:34:03 +00:00
truelight
213c71be3f (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
2006-08-22 18:15:17 +00:00
truelight
bdc1d681a7 (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
2006-08-22 17:13:49 +00:00
truelight
505566da5c (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.
2006-08-22 15:33:35 +00:00
rubidium
908d3bcfe6 (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. 2006-08-22 14:38:37 +00:00
bjarni
24d703808f (svn r6039) -Fix: [newGRF] FS#287 Bugfix for error in NewGRF callback 31 code for aircraft (Mart3p)
introduced in rev 5822
2006-08-21 16:35:47 +00:00
rubidium
db397d5a75 (svn r6002) -Cleanup: remove the now redundant BASE_YEAR constant. 2006-08-20 19:05:28 +00:00
rubidium
e87e065e41 (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
2006-08-16 11:39:55 +00:00
Darkvater
672ee1bf3a (svn r5914) -Fix [FS#235]: Bugfix for errors in FindNearestHangar function in aircraft_cmd.c (mart3p). 2006-08-15 14:38:43 +00:00
rubidium
9fc837ad85 (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
2006-08-14 14:21:15 +00:00
rubidium
f08c86e5cb (svn r5883) -Fix [FS#272]: use the height of the edge of the map for shadows of aircrafts that are outside the map; similar to r5841, caused by r5794. 2006-08-13 14:46:16 +00:00
peter1138
8048e8c5bd (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. 2006-08-09 21:11:45 +00:00
peter1138
53d2650d9b (svn r5819) - NewGRF: add support for refit costs specified in NewGRF. This may affect the default refit costs for the default rail vehicles. 2006-08-09 20:44:23 +00:00
tron
677ecc624c (svn r5613) Rename VS_DISASTER to VS_SHADOW, because this is what this flag actually means 2006-07-26 08:32:20 +00:00
tron
a5a780c12a (svn r5594) Be more strict what's allowed to be built in a hangar: if the airport can't handle planes/helicopters don't present and disallow building planes/helicopters - the latter case wasn't covered yet.
Also remove an error message about building aircraft which can't be triggered by a normal client
2006-07-22 14:43:53 +00:00
bjarni
66b3f0e174 (svn r5454) -Fix: [ 1394231 ] Autorenew glitch on helicopters
[ 1459348 ] Helicopters (possibly other aircraft) stopping in depot...
    by committing  FS#233 Bugfix for autorenewed/autoreplaced helicopters staying in depot (Mart3p)
    now helicopters (this only applied to helicopters) no longer stops in hangars when replaced and they will not even go there for autorenew if the model is out of date
2006-07-03 21:14:21 +00:00
peter1138
34e18cbdfe (svn r5427) - Codechange: testing for "== true" is redundant. 2006-06-29 08:58:08 +00:00
tron
772fbda3e3 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular 2006-06-27 21:25:53 +00:00
richk
ba780a25d3 (svn r5376) - Fix: Changed error message when trying to build a CTOL aircraft at a helidepot/helistation to "Airport has no runway". (Thanks to MeusH). Osprey can now be built at helidepot/helistation. (Thanks to mart3p). 2006-06-26 20:58:49 +00:00
richk
5d2bff0b78 (svn r5346) - Feature: Add 4 new airports. 2 for aircraft, 2 for helicopters.
Commuter airport: Small. 5x4. 3 terminals, 2 helipads.
Intercontinental: massive. 9x11. 8 terminals, 2 helipads, 4 runways.
Helidepot: a small heliport with a depot for helis only.
Helistation: a large heliport with 3 helipads and a depot.
2006-06-23 22:05:40 +00:00
peter1138
191023787a (svn r5336) - NewGRF: draw custom helicopter rotor sprites in vehicle info window, ensuring the correct direction is used (inspiration from mart3p) 2006-06-22 21:15:27 +00:00