Commit Graph

824 Commits

Author SHA1 Message Date
Rubidium
f29606fd14 Codechange: use std::string to cache engine/group/vehicle names 2023-05-31 19:31:09 +02:00
Jonathan G Rennison
02fe4af934 Merge branch 'master' into jgrpp
# Conflicts:
#	.github/workflows/release-windows.yml
#	src/company_base.h
#	src/company_cmd.cpp
#	src/company_gui.cpp
#	src/console_cmds.cpp
#	src/economy.cpp
#	src/economy_cmd.h
#	src/fios.h
#	src/goal.cpp
#	src/group_gui.cpp
#	src/network/core/config.h
#	src/network/network_admin.cpp
#	src/newgrf_config.cpp
#	src/os/windows/win32.cpp
#	src/saveload/afterload.cpp
#	src/saveload/company_sl.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload_error.hpp
#	src/settings_gui.cpp
#	src/ship_cmd.cpp
#	src/stdafx.h
#	src/story.cpp
#	src/story_base.h
#	src/string.cpp
#	src/table/settings/economy_settings.ini
#	src/tests/CMakeLists.txt
#	src/tests/math_func.cpp
2023-05-30 00:49:24 +01:00
Jonathan G Rennison
6091d7470c Merge branch 'master' into jgrpp
# Conflicts:
#	.github/workflows/release-macos.yml
#	src/company_gui.cpp
#	src/linkgraph/linkgraph.cpp
#	src/newgrf_debug_gui.cpp
#	src/strgen/strgen_base.cpp
#	src/timetable_gui.cpp
2023-05-28 10:20:52 +01:00
Jonathan G Rennison
b381a30d2d Merge branch 'master' into jgrpp
# Conflicts:
#	src/base_media_func.h
#	src/cargopacket.h
#	src/gfxinit.cpp
#	src/industry_cmd.cpp
#	src/window_gui.h
2023-05-26 20:08:05 +01:00
Peter Nelson
76516d7f70 Codechange: Use IsValidCargoID/IsValidCargoType.
IsValidCargoType() is used only for unmapped IDs.
2023-05-22 20:43:40 +01:00
PeterN
64930c343a
Codechange: Pass reference instead of pointer to GUI*Lists. (#10822)
Pointer-avoidance.
2023-05-14 09:17:44 +01:00
Peter Nelson
941dbadf9e Codechange: Add and use GetScrolledItemFromWidget to get a list item.
This function returns an iterator, either to the selected item or the
container's end.

This makes handling the result more robust as indices are not used.
2023-05-12 21:45:32 +01:00
Tyler Trahan
61d1b330d1
Change: Add padding to build vehicle text filter (#10792) 2023-05-08 17:21:29 +00:00
Peter Nelson
d2034d9c38 Codechange: Scrollbar methods now accept size_t.
This clears up a lot of casts from size_t to int.
2023-05-07 20:25:44 +01:00
Rubidium
19ec4e8beb Codechange: replace ClampToI32/U16 with ClampTo<int32_t/uint16_t> 2023-05-06 21:26:13 +02:00
Peter Nelson
0880616851 Codechange: Remove various STRING strings. 2023-05-05 07:07:54 +01:00
Peter Nelson
e18f688db5 Codechange: Remove various COMMA strings. 2023-05-05 07:07:54 +01:00
Tyler Trahan
6501f84b4a
Codechange: Move calendar date functions inside TimerGameCalendar (#10753) 2023-05-04 13:14:12 +00:00
Tyler Trahan
aa8830f57a
Feature: Filter engine build menu by name and NewGRF extra text (#10519) 2023-05-01 17:02:16 +00:00
Rubidium
c829930440 Codechange: replace strnatcmp with C++ string capable version 2023-04-29 12:07:45 +02:00
Peter Nelson
1a24016964 Fix: Set TC_NO_SHADE only for shaded engine in purchase list.
Additionally use TC_FORCE to prevent additional colours in the shaded text.
2023-04-28 23:12:07 +01:00
PeterN
1697dff744
Change: Hide all variants from UI when (display) parent is hidden. (#10708) 2023-04-25 20:34:10 +01:00
Patric Stout
1c76e0904d
Codechange: revive STR_TINY_BLACK_COMMA from its coma (#10714) 2023-04-24 18:33:39 +00:00
Jonathan G Rennison
a967cc4de2 Fix: Violation of strict weak ordering in engine value/running cost sorter 2023-04-23 12:52:12 +01:00
Jonathan G Rennison
dde4761e9d Fix: Violation of strict weak ordering in engine value/running cost sorter 2023-04-23 11:59:58 +01:00
Andy
89959bf178 Change: extend callback 161 (engine name) with bit 0x22 for context 'Autoreplace - Vehicles in use' (#10666)
(cherry picked from commit 15c3bc456f)
2023-04-18 00:01:52 +01:00
Andy
15c3bc456f
Change: extend callback 161 (engine name) with bit 0x22 for context 'Autoreplace - Vehicles in use' (#10666) 2023-04-17 00:02:32 +02:00
Jonathan G Rennison
82803b98e0 Merge branch 'master' into jgrpp
# Conflicts:
#	src/game/game_gui.cpp
#	src/graph_gui.cpp
#	src/linkgraph/linkgraph_gui.h
#	src/newgrf.cpp
#	src/order_gui.cpp
#	src/saveload/engine_sl.cpp
#	src/saveload/saveload.h
#	src/script/api/script_text.cpp
#	src/script/script_gui.cpp
#	src/settings_table.cpp
#	src/strings.cpp
#	src/table/settings/economy_settings.ini
#	src/table/settings/locale_settings.ini
#	src/timetable_gui.cpp
2023-04-10 15:11:53 +01:00
PeterN
f1144de509
Feature: Separate rail/road and sea/air velocity units, and add knots. (#10594)
This is achieved by packing vehicle type along with the velocity so that
the string system can decode and pick the appropriate unit.
2023-04-08 12:26:13 -04:00
Jonathan G Rennison
e061fa06fd Fix template train build window not being refreshed for variants changes 2023-03-07 19:11:59 +00:00
Michael Lutz
07c923eceb Feature: [NewGRF] Engine name callback.
(cherry picked from commit 05ed9f56fd)
2023-02-05 22:40:03 +00:00
Michael Lutz
05ed9f56fd Feature: [NewGRF] Engine name callback. 2023-01-30 22:00:56 +01:00
Jonathan G Rennison
80f0250de6 Merge branch 'master' into jgrpp 2023-01-24 21:19:09 +00:00
PeterN
4dfd6a096f
Fix #10220: Don't select unselectable engine as default. (#10404) 2023-01-24 00:05:42 +00:00
Jonathan G Rennison
a9100e93cb Merge branch 'master' into jgrpp
# Conflicts:
#	src/group_cmd.cpp
#	src/lang/korean.txt
#	src/lang/simplified_chinese.txt
#	src/script/api/script_rail.cpp
#	src/tunnelbridge_cmd.cpp
2023-01-23 19:10:07 +00:00
Rubidium
8aeef665c7 Fix #10377, Fix 94167df: bad sorting of rail vehicles when primary variant is missing 2023-01-22 21:13:17 +01:00
Jonathan G Rennison
1bfd96c7f2 Merge branch 'master' into jgrpp
# Conflicts:
#	src/3rdparty/fmt/core.h
#	src/command_type.h
#	src/console_cmds.cpp
#	src/core/overflowsafe_type.hpp
#	src/landscape.cpp
#	src/network/network.cpp
#	src/newgrf_object.h
#	src/object_cmd.cpp
#	src/order_gui.cpp
#	src/saveload/vehicle_sl.cpp
#	src/script/api/script_industrytype.cpp
#	src/script/api/script_object.hpp
#	src/script/api/script_town.cpp
#	src/table/object_land.h
#	src/timetable_cmd.cpp
#	src/tree_cmd.cpp
#	src/vehicle_gui.cpp
#	src/window.cpp
2023-01-15 19:28:37 +00:00
Rubidium
90f1768006 Codechange: add non-nullptr asserts in cases where it should never be nullptr
Though where similar calls are checked for nullptr as in those instances of
the use of that function it can actually return nullptr. In other words, write
down the assumption that the function never returns nullptr in an assert.
2023-01-14 21:15:23 +01:00
Jonathan G Rennison
10e76b2788 Fix #10032: Capacities of articulated vehicles in build window
See also: #9954
2023-01-14 18:52:01 +01:00
Jonathan G Rennison
d3e1c2695e Fix freight weight multiplier not being applied in train build window 2023-01-07 12:59:09 +00:00
Jonathan G Rennison
9cff3666ae Fix artic engines with no capacity on leading part in build window
Engines were being shown as not having any capacity overall
2023-01-07 00:26:04 +00:00
Jonathan G Rennison
a1f6aaa58f Merge branch 'master' into jgrpp
# Conflicts:
#	src/lang/korean.txt
#	src/saveload/afterload.cpp
#	src/saveload/ai_sl.cpp
#	src/saveload/game_sl.cpp
#	src/script/script_instance.cpp
2022-12-31 18:17:24 +00:00
PeterN
5e22788664
Fix #10220: Adding unavailable variants failed for non-rail engines. (#10297)
Unavailable parent variant engine for non-rail engines was added to the
wrong (temporary) list so the hierarchy was not added correctly.
2022-12-31 10:10:25 +00:00
Jonathan G Rennison
64c210f770 Merge branch 'master' into jgrpp
# Conflicts:
#	src/build_vehicle_gui.cpp
#	src/engine.cpp
#	src/engine_func.h
#	src/group_gui.cpp
#	src/lang/english.txt
#	src/newgrf.cpp
#	src/saveload/oldloader_sl.cpp
#	src/timetable_cmd.cpp
#	src/timetable_cmd.h
#	src/timetable_gui.cpp
2022-12-28 01:46:29 +00:00
Peter Nelson
85814b29d4 Feature: Vehicle add-ons can now group engines in purchase list.
Grouped engines are collapsed by default but can be expanded. This allows
similar engines to be grouped together to avoid cluttering the list.

Suggested uses for this are e.g.:
* Liveries; same stats but different paint job.
* Re-gearing; engine design is mostly the same but different stats.

... but avoiding complex hidden cargo subtype refit systems.

Grouped engines are otherwise separate, so can be independently
autoreplaced, even between variants.
2022-12-25 16:41:58 +00:00
peter1138
94167dfd34 Change: Add variant hierarchy to build vehicle window list. 2022-12-25 16:41:58 +00:00
Jonathan G Rennison
6d4474b84e Merge tag '13.0-beta2' into jgrpp
# Conflicts:
#	src/cheat_gui.cpp
#	src/company_gui.cpp
#	src/console_gui.cpp
#	src/depot_gui.cpp
#	src/error_gui.cpp
#	src/gfx.cpp
#	src/graph_gui.cpp
#	src/group_gui.cpp
#	src/lang/english.txt
#	src/lang/korean.txt
#	src/lang/polish.txt
#	src/misc_gui.cpp
#	src/network/network_content_gui.h
#	src/newgrf_debug_gui.cpp
#	src/order_gui.cpp
#	src/rail_gui.cpp
#	src/road_gui.cpp
#	src/settings_gui.cpp
#	src/settings_type.h
#	src/station_gui.cpp
#	src/subsidy_gui.cpp
#	src/table/settings/gui_settings.ini
#	src/timetable_gui.cpp
#	src/town_gui.cpp
#	src/train_cmd.cpp
#	src/vehicle_gui.cpp
#	src/viewport.cpp
#	src/water_cmd.cpp
#	src/widgets/dropdown.cpp
#	src/window_gui.h
2022-12-04 20:43:11 +00:00
Jonathan G Rennison
02e19521bc Merge branch 'master' into jgrpp
# Conflicts:
#	src/build_vehicle_gui.cpp
#	src/cheat_gui.cpp
#	src/company_gui.cpp
#	src/error_gui.cpp
#	src/fios_gui.cpp
#	src/gfx_func.h
#	src/graph_gui.cpp
#	src/group_gui.cpp
#	src/misc_gui.cpp
#	src/newgrf_debug_gui.cpp
#	src/order_gui.cpp
#	src/road_gui.cpp
#	src/roadveh_gui.cpp
#	src/settings_gui.cpp
#	src/ship_gui.cpp
#	src/station_gui.cpp
#	src/statusbar_gui.cpp
#	src/subsidy_gui.cpp
#	src/timetable_gui.cpp
#	src/town_gui.cpp
#	src/train_gui.cpp
#	src/tree_gui.cpp
#	src/vehicle_gui.cpp
#	src/widget.cpp
#	src/widgets/dropdown.cpp
#	src/window_gui.h
2022-12-04 13:53:44 +00:00
Jonathan G Rennison
2832fc16f5 Template replacement: Use more descriptive strings for add vehicle button 2022-11-28 19:54:41 +00:00
Jonathan G Rennison
5d171e0023 Add setting for whether dual pane train purchase window uses combined buttons
See: #421
2022-11-27 20:15:58 +00:00
Jonathan G Rennison
7b78a4f1ad Build vehicle window: Fix spelling errors in widget IDs 2022-11-27 19:13:19 +00:00
Jonathan G Rennison
728b902e9f No longer use CDECL for GUIList::FilterFunction 2022-11-19 21:51:52 +00:00
Peter Nelson
ed60c88b0a Change: Use power-of-2 scaling for some dimensions in GUI.
These are related to drawing sprites that are normally drawn on the
landscape, and should therefore still follow power-of-2 scaling to fit
correctly.
2022-11-12 18:28:39 +00:00
Peter Nelson
890b2666d3 Change: Use scaled WidgetDimensions. 2022-11-12 18:28:39 +00:00
Peter Nelson
5786d49143 Change: Use Rect when drawing build engine list. 2022-11-12 18:28:39 +00:00
Peter Nelson
6f95e04005 Change: Use Rect helpers for widget drawing.
This replaces repetitive and sometimes unwieldy use of constants.
2022-11-12 18:28:39 +00:00
Henry Wilson
89cf0d5da8 Codechange: Factor cargotype weight conversion magic numbers 2022-11-08 21:02:08 +01:00
Jonathan G Rennison
fdf2d3dfe1 Fix vehicles with no cargo being shown with last cargo in build window 2022-09-26 21:54:14 +01:00
Jonathan G Rennison
c7e4dbf2f6 Fix displayed capacities/weights of articulated vehicles in build window
Simplify handling of multi-part capacities and refits

See: https://github.com/OpenTTD/OpenTTD/issues/9954
See: https://github.com/OpenTTD/OpenTTD/issues/10032
2022-09-16 20:10:53 +01:00
Jonathan G Rennison
839746d2bb Fix template train move/sell command category for build while paused 2022-09-16 13:06:08 +01:00
Jonathan G Rennison
ad00f5032a Add a setting to show the introduction year for train wagons 2022-08-18 18:34:21 +01:00
Jonathan G Rennison
a6e3467d58 Fix virtual train consist change callbacks being run before cargotype set
When instantiating virtual train from non-buildable template train

See: #402

Also fixes instantiating virtual train from train not refitting leading
vehicle.
2022-06-27 01:27:35 +01:00
Jonathan G Rennison
0a7a7ebcf0 Add build vehicle window sort mode: cargo capacity / running cost 2022-01-30 22:09:16 +00:00
Jonathan G Rennison
96d789dfbf Fix window preference save/load of build vehicle windows 2022-01-23 13:58:34 +00:00
Michael Lutz
41fa16f325 Codechange: Don't use globals for return values from vehicle command procs. 2021-12-16 22:28:32 +01:00
Michael Lutz
21675ec7e2 Codechange: Un-bitstuff vehicle/engine commands. 2021-12-16 22:28:32 +01:00
Michael Lutz
4f3ea3907e Codechange: Un-bitstuff commands taking a ClientID (i.e. CMD_CLIENT_ID). 2021-12-16 22:28:32 +01:00
Michael Lutz
0f64ee5ce1 Codechange: Template DoCommandP 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.
2021-12-16 22:28:32 +01:00
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.
2021-12-16 22:28:32 +01:00
Michael Lutz
b0990fcff7 Codechange: Make TileIndex a "strong" typedef to give it a distinct type.
This is accomplished by changing it to a single member struct with the
appropriate operator overloads to make it all work with not too much
source modifications.
2021-12-16 22:28:32 +01:00
Michael Lutz
123c7f99c3 Codechange: Move command callback declarations to the cmd header files. 2021-12-16 22:28:32 +01:00
Michael Lutz
a38bbefe1b Codechange: Untangle command code, flags and error string for DoCommand*. 2021-12-16 22:28:32 +01:00
Michael Lutz
549caca39c Codechange: Move command arguments to the back of the networked command function calls. 2021-12-16 22:28:32 +01:00
Michael Lutz
b6933a2ebd Codechange: Move command arguments to the back of the DoCommand function call. 2021-12-16 22:28:32 +01:00
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
2021-11-02 17:51:38 +00:00
Jonathan G Rennison
f54d69a60a Merge branch 'master' into jgrpp-beta
# Conflicts:
#	src/economy.cpp
#	src/elrail.cpp
#	src/graph_gui.cpp
#	src/linkgraph/linkgraph_gui.cpp
#	src/network/core/game_info.cpp
#	src/newgrf_station.cpp
#	src/saveload/saveload.cpp
#	src/settings.cpp
#	src/station_cmd.cpp
#	src/station_gui.cpp
#	src/strings_func.h
#	src/table/settings/network_settings.ini
#	src/table/settings/settings.ini
2021-11-01 21:18:24 +00:00
Jonathan G Rennison
072e3ff5fc Show refitted capacity when adding template vehicles with cargo filter
See: #312
2021-08-22 15:01:26 +01:00
Jonathan G Rennison
e76c5dfda7 Revert "Temporarily mark dual pane train purchase window as experimental"
This reverts commit f9bb004b05.
2021-08-04 17:49:23 +01:00
Jonathan G Rennison
4d99c501b3 Add defensive checks to DrawVehiclePurchaseInfo 2021-08-04 17:24:10 +01:00
Loïc Guilloux
9b0bb21f3b
Fix 57734fd: Don't enable rename button for network clients in build vehicle window (#9452) 2021-07-19 22:38:36 +02:00
glx22
5844027eb8 Codechange: Remove FOR_ALL_SORTED_STANDARD_CARGOSPECS 2021-07-09 21:36:09 +02:00
Jonathan G Rennison
0d80b4450d Fix engine selection from click in new train purchase window
See: #287, #296, #297
2021-07-09 18:14:43 +01:00
Jonathan G Rennison
f9bb004b05 Temporarily mark dual pane train purchase window as experimental
See: #287, #296, #297
2021-07-09 18:12:55 +01:00
Jonathan G Rennison
44e9a746b7 Fix sorting by TE being always disabled in new train purchase window 2021-07-06 19:51:32 +01:00
Jonathan G Rennison
d027b70575 Fix 5230ff5e: wagon/logo sort and filter saved state mixup 2021-07-05 20:20:59 +01:00
Jonathan G Rennison
5230ff5e8d Fix crashes and wrong vehicle info in dual pane train purchase window
Reduce code duplication/redundancy
2021-07-05 17:24:21 +01:00
Jonathan G Rennison
0b4dc151d5 Rename to BuildVehicleWindowCommon to BuildVehicleWindowBase
See: #287
2021-06-29 00:56:11 +01:00
Jonathan G Rennison
dd5866c2c2 Fix loco and wagon button rows having different heights 2021-06-29 00:29:19 +01:00
Jonathan G Rennison
5e418128da Add setting for whether to use dual pane train purchase window 2021-06-29 00:11:07 +01:00
Jonathan G Rennison
70f7509126 Create common base class for build vehicle windows 2021-06-29 00:08:49 +01:00
Jonathan G Rennison
d1114b6b79 Fix build wagon button building locomotives instead 2021-06-28 23:43:37 +01:00
Jonathan G Rennison
ab5cee70ec Fix whitespace/code style issues 2021-06-28 23:38:12 +01:00
Jonathan G Rennison
42d1987713 Fix crash when building template vehicles 2021-06-28 23:35:00 +01:00
Jonathan G Rennison
1a7ebfd06c Fix duplication of sorter functions 2021-06-28 23:13:50 +01:00
Jonathan G Rennison
b4856d3164 Trim trailing whitespace 2021-06-28 23:02:16 +01:00
Andreas Schmitt
225e1ca634 Rearrange file to increase diff readability 2021-06-21 08:24:16 +02:00
Andreas Schmitt
081131c298 Make final adjustments and cleanup 2021-06-20 20:35:49 +02:00
Andreas Schmitt
58c00d169e Adjust OnClick 2021-06-20 20:35:49 +02:00
Andreas Schmitt
790b73ea3d Cleanup some code 2021-06-20 20:35:49 +02:00
Andreas Schmitt
92276518dd Adjust further to new API 2021-06-20 20:35:49 +02:00
Andreas Schmitt
40c9be0c02 Fix sorter functions 2021-06-20 20:35:49 +02:00
Andreas Schmitt
7ffd65c3e6 Add initial implementation 2021-06-20 20:35:49 +02:00
glx22
5799402f7a Codechange: Rename window related DeleteXXX to match new behaviour 2021-05-29 21:08:25 +02:00
rubidium42
2e136285e1 Codechange: move from C-string to std::string for DoCommand 2021-05-29 19:02:18 +02:00
Jonathan G Rennison
8eb27e1ac7 Merge branch 'master' into jgrpp
# Conflicts:
#	src/company_cmd.cpp
#	src/lang/japanese.txt
#	src/network/core/config.h
#	src/network/core/packet.cpp
#	src/network/core/tcp.cpp
#	src/network/network_content.cpp
#	src/network/network_server.cpp
#	src/network/network_udp.cpp
#	src/toolbar_gui.cpp
#	src/vehicle_gui_base.h
2021-04-25 22:14:59 +01:00