summaryrefslogtreecommitdiff
path: root/order_cmd.c
AgeCommit message (Collapse)Author
2005-11-07(svn r3155) -Feature: [autoreplace] autoreplace can now remove cars from too ↵bjarni
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
2005-10-23(svn r3078) Some more stuff, which piled up:tron
- 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
2005-09-16(svn r2959) - Fix: [ 1266036 ] Fix [ 1236317 ] Vehicles with and TRANSFER ↵Darkvater
order don't have that order restored (i_dachev). Also disallow non-train type vehicles to have non-stop orders.
2005-08-06(svn r2819) Make variables, which are exclusive for internal use of the ↵tron
save/load code, static in saveload.c
2005-07-24(svn r2701) Insert Id tags into all source filestron
2005-07-22(svn r2673) Include functions.h directly, not globally via openttd.htron
2005-07-20(svn r2650) Convert many explicit shifts+ands to extract bits to invocations ↵tron
of GB - should be a bit nicer to read
2005-07-17(svn r2599) Fix: Road vehicle multistop handling used NPF even if NPF was ↵ludde
off???? - Also simplified/optimized the code. - Now it uses manhattan distance as an approximation instead of actual distance to find the distance. Much faster.
2005-06-15(svn r2441) -Feature: You can now give transfer order to set up feeder systemscelestar
2005-06-02(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.Darkvater
2005-06-01(svn r2390) - Codechange: Fix some warnings on GCC 4.0.0hackykid
2005-05-30(svn r2387) - CodeChange: made the saveload code more readable and also ↵Darkvater
removed the 'byte' saveload arrays which means you can save an array of more than 255 elements, or bigger structs than 255 bytes. This doesn't yet solve the problem that a chunk can be a maximum of 16384 big. - Fix: also fix an unnoticed error in SlSaveLoadConv() due to wrong types.
2005-05-15(svn r2324) Introduce _cmd_text for passing strings with a command instead ↵tron
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.
2005-05-12(svn r2300) - CodeChange: check the last number of commands, now only the ↵Darkvater
refit ones remain, and some server-only commands. - CodeChange: remove cmd-misuses CmdStartScenario() and CmdDestroyCompanyHQ() - Fix (invisible): when parameter checking CmdRestoreOrderIndex() the vehicle did not have its orders yet, so it would fail. So move doing this until AFTER the orders have been added back in RestoreVehicleOrders()
2005-05-12(svn r2297) - CodeChange: server-check the next batch of commands.Darkvater
- 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.
2005-05-11(svn r2293) - Fix (regression): You couldn't modify commands anymore; fixed. ↵Darkvater
(|| and && are kinda confusing with !=) :P
2005-05-11(svn r2290) - CodeChange: protect the next batch of commands. This brings us ↵Darkvater
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-03(svn r2264) - Fix: [ 1060686 1187655 ] Changing the full-load flag on the ↵matthijs
current order doesn't take effect immediately. (glx)
2005-05-02(svn r2256) - Fix: Trains cannot find a depot when they are in a tunnel. (glx)matthijs
- 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(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for shipsmatthijs
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.
2005-04-30(svn r2237) - Fix (regression): [ 1192284 ] Bug: Ship refuses to add buoy to ↵Darkvater
its orders (init100)
2005-04-22(svn r2222) Check the parameters of Cmd{Insert,Delete,Modify,Skip}Order() ↵tron
and CmdRestoreOrderIndex(): - Check if the vehicle exists - Check if the vehicle belongs to the correct player - Check if the new order is valid (type, destination, flags) (CmdInsertOrder)
2005-04-11(svn r2184) - CodeChange: remove the copy of ClearSlot(), which is now also ↵Darkvater
called for CmdSkipOrder(). This also fixes the involuntary crash introduced 2 revisions ago
2005-04-10(svn r2178) Postprevcommitaddendum: add debug.h if you use DEBUG()Darkvater
2005-04-10(svn r2177) - Fix: Fix a slot desync with setting the invalid slot to the ↵Darkvater
correct value
2005-02-06(svn r1818) -Add: Dynamic orders (up to 64k orders)truelight
2005-02-05(svn r1801) -Fix [Multistop] Fixed a crash that occured when copying orders ↵celestar
due to not checking a pointer to be non-NULL
2005-02-02(svn r1770) -Fix: Hopefully last pieces of code that are containing a station-idtruelight
(and should be an uint16, not uint8)
2005-01-31(svn r1751) - Feature: New PathFinder (NPF).matthijs
- 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(svn r1749) Move the functions which calculate distances to map.[ch] and ↵tron
give the more meaningful names
2005-01-29(svn r1721) -Feature: It is now possible to build multiple road stations (up ↵celestar
to 8) on a single station. Thanks to: Truelight for the saveload code, Darkvater and Hackykid for network testing and Tron for proof-reading 1500 lines of diff.
2005-01-23(svn r1612) -Fix: made sure that ->next pointers are set to NULLtruelight
2005-01-23(svn r1607) -Fix: When deleting an order, the next pointer was not cleared, truelight
resulting in some unusual behavoir from time to time
2005-01-22(svn r1594) Convert all undefined parameter lists to (void) and add the ↵tron
appropriate warning flags in the Makefile
2005-01-18(svn r1556) -Fix: Vehicle list updates should now really workCelestar
2005-01-17(svn r1554) -Fix: [ 1103187 ] Order Check messages are now validated beforecelestar
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
2005-01-16(svn r1544) -Fix: SwapOrder did not use AssignOrder, which caused the ↵truelight
saveroutine to crash from time to time -Codechange: added const before 'Order *' where possible
2005-01-15(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.truelight
-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!
2005-01-15(svn r1521) -Fix: Ship Vehicle Lists are now redrawn correctlycelestar
-Codechange: added some const to last commit -Codechange: Ship and Aircraft lists are now update on order change, not on new day
2005-01-06(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns ↵truelight
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 *.
2004-12-29(svn r1297) Language fixes in the source.. (ln-)miham
2004-12-29(svn r1295) -Fix: [ 1092499 ] Copy order was fucked up, because memcpy said: truelight
sizeof(uint16), instead of sizeof(Order).
2004-12-19(svn r1177) Enable non-stop flag for waypointstron
2004-12-19(svn r1175) -Fix: [ 1086375 ] Backup-order-list was not closed with an ↵truelight
OT_NOTHING, resulting in order-lists mixing together (maybe tnx to Darkvater, not sure though..)
2004-12-19(svn r1164) Redid fix from revision 1163 to work with all patch settingsdominik
2004-12-18(svn r1163) Fix: [ 1087403 ] Crashed trains aren't reported to have too few ↵dominik
orders any more
2004-12-10(svn r1009) -Feature: per-station vehicle liststron
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.
2004-12-05(svn r955) Replace uint16 for orders with struct Ordertron
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.
2004-12-04(svn r942) -Merged branch/network back into the trunktruelight
2004-12-02(svn r901) Small step in the process to clean up the DPARAM mess:tron
- 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