Commit Graph

466 Commits (jgrpp)

Author SHA1 Message Date
Michael Lutz 41fa16f325 Codechange: Don't use globals for return values from vehicle command procs. 2 years ago
Michael Lutz e08b3abe7f Codechange: Un-bitstuff group and autoreplace commands. 2 years ago
Michael Lutz 21675ec7e2 Codechange: Un-bitstuff vehicle/engine commands. 2 years ago
Michael Lutz 211c630cbe Codechange: Un-bitstuff order commands. 2 years ago
Michael Lutz 4f3ea3907e Codechange: Un-bitstuff commands taking a ClientID (i.e. CMD_CLIENT_ID). 2 years ago
Michael Lutz e740c24eb7 Codechange: Template DoCommand to automagically reflect the parameters of the command proc.
When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
2 years ago
Michael Lutz 7048e1522f Codechange: Move flags in CommandProc in front of the command arguments. 2 years ago
Michael Lutz 33ca4f2b99 Codechange: Let the compile generate the master command table out of templated command traits.
This is using a non-intrusive type-traits like templated system, which
allows compile-time validation that the command table and the command
enum match up.
2 years ago
Michael Lutz a38bbefe1b Codechange: Untangle command code, flags and error string for DoCommand*. 2 years ago
Michael Lutz b6933a2ebd Codechange: Move command arguments to the back of the DoCommand function call. 2 years ago
Jonathan G Rennison faf32200cf Merge tag '12.0-beta1' into jgrpp-beta
# Conflicts:
#	CMakeLists.txt
#	bin/ai/CMakeLists.txt
#	bin/game/CMakeLists.txt
#	src/build_vehicle_gui.cpp
#	src/console_cmds.cpp
#	src/core/overflowsafe_type.hpp
#	src/fios.cpp
#	src/lang/english.txt
#	src/lang/german.txt
#	src/lang/korean.txt
#	src/lang/polish.txt
#	src/network/core/game_info.cpp
#	src/network/core/game_info.h
#	src/network/core/tcp_game.cpp
#	src/network/core/tcp_game.h
#	src/network/network.cpp
#	src/network/network_client.cpp
#	src/network/network_client.h
#	src/network/network_coordinator.cpp
#	src/network/network_gui.cpp
#	src/network/network_server.cpp
#	src/network/network_server.h
#	src/newgrf_engine.cpp
#	src/openttd.cpp
#	src/rev.cpp.in
#	src/settings_type.h
#	src/train.h
#	src/train_cmd.cpp
3 years ago
Jonathan G Rennison a026d82c6b Allow cloning trains directly from the template train list
See: #312
3 years ago
SamuXarick 76b8343777
Fix #9392: Return a valid value with GetBuildWithRefitCapacity when AIs are maxed out in vehicles (#9393) 3 years ago
Rubidium d31a535c87 Cleanup: remove some unneeded c_str() calls 3 years ago
rubidium42 2e136285e1 Codechange: move from C-string to std::string for DoCommand 3 years ago
rubidium42 661728558e Codechange: let IsUnique.* functions accept std::string 3 years ago
Jonathan G Rennison a15e26f369 NewGRF: Elide unmasked vehicle callbacks where possible
This includes:
* CBID_VEHICLE_32DAY_CALLBACK
* CBID_VEHICLE_REFIT_COST
* CBID_VEHICLE_MODIFY_PROPERTY
  This is on a per-property basis

The main benefit of this is to avoid callbacks not handled by the
vehicle's current sprite group from using the full graphics chain as
the "default" branch in the callback switch.
In the case where the graphics chain is long/expensive, a lot of work
had to be done before a callback failure result was eventually returned.
3 years ago
Jonathan G Rennison 27b65dadbc Refresh lookahead when starting train from stationary 3 years ago
Jonathan G Rennison f4e29071be Merge tag '1.11.0-beta2' into jgrpp
# Conflicts:
#	.github/workflows/ci-build.yml
#	.github/workflows/release.yml
#	CMakeLists.txt
#	src/blitter/32bpp_optimized.cpp
#	src/debug.cpp
#	src/gfx.cpp
#	src/gfx_func.h
#	src/lang/czech.txt
#	src/lang/english.txt
#	src/lang/italian.txt
#	src/lang/swedish.txt
#	src/lang/ukrainian.txt
#	src/network/network_server.cpp
#	src/os/windows/crashlog_win.cpp
#	src/os/windows/win32.cpp
#	src/pathfinder/follow_track.hpp
#	src/screenshot.cpp
#	src/settings_type.h
#	src/spritecache.cpp
#	src/vehicle_gui.cpp
#	src/video/sdl2_v.cpp
#	src/video/video_driver.cpp
#	src/video/video_driver.hpp
#	src/video/win32_v.cpp
3 years ago
Patric Stout 9a3dbf3122
Fix 02e770ff: allow estimating CloneVehicle if short on money (#8748)
CheckCompanyHasMoney() was also executed when not using DC_EXEC,
resulting in an error about shortage of money instead of the
estimation.
This mostly is a problem for AI players, as they will have no
way to know how much it would have cost.
3 years ago
Jonathan G Rennison b7ddd486cf Merge branch 'master' into jgrpp
# Conflicts:
#	cmake/CompileFlags.cmake
#	src/aircraft_cmd.cpp
#	src/blitter/32bpp_anim.cpp
#	src/cargopacket.cpp
#	src/cheat_gui.cpp
#	src/company_cmd.cpp
#	src/company_gui.cpp
#	src/core/pool_func.hpp
#	src/date.cpp
#	src/economy.cpp
#	src/error_gui.cpp
#	src/ground_vehicle.cpp
#	src/ground_vehicle.hpp
#	src/group_gui.cpp
#	src/industry_cmd.cpp
#	src/lang/dutch.txt
#	src/lang/french.txt
#	src/lang/german.txt
#	src/linkgraph/linkgraph_gui.cpp
#	src/linkgraph/mcf.cpp
#	src/network/network_content.cpp
#	src/network/network_server.cpp
#	src/network/network_udp.cpp
#	src/newgrf_engine.cpp
#	src/newgrf_station.cpp
#	src/order_cmd.cpp
#	src/order_gui.cpp
#	src/pathfinder/follow_track.hpp
#	src/pathfinder/yapf/yapf_common.hpp
#	src/saveload/saveload.cpp
#	src/settings_gui.cpp
#	src/station_cmd.cpp
#	src/station_kdtree.h
#	src/string_func.h
#	src/table/settings.ini
#	src/tgp.cpp
#	src/timetable_cmd.cpp
#	src/timetable_gui.cpp
#	src/toolbar_gui.cpp
#	src/town_cmd.cpp
#	src/train_cmd.cpp
#	src/train_gui.cpp
#	src/tree_gui.cpp
#	src/tunnelbridge_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_gui.cpp
#	src/video/sdl2_v.cpp
#	src/video/sdl_v.cpp
#	src/video/win32_v.cpp
#	src/viewport.cpp
#	src/viewport_sprite_sorter_sse4.cpp
#	src/window.cpp
3 years ago
Jonathan G Rennison f9956d88c3 Merge branch 'master' into jgrpp
# Conflicts:
#	src/aircraft_cmd.cpp
#	src/company_gui.cpp
#	src/lang/arabic_egypt.txt
#	src/lang/czech.txt
#	src/lang/esperanto.txt
#	src/lang/faroese.txt
#	src/lang/finnish.txt
#	src/lang/german.txt
#	src/lang/korean.txt
#	src/lang/latvian.txt
#	src/lang/malay.txt
#	src/lang/polish.txt
#	src/lang/spanish.txt
#	src/lang/spanish_MX.txt
#	src/lang/unfinished/urdu.txt
#	src/main_gui.cpp
#	src/rail_cmd.cpp
#	src/rail_gui.cpp
#	src/road_cmd.cpp
#	src/settings_type.h
#	src/station_cmd.cpp
#	src/table/settings.ini
3 years ago
Jonathan G Rennison dd16145b03 TBTR: No longer use idle vehicles in depots by default 3 years ago
Jonathan G Rennison 515aeb04e0 TBTR: Add support for vehicle reversed flag 3 years ago
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 3 years ago
Patric Stout 725d793be1
Fix: don't allow cloning vehicles if cloning orders is failing (#8515)
Before this fix, any failing clone order was silently ignored
and you as user would never know till you checked the order list.
Evil.
3 years ago
Jonathan G Rennison 369c98e3e0 TBTR: Fix editing a template not refitting the head and artic/dual parts 3 years ago
Yourself cbaceb62d2 Fix: overflow in CloneVehicleName 4 years ago
Jonathan G Rennison bbbda0739b Add third DoCommand parameter p3 4 years ago
Jonathan G Rennison ca726d79f5 Add company setting for whether to add vehicle to group on copy-clone 4 years ago
Jonathan G Rennison cce6d731a1 TBTR: Delete orphaned virtual trains on client disconnection 4 years ago
Jonathan G Rennison 34a6445e77 TBTR: Use virtual train head in CmdReplaceTemplateVehicle
Check that train is virtual
4 years ago
Jonathan G Rennison 08eba56a28 TBTR: Check virtual train ownership when deleting/using as template 4 years ago
Jonathan G Rennison 65cdb35898 TBTR: Fix CmdDeleteVirtualTrain deleting non-head vehicles
Deleting a non-head virtual vehicle left a dangling next pointer on
the previous vehicle. Delete the head instead.
Check for non-virtual vehicles
4 years ago
Jonathan G Rennison 0d4a023c1d TBTR: Fix TemplateVehicle allocation check in CmdReplaceTemplateVehicle 4 years ago
Jonathan G Rennison bd2649c19e Avoid unnecessary redrawing of vehicle list windows
Redraw info section every tick if values have changed
4 years ago
Jonathan G Rennison 9af2c258fa TBTR: Preserve replacement flags when editing template 4 years ago
Jonathan G Rennison 5243cfd6d0 Use TinyString for custom name fields which are almost always empty 4 years ago
Jonathan G Rennison f8d6e781ba Merge branch 'master' into jgrpp
# Conflicts:
#	projects/openttd_vs140.vcxproj.filters
#	projects/openttd_vs141.vcxproj.filters
#	projects/openttd_vs142.vcxproj.filters
#	src/base_consist.h
#	src/company_base.h
#	src/newgrf_config.cpp
#	src/newgrf_config.h
#	src/openttd.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/saveload/station_sl.cpp
#	src/settings.cpp
#	src/signs_base.h
#	src/string.cpp
#	src/string_func.h
#	src/table/misc_settings.ini
#	src/table/settings.h.preamble
#	src/town_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_cmd.cpp
#	src/video/cocoa/cocoa_v.mm
#	src/video/null_v.cpp
4 years ago
Michael Lutz 63ccb36ef3 Codechange: Use std::string for most of the user-settable custom names. 4 years ago
Jonathan G Rennison 07c9621fcf Merge branch 'master' into jgrpp 4 years ago
frosch 9f2e23d8ba Fix #8093: Build+Refit changed game-state in command test run, and thus caused desyncs.
Use DC_AUTOREPLACE for actions that shall be reversibe, in this case:
- Do not rearrange free wagons in test-run.
- Do not discard OrderBackups.
The latter was not triggered by actual auto-replace, since it does not set a 'user'.
4 years ago
frosch 0f9dc88834 Fix: When build+refit an engine, do not refit any free wagons that may get attached. 4 years ago
frosch 68244393f1 Codechange: Unify the tests whether build+refit is in simulation-test or real-run. 4 years ago
Jonathan G Rennison b458c0c88d Fix free wagon re-arrangement when estimating train build and refit cost
See: #149
4 years ago
Jonathan G Rennison e071da35fa Fix 42481344: Fix template replacement index not being updated 4 years ago
Jonathan G Rennison 7960db35f2 Merge branch 'master' into jgrpp
# Conflicts:
#	config.lib
#	projects/openttd_vs140.vcxproj
#	projects/openttd_vs140.vcxproj.filters
#	projects/openttd_vs141.vcxproj
#	projects/openttd_vs141.vcxproj.filters
#	projects/openttd_vs142.vcxproj
#	projects/openttd_vs142.vcxproj.filters
#	src/aircraft_cmd.cpp
#	src/base_station_base.h
#	src/core/pool_type.hpp
#	src/disaster_vehicle.cpp
#	src/economy.cpp
#	src/engine.cpp
#	src/group.h
#	src/group_cmd.cpp
#	src/group_gui.cpp
#	src/lang/english.txt
#	src/lang/german.txt
#	src/linkgraph/linkgraph_gui.cpp
#	src/network/network_command.cpp
#	src/network/network_server.cpp
#	src/openttd.cpp
#	src/order_cmd.cpp
#	src/road_cmd.cpp
#	src/saveload/afterload.cpp
#	src/saveload/cargopacket_sl.cpp
#	src/saveload/linkgraph_sl.cpp
#	src/saveload/order_sl.cpp
#	src/saveload/station_sl.cpp
#	src/saveload/town_sl.cpp
#	src/saveload/vehicle_sl.cpp
#	src/screenshot.cpp
#	src/screenshot.h
#	src/settings_gui.cpp
#	src/settings_type.h
#	src/smallmap_gui.cpp
#	src/station.cpp
#	src/station_cmd.cpp
#	src/table/settings.ini
#	src/toolbar_gui.cpp
#	src/town_cmd.cpp
#	src/train.h
#	src/train_cmd.cpp
#	src/train_gui.cpp
#	src/vehicle.cpp
#	src/vehicle_base.h
#	src/vehiclelist.cpp
#	src/window_type.h
4 years ago
glx d8a1be48cd Codechange: Replace vehicle related FOR_ALL with range-based for loops 5 years ago
Jonathan G Rennison 0394a734ed TBTR: Fix refit issues in a9c4b80d, abfb141a 5 years ago
Jonathan G Rennison ec0b5e0ed0 Improve performance of departures window
See: #119
5 years ago
Jonathan G Rennison abfb141afd TBTR: Check that refit command virtual flag can't be used on non-virtual vehicles 5 years ago
Jonathan G Rennison a9c4b80d26 TBTR: Fix refitting of virtual trains costing actual money 5 years ago
Jonathan G Rennison cbdd9f84d8 Merge branch 'master' into jgrpp
# Conflicts:
#	src/console_gui.cpp
#	src/lang/korean.txt
#	src/video/sdl2_v.cpp
#	src/video/sdl2_v.h
#	src/window.cpp
#	src/window_gui.h
5 years ago
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 5 years ago
Jonathan G Rennison edfd378e93 Merge branch 'master' into jgrpp
# Conflicts:
#	source.list
#	src/blitter/32bpp_anim.cpp
#	src/linkgraph/linkgraphjob.cpp
#	src/order_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_type.h
5 years ago
Charles Pigott 73a2cee779 Fix: Quiet a bogus -Wmaybe-unitialized warning from GCC9 5 years ago
stormcone 163192b5e0 Fix #7667: Buying an engine after buying wagons doesn't give a complete train.
(cherry picked from commit 2e686ad5d5)
5 years ago
stormcone 2e686ad5d5 Fix #7667: Buying an engine after buying wagons doesn't give a complete train. 5 years ago
Jonathan G Rennison 1df56993ea Fix order backups being applied when using buy and refit 5 years ago
Jonathan G Rennison 8042150a35 Add error messages for vehicle build failure due to wrong depot owner and rail type 5 years ago
Jonathan G Rennison 9d861fb8a0 TBTR: Allow cloning virtual/template trains with unavailable engines 5 years ago
Jonathan G Rennison 674732cd68 Merge: Codechange: Use null pointer literal instead of the NULL macro 5 years ago
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 5 years ago
Jonathan G Rennison c3e90b61b7 Merge branch 'master' into jgrpp
# Conflicts:
#	src/vehicle_cmd.cpp
5 years ago
peter1138 8114bad033 Fix #7469: Desync when using build and refit feature. 5 years ago
Jonathan G Rennison ba34ec7ade Merge branch 'master' into jgrpp
Replace build and refit, and group collapse implementations
Fix template creation build and refit

# Conflicts:
#	Makefile.bundle.in
#	config.lib
#	src/animated_tile.cpp
#	src/blitter/32bpp_anim.hpp
#	src/blitter/32bpp_base.hpp
#	src/blitter/8bpp_base.hpp
#	src/blitter/null.hpp
#	src/build_vehicle_gui.cpp
#	src/command.cpp
#	src/command_func.h
#	src/console_gui.cpp
#	src/core/smallstack_type.hpp
#	src/date.cpp
#	src/debug.cpp
#	src/genworld_gui.cpp
#	src/ground_vehicle.hpp
#	src/group_gui.cpp
#	src/lang/korean.txt
#	src/linkgraph/linkgraph_gui.h
#	src/main_gui.cpp
#	src/misc_gui.cpp
#	src/network/core/game.h
#	src/network/core/packet.cpp
#	src/network/core/udp.cpp
#	src/network/core/udp.h
#	src/network/network_content.cpp
#	src/network/network_type.h
#	src/network/network_udp.cpp
#	src/newgrf_house.h
#	src/openttd.cpp
#	src/order_cmd.cpp
#	src/order_gui.cpp
#	src/os/unix/crashlog_unix.cpp
#	src/os/windows/crashlog_win.cpp
#	src/osk_gui.cpp
#	src/pathfinder/opf/opf_ship.cpp
#	src/rail_cmd.cpp
#	src/rail_gui.cpp
#	src/saveload/saveload.cpp
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/smallmap_gui.h
#	src/station_base.h
#	src/station_cmd.cpp
#	src/table/gameopt_settings.ini
#	src/table/newgrf_debug_data.h
#	src/table/settings.ini
#	src/timetable_gui.cpp
#	src/toolbar_gui.cpp
#	src/train_gui.cpp
#	src/vehicle.cpp
#	src/vehicle_gui.cpp
#	src/vehiclelist.cpp
#	src/viewport.cpp
#	src/widgets/dropdown.cpp
#	src/window_gui.h
5 years ago
Charles Pigott e453572b6a Codechange: Initialise a few variables that -flto seems to think could possibly be uninitialised 5 years ago
Henry Wilson c01a2e2a81 Codechange: Removed SmallVector completely 5 years ago
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 5 years ago
Henry Wilson a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 5 years ago
Henry Wilson 5795f66d2e Codechange: Replaced SmallVector::Contains() with std::find() pattern 5 years ago
Henry Wilson a690936ed7 Codechange: Replace SmallVector::Length() with std::vector::size() 5 years ago
Henry Wilson bfd79e59dc Codechange: Replace SmallVector::Clear() with std::vector::clear() 5 years ago
peter1138 e6bb90543e Change: Show additional cost and refitted capacity in build vehicle window. 5 years ago
peter1138 d54b6ac09b Feature: When filtering purchase list by cargo type, make buy button perform a refit if required. 5 years ago
Jonathan G Rennison c6fa43d767 TBTR: Remove duplicated function: SetupTemplateVehicleFromVirtual 5 years ago
Jonathan G Rennison 1340392497 Verify length of binary data in CmdBuildVehicle and CmdAddPlanLine 5 years ago
Jonathan G Rennison 2fdcc52321 Merge branch 'save_ext' into jgrpp
# Conflicts:
#	Makefile.src.in
#	findversion.sh
#	projects/determineversion.vbs
#	src/lang/dutch.txt
#	src/lang/korean.txt
#	src/network/network.cpp
#	src/network/network_client.cpp
#	src/rail.cpp
#	src/rail_cmd.cpp
#	src/saveload/afterload.cpp
#	src/ship_cmd.cpp
#	src/toolbar_gui.cpp
#	src/vehicle.cpp
5 years ago
PeterN d242875d27
Fix #7197: Invalidate depot buttons when necessary. (#7212) 5 years ago
Jonathan G Rennison 255b6adfc9 Merge branch 'master' into jgrpp
# Conflicts:
#	src/vehicle_cmd.cpp
5 years ago
Peter Nelson 48fb575502 Fix 11ab3c4ea2f: Vehicles could not be refitted to cargo IDs higher than 32. 5 years ago
Jonathan G Rennison b1190b32b0 Merge branch 'master' into jgrpp 6 years ago
Niels Martin Hansen c84b9913bd Fix #6676: Prevent helicopters from stopping in midair during some kinds of landing
This adds a new flag that gets stored in the savegame, but it should still be compatible both ways, hence no save version bump.
6 years ago
Jonathan G Rennison e735c1a51a Merge branch 'master' into jgrpp
# Conflicts:
#	src/aircraft_cmd.cpp
#	src/autoreplace_cmd.cpp
#	src/pathfinder/follow_track.hpp
#	src/pathfinder/yapf/yapf_rail.cpp
#	src/saveload/afterload.cpp
#	src/saveload/saveload.cpp
#	src/script/api/ai/ai_station.hpp.sq
#	src/script/api/game/game_station.hpp.sq
#	src/script/api/script_station.hpp
#	src/track_func.h
#	src/vehicle_base.h
6 years ago
Charles Pigott f5b1115039 Doc: Lots and lots of doxymentation fixes 6 years ago
Jonathan G Rennison ee00a28717 Merge branch 'template_train_replacement' into jgrpp
# Conflicts:
#	src/saveload/extended_ver_sl.cpp
6 years ago
Jonathan G Rennison c4f5c8e789 TBTR: Add option to replace only old vehicles 6 years ago
Jonathan G Rennison ef0a458ab6 Add go to depot and sell vehicle orders
Controlled by a setting (default off)
6 years ago
Jonathan G Rennison cecbf257bc Merge branch 'save_ext' into template_train_replacement
# Conflicts:
#	src/saveload/saveload.cpp
#	src/vehicle_gui.cpp
6 years ago
Jonathan G Rennison a60eff174d Merge branch 'template_train_replacement' into jgrpp
# Conflicts:
#	src/saveload/extended_ver_sl.cpp
6 years ago
Jonathan G Rennison 5877cd0f9b TBTR: Fix display of vehicle sprites for some NewGRFs, fix issues in large UI modes
Slight code, GUI layout, and savegame format tidying
6 years ago
Jonathan G Rennison ad1c402ad8 Merge branch 'master' into jgrpp
# Conflicts:
#	src/debug.cpp
#	src/saveload/afterload.cpp
#	src/saveload/saveload.cpp
#	src/settings_type.h
#	src/town_cmd.cpp
#	src/window.cpp
6 years ago
Joan Josep 944f785be8 Fix: Spelling errors (#6769) 6 years ago
Jonathan G Rennison 53dd010f3b Add way to mass cancel vehicle go to depot/service 6 years ago
Jonathan G Rennison 0073c4e71e Road vehicles may no longer be stopped on level crossings. 7 years ago
Jonathan G Rennison fba4268127 Build and refit vehicle test no longer needs to match exec command. 7 years ago
Jonathan G Rennison 7ecdebddb3 Change and simplify algorithm for vehicle repair cost.
This is due to absurdly high repair costs for old vehicles with
old algorithm, due to implicit exponential increases.
Get rid of variable in vehicle struct.
8 years ago
Jonathan G Rennison 55e57fd07d Add shift-clicking on vehicle depot button to select specific depot. 8 years ago
Jonathan G Rennison 10ae23d3b9 Merge branch 'departure-boards' into jgrpp
VehicleListIdentifier API changes.

# Conflicts:
#	src/departures.cpp
#	src/vehicle_gui.cpp
8 years ago
frosch 476b2b0e8c (svn r27677) -Codechange: Remove implicit VehicleListIdentifier from uint32 constructor, to make conversions more explicit. 8 years ago