Commit Graph

82 Commits (e4eb0c672a9c6f492924a4a0b6b94665826415d6)

Author SHA1 Message Date
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 562a32c3ee (svn r2297) - CodeChange: server-check the next batch of commands.
- CodeChange: since only the server will be able to modify difficulty settings, leave the checking of correct values besides, and trust users will join legit servers.
- CodeChange: for renaming signs, only check if GetDParam(); eg _decode_parameters is empty ('\0') or not, instead of the extra check of players, etc. That basically does the same thing. Also dirty sign two times when renaming, once before, once after the action. Because if the name becomes shorter and you update only after, garbage remains on the screen.
- CodeChange: made GetMaskOfTownActions() available to the town-cmd to double-check if the action was available to the player. For this purpose the hardcoded _local_player has been removed from the function and is now passed as a parameter.
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
Darkvater b43331c931 (svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
- CodeChange: To correctly accept engine-prototypes, the best-player checking has been moved to its own function, I hope it functions the same as before.
- CodeChange: Added symbolic types of PlayerID, OrderID and EngineID. For engines also added GetEngine() and IsEngineIndex(), similar to the other such functions.
- CodeChange: To correctly build industries, some tables have been moved to build_industry.h. The only way to find out currently if an industry is valid in a climate is by looping all industries and checking if it matches. Also to comply with the patch setting build_rawmaterial_industries, it is assumed that these industries do not accept any cargo of any type. This can and probably should changed in the future to some flag in their struct. Also use _opt_ptr instead of _opt.
- CodeChange: implemented the HQ checking code inspired by MarkR2 in "[ 1190944 ] Many commands not checked for security".  Unfortunately it is impossible to prevent only deleting a HQ by a modified client atm.
- CodeChange: For insert order and modify order their parameters are implicitely truncated to 8 bits, instead of the 16 bits said in the comments.
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 a636a36989 (svn r2118) - Fix: Fix compilation with network disabled, and comment out some of the warnings (unused function) 20 years ago
tron b0eda62f1e (svn r2037) uint -> TileIndex, remove pointless casts, const, misc. 20 years ago
tron 59fa2e78e8 (svn r2036) Fix FindNearestHanger(), it never worked correctly because 0xFFFF != 65000 and a 16bit number has no 17th bit
While here also do some const gymnastics
20 years ago
celestar a9c0a173bf (svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful 20 years ago
bjarni e5abf58461 (svn r2024) -Fix: [autoreplace] reverted all changes involving v->set_for_replacement as they caused desyncs.
The bad sideeffect of this is that now no vehicle will automatically go to a depot anymore just 
because it is set to be autoreplaced. We will have to find a better way to solve this problem.

Revisions reverted: 1640, 1707, 1709, 1710, 1712(but not the cheat prevention in this one)
20 years ago
Darkvater cd369308aa (svn r1905) - Fix: [ 1118810 ] openttd: ship_cmd.c:642 ... Assertion failed. Mapwrap fixed in ship_cmd.c (was implicitely ok before biggermaps).
- CodeChange: rename all vehicle controllers to ...Controller for their similar behaviour
20 years ago
tron 6d2b9d2c3a (svn r1863) Give the effect vehicle type enums more descriptive names and use the enum as parameter type for CreateEffectVehicle*()
-Fix: [1116619] Generate the correct smoke type for diesel trains
20 years ago
tron 36c9758c94 (svn r1803) Move debugging stuff into files of it's own 20 years ago
truelight 99f3fe4c07 (svn r1786) -Fix: unitnumber is increased to 16bit, so now you can have up to 5000
trains in one game (instead of the 240 which was the current value). 
Default max allowed vehicles per type is changed:
  Trains:  500 (old 80)
  Road:    500 (old 80)
  Ships:   200 (old 40)
  Aicraft: 300 (old 50)
(Tnx to Celestar and Darkvater for checking the patch)
20 years ago
truelight 0668a6b485 (svn r1770) -Fix: Hopefully last pieces of code that are containing a station-id
(and should be an uint16, not uint8)
20 years ago
bjarni 081c068f56 (svn r1767) fixed mixed declarations and code in last commit (oops) 20 years ago
bjarni c70aa109b4 (svn r1766) - Feature: Aircrafts will now go to the nearest hangar if the next airport in the orders do not have one (helipads)
- Fix: sometimes aircrafts would not go to the hangar even when they should. They do now
20 years ago
tron bb680056b1 (svn r1749) Move the functions which calculate distances to map.[ch] and give the more meaningful names 20 years ago
bjarni f4bcb2e268 (svn r1742) - Fix: fixed bug introduced in r1730 where AI players had problems when building aircrafts 20 years ago
bjarni 7d967ad12a (svn r1741) - Fix: added IsVehicleIndex() so it's possible to protect GetVehicle() from reading an invalid vehicle index
- Fix: added check for v->type in some commands, which expects v to be a specific type

Checks like this is needed to protect network servers from people, who hack their clients to either cheat or crash the server

NOTE: if I made a mistake here it can make a function unreachable when it should be used. Here is one place to look if something weird happens
20 years ago
darkvater bc0198a4c3 (svn r1739) - Fix: type checking when selling vehicles (TrueLight) 20 years ago
bjarni 0cfb483677 (svn r1730) - Fix: Ships and Aircrafts have to be build in depots owned by _current_player (hacked client protection)
now all 4 types of vehicles have to be build in depots. Note: there is a wordaround for AI players since the AI handle aircraft building in a weird way
20 years ago
tron 39858e696b (svn r1713) Split off several functions which query/set information about a single tile from map.h and put them into a seperate file tile.h 20 years ago
bjarni 6252d595e2 (svn r1710) - Fix: [autoreplace] vehicles do no longer go to a depot all the time if the owner clicked 'stop replacing' ( ship+aircraft+road vehicles ) 20 years ago
bjarni f33013a37b (svn r1708) - Fix: FindNearestHangar() will no longer return a hangar where a jet will crash if it is a jet, that is searching
- Codechange: Since planes move in strait lines in 8 directions, GetTileDistAdv() is used instead of manhatten distance in FindNearestHangar()
20 years ago
dominik 936979c957 (svn r1704) - Fix: [newgrf] rotors of custom helicopters are displayed correctly in the hangar window 20 years ago
tron dba55a5742 (svn r1701) Style police ^^ 20 years ago
bjarni 72b9358291 (svn r1700) - Fix: Hacked clients can no longer be used to build vehicles that are not available yet (Hackykid) 20 years ago
bjarni 690027d1ab (svn r1699) - Feature [autoreplace] a plane will now go to the hangar right after landing if it needs to be replaced
- Fix     [autoreplace] fixed a typo that could prevent autoreplaced aircraft from automatically go to a hangar
20 years ago
bjarni e7e26a9db0 (svn r1698) - Feature [autoreplace] helicopters will now go to the nearest hangar if they are set to autoreplace and don't have any airport with a hangar in
schedule
20 years ago
bjarni f7774a007a (svn r1652) Fix: train and road vehicle lists are now redrawn when vehicles enters/leaves a depot (Hackykid)
fix: the ship status bar was not updated properly after a breakdown if show_speed was off (Hackykid)
20 years ago
dominik 8f0ea94363 (svn r1651) Fix: [ 1098696 ] Airport shadow remains after crashing 20 years ago
bjarni 879ca66041 (svn r1640) fix: now helicopters will use a hangar in schedule to be replaced in, even if they are only set to service there. Since helicopters are serviced at helipads, they will only go there if they needs to be replaced or renewed. 20 years ago
bjarni dcacc38d81 (svn r1636) fix: helicopters now go to a hangar if they are set for replacement or needs to be renewed 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
celestar 321c753418 (svn r1565) -Fix: [ 1104969 ] Aircraft in hangar messages are now revalidated before
display
-CodeChange: replaced one if (foo) return true else return false by
return (foo)
20 years ago
Celestar a003bb0b0e (svn r1556) -Fix: Vehicle list updates should now really work 20 years ago
celestar 6330806531 (svn r1554) -Fix: [ 1103187 ] Order Check messages are now validated before
displayed, so that there are no stray error messages any more.
-Feature/Fix: Order Checking is only execute for ONE vehicle in an
order-share system
20 years ago
truelight 07647737d5 (svn r1544) -Fix: SwapOrder did not use AssignOrder, which caused the saveroutine to
crash from time to time
-Codechange: added const before 'Order *' where possible
20 years ago
tron 61a6bc544d (svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts 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
celestar 3f74c9884e (svn r1521) -Fix: Ship Vehicle Lists are now redrawn correctly
-Codechange: added some const to last commit
-Codechange: Ship and Aircraft lists are now update on order change, not
on new day
20 years ago
tron dd6db73069 (svn r1520) Trim 134 (!) lines with trailing whitespace ): 20 years ago
celestar cd6904c36b (svn r1519) -Fix: [1102776], [1099535] Aircraft vehicle lists are now redrawn when an aircraft arrives in the depot. Station-specific vehicle lists are now redrawn daily as well (not only the master list) 20 years ago
celestar 5bc8829167 (svn r1440) -Feature: Allows more flexible airport layouts now, as the number of
terminals in every group can be freely chosen
-Codechange: AT_OILRIG is now 15, so that new airports can be added
easily.
20 years ago
tron 414ac3286b (svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY] 20 years ago
celestar b2c47cf7d6 (svn r1412) -Feature/Fix: Aircraft refit options have been restricted to "sane"
values.
-Feature: aircraft can now be refitted "mail-only"
-Feature: Passengers aircraft now ignore the amount of mail for "full
load any" options
20 years ago
celestar 91bf7a7448 (svn r1410) Replaced all occurences of 'passanger' by 'passenger' in the code 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