Commit Graph

133 Commits

Author SHA1 Message Date
Darkvater c626555f68 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
- CodeChange: renamed CmdTrainGotoDepot() to CmdSendTrainToDepot() to be consistent with other depot commands.
- CodeChange: 'newgame' console command now calls the unabused GenRandomNewGame(). For the server it still creates a new game, a client quits the game and continues in SP.
- CodeChange: in the game-difficulty window, setup the disabled buttons on window creation, not every redraw.
2005-05-12 00:18:30 +00:00
Darkvater 729066e407 (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. 2005-05-11 16:17:03 +00:00
Darkvater 5e6923e936 (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.
2005-05-11 00:00:27 +00:00
Darkvater ab954a934a (svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
- CodeChange: changed the airport gui airport-type checking. Added function GetValidAirports() that returns bitmasked availibility, is also used for checking.
- CodeChange: to check tree-planting, 2 const arrays have been moved to table/tree_land.h (type and count)
- CodeChange: added IsTownIndex() in following of IsStationIndex(), etc.
- Fix (regression): road tunnels did not work anymore, forgot that their type was 0x200 (documented now)
2005-05-09 22:33:00 +00:00
Darkvater 74671bd2c9 (svn r2283) - Fix (regression): [ 1197493 ] train_gui.c:1341: failed assertion ..., somehow RebuildVehicleList() got lost during the rewrite :P 2005-05-08 20:53:02 +00:00
matthijs 0e08878a68 (svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
- Add: [NPF] Reversing inside of depots now has a penalty. It also applies to trains only, other vehicles shouldn't bother reversing.
- Fix: [NPF] When checking whether to reverse a train, the trackdir of the first loc was used instead of the last vehicle as a starting node for pathfindig.
	This might have caused some trains not reversing when they should have (or vice versa). Typo introduced when converting to GetVehicleTrackdir() in r2256.
- CodeChange: [NPF] Removed duplicate code by letting NPFRouteTjoStationOrTile() call NPFRouteToStationOrTileTwoWay().
- Add: [NPF] NPFRouteToDepotBreadthFirstTwoWay() to find a depot while also looking backwards.
- Add: It is now possibly to specify a path cost for aystar starting nodes.
2005-05-07 22:00:36 +00:00
Darkvater adf929fef5 (svn r2274) - Codechange: some comments, parentheses and EngineID typedef for engine_type 2005-05-06 16:13:44 +00:00
Darkvater 203a84dd0b (svn r2270) - Fix/Codechange: fix up selling rail vehicles. Try to be smart about it. When selling dual-headed trains, also sell the rear end; if the now-first wagon is an engine, make it a train. When selling the whole train, try to leave dual-headed setups intact 2005-05-05 20:46:14 +00:00
matthijs 0699c54c45 (svn r2262) - Fix: Assertion when vehicle in a depot wants to do pathfinding.
GetVehicleTrackdir now tries to get a valid trackdir as much as possibly, by assuming that a vehicle is facing outwards in a depot or road station, for example.
- Codechange: [Multistop] Multistop now also tries to find a slot for road vehicles that are in stations, since the pathfinder now properly handles that.
2005-05-03 20:45:23 +00:00
matthijs 24943a4759 (svn r2261) - Fix: When crashed vehicles try to find a depot for servicing, openttd asserts.
Crashed vehicles shouldn't find depots anyway...
2005-05-03 19:31:33 +00:00
matthijs 6eb094c726 (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.
2005-05-02 23:59:11 +00:00
matthijs 4eeac3ea75 (svn r2202) - Fix: [NPF] When a vehicle could not reach its target, it would choose a random direction. It will now try to get as close as possible. 2005-04-15 13:48:08 +00:00
tron 02f5818912 (svn r2189) Introduce and use IsCompatibleTrainStationTile()
This should prevent trains, which are longer than the station, to turn around without stopping under certain circumstances and fix speed limit for trains entering a station, when realistic accerlation is used
2005-04-12 10:31:26 +00:00
tron 277d9d237b (svn r2188) Revert r2185, because trains always accerlated (Requested by Celestar) 2005-04-12 09:21:04 +00:00
tron e00785a855 (svn r2187) Implement a slightly better workaround than r1588 did. (Joint effort with Celestar) 2005-04-12 09:17:51 +00:00
celestar 4601cd1366 (svn r2185) -Fix: Made sure that the realistic acceleration does not freeze trains anymore 2005-04-11 21:10:47 +00:00
celestar a714444a8e (svn r2180) -Fix: Deceleration code now only takes into account rail station tiles for computing the remaining distance 2005-04-11 14:59:06 +00:00
matthijs 6409e6efaf (svn r2179) - Fix: [ 1121437, 1114228 ] Vehicles not entering depots for auto servicing. 2005-04-11 12:08:09 +00:00
pasky 2857b71214 (svn r2119) - Fix: [ 1172878 ] Trains "Go to depot" button: click twice skip to next order (patch by Loic GUILLOUX). I also added short explanation of OF_/OFB_ difference to order.h. 2005-04-02 01:08:01 +00:00
celestar c68cfdeeca (svn r2105) -Codechange: Added a cache for the first vehicle of a chain to increase performance, especially with many long trains 2005-03-29 11:19:10 +00:00
truelight 1eab014524 (svn r2058) -Fix: hopefully this fixes the reverse-train-in-depot-bugs (plural) 2005-03-25 12:07:26 +00:00
celestar 9cde836d08 (svn r2056) -Fix: [ 1166999 ] Strange cast removed. Thanks Tron 2005-03-25 11:03:05 +00:00
celestar 6e142d523e (svn r2055) -CodeChange: Begun introducting StationID 2005-03-25 10:40:58 +00:00
truelight 83637d164e (svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
-Codechange: rewrote some functions while moving waypoint-stuff
-Add: added support for 64k waypoints
-Fix: made the waypoint struct a bit more logic (no bit-fucking)
2005-03-24 17:03:37 +00:00
tron b19553574e (svn r2035) - Remove unneeded realloc()
- Use TileOffsByDir() instead of home brewed table
2005-03-23 08:24:13 +00:00
celestar fbc2eacade (svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful 2005-03-20 08:43:29 +00:00
bjarni acb1fb2e30 (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)
2005-03-19 21:16:22 +00:00
darkvater cc99c3e262 (svn r2011) - Fix: [ 1162209 ] Fix OS/2 build (orudge) #2 2005-03-15 12:21:59 +00:00
tron e5121e70d0 (svn r1979) Const correctness 2005-03-09 21:54:52 +00:00
tron e6e3e69da4 (svn r1976) Cleanups - mostly indentation and fiddling with loops 2005-03-09 19:09:04 +00:00
matthijs 4206d8f955 (svn r1965) - Fix: [NPF] Forgot to update one line where NPFGetFlag() should have been used two commits ago.
Message for last commit should have been:
- Add: [NPF] Added penalty for curves, straighter paths are now preferred when the length is the same. (HackyKid)
2005-03-08 20:13:21 +00:00
matthijs 232e41f2ff (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
- Add: [NPF] NPFGetFlag() and NPFSetFlag() to wrap NPF node flag handling
2005-03-08 19:54:10 +00:00
Celestar 7473cef063 (svn r1959) -Fix: Repaired two memleaks I have hacked :( 2005-03-08 16:27:26 +00:00
pasky a0c157eea8 (svn r1947) As in r1946, permit DC_QUERY_COST even on non-depot tiles - so that it works for the ai_new. It is de iure not a bug yet but let's be safe against future annoying headaches. Signed-Off-By: TrueLight 2005-03-06 16:58:42 +00:00
tron 2e3465cb49 (svn r1942) Fix r1938 2005-03-06 15:15:27 +00:00
tron aee2b0c50a (svn r1938) Miscellaneous cleanups: const correctness, kill a goto, ... 2005-03-06 12:54:19 +00:00
tron e748280622 (svn r1936) End some void-pointer-as-int-abuse; this also fixes a latent bug where a TileIndex was only 24bit wide (on 32bit architectures) 2005-03-06 12:41:18 +00:00
tron a4a09e73d5 (svn r1935) Missing braces; while here turn the ifs into a single switch 2005-03-06 12:33:33 +00:00
tron a747e2bb97 (svn r1934) Small cleanup (uint -> TileIndex, (uint)-1 -> INVALID_TILE and similar stuff) 2005-03-06 12:31:07 +00:00
Darkvater 232fffffac (svn r1922) - Fix: Disappearing of crashed trains inside tunnels were not checked properly. 2005-03-03 23:26:35 +00:00
tron 51eef8c5b7 (svn r1898) Remove some unused macros from macros.h and move some others to more appropriate headers 2005-02-22 12:48:03 +00:00
celestar d06f52a7f0 (svn r1891) -Fix: [ 1143587 ] carriages of newgrfs can be refitted again 2005-02-20 07:47:42 +00:00
tron 6b83a05ada (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
2005-02-12 15:53:32 +00:00
celestar f758bd769b (svn r1841) -Fix: [ 1117538 ] non-stop orders are no longer accidently skipped 2005-02-07 12:47:29 +00:00
matthijs c5c5c9b17c (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.
2005-02-06 22:36:08 +00:00
truelight e9c93f9c0c (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)
2005-02-06 10:18:47 +00:00
truelight 97728357e4 (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)
2005-02-04 14:24:23 +00:00
truelight ab3ed5c431 (svn r1770) -Fix: Hopefully last pieces of code that are containing a station-id
(and should be an uint16, not uint8)
2005-02-02 16:16:43 +00:00
matthijs a2dec6c32a (svn r1751) - Feature: New PathFinder (NPF).
- Supports trains, road vehicles and ships.
	- Uses A* pathfinding (same codebase as the new ai).
	- Currently unlimited search depth, so might perform badly on large maps/networks (especially ships).
	- Will always find a route if there is one.
	- Allows custom penalties for obstacles to be set in openttd.cfg (npf_ values).
	- With NPF enabled, ships can have orders that are very far apart. Be careful, this will break (ships get lost) when the old pathfinder is used again.
- Feature: Disabling 90 degree turns for trains and ships.
	- Requires NPF to be enabled.
	- Ships and trains can no longer make weird 90 degree turns on tile borders.
- Codechange: Removed table/directions.h.
	- table/directions.h contained ugly static tables but was included more than once. The tables, along with a few new ones are in npf.[ch] now. Better suggestions for a location?
- Fix: Binary heap in queue.c did not allocate enough space, resulting in a segfault.
- Codechange: Rewritten FindFirstBit2x64, added KillFirstBit2x64.
- Codechange: Introduced constant INVALID_TILE, to replace the usage of 0 as an invalid tile. Also replaces TILE_WRAPPED.
- Codechange: Moved TileAddWrap() to map.[ch] 
- Add TileIndexDiffCByDir(), TileIndexDiffCByDir(). 
- Codechange: Moved IsTrainStationTile() to station.h
- Add: IsRoadStationTile() and GetRoadStationDir().
2005-01-31 11:23:10 +00:00
tron 7bbcf5875c (svn r1749) Move the functions which calculate distances to map.[ch] and give the more meaningful names 2005-01-31 07:23:15 +00:00