Commit Graph

156 Commits (f9f6b5f341b8b296e58fa33a719bfd1ede5ebd05)

Author SHA1 Message Date
rubidium c55962f8a2 (svn r5916) -Cleanup: use MIN_YEAR/MAX_YEAR for the year boundaries and BASE_YEAR when comparing _cur_year with a 'full' year.
-Cleanup: replace some magic '1920' values with BASE_YEAR.
18 years ago
Darkvater b293c7a4e1 (svn r5910) Fix some more warnings on MSVC by using (void*) casts. Followup of r5907. 18 years ago
tron bdb843950a (svn r5894) Remove a totally unnecessary indirection in the vehicle sorter code. Less code, less data, simply better 18 years ago
rubidium 9fc837ad85 (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
18 years ago
belugas f1968d236c (svn r5839) Fix : A ship in a depot must be stopped before allowed to be cloned.
As this is standard behaviour for all other vehicle types...
18 years ago
peter1138 acaa043d6f (svn r5820) - NewGRF: Add support for extra vehicle text in the purchase list for road vehicles, aircraft and ships. 18 years ago
belugas 40a8964911 (svn r5609) CodeChange : Apply coding style 18 years ago
tron 772fbda3e3 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular 18 years ago
tron 8cae4d1214 (svn r5225) Some windows periodically check if their parent exists - if not they close themselves
This is unnecessary, because their parents already close them when they get closed
Therefore remove the code for the periodic checks
18 years ago
tron a2362674e3 (svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc. 18 years ago
peter1138 bbafbc2942 (svn r5188) - NewGRF: check refit capacity callback when refitting a ship 18 years ago
tron ce9639c6bc (svn r5120) Add IsShipInDepot{Stopped,}() and remove some redundant checks 18 years ago
tron 9ee944cabb (svn r5094) Remove _new_{aircraft,roadveh,ship,train,wagon}_id. _new_vehicle_id is enough. 18 years ago
tron d9e968e759 (svn r4943) uint tile -> TileIndex tile, byte player -> PlayerID player 18 years ago
tron e774caca2a (svn r4940) Remove the dubious feature of remembering the last built depot. It serves no real purpose except causing confusion 18 years ago
peter1138 28318a6cbd (svn r4709) - Codechange: avoid messing around with globals, magic numbers and literal strings by using a string ID, when drawing the small right arrow for the small order lists (aircraft and ships) 18 years ago
tron 35e93e451f (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()
18 years ago
peter1138 59ace676eb (svn r4322) - Codechange: Remove conversion of kmh to mph from gui code to within the units conversion system, in string.c. This means displaying kmh requires no conversion, instead of being convert from kmh to mph, and then back to kmh again. 18 years ago
tron 8cfcdaa733 (svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends 19 years ago
peter1138 97559a9df9 (svn r3631) - 2cc: Remove use of some temporary variables and perform minor optimization in the form of the ternary operator. 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
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 17ec6ed70d (svn r3520) Remove unused parameters from some functions 19 years ago
tron 1c3e8630fe (svn r3511) More whitespace ([FS#46] by Rubidium) 19 years ago
tron 2053685fb5 (svn r3367) Unify the 4 distinct CMD_CHANGE_{AIRCRAFT,ROADVEH,SHIP,TRAIN}_SERVICE_INT commands into one CMD_CHANGE_SERVICE_INT command.
As side effect this is a
-Fix: The default AI tried to change the service intervals of vehicles via the CMD_CHANGE_TRAIN_SERVICE_INT command - regardless of the type of the vehicle - which of course failed for non-trains
19 years ago
tron 24d56f889d (svn r3354) Fix a typo, which survived for about 3000 revisions: s/SRT_SORT_BY/STR_SORT_BY/ (noticed by chu) 19 years ago
peter1138 cac82aa4af (svn r3350) Fix widget glitch in player ship window (missed in r1379) 19 years ago
tron 28b8b7e269 (svn r3300) Remove unreachable code - in this case some duplicate breaks 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
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
tron 4caa0e593d (svn r3099) Copy&pasto in r3098 19 years ago
tron 7c14b86aaf (svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI 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 0b936c3222 (svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
nothing spectacular, just some stuff, which piled up
19 years ago
tron 53a4a6a0f4 (svn r3046) Replace some numbers with sprite names and fix a typo in the sprite list 19 years ago
tron 8980891b09 (svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants 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
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
tron 2aa27f9ecb (svn r2932) Give the strings consisting of an up/a down arrow symbolic names 19 years ago
bjarni 2412ad5a20 (svn r2795) -Fix: [Clone vehilcle] all error messages should now tell the right vehicle type (chrishuebsch) 19 years ago
ludde 9a060a0f24 (svn r2781) Fix some of the issues with variables in .h files. 19 years ago
tron 0ab62e7498 (svn r2772) Simplify the age notice in the vehicle details window 19 years ago
bjarni 059ae19626 (svn r2764) -Feature: Clone vehicles
-This allows a player to clone an excisting vehicle of his own
  -[fix]: this uncovered an excisting bug in CmdBuildRailVehicle() where depots could build trains of the wrong track type. This is fixed
  -Thanks to Celestar for drawing the sprites and _luca_ for including them in openttd.grf
19 years ago
celestar a3739aecdf (svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
by enums. There remains work in gfx.c to move the "transparency" and
"recolor" bits around to make space for more sprites. However, 2800
additional sprites can now be loaded. There also remains cleanup and
Doxygen work on many of the header files.
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
Darkvater 186036229c (svn r2623) - CodeChange: rework DrawStringCenteredTruncated() a bit. Instead of giving center + width you give the coordinates of the bounding box (left, right) it has to fit in (ludde)
- CodeChange: changed (back) maximum pixel length of truncated strings to a signed integer.
19 years ago
Darkvater 3f8ba76b2f (svn r2613) - Truncate savegames, and vehicle-texts in their window.
- Hardcoded width 5 for saves-path...oops :O
19 years ago
ludde 594dd34e84 (svn r2594) Fix: [strgen] Misc updates to the string system.
- Renamed the plural command to "P" instead of "PLURAL". Now write something like this to append an s on plural: {P "" s}. (You can optionally still add an argument index to explicitly specifiy which number that's used)
  - Removed the pluralized cargo strings from the string files. The new method is to use the plural specifier {P}
  - Added support for genders. First add "##gender der das die" on top, then use {G=der} on a cargoname/industry to set the gender, and to switch between genders do something like {G neu neu neue} {STRING}
  - Updated the swedish/english translation with P strings.
19 years ago
tron 5cbd8b598c (svn r2492) Remove some pointless casts and fix some nearby indentation 19 years ago
tron a733fede9b (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile" 19 years ago
celestar 354058341b (svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer 19 years ago
hackykid 90900802b9 (svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_) 19 years ago
tron d2364f1d51 (svn r2432) Use GetEngine() instead of DEREF_ENGINE() or even _engines[] 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
hackykid c4b426ef8c (svn r2412) - Fix: [ 1214948 ] building vehicles without depot crashes game. (Chris Huebsch) 19 years ago
tron a9b95b3cbb (svn r2407) Use {Get,Is}TileOwner to get/check the owner of a tile and fix some bogus reads of _map_owner 19 years ago
Darkvater ba8c649fac (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files. 19 years ago
tron 4eebeff58c (svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes. 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
Darkvater 5693f22f18 (svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points. 19 years ago
matthijs ba733c005d (svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
Buoys will now try to get within 3 tiles of a buoy instead of a the actual buoy tile. This gets ships to got past buoys in a realistic (IMO) way instead of barging right through them.
- Fix: [NPF] Trains get curves penalties sometimes even when the track is straight.
- Add: [NPF] Ships get a penalty for going over buoys now, so they will try to go around.
- Add: [NPF] Ships get a penalty for curves too, yay for straight lines.
- Add: TrackdirToTrack(), TrackToTrackdir(), IsDiagonalTrack() and IsDiagonalTrackdir() helper functions.
- Add: IsBuoy() and IsBuoyTile() helper functions.
- Codechange: Rearranged part of the control flow of ShipController(), removing a goto.
19 years ago
tron 9b6c01f81f (svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob 20 years ago
matthijs cc0966405b (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
- Add: asserts to find the v->u.rail.track == 0 problem.
- Add: IsValidDepot(), IsValidTown(), IsValidSign(), IsValidVehicle(), IsValidStation()
- Add: GetTileOwner(), IsTileOwner()
- Codechange: Replaced IsShipDepotTile(), IsTrainDepotTile(), IsRoadDepotTile() by IsTileDepotType().
- Codechange: typedeffed the MAP_OWNERS as Owner. Should be used as variable type.
- Codechange: Replaced a few uint by TileIndex.
20 years ago
tron c644e6b742 (svn r1827) Next iteration of the byte -> char transition: some string drawing functions and buffers 20 years ago
truelight bd7f37d592 (svn r1817) -Codechange: Moved depot-functions to depot.c
-Codechange: Added wrappers around depot-access (GetDepot no exists)
-Codechange: Made depot-functions a bit more logic (no longer 
GetDepotByTile crashes your game when you request it on a non-depot tile)
-Add: made depots dynamic (yes, 64k depots are possible now)
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
darkvater 0e272f2d10 (svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz) 20 years ago
truelight 5156f6b360 (svn r1609) -Codechange: converted the last order-loop with FOR_VEHICLE_ORDERS 20 years ago
Celestar a003bb0b0e (svn r1556) -Fix: Vehicle list updates should now really work 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 2d023f9c0b (svn r1478) -Fix: [1099195] mouse-wheel in train replace window. Scrollbar1 and Scrollbar2 now work independently. You can only scroll on list and scrollbar itself; scrollbar must be next widget of the list.
-Fix: updated the few gui's that didn't have the scrollbar right after the listbox.
20 years ago
darkvater bfa6755023 (svn r1466) -Fix: oops, depot windows can of course also scroll horizontally. Thanks si-m1. 20 years ago
darkvater 58dc91f64d (svn r1464) -Fix: [1099106] Resizeable portion of bus/air/rail depots window unclickable 20 years ago
darkvater 54e82ebbef (svn r1463) -Fix: [1099451] Game crashes after the click on Rename (see also Bug 10992). There was no check for non-selected engine 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
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
truelight 30433c332c (svn r1372) -Fix: fixed some GUI glitches introduced with resize-buttons 20 years ago
tron 74568aade0 (svn r1359) Fix typos in last commit 20 years ago
tron 815bac212a (svn r1358) Assert bounds of depot list when searching for a depot 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 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 d0a1507c34 (svn r1232) Plug memory leak 20 years ago
darkvater f8c9d0ea56 (svn r1213) -Feature: Stickified vehicle lists 20 years ago
darkvater 452db59121 (svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized 20 years ago
dominik 5611e85dac (svn r1179) Fix: Tooltips for vehicle list sorting
This has gotta be the greatest kick for Moriarty!
20 years ago
tron a148ff4e0d (svn r1117) Move map arrays and some related macros into their own files map.c and map.h 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
tron b8e83ca03f (svn r955) Replace uint16 for orders with struct Order
This adds no functionality, but is a stepping stone for future improvement (like 16bit order indices) and is easier to read.
This changes preserves binary compatibility wrt savegames.
20 years ago
truelight d6a1f3e412 (svn r942) -Merged branch/network back into the trunk 20 years ago
tron 5fc510bbfc (svn r920) Replace vehicle info macros with inline functions and add asserts to check limits 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
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 56435c8775 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
-Fix: added WIDGETS_END macro for WWT_LAST which does this for all last widget-types
20 years ago