Commit Graph

186 Commits

Author SHA1 Message Date
peter1138 61611711e3 (svn r6908) - Codechange: Modify DrawStringMultiLine() to return the number of pixel lines used, and use it for drawing NewGRF additional text (mart3p) 2006-10-23 18:13:24 +00:00
Darkvater ee27bb497c (svn r6884) -Codechange: Add strict bounds checking in string formatting system.
The last parameter should point to the end of the buffer (eg lastof(buf))
 Courtesy of Tron.
2006-10-21 23:31:34 +00:00
peter1138 8411b3b9fe (svn r6855) - Codechange: When displaying a "quantity of cargo" string, use the {CARGO} command and supply the cargo type and quantity, instead of manually looking up the cargo type's string. 2006-10-20 11:53:29 +00:00
peter1138 cd337672ba (svn r6789) - Codechange: Tidy up VehicleNameSorter() to use no global vars, and match the style of EngineNameSorter(). This also removes a bug where _internal_name_sorter_id was never set properly for anything other than trains. 2006-10-16 10:29:29 +00:00
Darkvater 841afe5c50 (svn r6759) -Codechange: Remove the brainheaded usage of STR_JUST_STRING to pass a StringID 2006-10-12 15:38:37 +00:00
peter1138 8411da7241 (svn r6690) - Fix (r6602): Translate global to per-climate cargo ids before... doing anything with them. (Thanks to MeusH for pointing this out...) 2006-10-08 19:28:55 +00:00
bjarni c968a1c5fc (svn r6689) -Fix: corrected vehicle type in tooltip for the list in the refit window
This was actually not a bug from unifying this window as it was incorrect even before they were merged
2006-10-08 17:56:08 +00:00
bjarni b4974b9d7d (svn r6676) -Fix: [vehicle list windows] mass start/stop now works correctly in shared orders and station lists 2006-10-07 08:24:11 +00:00
bjarni 13918e7cc9 (svn r6672) -Codechange: [depot & vehicle windows] applied SetWindowWidgetsDisabledState() and SetWindowWidgetsHiddenState() to depot and vehicle windows 2006-10-06 21:44:18 +00:00
peter1138 7fb948e1cf (svn r6667) - Codechange: The vehicle list has no horizontal scroll bar, so don't use it to store data; instead, just get the widget's width. 2006-10-06 08:47:01 +00:00
bjarni e341cc1e49 (svn r6652) -Feature: [depot window] depot lists are now sorted, so vehicle 1 is always first and so on
This should not be a big slowdown as it's only called each time the list is generated and will normally be much faster than the list generation itself (only a small % of the total number of vehicles is in the depot)
2006-10-05 13:11:17 +00:00
bjarni 55c7840710 (svn r6647) -Fix: [vehicle list windows] Lists of shared orders are now no longer closed by a window event if the list is empty
The window is now closed when the order is deleted.
   This is because removing windows from a window event is asking for problems
2006-10-05 08:27:40 +00:00
bjarni ff6f83b56c (svn r6646) -Codechange: [vehicle list window] Cleaned up the drawing code
This moved a few of the strings and sprites a few pixels. Hopefully this will work out ok.
2006-10-05 08:15:51 +00:00
bjarni ddb46fe8d8 (svn r6638) -Fix r5652: restored each vehicle list type to their type classes, so it's possible to redraw all lists of one vehicle type again (instead of all types) 2006-10-04 17:09:17 +00:00
glx e27e381d29 (svn r6635) -Fix r6634: incomplete/incorrect assignment 2006-10-04 01:08:25 +00:00
belugas 0305adeb12 (svn r6634) -Fix(r6377): Do not change a widget state after a DrawWindowWidgets, as it is a bit useless
-Fix(r6562): Use the correct widget index for enabling
2006-10-04 00:51:13 +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
belugas 753b572400 (svn r6619) -Codechange: Use accessors for disabled_state.
Another step toward merging XTDwidget.
The only two files not converted (window.h and widget.c) will be done at the very last commit)
2006-10-03 02:08:15 +00:00
peter1138 869b5d3b97 (svn r6615) - Fix (r6601): Fix bug that prevented subtypes appearing in some cases. 2006-10-02 16:03:31 +00:00
bjarni 94c3963841 (svn r6614) -Fix: added check to see if a newly opened refit window is different from NULL before assigning data to it 2006-10-02 08:41:20 +00:00
belugas 2c45339e0a (svn r6612) -Codechange: Use accessors for hidden_state.
Another step toward merging XTDwidget.
The only two files not converted (window.h and widget.c) will be done at the very last commit)
2006-10-02 00:28:31 +00:00
peter1138 c2220a9836 (svn r6608) - Fix (r6601): The scroll bar could fall out of the window... more gui-fu needed... 2006-10-01 15:03:15 +00:00
peter1138 8d5c98ee87 (svn r6607) - Fix (r6601): Fix selection of refit type when the list is scrolled. 2006-10-01 14:55:53 +00:00
peter1138 406d756c6f (svn r6602) - Feature: we now support NewGRF livery refits, as used by DBsetXL, amongst others. This requires a savegame bump to save the cargo subtype. 2006-10-01 12:25:31 +00:00
peter1138 2de71bc234 (svn r6601) - Codechange: Support cargo subtypes in the refit window. The refit window has been altered to support resizing and scrolling. Note that the cargo subtype isn't yet passed for actual refitting yet. (Based on mart3p's patch) 2006-10-01 12:00:32 +00:00
bjarni 3cfa76f0c5 (svn r6591) -Codechange: changed strings that used the word "depot" into one for each vehicle type
This is a request from translators as depot is not valid for all vehicle types in all translations
   This will cause a lot of warnings when generating the lang files. MiHaMiX will fix them in a moment (hopefully)
2006-09-30 20:59:23 +00:00
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