Commit Graph

152 Commits

Author SHA1 Message Date
Darkvater
2dcdeb985d (svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
IS_INTERACTIVE_PLAYER
2006-10-14 15:15:56 +00:00
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
2006-10-05 12:59:28 +00:00
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
2006-10-04 12:01:59 +00:00
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
2006-10-03 14:52:39 +00:00
peter1138
653e7fa548 (svn r6532) - Feature: Add support for NewGRF sound effects. Currently sound priority isn't supported. 2006-09-27 18:17:01 +00:00
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
2006-09-08 10:47:39 +00:00
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().
2006-09-05 23:21:41 +00:00
Darkvater
b7f36808ac (svn r6378) -Codechange: Rename VLW_FLAGS to VLW_MASK as it is a mask 2006-09-04 15:16:58 +00:00
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
2006-09-04 09:07:52 +00:00
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
2006-09-03 11:49:38 +00:00
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
2006-09-03 08:25:27 +00:00
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
2006-09-02 22:47:45 +00:00
bjarni
61e2fa3cd2 (svn r6304) -Codechange r6295: Use !! instead of (bool) in commands to send vehicles to depots 2006-09-02 09:35:03 +00:00
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 2006-09-01 12:37:03 +00:00
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)
2006-09-01 10:24:15 +00:00
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
2006-08-30 21:39:01 +00:00
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
2006-08-29 23:39:57 +00:00
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
2006-08-27 09:28:52 +00:00
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)
2006-08-26 16:34:03 +00:00
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
2006-08-22 18:15:17 +00:00
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
2006-08-22 17:13:49 +00:00
truelight
0461d89612 (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
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. 2006-08-22 14:38:37 +00:00
rubidium
893d4ba9d4 (svn r6002) -Cleanup: remove the now redundant BASE_YEAR constant. 2006-08-20 19:05:28 +00:00
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
2006-08-16 11:39:55 +00:00
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
2006-08-14 14:21:15 +00:00
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. 2006-08-09 21:11:45 +00:00
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. 2006-08-09 20:44:23 +00:00
peter1138
2e0498dce0 (svn r5427) - Codechange: testing for "== true" is redundant. 2006-06-29 08:58:08 +00:00
peter1138
19d14b474e (svn r5188) - NewGRF: check refit capacity callback when refitting a ship 2006-06-09 07:09:48 +00:00
tron
cb13a1e43d (svn r5120) Add IsShipInDepot{Stopped,}() and remove some redundant checks 2006-06-05 11:28:00 +00:00
peter1138
0a623bc333 (svn r5104) - When refitting a vehicle to its existing cargo type, don't lose the cargo onboard (useful when adding wagons to a train) 2006-06-04 17:49:16 +00:00
peter1138
f00c3e7e25 (svn r5103) - Add cargo subtype parameter to refit commands (mart3p) 2006-06-04 17:38:48 +00:00
tron
a0caafeb50 (svn r5094) Remove _new_{aircraft,roadveh,ship,train,wagon}_id. _new_vehicle_id is enough. 2006-06-04 09:28:33 +00:00
KUDr
9cf3badfcf (svn r5093) -CodeChange: [YAPF] min. debug level changed from 1 to 3 and 4 for frequent debug messages (performance stats) 2006-06-04 09:13:59 +00:00
KUDr
5e73dce0e7 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing. 2006-05-27 16:12:16 +00:00
peter1138
cd6ab6178c (svn r4910) - NewGRF: add and initialize cargo subtype for vehicle visual variations 2006-05-19 10:04:03 +00:00
bjarni
2e05a16959 (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
2006-05-11 13:31:14 +00:00
tron
c1dc517dab (svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE} 2006-04-23 19:35:36 +00:00
celestar
76e2d2939a (svn r4505) -Fix (FS#94) Ships can now be used to set up feeders as well. 2006-04-21 19:47:52 +00:00
tron
81e6d68f95 (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()
2006-04-10 07:15:58 +00:00
tron
5be2aa3e99 (svn r4321) For ships check the ship state, not the road state. This bug was harmless, because both states are at the same byte in the vehicle type specific union. 2006-04-08 06:55:43 +00:00
celestar
c0cb020c80 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup 2006-04-07 15:57:03 +00:00
celestar
fcedc458f1 (svn r4289) -Codechange: Make use of water_map accessors for ships. Make a mental note to clean ship_cmd 2006-04-05 18:46:21 +00:00
celestar
8b151d8faa (svn r4272) -Codechange: Moved the map-accessing stuff from station.h into station_map.h 2006-04-04 11:35:52 +00:00
celestar
3aa1e38be6 (svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE 2006-04-03 05:32:11 +00:00
tron
b05a98fdfa (svn r3832) Replace some magic numbers by (Diag)Direction enums 2006-03-12 17:42:04 +00:00
tron
fbe939b31f (svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends 2006-03-08 06:55:33 +00:00
tron
586388c9f1 (svn r3767) Move all direction related enums and functions to a separate header 2006-03-05 12:34:55 +00:00
tron
87fdb129d2 (svn r3758) Remove the news validation callback. It is superseded by r3757. 2006-03-04 11:15:44 +00:00