summaryrefslogtreecommitdiff
path: root/vehicle.c
AgeCommit message (Collapse)Author
2006-10-23(svn r6905) - Codechange: Copy cargo subtype when cloning vehicles.peter1138
2006-10-21(svn r6884) -Codechange: Add strict bounds checking in string formatting system.Darkvater
The last parameter should point to the end of the buffer (eg lastof(buf)) Courtesy of Tron.
2006-10-16(svn r6788) - Codechange: Add and use a function to test if a string ID is a ↵peter1138
custom name.
2006-10-08(svn r6698) -Code cleanup r6697: simplified getting the string of the ↵bjarni
vehicle type
2006-10-08(svn r6697) -Fix: [order refit] if an order refit fails, the vehicle is now ↵bjarni
stopped and the player gets a message (like vehicle stopped in depot) This should prevent a vehicle from failing to be refitted and then show up and block a station with full load. In such a case, it's better to stop in a depot (that will not stop any other vehicles) and notify the owner
2006-10-08(svn r6696) -Codechange: changed all comparision for refit cargo in orders ↵bjarni
against CT_NO_REFIT to checks for valid cargo IDs This should prevent any bugs made by mixing up CT_NO_REFIT and CT_INVALID
2006-10-07(svn r6676) -Fix: [vehicle list windows] mass start/stop now works correctly ↵bjarni
in shared orders and station lists
2006-10-05(svn r6653) -Fix r6624: [autoreplace] autoreplace will no longer replace a ↵bjarni
vehicle if the old type can refit to the cargo types being used in the refit orders and the new one lacks one or more of those refit capabilities
2006-10-05(svn r6651) -Coding feature: added the windowevent WE_INVALIDATE_DATAbjarni
This gives the ability to invalidate some window data and recalculate as needed instead of doing it for each WE_PAINT This event is called right away when using InvalidateWindowData(), so it may be a good idea to set a bool or similar in the window or similar and then act on that bool in WE_PAINT instead of doing a lot of stuff in WE_INVALIDATE_DATA as it might be called more than once before WE_PAINT is called InvalidateWindowData() will not automatically repaint the window, so if you want to repaint it as well, you need to mark it dirty as well. Made the depot windows use WE_INVALIDATE_DATA to set when to generate the engine and wagon lists instead of at each redraw It makes no sense to regenerate the list when say using the scrollbar if we know that no vehicle have entered or left the list NOTE: currently there is a piece of code to generate the list when it's not needed and compare it to the stored list and assert if they mismatch This check is somewhat slow and kills the whole idea of WE_INVALIDATE_DATA, so it's a short lived one to verify that InvalidateWindowData() is used everywhere where it's needed
2006-10-05(svn r6648) -Codechange: simplified CmdDepotMassAutoReplace() by changing a ↵bjarni
switch-case into using a function, that was added in r6647
2006-10-05(svn r6646) -Codechange: [vehicle list window] Cleaned up the drawing codebjarni
This moved a few of the strings and sprites a few pixels. Hopefully this will work out ok.
2006-10-04(svn r6640) -Fix: [autoreplace] autoreplace can now use the money for ↵bjarni
selling the old vehicle to build the new one Say we got 40k for selling the old one and the new one costs 60k, then the player only needs 20k to replace The new engine is still built before selling the old one for various reasons, but now the player gets a loan of the sell value, which is always repaid when replace fails or the old engine is sold. The player will never notice this loan.
2006-10-04(svn r6637) -Codechange: merged all (vehicle type)EnterDepot into ↵bjarni
VehicleEnterDepot() This revealed duplicated code like aircraft lists got invalidated twice Moved invalidation of the vehicle detail window to VehicleServiceInDepot() as it should always be updated when serviced
2006-10-03(svn r6624) -Feature: added ability to add refit commands to vehicle orders ↵bjarni
(can only be done in goto depot orders) Example: make a train transport iron ore from A to B, then it visits a depot and refits to steel It then transport steel back to A or near A if there is a factory and then it visits another depot to refit to iron ore again This is controlled in the orders. If a goto depot order is lightlighted, then "Unload" changes to "Refit" Control click "Refit" removes the refit part of the order (as the tooltip says) The player will still pay the normal refit costs Known issues: If a vehicle is not in a depot, then the refit window will fail to tell refitted cargo capacity Refit costs in the refit window can sometimes print 0 when it should not because the refit calculation is unaware that the vehicle will be refitted in between Warning: autoreplace got a protection against replacing something so you get a new cargo type, but it can fail here. In the iron ore/steel example, it can see that the vehicle carries iron ore and the new one can be refitted to iron ore, then it will replace. It will not check to see that it's valid for steel as well. This is something to look into in the future
2006-10-01(svn r6602) - Feature: we now support NewGRF livery refits, as used by ↵peter1138
DBsetXL, amongst others. This requires a savegame bump to save the cargo subtype.
2006-09-30(svn r6590) -Fix r6588: killed MSVC warnings for realglx
2006-09-30(svn r6588) -Fix r6582: killed some windows only warnings (thanks webfreakz ↵bjarni
for testing)
2006-09-30(svn r6586) -Feature: [depot window] added a vehicle list window with all ↵bjarni
vehicles having a certain depot in their orders It got one known issue though. The top bar got a plural issue so expect to see stuff like "1 trains" until we figure out why it behaves this way Added the button to the depot windows. Made the autoreplace button bigger while I was moving some widgets anyway Made road vehicle depot windows start with one more row to make room for the buttons
2006-09-29(svn r6582) -Codechange: changed GenerateVehicleSortList() to reuse the same ↵bjarni
allocation over and over if possible (like BuildDepotVehicleList() ) This will prevent some reallocations when sorting vehicle list windows It also prevents moving the whole array into a new one each time the list is generated/updated (it used to make the list in one array and then move it into another one each time) Also ensured that neither GenerateVehicleSortList() or BuildDepotVehicleList() will never allocate lists longer than the total number of vehicles in the game
2006-09-29(svn r6580) -Fix r6552: [depot window] fixed issue where vehicles sometimes ↵bjarni
failed to restart after being replaced Also fixed an issue where cost animation could fail to show (trigger events appeared to be linked for those two issues)
2006-09-29(svn r6579) -Fix r6552: [depot window] solved a condition where pressing ↵bjarni
autoreplace in a depot window could result in asserts It still got an issue where it fails to restart moving vehicles after they are replaced though. The cause of this will hopefully be found shortly
2006-09-29(svn r6570) -Feature: added "start all" and "stop all" buttons to the ↵bjarni
vehicle lists
2006-09-28(svn r6552) -Feature: [depot window] added a "autoreplace all vehicles in ↵bjarni
depot" button Like the "sell all" button, this one lacks a sprite as well. We will hopefully get one shortly
2006-09-27(svn r6542) -Feature: [depot window] added a "sell all vehicles in depot" buttonbjarni
It's right below the sell button (sell whole chain button for trains) It's still missing a sprite. That one will be added as soon as anybody draws something we can use To make room for this button, all depots except train depots now opens with an additional row and can't be resized shorter than that
2006-09-27(svn r6532) - Feature: Add support for NewGRF sound effects. Currently sound ↵peter1138
priority isn't supported.
2006-09-27(svn r6524) -Code cleanup r6515: cleaned up the command to start/stop all ↵bjarni
vehicles in a depot. IsWholeTrainInDepot() is removed as CheckTrainInDepot() could be used instead Cleaned up the check to see if a vehicle is valid for start/stop
2006-09-26(svn r6515) -Feature: added "start all" and "stop all" buttons to the depot ↵bjarni
windows
2006-09-24(svn r6503) -Codechange: added a function to tell what vehicles a depot containsbjarni
This will ensure that you can always get the same list when checking for vehicles in a depot (no need to duplicate code for each place, that needs such a list) Since the vehicles are only looped once for each redraw, drawing speed is around twice as fast (measured to be 114%-121% faster depending on the number of vehicles in the game)
2006-09-17(svn r6474) - Add a patch option to control display of liveries, allowing ↵peter1138
none, your own, or all companies.
2006-09-16(svn r6468) -Codechange r6464: now use error() when failing refit in ↵bjarni
autoreplace to ensure that such a failure will not break a game We should only reach this error() if there is a bug, that would otherwise make the vehicles carry a different type of cargo without telling the user This also kills the warning added in r6464 (oops)
2006-09-16(svn r6464) -Fix r6393: killed a warning when compiling without assertsbjarni
added an error popup in the game if autoreplace fails to refit Since it's only triggered by conditions bugs can trigger, it works kind of like a non-fatal assert in builds without asserts
2006-09-15(svn r6456) - Replace single colour scheme for passenger wagons with ↵peter1138
separate schemes for each of steam, diesel or electric engines. Savegames from the previous revision will not load.
2006-09-15(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This ↵peter1138
replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
2006-09-08(svn r6424) -Codechange: [autoreplace] removed a loop though all vehicles ↵bjarni
from each time the window is redrawn To do this, the player struct contains an array, that contains the count of each engine type that the player owns Those arrays are updated each time a vehicle is build or deleted and is calculated on load (it's not saved) It's possible to access the arrays outside of the autoreplace GUI, so feel free to read from them in other patches as well
2006-09-05(svn r6407) -Fix: Check return values of DoCommand() with CmdFailed and that ↵Darkvater
of DoCommandP with a boolean type.
2006-09-05(svn r6394) -Fix r6393: removed a warning originally removed in r6376 ↵bjarni
accidentally readded in r6393
2006-09-05(svn r6393) -Fix: [autoreplace] now refit costs are added to the estimated ↵bjarni
costs (could spend more than allowed when estimate and actual cost were not the same) -Fix: [autoreplace] fixed a very rare failure when building an engine could cost more than the player could pay before selling the old one this happened when the replacing the front cost so much that the the rear end didn't have enough money to build as expected now the estimate keeps track of the price for the wagons/engines in front of the unit it's currently looking at -Codechange: [autoreplace] added function to learn if and what cargo type to refit to. Needed to allow the estimation to tell refit costs
2006-09-04(svn r6386) -Fix(r6376): removed a warningglx
2006-09-04(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines ↵rubidium
more uniform. -Cleanup: whitespace alignment of a few tables.
2006-09-04(svn r6376) -Codechange: [vehicle refit] moved all refit cost calculations ↵bjarni
into GetRefitCost() Now it's possible to tell refit costs for an EngineID without actually having build a vehicle
2006-09-03(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as ↵tron
large as any type of destinataion (StationID, DepotID, WaypointID) it can hold DestinationID being a union of these types is just hassle without benefit and cannot be handled correctly everywhere because of local lack of information
2006-09-01(svn r6300) -Fix: FS#321 autoreplace / wagon removalbjarni
turned out to be a failure to run the wagon remoral code if the player didn't have enough money to do the replace after the replace took place the cost animation failed to show in this condition as well Now the test is not run anymore after the replace took place
2006-09-01(svn r6291) -Feature: Vehicle lists from the station window now also got the ↵bjarni
goto depot button -Codechange: unified the code for mass goto depot to avoid duplicated code -Fix: Vehicles already on the way to depots will not be cancelled by mass goto depot (made it really hard to send all vehicles at once)
2006-08-31(svn r6284) -Code Cleanup r6282: cleaned up the code a bitbjarni
2006-08-31(svn r6282) -Codechange: made a function to create the vehicle list for ↵bjarni
vehicle list windows this list is also used by mass goto depot to ensure that they use the same vehicles right now only the list of all vehicles use this for goto depot, but eventually all the types will use this
2006-08-31(svn r6280) -Codechange: Use the same naming for trains as for other vehicles:Darkvater
CMD_SEND_TRAIN_TO_DEPOT instead of CMD_TRAIN_GOTO_DEPOT
2006-08-30(svn r6249) -Fix: fixed assert when pressing goto depot in an empty list ↵bjarni
(forgot to disable the button in this condition) -Code cleanup r6246: simplified SendAllVehiclesToDepot() and moved an { in PlayerVehWndProc()
2006-08-30(svn r6246) -Feature: added the many times requested "send all vehicle to ↵bjarni
depot" button it's located in the vehicle list screen and does the same as in the shared orders window (send all vehicles in list to a depot) it will still not inform the player if a vehicle failed to find a depot, so don't take for granted that all of them go
2006-08-29(svn r6229) -Feature: Shared order lists now got a "goto depot" buttonbjarni
this will try to send all vehicles in the list to depots/hangars currently if one fails to find a depot, it will not tell the player
2006-08-28(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else ↵rubidium
{' -> '} else {', tabs between code and comment, etc.