Commit Graph

203 Commits (85da0eb990d5bb3f4e76838832845c483be95bb8)

Author SHA1 Message Date
peter1138 c7ddf7eb21 (svn r4343) [Autoreplace] Fix drawing of train list for outdated engines. Fixes FS#106 18 years ago
peter1138 2a8a8f5f98 (svn r4229) [elrail & autoreplace] Always show compatible rail vehicles in the left list, and only the selected rail type in the right list, to
allow converting electric engines to non-electric.
19 years ago
peter1138 eb15688358 (svn r4201) - Codechange: Do for _engine_info[] what we do for _*_vehicle_info[]; create and use a function to retrieve data, and ensure constness. 19 years ago
celestar 6c44bf5012 (svn r4150) -Feature: Merged elrails into trunk. Thanks to Tron for lots of code and proofreading, thanks to peter1138 for another lot of code and ideas. 19 years ago
peter1138 b5cd24f05d (svn r3620) - 2cc: Replace use of macro to determine colour map with a function call for drawing of vehicles. 19 years ago
tron 06b6ad9217 (svn r3610) And one more (see r3608/r3609) 19 years ago
tron 784ca2b0e6 (svn r3609) Some more simplification in the same function as r3608 19 years ago
tron 25813a1156 (svn r3608) No functional change, just make some code more comprehensible: Reduce variable scope, remove write-only variables, turn do-while-loops with multiple induction variables into canonical for-loops 19 years ago
peter1138 d172b39407 (svn r3605) - Remove silly macro and fix indenting in DrawVehicleRefitWindow() 19 years ago
tron 087fe86ed2 (svn r3564) Several smaller changes:
- Don't treat non-booleans as booleans
- Reduce variable scope
- Bracing
- Use DeMorgan's law to make conditionals easier to read
- if cascade -> switch
- Replace some magic numbers by symbolic names
- Avoid assignments within other statements
19 years ago
peter1138 2d67fc8741 (svn r3546) - NewGRF feature: Implement rail vehicle 'property' 0x1A: allows shuffling order of rail vehicle purchase list (and replace vehicle list) 19 years ago
bjarni c77c99b3c7 (svn r3535) -Feature: [autoreplace] allow autoreplacing of train wagons
currently ALL available wagons are displayed in the right menu in the replace window
	however the replacement will only be done if the new wagon can be refitted to carry same cargo as the old one is currently carrying

	Since the standard vehicles do not have any valid wagon replacements, this feature can only be used when using newgrf sets
19 years ago
peter1138 144c1f39a4 (svn r3528) - Feature: Allow sorting of vehicle lists by model or value (based on meush's work) 19 years ago
peter1138 6c28b1cec7 (svn r3524) - Split newgrf features from engine.[ch] into newgrf_engine.[ch], and add the new files to project files. 19 years ago
tron 9712d6f639 (svn r3510) Fiddle with whitespace and parentheses 19 years ago
peter1138 2222907a40 (svn r3396) - Autoreplace changes:
- Change fixed array per player to a single pool. This avoids future problems
    with vehicle numbers and decreases savegame size. Engine replacements from
    previous savegames will be lost.
  - Move engine replacement code from players.c to engine.c.
                                      (thanks to blathijs for rewriting this)
19 years ago
tron 9b87635c1f (svn r3366) Make an unnecessarily global variable local 19 years ago
peter1138 d5ce50a405 (svn r3359) - Autoreplace GUI: When starting or stopping a replacement, redraw the replace window after the command has completed, rather than after calling the command. 19 years ago
tron ed4b89ee36 (svn r3353) Simplify the automatic length adjustment algorithm for replacing trains: Use the length of the train before the replacement as reference length 19 years ago
tron a2533d5ee6 (svn r3298) Remove unused and write-only variables 19 years ago
peter1138 fc9c1c0f4e (svn r3292) - Autoreplace: Disallow replacing to an engine type that already has a replacement set up; this stops loops being set up. 19 years ago
peter1138 219a63238c (svn r3291) - Codechange, Autoreplace: Replace int with EngineID and -1 with INVALID_ENGINE, as appropriate. 19 years ago
peter1138 5f3dc36983 (svn r3270) Correct all (mis)uses of WWT_CLOSEBOX / WWT_TEXTBTN to reflect their actual use, and add "Close Window" tooltip where missing. 19 years ago
peter1138 14064b223d (svn r3239) - Codechange: Introduce and use helper functions for engine replacement code. 19 years ago
bjarni 16e65960b9 (svn r3218) -Feature: Multiheaded train engines will now stay in the same train
This means that any user attempt to remove a rear engine will tell the user to move the front engine instead
	This fixes the assert when moving multiheaded engines (introduced in r3144)
	Note: to make old savegames use this feature, some engines might be turned around in order to link engines in pairs

-Codechange: train subtype is now a bitmask
	This allows fast access to info like if it is a wagon or engine and if it is in front and so on
	Note: savegame version bump
19 years ago
tron 9d0e7b6458 (svn r3181) -Bracing
-Indentation
-Whitespace
-DeMorgan's Law
-Test with NULL or 0 for non-booleans
-'\0' instead of 0 for chars
-Remove redundantly redundant comments (like DoFoo(); // Do foo)
-Join multiple short lines with a single statement
-Split single lines with multiple statements
-Avoid assignments in if
19 years ago
tron 81e5b16d71 (svn r3172) static, const 19 years ago
bjarni df6c48fdba (svn r3155) -Feature: [autoreplace] autoreplace can now remove cars from too long trains
-Trains will now remember the length of stations it visits and sell cars
        when being autoreplaced if they became too long
        -If it needs to remove cars, then it starts from the front and sells
        all it can find until the train is short enough
        -This only works for trains, that knows the station length of the route
        so a full uninterrupted run is needed
        -a train needs 1-2 runs to detect if the shortest station is expanded
        -This feature can be turned on and off in the train replace window
        and each company can have it's own setting
        -NOTE: minor savegame version bump
19 years ago
peter1138 34c503cabf (svn r3148) -NewGRF, Feature: Add support for cargo refitting specification by cargo classes. 19 years ago
peter1138 84684ef1a3 (svn r3106) -Autoreplace feature: Continue to show old vehicles in replace window after all player's vehicles of that type have been replaced. This allows the replacement to be removed. These vehicles are shown in grey instead of the player's colour. 19 years ago
peter1138 6b0bbde53d (svn r3089) Fix possible issue with out-of-bounds array access in replace vehicle gui, and add brief commenting. 19 years ago
bjarni d0d6804bf8 (svn r3082) made ChangeVehicleViewWindow() more readable (added in last commit) 19 years ago
bjarni 0f5c8787f8 (svn r3081) -Codechange: [autoreplace] complete rewrite of autoreplace
this is a complete rewrite, that makes use of existing commands like build and sell
        this means that multiheaded train engines are replaced correctly
19 years ago
tron 181d586a7c (svn r3078) Some more stuff, which piled up:
- const, whitespace, indentation, bracing, GB/SB, pointless casts
- use the trinary operator where appropriate
- data types (uint[] -> AcceptedCargo, ...)
- if cascade -> switch
- if (ptr) -> if (ptr != NULL)
- DeMorgan's Law
- Fix some comments
- 0 -> '\0', change magic numbers to symbolic constants
19 years ago
tron 24253c17cc (svn r3059) Use bitfields to encode railtype and climates of engines instead of manual shifting/anding 19 years ago
tron e3d1e43559 (svn r3049) Replace byte/int/uint by RailType where appropriate 19 years ago
tron d318f3763a (svn r3048) Replace 0/1/2 by RAILTYPE_RAIL/MONO/MAGLEV where appropriate 19 years ago
tron 0ad3902acf (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts) 19 years ago
tron f608232673 (svn r2992) Use PlayerID, StationID and INVALID_STATION instead of int, int and -1 19 years ago
tron d7af8df07b (svn r2988) static where static is due 19 years ago
peter1138 968f7dcf55 (svn r2974) -Fix: Drag and drop selection on drop down boxes didn't select correct item when some items were hidden.
-Separate disabled and hidden masks in drop downs to support both hidden and disabled items.
19 years ago
Darkvater 4a58250cb9 (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
- change a lot of byte player types to PlayerID
- beautify header files, same "#endif /* filename */" ending
19 years ago
Darkvater 4f402ffd7e (svn r2901) Refix 'replace window' with wrong string-etc. coordinates. Also clean up, and make window-title a bit more meaningful (specify vehicle type replaced) 19 years ago
Darkvater 8f00b8ad4e (svn r2880) Fix graphical glitch in replace window (text at wrong coordinates) 19 years ago
bjarni 9952ff0b59 (svn r2817) -Codechange: [autoreplace]: moved autoreplace and autorenew to serverside
-This means that one company can only have one setting for renew and replacing
    more clients will not fight due to different settings anymore
  -This is a needed step in the line to fix autoreplacing dualheaded locomotives
  NOTE: savegame revision bump (peter1138 + me in coop)
19 years ago
tron 842991bbe0 (svn r2812) Move variables, which only vehicle_gui.c needs to know about, there 19 years ago
bjarni a1557fa270 (svn r2724) -Fix: [Autoreplace] made the pulldown menu read GetPlayer(_local_player)->avail_railtypes - this removes the need for updating this code if we add more railtypes and it also allows the menu to show maglev when monorail is not available 19 years ago
tron 647cbd6bdd (svn r2701) Insert Id tags into all source files 19 years ago
tron 54cbd01825 (svn r2673) Include functions.h directly, not globally via openttd.h 19 years ago
tron 71140a5768 (svn r2669) Shuffle some more stuff around to reduce dependencies 19 years ago
tron 8b05455903 (svn r2664) Remove depedency on player.h from variables.h 19 years ago
tron d2364f1d51 (svn r2432) Use GetEngine() instead of DEREF_ENGINE() or even _engines[] 19 years ago
hackykid dc75e1d58b (svn r2429) - Fix: Oops, forgot to increase the size of the autoreplace window to fit the extra info from powered wagons. 19 years ago
hackykid eebe82c983 (svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
- Add: In the purchase details for trains display "(refittable)" after the capacity if the vehicle is refittable.
19 years ago
Darkvater ba8c649fac (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files. 19 years ago
hackykid e383ee6bba (svn r2365) - Change: [refitting] Make refitting capacities for trains newgrf compatible. Train vehicles can now carry twice as much mail/goods as other cargo, and four times as much passengers.
- Fix: [refitting] The refit window now shows the correct refit options for the entire consist. Only if at least one of the vehicles in the train can be refitted to a certain cargo, it is shown in the list.
 - Fix: [refitting] When refitting to a cargo which is already carried by some vehicles in the consist, the capacities of those vehicles are taken into account when calculating the new capacity of the train in the refit window.
19 years ago
Darkvater 7470322a3d (svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks" 19 years ago
matthijs fbed2d4bbb (svn r2267) - Codechange: Reverted the typedeffing of VehicleType (r2256), since that interfered with the saveload code. 19 years ago
matthijs f8302a137a (svn r2256) - Fix: Trains cannot find a depot when they are in a tunnel. (glx)
- Add: GetVehicleTrackdir() helper function.
- Codechange: Moved SortStruct from vehicle_gui.h to ttd.h, so the dependency from vehicle.h on vehicle_gui.h could be removed.
- Codechange: Typedeffed the VehicleTypes struct so it can be used as the type for Vehicle.type instead of "byte".
- Codechange: Removed prototype for VehicleSorter(), which had no implementation anymore and was never called.
19 years ago
Darkvater e25dfa6e7e (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
- I also changed an order of strings from On, Off to Off, On, so this can be used ingame with the WWT_4 widget type.
- Since the newssettings now take 2 bits per setting (off/summary/on) _news_display_opt is widened to 32 bits and the settings code changed slightly to accomodate for a maximum of 16 message-types.
19 years ago
Darkvater c0ac4cfe51 (svn r1969) - GUI: Replace vehicle dropdown menu now looks a bit more comform the ones used throughout the game. 20 years ago
Darkvater 5c08ac3b93 (svn r1966) - Fix: [ 1110437 ] Replace Vehicles GUI gets random clicks. Breaks people! Don't forget the breaks in switch() statements!! 20 years ago
tron 830565514c (svn r1867) Include tables/sprites.h only in files which need it 20 years ago
tron d3f84347ac (svn r1813) Declare functions implemented in strings.c in their own shiny new header (though i think some of these function don't belong into strings.c) 20 years ago
tron 36c9758c94 (svn r1803) Move debugging stuff into files of it's own 20 years ago
tron 6379304126 (svn r1798) GetFoo(i)->index is per definition i, so replace the former with the latter 20 years ago
truelight f183ca5cc2 (svn r1783) -Add: Dynamic vehicles (now up to 64k of vehicles) 20 years ago
darkvater 0e272f2d10 (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz) 20 years ago
Celestar 697b619ac1 (svn r1695) -Fix: I broke maximum speed sorting for anything but trains with the new acceleration. Sorry 20 years ago
bjarni 3fb831b0ae (svn r1684) - Fix: [autoreplace] made sure that planes only show planes in replace GUI and helicopters only show helicopters 20 years ago
celestar ccd4f53a34 (svn r1681) -Feature: New realistic acceleration.
This will make things more difficult as narrow curves
          and depots impose rather strict speed limits. Feedback welcome
          For those who don't like low-speed curves: Switch it off
20 years ago
bjarni bd8b10d250 (svn r1680) Feature: Replace train GUI now remembers the railtype selected in the dropdown menu 20 years ago
bjarni d7fc1b2c69 (svn r1679) Fix: dropdown menus now returns the index of the string that was clicked even if a previous item is hidden
This bug was not triggered by the current code, but it's easier to code new features if you do not have to think about such limitations 
like you can't hide an item in the middle of the list ;)
20 years ago
bjarni bce73fb080 (svn r1635) fix: forgot to set SetVScrollCount properly in autoreplace train GUI. It appears ok now 20 years ago
bjarni cf862380fc (svn r1629) added a counter to tell how many engines you have of each type to the autoreplace vehicle windows and made them show only the vehicles you actually have in the left list.
this also fixes some window updates issues when autoreplacing
20 years ago
tron 94d5aeabb2 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile 20 years ago
bjarni 467e4b82bf (svn r1568) made an enum of train subtypes to make the code more readable 20 years ago
truelight 7cafdf3b0b (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
-Codechange: renamed all 'schedule' stuff to 'order(list)'
-Codechange: moved all order-stuff to order_cmd.c / order.h
-Codechange: vehicles that share orders are now linked to eachother
  with next_shared/prev_shared in Vehicle

  Developers: please use AssignOrder to assign data to an order. If not, 
   you _WILL_ make the save-routine to assert!
20 years ago
darkvater cd4272e08d (svn r1518) -Fix: server issue where some company names were wrong
-Fix: Highscore troubles; accessing members of deleted window
20 years ago
darkvater 94e44d05a1 (svn r1460) -Fix: [1099225] Bug Fix - Vehicle Lists not updated at Acqusition (thx tamlin and mpetrov) This also fixes some bug but can't find i right now. 20 years ago
dominik a4aa201b2f (svn r1434) Fix: [ 1098553 ] Crash when all vehicles from a vehicles per station list had been removed 20 years ago
truelight b450603437 (svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
(in prepare of dynamic arrays):
  - DEREF_XXX is changed into GetXXX
  - All direct call are directed via GetXXX
  - struct Industry has now an index-field
  - ENUM'd some stuff
  - Replaced home built loops with FOR_ALL_XXX
  - Added _stations_size, _vehicles_size, ... which gives the length of the
    array (which will be dynamic in the near future)
  - Changed lengtof(XXX) to _XXX_size (e.g. _stations_size)
  - Removed all endof(XXX) (because mostly it was part of a FOR_ALL_XXX)
  - Made the sort-functions of all 4 dynamic
  - Made all 4 Initialize functions more of the same
  - Some minor tab-fixing and stuff
  (tnx to Tron for proof-reading my 100kb patch ;))

  Note for all: please do NOT directly call _stations, _vehicles, _towns and
  _industries, but use the right wrapper to access them. Thank you.
  Ps: please also do not use 'v++', where v is of type Vehicle *.
20 years ago
tron 2eb7aedf69 (svn r1402) Trim trailing whitespace 20 years ago
truelight c097a788ee (svn r1399) -Fix: Fixes for compiling with Watcom C/C++ (ie, OS/2 port). (orudge)
Note: If people could watch out for initialising structs with
  *non-constants* in future... it's a bit annoying, I
  know, but Open Watcom isn't the only compiler which
  doesn't support this (yet) - Borland, for example,
  still doesn't like it.
20 years ago
bjarni 2492e7736e (svn r1393) fix [ 1096026 ]. Autorenew trains should now hopefully work like it did before autoreplace was added
DEREF_ENGINE is now used in autoreplace
20 years ago
darkvater d63144e8c0 (svn r1379) -Fix: various GUI glitches. Added default sizes to various widgets. Sticky/Resize- and Scrollbar must be 11 pixels wide, Horizontal scrollbar 11 pixels high, caption must be 13 pixels. I hope I didn't forget any widgets, the game will assert for that so report them to me! 20 years ago
bjarni 32973058a3 (svn r1351) fixed issue in last commit where it it not update the replace train window properly when changing company colour (the lower two panels stayed the old colour until the window was reopened) 20 years ago
bjarni 578d34cfe0 (svn r1350) Replace Vehicle GUI:
- Replaced "WP(w,replaceveh_d).line_height" with 
"w->resize.step_height" since they needed to be the same anyway
- Cleaned the code a litte for readability (like correct tabbing)
- Added company color to replace vehicle windows to make them look like 
the rest of the vehicle windows and made the caption text white (also to 
fit the standard)

 --This line, and those below, will be ignored--

M    vehicle_gui.c
M    lang/english.txt
M    window.h
20 years ago
truelight 3b7d2a8b67 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
how the system works. All useful windows are already made resizable. Enjoy :)
-Fix: fixed some GUI-glitches and flaws along the way
20 years ago
bjarni a1a5790014 (svn r1326) fixed compiler warnings in vehicle_gui.c and widget.c 20 years ago
bjarni 71cfc83f99 (svn r1324) Fixed problem with autoreplace GUI and msvc6 (thanks bociusz) 20 years ago
bjarni 5da75918c0 (svn r1323) Adding autoreplace feature
This feature works much like autorenew, but it will get you a new engine type instead of a new one of the same type. Once 
ordered, it will automatically replace the engines while they visits a depot. The GUI for setting this up have been added on the 
vehicle overview windows
Note: autorenew is now autoreplace, but to the same engine type
Nice new features, that was added to make this possible
- windows can now have two independant vertical scrollbars
- CMD_SHOW_NO_ERROR have been added as a flag for DoCommandP. It will make it do the action instead of showing the red box with 
estimated costs even if shift is pressed
- fixed problem where enginetypes where not initialized when loading a game. It's now done in InitializeGame()
20 years ago
tron 9da370de63 (svn r1016) Make the cargo sorter not consider the number of wagons of a particular cargo type but the sum of their capacity.
Also add the number sorter to sort by vehicle number if the cargo capacity is equal.
20 years ago
tron 13e8d01dcb (svn r1009) -Feature: per-station vehicle lists
This adds a little button per vehicle class to the station window which opens a list of all vehicles that have this station on their schedule.
As side effect this gets rid of some global variables.
20 years ago
dominik b747cd2fcd (svn r999) New icons for the network interface, newgrf gui and the tiny euro 20 years ago
tron 265ac67183 (svn r901) Small step in the process to clean up the DPARAM mess:
- reduce to 2 sizes (*DParam64 for 64bit values, *DParam for the rest)
- use inline functions instead of macros
- add assert()s to check for buffer overruns
20 years ago
tron acbd1801c7 (svn r815) Include strings.h only in the files which need it.
This should reduce the compile time after altering english.txt by about 1/3, because "only" 62 instead of 90 .c files must be recompiled.
20 years ago
tron b07357373f (svn r813) Push two tables from vehicle_gui.h into vehicle_gui.c - they were in the binary 48 (!) times.
While here change the type for one table from uint16 to StringID.
20 years ago
darkvater c79e8ad626 (svn r244) -Fix: Stations were not sorted for non-player-0 players
-Fix: Correctly resorting vehicle list of player when the list of another player is open.
20 years ago
truelight eb49a19460 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way! 20 years ago
darkvater c1e464f1ea (svn r172) -Fix: warning fixes (Tron) 20 years ago
darkvater 78b64ed192 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
-Fix: savegames are sorted with newest date first by default
-Codechange: refine sorter functions
-Fix: fixed linux warnings (tokai)
20 years ago
darkvater bf0652d3fc (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
-Fix: Sorter icon pointing down 'v' sorts in every window lowest value first, '^' highest value first
-CodeChange: move Dropdownlist from settings_gui.c to widget.c. More in place there.
20 years ago