Commit Graph

160 Commits

Author SHA1 Message Date
bjarni
f91c43d792 (svn r6586) -Feature: [depot window] added a vehicle list window with all vehicles having a certain depot in their orders
It got one known issue though. The top bar got a plural issue so expect to see stuff like "1 trains" until we figure out why it behaves this way
  Added the button to the depot windows. Made the autoreplace button bigger while I was moving some widgets anyway
  Made road vehicle depot windows start with one more row to make room for the buttons
2006-09-30 13:39:34 +00:00
bjarni
043f72678f (svn r6582) -Codechange: changed GenerateVehicleSortList() to reuse the same allocation over and over if possible (like BuildDepotVehicleList() )
This will prevent some reallocations when sorting vehicle list windows
  It also prevents moving the whole array into a new one each time the list is generated/updated (it used to make the list in one array and then move it into another one each time)
  Also ensured that neither GenerateVehicleSortList() or BuildDepotVehicleList() will never allocate lists longer than the total number of vehicles in the game
2006-09-29 20:41:28 +00:00
bjarni
7c863e6763 (svn r6581) -Fix r6562: [vehicle list windows] fixed an off by one issue when drawing the bottom row of buttons 2006-09-29 19:03:40 +00:00
bjarni
5b60e371a6 (svn r6570) -Feature: added "start all" and "stop all" buttons to the vehicle lists 2006-09-29 11:30:48 +00:00
peter1138
902c3ef1e2 (svn r6565) - Fix (r6562): Missing newline at EOF caused a compiler warning 2006-09-29 07:30:44 +00:00
bjarni
4ccdb0686f (svn r6562) -Codechange: merged the vehicle list window widget arrays
It made no sense to maintain 8 nearly identically arrays when a single one can do the job
  Also made the two buttons always use half of the bottom width each, even when resizing
2006-09-28 23:05:03 +00:00
bjarni
b49018f7b1 (svn r6559) -Codechange: [vehicle list windows] moved creation and drawing code into two new functions to make it easier to see what goes on where 2006-09-28 18:13:31 +00:00
peter1138
f469d3fe76 (svn r6544) - Codechange: Rename CmdReplaceVehicle to CmdSetAutoReplace, to reflect what it does. 2006-09-28 07:02:55 +00:00
bjarni
bd6f087ab1 (svn r6519) -Code cleanup r6518: changed a line to apply to the coding style 2006-09-27 08:06:40 +00:00
bjarni
0739d0c6f6 (svn r6518) -Codechange: unified the vehicle refit windows
This was requested by peter1138
2006-09-27 07:23:38 +00:00
belugas
1c56a5ae0f (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct 2006-09-23 02:39:24 +00:00
bjarni
ed7cecb5cf (svn r6431) -Fix r6424: removed a declaration after statement in ReplaceVehicleWndProc() 2006-09-08 19:43:13 +00:00
bjarni
c582499bde (svn r6429) -Fix: [autoreplace GUI] selecting an empty line will now deselect the engine instead of selecting the first in the list (consistent with all other windows)
-Fix: [autoreplace GUI] engine info is now drawn in the right side even if the left list is empty
2006-09-08 12:10:37 +00:00
bjarni
86e27e42ff (svn r6428) -Codechange: [autoreplace] removed duplicated code to draw the info text in the autoreplace window 2006-09-08 11:53:05 +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
bjarni
347a3f9a43 (svn r6418) -Fix: [autoreplace] now multiheaded engines and other locomotives consisting of more than one unit will only be counted once
This also cleaned up the counting loop alot and it will also (hopefully) be faster (didn't benchmark it)
2006-09-07 15:00:47 +00:00
rubidium
63687763e9 (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
56d06ba0a7 (svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'. 2006-09-04 15:44:28 +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
Darkvater
a40d6951d1 (svn r6377) -Codechange: Set up the widgets in the WE_CREATE instead of on every WE_PAINT
-Codechange: Initialize sorting-type on WE_CREATE instead of checking every time.
-Codechange: Update custom vehiclelist_d with standard list_d struct, more static
2006-09-04 15:13:49 +00:00
Darkvater
794cc6d55e (svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
-Codechange: Unify the Sorting struct both for vehicle-lists and network-lists.
2006-09-03 23:27:38 +00:00
bjarni
e42d819b6a (svn r6370) -Codechange: moved all the remaining setup for PlayerVehWndProc() into WE_CREATE 2006-09-03 23:14:39 +00:00
bjarni
0fc0586bbf (svn r6350) -Codechange: moved some setup stuff into WE_CREATE in PlayerVehWndProc()
This is possible now that the window number is known when running WE_CREATE and it's a nicer solution
2006-09-02 21:16:46 +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
3235b7407f (svn r6283) -Code cleanup: fixed wrong indent in PlayerVehWndProc() 2006-08-31 18:33:05 +00:00
bjarni
3367b2a95b (svn r6282) -Codechange: made a function to create the vehicle list for vehicle list windows
this list is also used by mass goto depot to ensure that they use the same vehicles
	right now only the list of all vehicles use this for goto depot, but eventually all the types will use this
2006-08-31 17:42:27 +00:00
tron
78f9d19d2d (svn r6271) Remove stale comment 2006-08-31 13:37:25 +00:00
tron
659e09e5bc (svn r6270) Remove the "unsorted" vehicle sorter, because it's plain useless 2006-08-31 13:33:25 +00:00
bjarni
68e0703226 (svn r6269) -Fix r6240: fixed incorrect row count in vehicle lists when resizing to smaller windows (AsterixMG) 2006-08-31 13:28:59 +00:00
bjarni
c3900434b5 (svn r6261) -Fix r6246: fixed sprite related crash related to other player's vehicle list windows (spotted by Darkvater) 2006-08-31 09:40:10 +00:00
bjarni
7922c9ff84 (svn r6249) -Fix: fixed assert when pressing goto depot in an empty list (forgot to disable the button in this condition)
-Code cleanup r6246: simplified SendAllVehiclesToDepot() and moved an { in PlayerVehWndProc()
2006-08-30 23:01:45 +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
1983c07955 (svn r6243) -Codechange: made SortVehicleList() static as well since that one is not used in any other files either (Thanks Tron for pointing this out) 2006-08-30 19:49:46 +00:00
bjarni
2a07ed9d46 (svn r6242) -Codechange: made BuildVehicleList static as it is not used in any other files anymore
added window_type to arguments and used it to replace an if cascade with a switch case
2006-08-30 19:42:20 +00:00
bjarni
8f102334ff (svn r6241) -Fix r6240: missed altering one line in last commit 2006-08-30 19:10:12 +00:00
bjarni
ced2972c74 (svn r6240) -Code cleanup: in PlayerVehWndProc: replaced size_of_row with w->resize.step_height
it was only used twice, so there was no reason to calculate it for each event
2006-08-30 18:35:02 +00:00
bjarni
6cc29d5daf (svn r6239) -Code cleanup: cleaned up PlayerVehWndProc
code to delete an empty shared orders list is now much simpler
	cleaned up the code to handle button clicks
	fixed an assert if widget 9 was pressed on a list with vehicles for another company
2006-08-30 16:32:00 +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
b85a5d8cc8 (svn r6228) -Fix: redrawing an empty list of shared vehicles will now close the window
Since the order is no more, the player will not need that particular window anymore
	this could happen if the player opened the window and then sold all the vehicles (or crashed them)
	A crash could happen if a new order gets the same (now freed) OrderID and the vehicle using it is not of the same type as the window expect
2006-08-29 22:47:38 +00:00
bjarni
a73b07561e (svn r6227) -Codechange: added window type flags to use with PlayerVehWndProc
this makes the list type detection much easier and allowed an if cascade to be turned into a switch case
	this also makes it easier to add more list types
2006-08-29 21:36:39 +00:00
bjarni
92582f0960 (svn r6215) -Codechange: [vehicle list windows] unified Player(vehicle)WndProc into PlayerVehWndProc
Those 4 unified functions were really much alike, so there was no reason to have so much dublicated code
2006-08-29 17:41:13 +00:00
rubidium
27cee58ab8 (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
rubidium
bee83fb3e4 (svn r6195) -Codechange: do not use '//' in '/* ... */' style comments and '/*' or '*/' in '//' style comments. 2006-08-28 10:14:37 +00:00
bjarni
27534b3521 (svn r6167) -Code cleanup r6161: replaced some uint16 with OrderID and (1 << 8) with SHARE_FLAG 2006-08-27 09:55:54 +00:00
bjarni
d576f799d5 (svn r6161) -Feature: List of vehicles with the same shared orders
the list is available in the orders window and looks like the list buttons from the station windows (small vehicle)
   The button is disabled if the vehicle do not have any shared orders or it got shared orders, but an empty order list
   based on a patch by nycom, thought it ended up getting heavily modified
   Thanks to TrueLight for proofreading and suggestions
2006-08-26 22:28:40 +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
5fd9aeb12b (svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
It isn't the best name, but we couldn't find any better.
  This unifies the pool-system even more.
2006-08-22 20:41:26 +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
Darkvater
b13a60db42 (svn r5910) Fix some more warnings on MSVC by using (void*) casts. Followup of r5907. 2006-08-15 09:28:27 +00:00
tron
4ad8d1c7a2 (svn r5907) Remove more indirection by using pointers instead of IDs. Also fix some bogus warnings on MSVC by using (void*) casts 2006-08-15 07:07:17 +00:00