Commit Graph

234 Commits

Author SHA1 Message Date
Darkvater
5dc75d233a (svn r7415) -Codechange: Don't use typedef enum for simple widget enumerators when we will never use
their type anyways.
2006-12-07 13:00:41 +00:00
peter1138
e205c58ddc (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
KUDr
b450652dbe (svn r7317) -Fix: (r7299) warning: unused variable num_engines (peter1138) 2006-12-01 08:23:15 +00:00
Darkvater
a7ff2cc7c7 (svn r7315) -Fix: Have the first engine in the list be selected once again when the window is opened
and remove a useless loop that tested if selected engine is still in list (moved to list
 generation).
2006-12-01 00:26:42 +00:00
Darkvater
f40eccae9b (svn r7314) -Cleanup: const, whitespace, coding style and variable usage. 2006-12-01 00:14:10 +00:00
Darkvater
04f9944746 (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
KUDr
04773f5eb4 (svn r7309) -Codechange: sort train engines/wagons by number first and then by custom rule 2006-11-30 21:37:06 +00:00
peter1138
c45423695b (svn r7304) -Codechange: Reinstate caching of sorted purchase list. Dropping from 9m to 1.5m cycles for a redraw of a full list is not frivolous. 2006-11-30 18:23:25 +00:00
peter1138
d0d47e9202 (svn r7303) -Codechange: Sort wagon list as well as engine list. 2006-11-30 18:16:08 +00:00
KUDr
1235172cc7 (svn r7299) -CodeChange: Train and Aircraft Build window GUI code simplified a bit:
- using one engine list instead of 3
- removed engine filters (loco, wagons, helicopters, etc.)
- EngineList code isolated from GUI (moved to helpers.cpp - reusing CBlobT code which does exactly what is needed for EngineList)
- removed unnecessary  "optimization" (rebuild and sort engine list on each WE_PAINT)
2006-11-30 16:03:12 +00:00
peter1138
470c383738 (svn r7269) -Feature: Add freight trains patch option. This option is a multiplier for the weight of cargo on freight trains, to simulate longer heavier trains. The default value of 1 behaves as before. 2006-11-27 23:11:56 +00:00
Darkvater
b3c48c0a84 (svn r7205) -Fix [FS#350, SF#1560913]: Window allocation and deletion messed with the actual window
structs inside their array, and possibly invalidating pointers higher up.
 Meaning that any function called within an wndproc could cause unknown/invalid pointers
 once control was returned to this function. Solved by the introduction of an extra
 abstraction layer, an array of z-window positions that is only concerned with the
 pointers.
2006-11-18 16:47:02 +00:00
KUDr
7f45482bbe (svn r7178) -Fix: forgotten pointer dereferences (Bjarni, Bjarni, Bjarni, ...) 2006-11-16 20:52:39 +00:00
KUDr
591a34296d (svn r7167) -Fix: [FS#367] Crash: engine.h:194: RailVehInfo: Assertion (reported by skidd13) 2006-11-16 13:59:26 +00:00
Darkvater
21db9ebb8e (svn r7129) -Codechange: Get rid of a global variable that only sets a window's number. 2006-11-11 09:47:44 +00:00
Darkvater
d50f6c8a8c (svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1) 2006-11-10 19:24:14 +00:00
Darkvater
1e69ac550d (svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
for the aptly found name)
-Codechange: Remove the explicit numbering from WindowWidgetTypes
2006-10-24 16:27:18 +00:00
Darkvater
d303ef94b3 (svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
WWT_IMGBTN must contain an image for drawing. Renamed WWT_PANEL_2 to WWT_IMGBTN_2
 because that is what it is. Added WWT_PUSHBTN that is either just a pushable button,
 or a textbutton, which text's drawn dynamically independent of widget.
2006-10-24 14:15:17 +00:00
Darkvater
605036dbb4 (svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names. 2006-10-24 13:20:54 +00:00
peter1138
736e3597b5 (svn r6920) - Codechange: Ignore refit options of an engine if it has no capacity. 2006-10-24 07:10:37 +00:00
peter1138
735c636f6f (svn r6912) - Feature: Show a list of cargo types that a vehicle is refittable to in the purchase information window. (mart3p) 2006-10-23 21:39:15 +00:00
peter1138
552e6de4ce (svn r6911) - Codechange: Add extra space to all purchase windows (and the replace window) to allow room for more text. (mart3p) 2006-10-23 21:25:30 +00:00
peter1138
59f78aa2b7 (svn r6910) - Codechange: Supply width of area when drawing purchase info instead of using hardcoded values. (mart3p) 2006-10-23 18:45:43 +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
df8b06dec6 (svn r6858) - Fix (r6855): Handle rail vehicles with no capacity (N/A) by setting cargo type to CT_INVALID and handling it later. STR_8838_N_A is not a valid cargo type... 2006-10-20 19:48:25 +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
c88f7b0138 (svn r6801) - Fix (r6619): Always disable the train refit button. It will be enabled later if refitting is possible. 2006-10-17 17:10:39 +00:00
peter1138
8072c6fe17 (svn r6794) - Fix: In the train detail window, split up articulated parts if they can contain cargo. This allows us to show the full cargo contents. 2006-10-17 07:33:05 +00:00
Darkvater
2b7a0a8dac (svn r6760) -Codechange: Do a case insensitive sort of train engine names and just normally
check a boolean; no special magic needed
2006-10-12 15:39:33 +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
75fe56eff0 (svn r6737) - Codechange: Sort train engines by their NewGRF specified list position instead of plain EngineID. This brings us back the custom order that was lost when generalized sorting was introduced. 2006-10-11 18:44:02 +00:00
bjarni
3a94561f25 (svn r6716) -Code cleanup: [aircraft/train build windows] fixed a spelling mistake in the widget names (the game itself is unaffected by this) 2006-10-10 08:34:14 +00:00
bjarni
238b34e000 (svn r6714) -Codechange: replaced a direct manipulation of windows with InvalidateWindowData() in rail_cmd.c
Moved the actual modification of railtype to WE_INVALIDATE_DATA in the train depot handler
-Codechange: added SetWindowDirty() to WE_INVALIDATE_DATA as it made no sense to update the list without making the window dirty
2006-10-10 08:14:30 +00:00
bjarni
08789dd3e8 (svn r6712) -Code cleanup: renamed buildtrain_d to buildvehicle_d as it's used for all vehicle types 2006-10-10 07:56:23 +00:00
bjarni
684c50d82f (svn r6709) -Fix r6679: [build train window] solved an issue that could lead to trailing empty blocks in the list array
Since they were freed with the rest of the array, it only meant that we wasted a few bytes (max 16) while the window were open and we didn't leak memory
2006-10-09 21:42:18 +00:00
bjarni
b8e1f70751 (svn r6707) -Feature: [build aircraft window] added buttons to view propeller planes, jet planes or helicopters
-Codechange: the build aircraft window now generates 3 malleced lists and displays based on those list
    This is preparation for sorting aircraft
2006-10-09 20:16:56 +00:00
bjarni
de504592a8 (svn r6684) -Feature: [train build window] added sorting options for the engines 2006-10-07 22:58:25 +00:00
KUDr
9fc9383c81 (svn r6683) -Fix: '<' signed unsigned mismatch produced by VC8 2006-10-07 20:31:38 +00:00
bjarni
d2cebc7e86 (svn r6681) -Fix: when vehicles never expire they will stay at peak reliability instead of the lowest to make them useful even when old
-Fix: when retiring an engine design, invalidate the build windows and invalidate the build window data
-Fix: mark build windows dirty when engine reliability changes
2006-10-07 15:04:22 +00:00
bjarni
208e258f4c (svn r6680) -Codechange r6679: [train build window] only generate the list when the window data is invalidated or the window is generated, not on each redraw 2006-10-07 14:30:13 +00:00
bjarni
db66567799 (svn r6679) -Feature: [train build window] added filter for wagons, engines or both in the display
-Codechange: [train build window] to get rid of a really ugly hack, the train build list is now generated in one loop and stored in an array
2006-10-07 13:58:08 +00:00
bjarni
5df4e234e0 (svn r6678) -Code cleanup: [train build window] made an enum with widget names and fixed some incorrect indents 2006-10-07 09:02:48 +00:00
peter1138
cdfac3d7b7 (svn r6649) - Codechange: Show more correct capacity of articulated wagons in the train purchase list. 2006-10-05 11:26: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
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
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
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
0739d0c6f6 (svn r6518) -Codechange: unified the vehicle refit windows
This was requested by peter1138
2006-09-27 07:23:38 +00:00
bjarni
f7769e885e (svn r6513) -Codechange: unified the code to draw depot windows
This change is intended to make it easier to make depot behaviour consistent
   and faster to code when adding more features in the future
   The user interface should hopefully not be affected by this
2006-09-26 16:47:51 +00:00
bjarni
8f4a4a81da (svn r6503) -Codechange: added a function to tell what vehicles a depot contains
This will ensure that you can always get the same list when checking for vehicles in a depot (no need to duplicate code for each place, that needs such a list)
   Since the vehicles are only looped once for each redraw, drawing speed is around twice as fast (measured to be 114%-121% faster depending on the number of vehicles in the game)
2006-09-24 15:01:02 +00:00