2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
|
|
|
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2007-05-19 09:40:18 +00:00
|
|
|
/** @file group_cmd.cpp Handling of the engine groups */
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
2010-04-17 13:31:41 +00:00
|
|
|
#include "cmd_helper.h"
|
2007-12-21 21:50:46 +00:00
|
|
|
#include "command_func.h"
|
2007-05-19 09:40:18 +00:00
|
|
|
#include "train.h"
|
2010-09-08 21:37:13 +00:00
|
|
|
#include "vehiclelist.h"
|
2007-12-27 13:35:39 +00:00
|
|
|
#include "vehicle_func.h"
|
2008-01-07 09:19:53 +00:00
|
|
|
#include "autoreplace_base.h"
|
|
|
|
#include "autoreplace_func.h"
|
2021-06-20 06:35:28 +00:00
|
|
|
#include "base_station_base.h"
|
2008-01-07 14:23:25 +00:00
|
|
|
#include "string_func.h"
|
2008-09-30 20:51:04 +00:00
|
|
|
#include "company_func.h"
|
2009-05-22 15:13:50 +00:00
|
|
|
#include "core/pool_func.hpp"
|
2010-08-18 15:15:59 +00:00
|
|
|
#include "order_backup.h"
|
Squashed commit of the following:
commit b17f39a2016dc11a6a9815f398d690d82a6a59aa
Merge: 67b3190 3bb7c47
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Feb 12 19:44:34 2016 +0100
Merge branch 'merge/trunk27506' into dev
commit 3bb7c4768580198b7316bfeebc4b870d355439e8
Merge: 14929fe 9db36bd
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Feb 12 19:43:53 2016 +0100
Merge remote-tracking branch 'openttd/master' into merge/trunk27506
commit 14929fe3536e2aa5b4d6a43d0d55043da7a2f252
Merge: af15609 4b8c698
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Feb 10 22:14:25 2016 +0100
Merge branch 'master' into merge/trunk27506
commit 67b319060b4b88b72c94b0e0c2c9fdcf1c2fd95d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sat Feb 28 20:17:13 2015 +0100
removed 2 unused function calls
commit af15609c938eb388dd507b16fb7b6d547c54c2da
Merge: 5465c88 b251ba3
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sat Feb 28 15:12:33 2015 +0100
Merge branch 'trunk' into merge_trunk
commit 5465c88c8016c5e7910570ab5795222e8348c703
Author: me <streen01@gmx.de>
Date: Sat Feb 28 10:59:41 2015 +0100
regenerated MSVS project files
forgot to do this, they still retained the old filenames
commit 0391455e29c5ed794fcd0f58c63ff98dc52685ac
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 16:53:05 2015 +0100
removed the patch files from this repo again
that was a rather dum idea, it made the difference patch between
branches trunk and tbtr huge.
the patch files are now being tracked again in the supplimentary repo
'tbtr_proj', that will keep this fork clean and creating diff-patches
will be much easier
commit 8395d40386c8d620c90fb4be66cf6679408ac975
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 16:27:40 2015 +0100
fix for reported bug by DC-1: crash in station gui
the template gui item was added to the drop-down list that was also
shown in a station gui, but there was no action present when this item
was selected in a station gui. per default the game would commit suicide
by called NOT_REACHED() at the default case of the according
switch-statement.
commit 833873245d33bd77105a82a584d9bec2362419bc
Merge: 39596be 8688c95
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 15:08:53 2015 +0100
Merge branch 'fix_disableTemplateOrderCheck' into tbtr
commit 8688c95a01ed5933a35a08597bbf45ff148f5a67
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 15:06:25 2015 +0100
added fix by DC-1
don't check the orders list of a virtual vehicle
commit 39596beff9a815a0f9b2ea3abe5d82c3ec5933e7
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 22 10:47:58 2015 +0100
added history of patches for the mod
commit b3ae74ac4e9143202a1fda1333a91c3716ebb21e
Merge: 9a601a1 ee756e1
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 22 10:03:04 2015 +0100
Merge branch 'tbtr' into merge_tbtr
commit ee756e1c2229534f1cc05edb97269b0c83ddde66
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Feb 17 22:25:50 2015 +0100
removed nonsensical comments + disabled code
commit e7d37f0500c56c84a36ce8b93eafb31f800e1086
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Feb 17 21:30:38 2015 +0100
added some missing renames in includes
commit 63c2b13766b077e4f2923f321e95d53356dee2db
Merge: e92e6ba 9752606
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Feb 17 21:22:11 2015 +0100
Merge branch 'feat_renameFiles' into merge_renameFiles
Conflicts:
src/tbtr_template_gui_create_virtualtrain.cpp
commit 975260643d212f8cac72485f2011011210622849
Author: Thomas Schmidt <streen01@gmx.de>
Date: Mon Feb 9 22:11:18 2015 +0100
replaced source file prefix: aaa -> tbtr
commit e92e6ba7089564886d17dd5c1fd8d85ea0ca4ac7
Merge: 62d2f80 ac16eab
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 15:02:19 2015 +0100
Merge branch 'rm_TODOs' into dev
Conflicts:
src/aaa_template_gui_main.cpp
commit 62d2f809edf170cfbeb0599822c4c3d4f9a1fefe
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:59:36 2015 +0100
i++ -> ++i
commit ac16eabc082f62b9fe2ef6c11a314f8e9a28c26b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:34:36 2015 +0100
rm'ed TODOs
commit 22f642f32265882b8f99b409b517823991c08101
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:17:49 2015 +0100
rm TODO
yes, depends on the selected template because the button "Start
replacing" means, to start the replacement for the currently selected
group and template (create a templatereplacement object for this
combination)
commit 60d8192838e340a3cf6899979361c997df73b716
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:17:26 2015 +0100
rm'ed TODO: included task in TODO-list
commit 39e42674ac9f5ad5dd056b613e80ef4e754c1153
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 11:19:36 2015 +0100
changed window class in use: WC_NONE -> WC_TEMPLATE_GUI_MAIN
commit cadfac96e21aeb862b75e0454197ddce89fb728c
Author: Thomas Schmidt <streen01@gmx.de>
Date: Mon Jan 26 23:18:29 2015 +0100
removed a weird call to deleteAllTmplReplacements
was a TODO task, it was set to delete all template replacements
belonging to group with id -1, which does not exist, ever
commit dc1058464c29f61b6197dec556ec468d1ff38451
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 25 23:27:03 2015 +0100
removed some TODOs
commit 7afeb17db512600424039099a0f4bd78882fcd8e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 25 11:35:47 2015 +0100
removed all MYGUI comments
tried to replace them with useful comments where necessary
added a few new TODOs here and there
commit 6b9453224a77811062254e6bce7dac4074b829a8
Merge: 292a5aa 687bc4c
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 20:47:06 2015 +0100
Merge branch 'fix_compiler_warnings' into dev
commit 687bc4c34fbb9ddeaf15b4857b235a9709dd85be
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 20:43:26 2015 +0100
fixed all remaining warnings
commit ada08d7097772e325b7852fd058d8bad7036ae4d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 18:25:45 2015 +0100
removed testing code that produced a warning
commit f3b1568384f36998aeb1fa51c1fab4cfb96c7f93
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 00:07:34 2015 +0100
removed unused variable REPLACEMENT_IN_PROGRESS
commit 5aa9098880070cfaa3d2815f445497b2886933f9
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 00:02:43 2015 +0100
removed variable 'mode' from ClickedOnVehicle()
member function of class TemplateCreateWindow
in the depot gui the mode variable is used to decide whether a vehicle
is started or dragged or ...
here, we only drag so the mode is never used
commit 292a5aa9dba9cf1d0003e84055fb95357f922454
Merge: 8f6df8c 2bb12bc
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Jan 14 23:41:29 2015 +0100
Merge branch 'feat_mergePatch0.4c' into dev
commit 2bb12bcf283cccc8869bf537b79b22f479cb7203
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Jan 14 23:32:04 2015 +0100
added vi's .swp files to .gitignore
commit aecf6f549b32f92342f8e0b65158bebef6270537
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Jan 13 20:15:25 2015 +0100
corrected UpdateViewport code
was VehicleUpdateViewport(Vehicle*, bool) before
is Vehicle::UpdateViewport(bool, bool) now
commit ae199283fd5ac0199cef1c4c980561122d030199
Author: Thomas Schmidt <streen01@gmx.de>
Date: Mon Jan 12 22:34:22 2015 +0100
updated code for EngineNumberSorter
commit 9735035c6dd4ded9bb76958722dc25e26ced5f05
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 11 18:36:17 2015 +0100
removed unused parameter 'part_of_chain'
from cargo movement code
commit b8b86e1f2592288ddcfb46a0a5d81c3257da60d3
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 4 21:44:17 2015 +0100
Reimplemented moving of cargo
- uses the new shift function
- manages to spread the old cargo of replaced vehicles from a chain across the memebers of the newly constructed chain
some TODOs are left within the code and some testing needs to be done,
how this behaves when there is more than one vehicle being replaced
commit 0d76e1bfe10ef207ac5e4018976e9fba0b0bb25e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sat Jan 3 01:05:54 2015 +0100
fixed saveload code for TemplateVehicle
commit ba0ea6975f48fe38c2b5376ebc83c23d6bb6151c
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 11:32:23 2015 +0100
final changes for the merge
- removed the WDF_UNLICK_BUTTON
- updated ctor calls to Window()
- disabled the engine number sorter
commit 9cc213335046b3febfe6649fde40b00e1bb43d5b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 11:29:03 2015 +0100
disabled cargo movement during templrpl
need to reimplement this step since the cargo is now moved
packet-by-packet and not as a complete list from a vehicle onto another
vehicle anymore
commit 39743806d0156f8547670c525af0e59083dbcd49
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 11:16:54 2015 +0100
replaced cargo function 'Count'
- not available anymore: VehicleCargoList::Count()
- using StoredCount() for now, should check if this is the correct count
commit 9b240bbf9b2ee5659bbcb518e9e2767103861254
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:27:56 2015 +0100
final corrections for template_gui_create_virtualtrain
commit cf0d48d8fa052ff521e1fac0ec75d75107c9b76e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:20:30 2015 +0100
disbabled usage of not-anymore-existing newgrf_engine.h::ListPositionOfEngine
commit 81da16b7f0c3ea2417b24707329d1d971a67e82e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:09:53 2015 +0100
fixed typo in value WID_BV_SORT_ASSENDING_DESCENDING
commit c8f81a5c3df5ccf4858bda64a53979af510ccd87
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:09:25 2015 +0100
create_virtual_train: uint GetEngineListHeight not static
commit bd29d99f80bd824e28104f3bc839fc2a5abdd297
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 00:57:25 2015 +0100
template_gui_create: static WindowDesc not const
commit edee9c1c544845459102328209b98d424cfd3248
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 00:44:50 2015 +0100
updated call to Window::FinishInitNested
commit 25fc3cb7ed6db15f42bd3fdff9506621fbba3d72
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Jan 1 23:56:48 2015 +0100
updated ctor calls for classes derived from Window
- first param in the constructor used to be const WindowDesc*, now it is
WindowDesc*
commit 54d710170f1ce9cf5539cd525744ca61f4089e7b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Jan 1 02:50:29 2015 +0100
updated constr calls to WindowDesc::WindowDesc
need a const char* at 2nd pos now
commit 7c954141f00666dec4c9559019a1a4af3b452372
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:30:02 2014 +0100
applied patch vehicle.cpp
commit aa12720049a3dfb1c2e02d453813bd567b67ff60
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:22:54 2014 +0100
applied patch vehicle_gui.cpp (failed hunks 2,4,5/6)
commit 2b8e70f15478072264f1e063418f8de0744a98e1
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:13:29 2014 +0100
applied patch train_cmd.cpp (failed hunk 1/8)
commit 47499523bf1ed0cce5fdf6cc2a7102e571dcb07d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:07:00 2014 +0100
applied patch newgrf_engine.cpp
commit 7a40c62a7b5ab8059981270252a7def69eacb7d7
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:02:52 2014 +0100
applied patch vehicle_cmd.cpp (failed hunks 2,3/3)
commit 277839abd8cb7eb277e4ed6cb72e0f3da5b7e479
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:56:35 2014 +0100
applied patch saveload.h (failed hunk 1/1)
commit 7b64c87ad3dede6442a88dafa5aa8a6a3e0db812
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:53:56 2014 +0100
applied patch group_gui.cpp (failed hunks 2,3/4)
commit 8075261c526004e21534fa0ab80429132d5f634b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:46:24 2014 +0100
applied patch vehiclelist.cpp (failed hunk 1/2)
commit b1c197c0f38e45fb50dad7f7e33f1438b150a34f
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:42:04 2014 +0100
applied patch train.h (failed hunk 1/3)
commit 81bfa209e92fa74387420cc85851767d2737c1b0
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch viewport.cpp.patch (file src/viewport.cpp)
commit 5c083054544eabac9260a75033198c665b169215
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch train_gui.cpp.patch (file src/train_gui.cpp)
commit 3c3534621c6b37530035faadfa092d70fed724c9
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch source.list.patch (file source.list)
commit 6bbb071431882d4bab43023f7194f96c824e78e5
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch saveload_internal.h.patch (file src/saveload/saveload_internal.h)
commit 158640eb786cc7867c9e689eb8a92a209e528a83
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch saveload.cpp.patch (file src/saveload/saveload.cpp)
commit e171ad716c126e98bc045f5ce574ac6161f3ab4f
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs90.vcproj.patch (file projects/openttd_vs90.vcproj)
commit b77486d89c12a80f73f088759da760abd0af7f49
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs80.vcproj.patch (file projects/openttd_vs80.vcproj)
commit 57f9c52fc580da51e20bd40f116fe66c9a0f3669
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs100.vcxproj.patch (file projects/openttd_vs100.vcxproj)
commit bda1f739a415600a7f522b1c7f9ca53fa7713ed3
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs100.vcxproj.filters.patch (file projects/openttd_vs100.vcxproj.filters)
commit ed96771b03e726e5cb56cac9a8328c3a1e63856b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch newgrf_spritegroup.cpp.patch (file src/newgrf_spritegroup.cpp)
commit 3df57e0d855fef5f54be4fd8d25e231a7eb3c3f1
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch group_cmd.cpp.patch (file src/group_cmd.cpp)
commit da31ca4b67d6993f127c6cecac717eb286ead4e6
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch english.txt.patch (file src/lang/english.txt)
commit ddc0af7139fccbae4060c70440f17c763e3bba96
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch depot_gui.cpp.patch (file src/depot_gui.cpp)
commit 88aca9db192c6a2b92185f56505caf8b91d23ab4
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch autoreplace_cmd.cpp.patch (file src/autoreplace_cmd.cpp)
commit 45ca80f7c9847ac3afe181a0badeb12bbbd5ed0d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch articulated_vehicles.cpp.patch (file src/articulated_vehicles.cpp)
commit 44bd0bf2e77f366b61f96b0f4ca564f2e2e5814a
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch afterload.cpp.patch (file src/saveload/afterload.cpp)
commit 679f9b327f9d3f3bec327ae0266f289981972c85
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_veh_sl.cpp.patch (file src/saveload/aaa_template_veh_sl.cpp)
commit ebcec221ec7c1988e85ba458283ff362e034e6d5
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle.h.patch (file src/aaa_template_vehicle.h)
commit ad690e74b95d2aa07157b73834eef672c63ef901
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle_func.h.patch (file src/aaa_template_vehicle_func.h)
commit 5982153c369432fc694daaa91a06dfefeeb29485
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle_func.cpp.patch (file src/aaa_template_vehicle_func.cpp)
commit 773f889e165b013de96736fa380d5ab5c311b3dd
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle.cpp.patch (file src/aaa_template_vehicle.cpp)
commit 03af781d69a09863d3b76ee4911e5eecd90a7cf5
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_replacement_sl.cpp.patch (file src/saveload/aaa_template_replacement_sl.cpp)
commit ab6cb0562fd390d551670dbc27e0c3c94c8554db
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_gui_replaceall.cpp.patch (file src/aaa_template_gui_replaceall.cpp)
commit d88452a6195c55e39bceb3ea7689fc546c4eee6a
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_gui_main.cpp.patch (file src/aaa_template_gui_main.cpp)
commit ab6ac687f355d400ad9ebc154e75477671a8e0fa
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:42:21 2014 +0100
applied patch aaa_template_gui_create_virtualtrain.cpp.patch (file src/aaa_template_gui_create_virtualtrain.cpp)
commit 288d14b9b145cb045b6a287d23cf3be4f2712ede
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:38:12 2014 +0100
applied patch aaa_template_gui_create.cpp.patch (file src/aaa_template_gui_create.cpp)
commit 5342db70e07fb7c1f3c41654abd2c6a4c51472c4
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:18:32 2014 +0100
applied aaa_* header files
commit 6f14e94a0ad715a33a2653cf6c12e1c2981ace8d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:29:55 2014 +0100
applied vehicle_base.h.patch
commit b76a5ce921fab5d81b60755ce66db71e38664e9b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:29:28 2014 +0100
applied window_type.h.patch
commit d33d738c7e3477de3f12affcc74c88194a61c442
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:28:30 2014 +0100
applied newgrf_engine.h.patch
commit 931fd1143706bc76aa145e1430645cb4496f9f4a
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:27:21 2014 +0100
applied vehicle_gui.h.patch
commit f6c4ab089dad5a4a01401e18cffa8f20e02f733e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:00:52 2014 +0100
applied vehicle_gui_base.h.patch
commit 5f7378136758fcc4987791d264856169950cbfe2
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 12:34:23 2014 +0100
applied build_vehicle_widget.h.patch
commit 5c6fc73847a2f34573260721bb68c7b552d546bc
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 12:01:10 2014 +0100
applied autoreplace_func.h
commit 7636f27011841d01e5f954c855dfa0cf1859e0e0
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 12:01:00 2014 +0100
applied newgrf.h
Remove some spurious whitespace changes, update projects files.
2016-02-13 19:26:47 +00:00
|
|
|
#include "tbtr_template_vehicle.h"
|
2016-04-05 17:40:16 +00:00
|
|
|
#include "tracerestrict.h"
|
2007-05-19 09:40:18 +00:00
|
|
|
|
2008-01-13 01:21:35 +00:00
|
|
|
#include "table/strings.h"
|
|
|
|
|
2014-04-23 20:13:33 +00:00
|
|
|
#include "safeguards.h"
|
2021-06-20 06:35:28 +00:00
|
|
|
#include "strings_func.h"
|
2021-06-20 08:22:16 +00:00
|
|
|
#include "town.h"
|
2021-06-20 06:35:28 +00:00
|
|
|
#include "townname_func.h"
|
2014-04-23 20:13:33 +00:00
|
|
|
|
2009-01-12 17:11:45 +00:00
|
|
|
GroupID _new_group_id;
|
|
|
|
|
2009-05-22 15:13:50 +00:00
|
|
|
GroupPool _group_pool("Group");
|
|
|
|
INSTANTIATE_POOL_METHODS(Group)
|
|
|
|
|
2011-10-03 17:20:26 +00:00
|
|
|
/**
|
|
|
|
* Clear all caches.
|
|
|
|
*/
|
|
|
|
void GroupStatistics::Clear()
|
|
|
|
{
|
|
|
|
this->num_vehicle = 0;
|
2011-10-03 17:25:44 +00:00
|
|
|
this->profit_last_year = 0;
|
2023-01-22 13:14:02 +00:00
|
|
|
this->num_vehicle_min_age = 0;
|
|
|
|
this->profit_last_year_min_age = 0;
|
2011-10-03 17:20:26 +00:00
|
|
|
|
2024-01-21 14:09:44 +00:00
|
|
|
/* This is also called when NewGRF change. So the number of engines might have changed. Reset. */
|
|
|
|
this->num_engines.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get number of vehicles of a specific engine ID.
|
|
|
|
* @param engine Engine ID.
|
|
|
|
* @returns number of vehicles of this engine ID.
|
|
|
|
*/
|
|
|
|
uint16_t GroupStatistics::GetNumEngines(EngineID engine) const
|
|
|
|
{
|
|
|
|
auto found = this->num_engines.find(engine);
|
|
|
|
if (found != std::end(this->num_engines)) return found->second;
|
|
|
|
return 0;
|
2011-10-03 17:20:26 +00:00
|
|
|
}
|
|
|
|
|
2011-10-03 17:21:41 +00:00
|
|
|
/**
|
|
|
|
* Returns the GroupStatistics for a specific group.
|
|
|
|
* @param company Owner of the group.
|
|
|
|
* @param id_g GroupID of the group.
|
|
|
|
* @param type VehicleType of the vehicles in the group.
|
|
|
|
* @return Statistics for the group.
|
|
|
|
*/
|
|
|
|
/* static */ GroupStatistics &GroupStatistics::Get(CompanyID company, GroupID id_g, VehicleType type)
|
|
|
|
{
|
|
|
|
if (Group::IsValidID(id_g)) {
|
|
|
|
Group *g = Group::Get(id_g);
|
|
|
|
assert(g->owner == company);
|
|
|
|
assert(g->vehicle_type == type);
|
|
|
|
return g->statistics;
|
|
|
|
}
|
|
|
|
|
2011-10-03 17:22:56 +00:00
|
|
|
if (IsDefaultGroupID(id_g)) return Company::Get(company)->group_default[type];
|
2011-10-03 17:23:41 +00:00
|
|
|
if (IsAllGroupID(id_g)) return Company::Get(company)->group_all[type];
|
2011-10-03 17:22:56 +00:00
|
|
|
|
2011-10-03 17:21:41 +00:00
|
|
|
NOT_REACHED();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the GroupStatistic for the group of a vehicle.
|
|
|
|
* @param v Vehicle.
|
|
|
|
* @return GroupStatistics for the group of the vehicle.
|
|
|
|
*/
|
|
|
|
/* static */ GroupStatistics &GroupStatistics::Get(const Vehicle *v)
|
|
|
|
{
|
|
|
|
return GroupStatistics::Get(v->owner, v->group_id, v->type);
|
|
|
|
}
|
|
|
|
|
2011-10-03 17:23:41 +00:00
|
|
|
/**
|
|
|
|
* Returns the GroupStatistic for the ALL_GROUPO of a vehicle type.
|
|
|
|
* @param v Vehicle.
|
|
|
|
* @return GroupStatistics for the ALL_GROUP of the vehicle type.
|
|
|
|
*/
|
|
|
|
/* static */ GroupStatistics &GroupStatistics::GetAllGroup(const Vehicle *v)
|
|
|
|
{
|
|
|
|
return GroupStatistics::Get(v->owner, ALL_GROUP, v->type);
|
|
|
|
}
|
|
|
|
|
2011-10-03 17:20:56 +00:00
|
|
|
/**
|
2018-10-28 02:17:36 +00:00
|
|
|
* Update all caches after loading a game, changing NewGRF, etc.
|
2011-10-03 17:20:56 +00:00
|
|
|
*/
|
|
|
|
/* static */ void GroupStatistics::UpdateAfterLoad()
|
|
|
|
{
|
|
|
|
/* Set up the engine count for all companies */
|
2019-12-14 16:22:38 +00:00
|
|
|
for (Company *c : Company::Iterate()) {
|
2011-10-03 17:22:56 +00:00
|
|
|
for (VehicleType type = VEH_BEGIN; type < VEH_COMPANY_END; type++) {
|
2011-10-03 17:23:41 +00:00
|
|
|
c->group_all[type].Clear();
|
2011-10-03 17:22:56 +00:00
|
|
|
c->group_default[type].Clear();
|
|
|
|
}
|
2011-10-03 17:20:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Recalculate */
|
2019-12-16 17:01:57 +00:00
|
|
|
for (Group *g : Group::Iterate()) {
|
2011-10-03 17:20:56 +00:00
|
|
|
g->statistics.Clear();
|
|
|
|
}
|
|
|
|
|
2019-12-17 02:37:43 +00:00
|
|
|
for (const Vehicle *v : Vehicle::Iterate()) {
|
2011-10-03 17:20:56 +00:00
|
|
|
if (!v->IsEngineCountable()) continue;
|
|
|
|
|
2011-10-03 17:22:09 +00:00
|
|
|
GroupStatistics::CountEngine(v, 1);
|
2011-10-03 17:21:41 +00:00
|
|
|
if (v->IsPrimaryVehicle()) GroupStatistics::CountVehicle(v, 1);
|
2011-10-03 17:20:56 +00:00
|
|
|
}
|
2011-10-03 17:26:37 +00:00
|
|
|
|
2019-12-14 16:22:38 +00:00
|
|
|
for (const Company *c : Company::Iterate()) {
|
2011-10-03 17:26:37 +00:00
|
|
|
GroupStatistics::UpdateAutoreplace(c->index);
|
|
|
|
}
|
2011-10-03 17:20:56 +00:00
|
|
|
}
|
|
|
|
|
2011-10-03 17:21:41 +00:00
|
|
|
/**
|
|
|
|
* Update num_vehicle when adding or removing a vehicle.
|
|
|
|
* @param v Vehicle to count.
|
|
|
|
* @param delta +1 to add, -1 to remove.
|
|
|
|
*/
|
|
|
|
/* static */ void GroupStatistics::CountVehicle(const Vehicle *v, int delta)
|
|
|
|
{
|
Squashed commit of the following:
commit b17f39a2016dc11a6a9815f398d690d82a6a59aa
Merge: 67b3190 3bb7c47
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Feb 12 19:44:34 2016 +0100
Merge branch 'merge/trunk27506' into dev
commit 3bb7c4768580198b7316bfeebc4b870d355439e8
Merge: 14929fe 9db36bd
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Feb 12 19:43:53 2016 +0100
Merge remote-tracking branch 'openttd/master' into merge/trunk27506
commit 14929fe3536e2aa5b4d6a43d0d55043da7a2f252
Merge: af15609 4b8c698
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Feb 10 22:14:25 2016 +0100
Merge branch 'master' into merge/trunk27506
commit 67b319060b4b88b72c94b0e0c2c9fdcf1c2fd95d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sat Feb 28 20:17:13 2015 +0100
removed 2 unused function calls
commit af15609c938eb388dd507b16fb7b6d547c54c2da
Merge: 5465c88 b251ba3
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sat Feb 28 15:12:33 2015 +0100
Merge branch 'trunk' into merge_trunk
commit 5465c88c8016c5e7910570ab5795222e8348c703
Author: me <streen01@gmx.de>
Date: Sat Feb 28 10:59:41 2015 +0100
regenerated MSVS project files
forgot to do this, they still retained the old filenames
commit 0391455e29c5ed794fcd0f58c63ff98dc52685ac
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 16:53:05 2015 +0100
removed the patch files from this repo again
that was a rather dum idea, it made the difference patch between
branches trunk and tbtr huge.
the patch files are now being tracked again in the supplimentary repo
'tbtr_proj', that will keep this fork clean and creating diff-patches
will be much easier
commit 8395d40386c8d620c90fb4be66cf6679408ac975
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 16:27:40 2015 +0100
fix for reported bug by DC-1: crash in station gui
the template gui item was added to the drop-down list that was also
shown in a station gui, but there was no action present when this item
was selected in a station gui. per default the game would commit suicide
by called NOT_REACHED() at the default case of the according
switch-statement.
commit 833873245d33bd77105a82a584d9bec2362419bc
Merge: 39596be 8688c95
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 15:08:53 2015 +0100
Merge branch 'fix_disableTemplateOrderCheck' into tbtr
commit 8688c95a01ed5933a35a08597bbf45ff148f5a67
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 15:06:25 2015 +0100
added fix by DC-1
don't check the orders list of a virtual vehicle
commit 39596beff9a815a0f9b2ea3abe5d82c3ec5933e7
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 22 10:47:58 2015 +0100
added history of patches for the mod
commit b3ae74ac4e9143202a1fda1333a91c3716ebb21e
Merge: 9a601a1 ee756e1
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 22 10:03:04 2015 +0100
Merge branch 'tbtr' into merge_tbtr
commit ee756e1c2229534f1cc05edb97269b0c83ddde66
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Feb 17 22:25:50 2015 +0100
removed nonsensical comments + disabled code
commit e7d37f0500c56c84a36ce8b93eafb31f800e1086
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Feb 17 21:30:38 2015 +0100
added some missing renames in includes
commit 63c2b13766b077e4f2923f321e95d53356dee2db
Merge: e92e6ba 9752606
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Feb 17 21:22:11 2015 +0100
Merge branch 'feat_renameFiles' into merge_renameFiles
Conflicts:
src/tbtr_template_gui_create_virtualtrain.cpp
commit 975260643d212f8cac72485f2011011210622849
Author: Thomas Schmidt <streen01@gmx.de>
Date: Mon Feb 9 22:11:18 2015 +0100
replaced source file prefix: aaa -> tbtr
commit e92e6ba7089564886d17dd5c1fd8d85ea0ca4ac7
Merge: 62d2f80 ac16eab
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 15:02:19 2015 +0100
Merge branch 'rm_TODOs' into dev
Conflicts:
src/aaa_template_gui_main.cpp
commit 62d2f809edf170cfbeb0599822c4c3d4f9a1fefe
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:59:36 2015 +0100
i++ -> ++i
commit ac16eabc082f62b9fe2ef6c11a314f8e9a28c26b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:34:36 2015 +0100
rm'ed TODOs
commit 22f642f32265882b8f99b409b517823991c08101
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:17:49 2015 +0100
rm TODO
yes, depends on the selected template because the button "Start
replacing" means, to start the replacement for the currently selected
group and template (create a templatereplacement object for this
combination)
commit 60d8192838e340a3cf6899979361c997df73b716
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:17:26 2015 +0100
rm'ed TODO: included task in TODO-list
commit 39e42674ac9f5ad5dd056b613e80ef4e754c1153
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 11:19:36 2015 +0100
changed window class in use: WC_NONE -> WC_TEMPLATE_GUI_MAIN
commit cadfac96e21aeb862b75e0454197ddce89fb728c
Author: Thomas Schmidt <streen01@gmx.de>
Date: Mon Jan 26 23:18:29 2015 +0100
removed a weird call to deleteAllTmplReplacements
was a TODO task, it was set to delete all template replacements
belonging to group with id -1, which does not exist, ever
commit dc1058464c29f61b6197dec556ec468d1ff38451
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 25 23:27:03 2015 +0100
removed some TODOs
commit 7afeb17db512600424039099a0f4bd78882fcd8e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 25 11:35:47 2015 +0100
removed all MYGUI comments
tried to replace them with useful comments where necessary
added a few new TODOs here and there
commit 6b9453224a77811062254e6bce7dac4074b829a8
Merge: 292a5aa 687bc4c
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 20:47:06 2015 +0100
Merge branch 'fix_compiler_warnings' into dev
commit 687bc4c34fbb9ddeaf15b4857b235a9709dd85be
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 20:43:26 2015 +0100
fixed all remaining warnings
commit ada08d7097772e325b7852fd058d8bad7036ae4d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 18:25:45 2015 +0100
removed testing code that produced a warning
commit f3b1568384f36998aeb1fa51c1fab4cfb96c7f93
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 00:07:34 2015 +0100
removed unused variable REPLACEMENT_IN_PROGRESS
commit 5aa9098880070cfaa3d2815f445497b2886933f9
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 00:02:43 2015 +0100
removed variable 'mode' from ClickedOnVehicle()
member function of class TemplateCreateWindow
in the depot gui the mode variable is used to decide whether a vehicle
is started or dragged or ...
here, we only drag so the mode is never used
commit 292a5aa9dba9cf1d0003e84055fb95357f922454
Merge: 8f6df8c 2bb12bc
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Jan 14 23:41:29 2015 +0100
Merge branch 'feat_mergePatch0.4c' into dev
commit 2bb12bcf283cccc8869bf537b79b22f479cb7203
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Jan 14 23:32:04 2015 +0100
added vi's .swp files to .gitignore
commit aecf6f549b32f92342f8e0b65158bebef6270537
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Jan 13 20:15:25 2015 +0100
corrected UpdateViewport code
was VehicleUpdateViewport(Vehicle*, bool) before
is Vehicle::UpdateViewport(bool, bool) now
commit ae199283fd5ac0199cef1c4c980561122d030199
Author: Thomas Schmidt <streen01@gmx.de>
Date: Mon Jan 12 22:34:22 2015 +0100
updated code for EngineNumberSorter
commit 9735035c6dd4ded9bb76958722dc25e26ced5f05
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 11 18:36:17 2015 +0100
removed unused parameter 'part_of_chain'
from cargo movement code
commit b8b86e1f2592288ddcfb46a0a5d81c3257da60d3
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 4 21:44:17 2015 +0100
Reimplemented moving of cargo
- uses the new shift function
- manages to spread the old cargo of replaced vehicles from a chain across the memebers of the newly constructed chain
some TODOs are left within the code and some testing needs to be done,
how this behaves when there is more than one vehicle being replaced
commit 0d76e1bfe10ef207ac5e4018976e9fba0b0bb25e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sat Jan 3 01:05:54 2015 +0100
fixed saveload code for TemplateVehicle
commit ba0ea6975f48fe38c2b5376ebc83c23d6bb6151c
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 11:32:23 2015 +0100
final changes for the merge
- removed the WDF_UNLICK_BUTTON
- updated ctor calls to Window()
- disabled the engine number sorter
commit 9cc213335046b3febfe6649fde40b00e1bb43d5b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 11:29:03 2015 +0100
disabled cargo movement during templrpl
need to reimplement this step since the cargo is now moved
packet-by-packet and not as a complete list from a vehicle onto another
vehicle anymore
commit 39743806d0156f8547670c525af0e59083dbcd49
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 11:16:54 2015 +0100
replaced cargo function 'Count'
- not available anymore: VehicleCargoList::Count()
- using StoredCount() for now, should check if this is the correct count
commit 9b240bbf9b2ee5659bbcb518e9e2767103861254
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:27:56 2015 +0100
final corrections for template_gui_create_virtualtrain
commit cf0d48d8fa052ff521e1fac0ec75d75107c9b76e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:20:30 2015 +0100
disbabled usage of not-anymore-existing newgrf_engine.h::ListPositionOfEngine
commit 81da16b7f0c3ea2417b24707329d1d971a67e82e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:09:53 2015 +0100
fixed typo in value WID_BV_SORT_ASSENDING_DESCENDING
commit c8f81a5c3df5ccf4858bda64a53979af510ccd87
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:09:25 2015 +0100
create_virtual_train: uint GetEngineListHeight not static
commit bd29d99f80bd824e28104f3bc839fc2a5abdd297
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 00:57:25 2015 +0100
template_gui_create: static WindowDesc not const
commit edee9c1c544845459102328209b98d424cfd3248
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 00:44:50 2015 +0100
updated call to Window::FinishInitNested
commit 25fc3cb7ed6db15f42bd3fdff9506621fbba3d72
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Jan 1 23:56:48 2015 +0100
updated ctor calls for classes derived from Window
- first param in the constructor used to be const WindowDesc*, now it is
WindowDesc*
commit 54d710170f1ce9cf5539cd525744ca61f4089e7b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Jan 1 02:50:29 2015 +0100
updated constr calls to WindowDesc::WindowDesc
need a const char* at 2nd pos now
commit 7c954141f00666dec4c9559019a1a4af3b452372
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:30:02 2014 +0100
applied patch vehicle.cpp
commit aa12720049a3dfb1c2e02d453813bd567b67ff60
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:22:54 2014 +0100
applied patch vehicle_gui.cpp (failed hunks 2,4,5/6)
commit 2b8e70f15478072264f1e063418f8de0744a98e1
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:13:29 2014 +0100
applied patch train_cmd.cpp (failed hunk 1/8)
commit 47499523bf1ed0cce5fdf6cc2a7102e571dcb07d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:07:00 2014 +0100
applied patch newgrf_engine.cpp
commit 7a40c62a7b5ab8059981270252a7def69eacb7d7
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:02:52 2014 +0100
applied patch vehicle_cmd.cpp (failed hunks 2,3/3)
commit 277839abd8cb7eb277e4ed6cb72e0f3da5b7e479
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:56:35 2014 +0100
applied patch saveload.h (failed hunk 1/1)
commit 7b64c87ad3dede6442a88dafa5aa8a6a3e0db812
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:53:56 2014 +0100
applied patch group_gui.cpp (failed hunks 2,3/4)
commit 8075261c526004e21534fa0ab80429132d5f634b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:46:24 2014 +0100
applied patch vehiclelist.cpp (failed hunk 1/2)
commit b1c197c0f38e45fb50dad7f7e33f1438b150a34f
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:42:04 2014 +0100
applied patch train.h (failed hunk 1/3)
commit 81bfa209e92fa74387420cc85851767d2737c1b0
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch viewport.cpp.patch (file src/viewport.cpp)
commit 5c083054544eabac9260a75033198c665b169215
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch train_gui.cpp.patch (file src/train_gui.cpp)
commit 3c3534621c6b37530035faadfa092d70fed724c9
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch source.list.patch (file source.list)
commit 6bbb071431882d4bab43023f7194f96c824e78e5
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch saveload_internal.h.patch (file src/saveload/saveload_internal.h)
commit 158640eb786cc7867c9e689eb8a92a209e528a83
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch saveload.cpp.patch (file src/saveload/saveload.cpp)
commit e171ad716c126e98bc045f5ce574ac6161f3ab4f
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs90.vcproj.patch (file projects/openttd_vs90.vcproj)
commit b77486d89c12a80f73f088759da760abd0af7f49
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs80.vcproj.patch (file projects/openttd_vs80.vcproj)
commit 57f9c52fc580da51e20bd40f116fe66c9a0f3669
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs100.vcxproj.patch (file projects/openttd_vs100.vcxproj)
commit bda1f739a415600a7f522b1c7f9ca53fa7713ed3
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs100.vcxproj.filters.patch (file projects/openttd_vs100.vcxproj.filters)
commit ed96771b03e726e5cb56cac9a8328c3a1e63856b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch newgrf_spritegroup.cpp.patch (file src/newgrf_spritegroup.cpp)
commit 3df57e0d855fef5f54be4fd8d25e231a7eb3c3f1
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch group_cmd.cpp.patch (file src/group_cmd.cpp)
commit da31ca4b67d6993f127c6cecac717eb286ead4e6
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch english.txt.patch (file src/lang/english.txt)
commit ddc0af7139fccbae4060c70440f17c763e3bba96
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch depot_gui.cpp.patch (file src/depot_gui.cpp)
commit 88aca9db192c6a2b92185f56505caf8b91d23ab4
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch autoreplace_cmd.cpp.patch (file src/autoreplace_cmd.cpp)
commit 45ca80f7c9847ac3afe181a0badeb12bbbd5ed0d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch articulated_vehicles.cpp.patch (file src/articulated_vehicles.cpp)
commit 44bd0bf2e77f366b61f96b0f4ca564f2e2e5814a
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch afterload.cpp.patch (file src/saveload/afterload.cpp)
commit 679f9b327f9d3f3bec327ae0266f289981972c85
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_veh_sl.cpp.patch (file src/saveload/aaa_template_veh_sl.cpp)
commit ebcec221ec7c1988e85ba458283ff362e034e6d5
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle.h.patch (file src/aaa_template_vehicle.h)
commit ad690e74b95d2aa07157b73834eef672c63ef901
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle_func.h.patch (file src/aaa_template_vehicle_func.h)
commit 5982153c369432fc694daaa91a06dfefeeb29485
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle_func.cpp.patch (file src/aaa_template_vehicle_func.cpp)
commit 773f889e165b013de96736fa380d5ab5c311b3dd
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle.cpp.patch (file src/aaa_template_vehicle.cpp)
commit 03af781d69a09863d3b76ee4911e5eecd90a7cf5
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_replacement_sl.cpp.patch (file src/saveload/aaa_template_replacement_sl.cpp)
commit ab6cb0562fd390d551670dbc27e0c3c94c8554db
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_gui_replaceall.cpp.patch (file src/aaa_template_gui_replaceall.cpp)
commit d88452a6195c55e39bceb3ea7689fc546c4eee6a
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_gui_main.cpp.patch (file src/aaa_template_gui_main.cpp)
commit ab6ac687f355d400ad9ebc154e75477671a8e0fa
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:42:21 2014 +0100
applied patch aaa_template_gui_create_virtualtrain.cpp.patch (file src/aaa_template_gui_create_virtualtrain.cpp)
commit 288d14b9b145cb045b6a287d23cf3be4f2712ede
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:38:12 2014 +0100
applied patch aaa_template_gui_create.cpp.patch (file src/aaa_template_gui_create.cpp)
commit 5342db70e07fb7c1f3c41654abd2c6a4c51472c4
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:18:32 2014 +0100
applied aaa_* header files
commit 6f14e94a0ad715a33a2653cf6c12e1c2981ace8d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:29:55 2014 +0100
applied vehicle_base.h.patch
commit b76a5ce921fab5d81b60755ce66db71e38664e9b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:29:28 2014 +0100
applied window_type.h.patch
commit d33d738c7e3477de3f12affcc74c88194a61c442
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:28:30 2014 +0100
applied newgrf_engine.h.patch
commit 931fd1143706bc76aa145e1430645cb4496f9f4a
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:27:21 2014 +0100
applied vehicle_gui.h.patch
commit f6c4ab089dad5a4a01401e18cffa8f20e02f733e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:00:52 2014 +0100
applied vehicle_gui_base.h.patch
commit 5f7378136758fcc4987791d264856169950cbfe2
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 12:34:23 2014 +0100
applied build_vehicle_widget.h.patch
commit 5c6fc73847a2f34573260721bb68c7b552d546bc
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 12:01:10 2014 +0100
applied autoreplace_func.h
commit 7636f27011841d01e5f954c855dfa0cf1859e0e0
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 12:01:00 2014 +0100
applied newgrf.h
Remove some spurious whitespace changes, update projects files.
2016-02-13 19:26:47 +00:00
|
|
|
/* make virtual trains group-neutral */
|
2016-03-21 18:22:29 +00:00
|
|
|
if (HasBit(v->subtype, GVSF_VIRTUAL)) return;
|
Squashed commit of the following:
commit b17f39a2016dc11a6a9815f398d690d82a6a59aa
Merge: 67b3190 3bb7c47
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Feb 12 19:44:34 2016 +0100
Merge branch 'merge/trunk27506' into dev
commit 3bb7c4768580198b7316bfeebc4b870d355439e8
Merge: 14929fe 9db36bd
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Feb 12 19:43:53 2016 +0100
Merge remote-tracking branch 'openttd/master' into merge/trunk27506
commit 14929fe3536e2aa5b4d6a43d0d55043da7a2f252
Merge: af15609 4b8c698
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Feb 10 22:14:25 2016 +0100
Merge branch 'master' into merge/trunk27506
commit 67b319060b4b88b72c94b0e0c2c9fdcf1c2fd95d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sat Feb 28 20:17:13 2015 +0100
removed 2 unused function calls
commit af15609c938eb388dd507b16fb7b6d547c54c2da
Merge: 5465c88 b251ba3
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sat Feb 28 15:12:33 2015 +0100
Merge branch 'trunk' into merge_trunk
commit 5465c88c8016c5e7910570ab5795222e8348c703
Author: me <streen01@gmx.de>
Date: Sat Feb 28 10:59:41 2015 +0100
regenerated MSVS project files
forgot to do this, they still retained the old filenames
commit 0391455e29c5ed794fcd0f58c63ff98dc52685ac
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 16:53:05 2015 +0100
removed the patch files from this repo again
that was a rather dum idea, it made the difference patch between
branches trunk and tbtr huge.
the patch files are now being tracked again in the supplimentary repo
'tbtr_proj', that will keep this fork clean and creating diff-patches
will be much easier
commit 8395d40386c8d620c90fb4be66cf6679408ac975
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 16:27:40 2015 +0100
fix for reported bug by DC-1: crash in station gui
the template gui item was added to the drop-down list that was also
shown in a station gui, but there was no action present when this item
was selected in a station gui. per default the game would commit suicide
by called NOT_REACHED() at the default case of the according
switch-statement.
commit 833873245d33bd77105a82a584d9bec2362419bc
Merge: 39596be 8688c95
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 15:08:53 2015 +0100
Merge branch 'fix_disableTemplateOrderCheck' into tbtr
commit 8688c95a01ed5933a35a08597bbf45ff148f5a67
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 15:06:25 2015 +0100
added fix by DC-1
don't check the orders list of a virtual vehicle
commit 39596beff9a815a0f9b2ea3abe5d82c3ec5933e7
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 22 10:47:58 2015 +0100
added history of patches for the mod
commit b3ae74ac4e9143202a1fda1333a91c3716ebb21e
Merge: 9a601a1 ee756e1
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 22 10:03:04 2015 +0100
Merge branch 'tbtr' into merge_tbtr
commit ee756e1c2229534f1cc05edb97269b0c83ddde66
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Feb 17 22:25:50 2015 +0100
removed nonsensical comments + disabled code
commit e7d37f0500c56c84a36ce8b93eafb31f800e1086
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Feb 17 21:30:38 2015 +0100
added some missing renames in includes
commit 63c2b13766b077e4f2923f321e95d53356dee2db
Merge: e92e6ba 9752606
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Feb 17 21:22:11 2015 +0100
Merge branch 'feat_renameFiles' into merge_renameFiles
Conflicts:
src/tbtr_template_gui_create_virtualtrain.cpp
commit 975260643d212f8cac72485f2011011210622849
Author: Thomas Schmidt <streen01@gmx.de>
Date: Mon Feb 9 22:11:18 2015 +0100
replaced source file prefix: aaa -> tbtr
commit e92e6ba7089564886d17dd5c1fd8d85ea0ca4ac7
Merge: 62d2f80 ac16eab
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 15:02:19 2015 +0100
Merge branch 'rm_TODOs' into dev
Conflicts:
src/aaa_template_gui_main.cpp
commit 62d2f809edf170cfbeb0599822c4c3d4f9a1fefe
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:59:36 2015 +0100
i++ -> ++i
commit ac16eabc082f62b9fe2ef6c11a314f8e9a28c26b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:34:36 2015 +0100
rm'ed TODOs
commit 22f642f32265882b8f99b409b517823991c08101
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:17:49 2015 +0100
rm TODO
yes, depends on the selected template because the button "Start
replacing" means, to start the replacement for the currently selected
group and template (create a templatereplacement object for this
combination)
commit 60d8192838e340a3cf6899979361c997df73b716
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:17:26 2015 +0100
rm'ed TODO: included task in TODO-list
commit 39e42674ac9f5ad5dd056b613e80ef4e754c1153
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 11:19:36 2015 +0100
changed window class in use: WC_NONE -> WC_TEMPLATE_GUI_MAIN
commit cadfac96e21aeb862b75e0454197ddce89fb728c
Author: Thomas Schmidt <streen01@gmx.de>
Date: Mon Jan 26 23:18:29 2015 +0100
removed a weird call to deleteAllTmplReplacements
was a TODO task, it was set to delete all template replacements
belonging to group with id -1, which does not exist, ever
commit dc1058464c29f61b6197dec556ec468d1ff38451
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 25 23:27:03 2015 +0100
removed some TODOs
commit 7afeb17db512600424039099a0f4bd78882fcd8e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 25 11:35:47 2015 +0100
removed all MYGUI comments
tried to replace them with useful comments where necessary
added a few new TODOs here and there
commit 6b9453224a77811062254e6bce7dac4074b829a8
Merge: 292a5aa 687bc4c
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 20:47:06 2015 +0100
Merge branch 'fix_compiler_warnings' into dev
commit 687bc4c34fbb9ddeaf15b4857b235a9709dd85be
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 20:43:26 2015 +0100
fixed all remaining warnings
commit ada08d7097772e325b7852fd058d8bad7036ae4d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 18:25:45 2015 +0100
removed testing code that produced a warning
commit f3b1568384f36998aeb1fa51c1fab4cfb96c7f93
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 00:07:34 2015 +0100
removed unused variable REPLACEMENT_IN_PROGRESS
commit 5aa9098880070cfaa3d2815f445497b2886933f9
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 00:02:43 2015 +0100
removed variable 'mode' from ClickedOnVehicle()
member function of class TemplateCreateWindow
in the depot gui the mode variable is used to decide whether a vehicle
is started or dragged or ...
here, we only drag so the mode is never used
commit 292a5aa9dba9cf1d0003e84055fb95357f922454
Merge: 8f6df8c 2bb12bc
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Jan 14 23:41:29 2015 +0100
Merge branch 'feat_mergePatch0.4c' into dev
commit 2bb12bcf283cccc8869bf537b79b22f479cb7203
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Jan 14 23:32:04 2015 +0100
added vi's .swp files to .gitignore
commit aecf6f549b32f92342f8e0b65158bebef6270537
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Jan 13 20:15:25 2015 +0100
corrected UpdateViewport code
was VehicleUpdateViewport(Vehicle*, bool) before
is Vehicle::UpdateViewport(bool, bool) now
commit ae199283fd5ac0199cef1c4c980561122d030199
Author: Thomas Schmidt <streen01@gmx.de>
Date: Mon Jan 12 22:34:22 2015 +0100
updated code for EngineNumberSorter
commit 9735035c6dd4ded9bb76958722dc25e26ced5f05
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 11 18:36:17 2015 +0100
removed unused parameter 'part_of_chain'
from cargo movement code
commit b8b86e1f2592288ddcfb46a0a5d81c3257da60d3
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 4 21:44:17 2015 +0100
Reimplemented moving of cargo
- uses the new shift function
- manages to spread the old cargo of replaced vehicles from a chain across the memebers of the newly constructed chain
some TODOs are left within the code and some testing needs to be done,
how this behaves when there is more than one vehicle being replaced
commit 0d76e1bfe10ef207ac5e4018976e9fba0b0bb25e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sat Jan 3 01:05:54 2015 +0100
fixed saveload code for TemplateVehicle
commit ba0ea6975f48fe38c2b5376ebc83c23d6bb6151c
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 11:32:23 2015 +0100
final changes for the merge
- removed the WDF_UNLICK_BUTTON
- updated ctor calls to Window()
- disabled the engine number sorter
commit 9cc213335046b3febfe6649fde40b00e1bb43d5b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 11:29:03 2015 +0100
disabled cargo movement during templrpl
need to reimplement this step since the cargo is now moved
packet-by-packet and not as a complete list from a vehicle onto another
vehicle anymore
commit 39743806d0156f8547670c525af0e59083dbcd49
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 11:16:54 2015 +0100
replaced cargo function 'Count'
- not available anymore: VehicleCargoList::Count()
- using StoredCount() for now, should check if this is the correct count
commit 9b240bbf9b2ee5659bbcb518e9e2767103861254
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:27:56 2015 +0100
final corrections for template_gui_create_virtualtrain
commit cf0d48d8fa052ff521e1fac0ec75d75107c9b76e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:20:30 2015 +0100
disbabled usage of not-anymore-existing newgrf_engine.h::ListPositionOfEngine
commit 81da16b7f0c3ea2417b24707329d1d971a67e82e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:09:53 2015 +0100
fixed typo in value WID_BV_SORT_ASSENDING_DESCENDING
commit c8f81a5c3df5ccf4858bda64a53979af510ccd87
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:09:25 2015 +0100
create_virtual_train: uint GetEngineListHeight not static
commit bd29d99f80bd824e28104f3bc839fc2a5abdd297
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 00:57:25 2015 +0100
template_gui_create: static WindowDesc not const
commit edee9c1c544845459102328209b98d424cfd3248
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 00:44:50 2015 +0100
updated call to Window::FinishInitNested
commit 25fc3cb7ed6db15f42bd3fdff9506621fbba3d72
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Jan 1 23:56:48 2015 +0100
updated ctor calls for classes derived from Window
- first param in the constructor used to be const WindowDesc*, now it is
WindowDesc*
commit 54d710170f1ce9cf5539cd525744ca61f4089e7b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Jan 1 02:50:29 2015 +0100
updated constr calls to WindowDesc::WindowDesc
need a const char* at 2nd pos now
commit 7c954141f00666dec4c9559019a1a4af3b452372
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:30:02 2014 +0100
applied patch vehicle.cpp
commit aa12720049a3dfb1c2e02d453813bd567b67ff60
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:22:54 2014 +0100
applied patch vehicle_gui.cpp (failed hunks 2,4,5/6)
commit 2b8e70f15478072264f1e063418f8de0744a98e1
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:13:29 2014 +0100
applied patch train_cmd.cpp (failed hunk 1/8)
commit 47499523bf1ed0cce5fdf6cc2a7102e571dcb07d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:07:00 2014 +0100
applied patch newgrf_engine.cpp
commit 7a40c62a7b5ab8059981270252a7def69eacb7d7
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:02:52 2014 +0100
applied patch vehicle_cmd.cpp (failed hunks 2,3/3)
commit 277839abd8cb7eb277e4ed6cb72e0f3da5b7e479
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:56:35 2014 +0100
applied patch saveload.h (failed hunk 1/1)
commit 7b64c87ad3dede6442a88dafa5aa8a6a3e0db812
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:53:56 2014 +0100
applied patch group_gui.cpp (failed hunks 2,3/4)
commit 8075261c526004e21534fa0ab80429132d5f634b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:46:24 2014 +0100
applied patch vehiclelist.cpp (failed hunk 1/2)
commit b1c197c0f38e45fb50dad7f7e33f1438b150a34f
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:42:04 2014 +0100
applied patch train.h (failed hunk 1/3)
commit 81bfa209e92fa74387420cc85851767d2737c1b0
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch viewport.cpp.patch (file src/viewport.cpp)
commit 5c083054544eabac9260a75033198c665b169215
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch train_gui.cpp.patch (file src/train_gui.cpp)
commit 3c3534621c6b37530035faadfa092d70fed724c9
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch source.list.patch (file source.list)
commit 6bbb071431882d4bab43023f7194f96c824e78e5
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch saveload_internal.h.patch (file src/saveload/saveload_internal.h)
commit 158640eb786cc7867c9e689eb8a92a209e528a83
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch saveload.cpp.patch (file src/saveload/saveload.cpp)
commit e171ad716c126e98bc045f5ce574ac6161f3ab4f
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs90.vcproj.patch (file projects/openttd_vs90.vcproj)
commit b77486d89c12a80f73f088759da760abd0af7f49
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs80.vcproj.patch (file projects/openttd_vs80.vcproj)
commit 57f9c52fc580da51e20bd40f116fe66c9a0f3669
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs100.vcxproj.patch (file projects/openttd_vs100.vcxproj)
commit bda1f739a415600a7f522b1c7f9ca53fa7713ed3
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs100.vcxproj.filters.patch (file projects/openttd_vs100.vcxproj.filters)
commit ed96771b03e726e5cb56cac9a8328c3a1e63856b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch newgrf_spritegroup.cpp.patch (file src/newgrf_spritegroup.cpp)
commit 3df57e0d855fef5f54be4fd8d25e231a7eb3c3f1
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch group_cmd.cpp.patch (file src/group_cmd.cpp)
commit da31ca4b67d6993f127c6cecac717eb286ead4e6
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch english.txt.patch (file src/lang/english.txt)
commit ddc0af7139fccbae4060c70440f17c763e3bba96
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch depot_gui.cpp.patch (file src/depot_gui.cpp)
commit 88aca9db192c6a2b92185f56505caf8b91d23ab4
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch autoreplace_cmd.cpp.patch (file src/autoreplace_cmd.cpp)
commit 45ca80f7c9847ac3afe181a0badeb12bbbd5ed0d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch articulated_vehicles.cpp.patch (file src/articulated_vehicles.cpp)
commit 44bd0bf2e77f366b61f96b0f4ca564f2e2e5814a
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch afterload.cpp.patch (file src/saveload/afterload.cpp)
commit 679f9b327f9d3f3bec327ae0266f289981972c85
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_veh_sl.cpp.patch (file src/saveload/aaa_template_veh_sl.cpp)
commit ebcec221ec7c1988e85ba458283ff362e034e6d5
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle.h.patch (file src/aaa_template_vehicle.h)
commit ad690e74b95d2aa07157b73834eef672c63ef901
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle_func.h.patch (file src/aaa_template_vehicle_func.h)
commit 5982153c369432fc694daaa91a06dfefeeb29485
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle_func.cpp.patch (file src/aaa_template_vehicle_func.cpp)
commit 773f889e165b013de96736fa380d5ab5c311b3dd
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle.cpp.patch (file src/aaa_template_vehicle.cpp)
commit 03af781d69a09863d3b76ee4911e5eecd90a7cf5
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_replacement_sl.cpp.patch (file src/saveload/aaa_template_replacement_sl.cpp)
commit ab6cb0562fd390d551670dbc27e0c3c94c8554db
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_gui_replaceall.cpp.patch (file src/aaa_template_gui_replaceall.cpp)
commit d88452a6195c55e39bceb3ea7689fc546c4eee6a
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_gui_main.cpp.patch (file src/aaa_template_gui_main.cpp)
commit ab6ac687f355d400ad9ebc154e75477671a8e0fa
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:42:21 2014 +0100
applied patch aaa_template_gui_create_virtualtrain.cpp.patch (file src/aaa_template_gui_create_virtualtrain.cpp)
commit 288d14b9b145cb045b6a287d23cf3be4f2712ede
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:38:12 2014 +0100
applied patch aaa_template_gui_create.cpp.patch (file src/aaa_template_gui_create.cpp)
commit 5342db70e07fb7c1f3c41654abd2c6a4c51472c4
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:18:32 2014 +0100
applied aaa_* header files
commit 6f14e94a0ad715a33a2653cf6c12e1c2981ace8d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:29:55 2014 +0100
applied vehicle_base.h.patch
commit b76a5ce921fab5d81b60755ce66db71e38664e9b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:29:28 2014 +0100
applied window_type.h.patch
commit d33d738c7e3477de3f12affcc74c88194a61c442
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:28:30 2014 +0100
applied newgrf_engine.h.patch
commit 931fd1143706bc76aa145e1430645cb4496f9f4a
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:27:21 2014 +0100
applied vehicle_gui.h.patch
commit f6c4ab089dad5a4a01401e18cffa8f20e02f733e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:00:52 2014 +0100
applied vehicle_gui_base.h.patch
commit 5f7378136758fcc4987791d264856169950cbfe2
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 12:34:23 2014 +0100
applied build_vehicle_widget.h.patch
commit 5c6fc73847a2f34573260721bb68c7b552d546bc
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 12:01:10 2014 +0100
applied autoreplace_func.h
commit 7636f27011841d01e5f954c855dfa0cf1859e0e0
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 12:01:00 2014 +0100
applied newgrf.h
Remove some spurious whitespace changes, update projects files.
2016-02-13 19:26:47 +00:00
|
|
|
|
2011-10-03 17:21:41 +00:00
|
|
|
assert(delta == 1 || delta == -1);
|
|
|
|
|
2011-10-03 17:23:41 +00:00
|
|
|
GroupStatistics &stats_all = GroupStatistics::GetAllGroup(v);
|
2011-10-03 17:21:41 +00:00
|
|
|
GroupStatistics &stats = GroupStatistics::Get(v);
|
|
|
|
|
2011-10-03 17:23:41 +00:00
|
|
|
stats_all.num_vehicle += delta;
|
2023-01-22 13:14:02 +00:00
|
|
|
stats_all.profit_last_year += v->GetDisplayProfitLastYear() * delta;
|
2011-10-03 17:21:41 +00:00
|
|
|
stats.num_vehicle += delta;
|
2023-01-22 13:14:02 +00:00
|
|
|
stats.profit_last_year += v->GetDisplayProfitLastYear() * delta;
|
2011-10-03 17:25:44 +00:00
|
|
|
|
2024-03-09 14:38:52 +00:00
|
|
|
if (v->economy_age > VEHICLE_PROFIT_MIN_AGE) {
|
2023-01-22 13:14:02 +00:00
|
|
|
stats_all.num_vehicle_min_age += delta;
|
|
|
|
stats_all.profit_last_year_min_age += v->GetDisplayProfitLastYear() * delta;
|
|
|
|
stats.num_vehicle_min_age += delta;
|
|
|
|
stats.profit_last_year_min_age += v->GetDisplayProfitLastYear() * delta;
|
2011-10-03 17:25:44 +00:00
|
|
|
}
|
2011-10-03 17:21:41 +00:00
|
|
|
}
|
|
|
|
|
2011-10-03 17:22:09 +00:00
|
|
|
/**
|
|
|
|
* Update num_engines when adding/removing an engine.
|
|
|
|
* @param v Engine to count.
|
|
|
|
* @param delta +1 to add, -1 to remove.
|
|
|
|
*/
|
|
|
|
/* static */ void GroupStatistics::CountEngine(const Vehicle *v, int delta)
|
|
|
|
{
|
2016-03-21 18:22:29 +00:00
|
|
|
/* make virtual trains group-neutral */
|
|
|
|
if (HasBit(v->subtype, GVSF_VIRTUAL)) return;
|
|
|
|
|
2011-10-03 17:22:09 +00:00
|
|
|
assert(delta == 1 || delta == -1);
|
2011-10-03 17:23:41 +00:00
|
|
|
GroupStatistics::GetAllGroup(v).num_engines[v->engine_type] += delta;
|
2011-10-03 17:22:09 +00:00
|
|
|
GroupStatistics::Get(v).num_engines[v->engine_type] += delta;
|
|
|
|
}
|
|
|
|
|
2011-10-03 17:25:44 +00:00
|
|
|
/**
|
2023-01-22 13:14:02 +00:00
|
|
|
* Add a vehicle's last year profit to the profit sum of its group.
|
2011-10-03 17:25:44 +00:00
|
|
|
*/
|
2023-01-22 13:14:02 +00:00
|
|
|
/* static */ void GroupStatistics::AddProfitLastYear(const Vehicle *v)
|
2011-10-03 17:25:44 +00:00
|
|
|
{
|
|
|
|
GroupStatistics &stats_all = GroupStatistics::GetAllGroup(v);
|
|
|
|
GroupStatistics &stats = GroupStatistics::Get(v);
|
|
|
|
|
|
|
|
stats_all.profit_last_year += v->GetDisplayProfitLastYear();
|
|
|
|
stats.profit_last_year += v->GetDisplayProfitLastYear();
|
|
|
|
}
|
|
|
|
|
2023-01-22 13:14:02 +00:00
|
|
|
/**
|
|
|
|
* Add a vehicle to the profit sum of its group.
|
|
|
|
*/
|
|
|
|
/* static */ void GroupStatistics::VehicleReachedMinAge(const Vehicle *v)
|
|
|
|
{
|
|
|
|
GroupStatistics &stats_all = GroupStatistics::GetAllGroup(v);
|
|
|
|
GroupStatistics &stats = GroupStatistics::Get(v);
|
|
|
|
|
|
|
|
stats_all.num_vehicle_min_age++;
|
|
|
|
stats_all.profit_last_year_min_age += v->GetDisplayProfitLastYear();
|
|
|
|
stats.num_vehicle_min_age++;
|
|
|
|
stats.profit_last_year_min_age += v->GetDisplayProfitLastYear();
|
|
|
|
}
|
|
|
|
|
2011-10-03 17:25:44 +00:00
|
|
|
/**
|
|
|
|
* Recompute the profits for all groups.
|
|
|
|
*/
|
|
|
|
/* static */ void GroupStatistics::UpdateProfits()
|
|
|
|
{
|
|
|
|
/* Set up the engine count for all companies */
|
2019-12-14 16:22:38 +00:00
|
|
|
for (Company *c : Company::Iterate()) {
|
2011-10-03 17:25:44 +00:00
|
|
|
for (VehicleType type = VEH_BEGIN; type < VEH_COMPANY_END; type++) {
|
|
|
|
c->group_all[type].ClearProfits();
|
|
|
|
c->group_default[type].ClearProfits();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Recalculate */
|
2019-12-16 17:01:57 +00:00
|
|
|
for (Group *g : Group::Iterate()) {
|
2011-10-03 17:25:44 +00:00
|
|
|
g->statistics.ClearProfits();
|
|
|
|
}
|
|
|
|
|
2024-02-25 14:49:31 +00:00
|
|
|
for (const Vehicle *v : Vehicle::IterateFrontOnly()) {
|
2023-01-23 19:10:07 +00:00
|
|
|
if (v->IsPrimaryVehicle() && !HasBit(v->subtype, GVSF_VIRTUAL)) {
|
2023-01-22 13:14:02 +00:00
|
|
|
GroupStatistics::AddProfitLastYear(v);
|
2024-03-09 14:38:52 +00:00
|
|
|
if (v->economy_age > VEHICLE_PROFIT_MIN_AGE) GroupStatistics::VehicleReachedMinAge(v);
|
2023-01-22 13:14:02 +00:00
|
|
|
}
|
2011-10-03 17:25:44 +00:00
|
|
|
}
|
|
|
|
}
|
2011-10-03 17:20:26 +00:00
|
|
|
|
2011-10-03 17:26:37 +00:00
|
|
|
/**
|
|
|
|
* Update autoreplace_defined and autoreplace_finished of all statistics of a company.
|
|
|
|
* @param company Company to update statistics for.
|
|
|
|
*/
|
|
|
|
/* static */ void GroupStatistics::UpdateAutoreplace(CompanyID company)
|
|
|
|
{
|
|
|
|
/* Set up the engine count for all companies */
|
|
|
|
Company *c = Company::Get(company);
|
|
|
|
for (VehicleType type = VEH_BEGIN; type < VEH_COMPANY_END; type++) {
|
|
|
|
c->group_all[type].ClearAutoreplace();
|
|
|
|
c->group_default[type].ClearAutoreplace();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Recalculate */
|
2019-12-16 17:01:57 +00:00
|
|
|
for (Group *g : Group::Iterate()) {
|
2011-10-03 17:26:37 +00:00
|
|
|
if (g->owner != company) continue;
|
|
|
|
g->statistics.ClearAutoreplace();
|
|
|
|
}
|
|
|
|
|
2019-04-10 21:07:06 +00:00
|
|
|
for (EngineRenewList erl = c->engine_renew_list; erl != nullptr; erl = erl->next) {
|
2011-10-03 17:26:37 +00:00
|
|
|
const Engine *e = Engine::Get(erl->from);
|
|
|
|
GroupStatistics &stats = GroupStatistics::Get(company, erl->group_id, e->type);
|
|
|
|
if (!stats.autoreplace_defined) {
|
|
|
|
stats.autoreplace_defined = true;
|
|
|
|
stats.autoreplace_finished = true;
|
|
|
|
}
|
2019-01-13 22:29:17 +00:00
|
|
|
if (GetGroupNumEngines(company, erl->group_id, erl->from) > 0) stats.autoreplace_finished = false;
|
2011-10-03 17:26:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-19 09:40:18 +00:00
|
|
|
/**
|
|
|
|
* Update the num engines of a groupID. Decrease the old one and increase the new one
|
|
|
|
* @note called in SetTrainGroupID and UpdateTrainGroupID
|
2011-10-03 17:22:09 +00:00
|
|
|
* @param v Vehicle we have to update
|
2007-05-19 09:40:18 +00:00
|
|
|
* @param old_g index of the old group
|
|
|
|
* @param new_g index of the new group
|
|
|
|
*/
|
2011-10-03 17:22:09 +00:00
|
|
|
static inline void UpdateNumEngineGroup(const Vehicle *v, GroupID old_g, GroupID new_g)
|
2007-05-19 09:40:18 +00:00
|
|
|
{
|
|
|
|
if (old_g != new_g) {
|
2011-10-03 17:22:09 +00:00
|
|
|
/* Decrease the num engines in the old group */
|
2011-10-03 17:22:56 +00:00
|
|
|
GroupStatistics::Get(v->owner, old_g, v->type).num_engines[v->engine_type]--;
|
2007-05-19 09:40:18 +00:00
|
|
|
|
2011-10-03 17:22:09 +00:00
|
|
|
/* Increase the num engines in the new group */
|
2011-10-03 17:22:56 +00:00
|
|
|
GroupStatistics::Get(v->owner, new_g, v->type).num_engines[v->engine_type]++;
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-01-31 13:57:44 +00:00
|
|
|
const Livery *GetParentLivery(const Group *g)
|
|
|
|
{
|
|
|
|
if (g->parent == INVALID_GROUP) {
|
|
|
|
const Company *c = Company::Get(g->owner);
|
|
|
|
return &c->livery[LS_DEFAULT];
|
|
|
|
}
|
|
|
|
|
|
|
|
const Group *pg = Group::Get(g->parent);
|
|
|
|
return &pg->livery;
|
|
|
|
}
|
|
|
|
|
2023-12-29 15:34:34 +00:00
|
|
|
static inline bool IsGroupDescendantOfGroupID(const Group *g, const GroupID top_gid, const Owner owner)
|
2021-05-14 01:04:37 +00:00
|
|
|
{
|
2023-12-29 15:34:34 +00:00
|
|
|
if (g->owner != owner) return false;
|
2021-05-14 01:04:37 +00:00
|
|
|
|
|
|
|
while (true) {
|
2023-12-29 15:34:34 +00:00
|
|
|
if (g->parent == top_gid) return true;
|
2021-05-14 01:04:37 +00:00
|
|
|
if (g->parent == INVALID_GROUP) return false;
|
|
|
|
g = Group::Get(g->parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
NOT_REACHED();
|
|
|
|
}
|
|
|
|
|
2023-12-29 15:34:34 +00:00
|
|
|
static inline bool IsGroupDescendantOfGroup(const Group *g, const Group *top)
|
|
|
|
{
|
|
|
|
return IsGroupDescendantOfGroupID(g, top->index, top->owner);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool IsGroupIDDescendantOfGroupID(const GroupID gid, const GroupID top_gid, const Owner owner)
|
|
|
|
{
|
|
|
|
if (IsTopLevelGroupID(gid) || gid == INVALID_GROUP) return false;
|
|
|
|
|
|
|
|
return IsGroupDescendantOfGroupID(Group::Get(gid), top_gid, owner);
|
|
|
|
}
|
|
|
|
|
2021-05-14 01:04:37 +00:00
|
|
|
template <typename F>
|
|
|
|
void IterateDescendantsOfGroup(const Group *top, F func)
|
|
|
|
{
|
|
|
|
for (Group *cg : Group::Iterate()) {
|
|
|
|
if (IsGroupDescendantOfGroup(cg, top)) {
|
|
|
|
func(cg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename F>
|
|
|
|
void IterateDescendantsOfGroup(GroupID id_top, F func)
|
|
|
|
{
|
|
|
|
const Group *top = Group::GetIfValid(id_top);
|
|
|
|
if (top != nullptr) IterateDescendantsOfGroup<F>(top, func);
|
|
|
|
}
|
2019-01-31 13:57:44 +00:00
|
|
|
|
2023-12-29 15:34:34 +00:00
|
|
|
static void PropagateChildLiveryResetVehicleCache(const Group *g)
|
2019-01-31 13:57:44 +00:00
|
|
|
{
|
2023-12-29 15:34:34 +00:00
|
|
|
/* Company colour data is indirectly cached. */
|
2024-02-25 14:49:31 +00:00
|
|
|
for (Vehicle *v : Vehicle::IterateFrontOnly()) {
|
2023-12-29 15:34:34 +00:00
|
|
|
if (v->IsPrimaryVehicle() && (v->group_id == g->index || IsGroupIDDescendantOfGroupID(v->group_id, g->index, g->owner))) {
|
|
|
|
for (Vehicle *u = v; u != nullptr; u = u->Next()) {
|
|
|
|
u->colourmap = PAL_NONE;
|
|
|
|
u->InvalidateNewGRFCache();
|
|
|
|
u->InvalidateImageCache();
|
2019-01-31 13:57:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-12-29 15:34:34 +00:00
|
|
|
}
|
2019-01-31 13:57:44 +00:00
|
|
|
|
2023-12-29 15:34:34 +00:00
|
|
|
static void PropagateChildLivery(const GroupID top_gid, const Owner owner, const Livery &top_livery)
|
|
|
|
{
|
|
|
|
for (Group *g : Group::Iterate()) {
|
|
|
|
if (g->owner != owner) continue;
|
|
|
|
|
|
|
|
Livery livery = g->livery;
|
|
|
|
|
|
|
|
const Group *pg = g;
|
|
|
|
bool is_descendant = (g->index == top_gid);
|
|
|
|
while (!is_descendant) {
|
|
|
|
if (pg->parent == top_gid) {
|
|
|
|
is_descendant = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (pg->parent == INVALID_GROUP) break;
|
|
|
|
pg = Group::Get(pg->parent);
|
|
|
|
if (!HasBit(livery.in_use, 0)) livery.colour1 = pg->livery.colour1;
|
|
|
|
if (!HasBit(livery.in_use, 1)) livery.colour2 = pg->livery.colour2;
|
|
|
|
livery.in_use |= pg->livery.in_use;
|
|
|
|
}
|
|
|
|
if (is_descendant) {
|
|
|
|
if (!HasBit(livery.in_use, 0)) livery.colour1 = top_livery.colour1;
|
|
|
|
if (!HasBit(livery.in_use, 1)) livery.colour2 = top_livery.colour2;
|
|
|
|
g->livery.colour1 = livery.colour1;
|
|
|
|
g->livery.colour2 = livery.colour2;
|
2019-01-31 13:57:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-29 15:34:34 +00:00
|
|
|
/**
|
|
|
|
* Propagate a livery change to a group's children, and optionally update cached vehicle colourmaps.
|
|
|
|
* @param g Group to propagate colours to children.
|
|
|
|
* @param reset_cache Reset colourmap of vehicles in this group.
|
|
|
|
*/
|
|
|
|
static void PropagateChildLivery(const Group *g, bool reset_cache)
|
|
|
|
{
|
|
|
|
PropagateChildLivery(g->index, g->owner, g->livery);
|
|
|
|
if (reset_cache) PropagateChildLiveryResetVehicleCache(g);
|
|
|
|
}
|
|
|
|
|
2023-12-27 15:26:33 +00:00
|
|
|
/**
|
|
|
|
* Update group liveries for a company. This is called when the LS_DEFAULT scheme is changed, to update groups with
|
|
|
|
* colours set to default.
|
|
|
|
* @param c Company to update.
|
|
|
|
*/
|
|
|
|
void UpdateCompanyGroupLiveries(const Company *c)
|
|
|
|
{
|
2023-12-29 15:34:34 +00:00
|
|
|
PropagateChildLivery(INVALID_GROUP, c->index, c->livery[LS_DEFAULT]);
|
2023-12-27 15:26:33 +00:00
|
|
|
}
|
2007-05-19 09:40:18 +00:00
|
|
|
|
2008-09-30 20:39:50 +00:00
|
|
|
Group::Group(Owner owner)
|
2007-05-19 09:40:18 +00:00
|
|
|
{
|
2008-01-12 13:36:22 +00:00
|
|
|
this->owner = owner;
|
2019-03-26 00:35:01 +00:00
|
|
|
this->folded = false;
|
2007-08-02 12:51:57 +00:00
|
|
|
}
|
2007-05-19 09:40:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2007-07-08 09:35:39 +00:00
|
|
|
* Create a new vehicle group.
|
2007-05-19 09:40:18 +00:00
|
|
|
* @param tile unused
|
2009-09-18 14:23:58 +00:00
|
|
|
* @param flags type of operation
|
2007-05-19 09:40:18 +00:00
|
|
|
* @param p1 vehicle type
|
2019-02-15 18:43:33 +00:00
|
|
|
* @param p2 parent groupid
|
2009-09-18 14:23:58 +00:00
|
|
|
* @param text unused
|
|
|
|
* @return the cost of this operation or an error
|
2007-05-19 09:40:18 +00:00
|
|
|
*/
|
2024-01-07 16:41:53 +00:00
|
|
|
CommandCost CmdCreateGroup(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint32_t p2, const char *text)
|
2007-05-19 09:40:18 +00:00
|
|
|
{
|
2010-04-17 13:31:41 +00:00
|
|
|
VehicleType vt = Extract<VehicleType, 0, 3>(p1);
|
2008-09-30 20:39:50 +00:00
|
|
|
if (!IsCompanyBuildableVehicleType(vt)) return CMD_ERROR;
|
2007-05-19 09:40:18 +00:00
|
|
|
|
2008-04-23 20:56:08 +00:00
|
|
|
if (!Group::CanAllocateItem()) return CMD_ERROR;
|
2007-08-02 12:51:57 +00:00
|
|
|
|
2019-02-15 18:43:33 +00:00
|
|
|
const Group *pg = Group::GetIfValid(GB(p2, 0, 16));
|
2019-04-10 21:07:06 +00:00
|
|
|
if (pg != nullptr) {
|
2019-02-15 18:43:33 +00:00
|
|
|
if (pg->owner != _current_company) return CMD_ERROR;
|
|
|
|
if (pg->vehicle_type != vt) return CMD_ERROR;
|
|
|
|
}
|
|
|
|
|
2007-05-19 09:40:18 +00:00
|
|
|
if (flags & DC_EXEC) {
|
2008-09-30 20:39:50 +00:00
|
|
|
Group *g = new Group(_current_company);
|
2007-05-19 09:40:18 +00:00
|
|
|
g->vehicle_type = vt;
|
2014-04-08 21:09:06 +00:00
|
|
|
g->parent = INVALID_GROUP;
|
2007-05-22 19:48:11 +00:00
|
|
|
|
2019-04-10 21:07:06 +00:00
|
|
|
if (pg == nullptr) {
|
2019-02-15 18:43:33 +00:00
|
|
|
const Company *c = Company::Get(_current_company);
|
|
|
|
g->livery.colour1 = c->livery[LS_DEFAULT].colour1;
|
|
|
|
g->livery.colour2 = c->livery[LS_DEFAULT].colour2;
|
2019-03-30 07:13:08 +00:00
|
|
|
if (c->settings.renew_keep_length) SetBit(g->flags, GroupFlags::GF_REPLACE_WAGON_REMOVAL);
|
2019-02-15 18:43:33 +00:00
|
|
|
} else {
|
|
|
|
g->parent = pg->index;
|
|
|
|
g->livery.colour1 = pg->livery.colour1;
|
|
|
|
g->livery.colour2 = pg->livery.colour2;
|
2019-03-30 07:13:08 +00:00
|
|
|
g->flags = pg->flags;
|
2023-03-24 21:47:14 +00:00
|
|
|
if (vt == VEH_TRAIN) ReindexTemplateReplacementsRecursive();
|
2019-02-15 18:43:33 +00:00
|
|
|
}
|
2019-01-31 13:57:44 +00:00
|
|
|
|
2009-01-12 17:11:45 +00:00
|
|
|
_new_group_id = g->index;
|
|
|
|
|
2010-09-08 21:37:13 +00:00
|
|
|
InvalidateWindowData(GetWindowClassForVehicleType(vt), VehicleListIdentifier(VL_GROUP_LIST, vt, _current_company).Pack());
|
2019-01-31 13:57:44 +00:00
|
|
|
InvalidateWindowData(WC_COMPANY_COLOUR, g->owner, g->vehicle_type);
|
2020-09-19 10:58:44 +00:00
|
|
|
InvalidateWindowData(WC_TEMPLATEGUI_MAIN, 0, 0, 0);
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
|
2007-06-18 19:53:50 +00:00
|
|
|
return CommandCost();
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2007-07-08 09:35:39 +00:00
|
|
|
* Add all vehicles in the given group to the default group and then deletes the group.
|
2007-05-19 09:40:18 +00:00
|
|
|
* @param tile unused
|
2009-09-18 14:23:58 +00:00
|
|
|
* @param flags type of operation
|
2007-05-19 09:40:18 +00:00
|
|
|
* @param p1 index of array group
|
|
|
|
* - p1 bit 0-15 : GroupID
|
|
|
|
* @param p2 unused
|
2009-09-18 14:23:58 +00:00
|
|
|
* @param text unused
|
|
|
|
* @return the cost of this operation or an error
|
2007-05-19 09:40:18 +00:00
|
|
|
*/
|
2024-01-07 16:41:53 +00:00
|
|
|
CommandCost CmdDeleteGroup(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint32_t p2, const char *text)
|
2007-05-19 09:40:18 +00:00
|
|
|
{
|
2009-05-18 16:21:28 +00:00
|
|
|
Group *g = Group::GetIfValid(p1);
|
2019-04-10 21:07:06 +00:00
|
|
|
if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
|
2007-05-19 09:40:18 +00:00
|
|
|
|
2011-11-14 16:09:58 +00:00
|
|
|
/* Remove all vehicles from the group */
|
|
|
|
DoCommand(0, p1, 0, flags, CMD_REMOVE_ALL_VEHICLES_GROUP);
|
2007-05-19 09:40:18 +00:00
|
|
|
|
2014-04-08 21:09:06 +00:00
|
|
|
/* Delete sub-groups */
|
2019-12-16 17:01:57 +00:00
|
|
|
for (const Group *gp : Group::Iterate()) {
|
2014-04-08 21:09:06 +00:00
|
|
|
if (gp->parent == g->index) {
|
|
|
|
DoCommand(0, gp->index, 0, flags, CMD_DELETE_GROUP);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-14 16:09:58 +00:00
|
|
|
if (flags & DC_EXEC) {
|
2008-02-27 21:46:57 +00:00
|
|
|
/* Update backupped orders if needed */
|
2010-08-18 15:15:59 +00:00
|
|
|
OrderBackup::ClearGroup(g->index);
|
2008-02-27 21:46:57 +00:00
|
|
|
|
2007-05-19 09:40:18 +00:00
|
|
|
/* If we set an autoreplace for the group we delete, remove it. */
|
2008-09-30 20:39:50 +00:00
|
|
|
if (_current_company < MAX_COMPANIES) {
|
|
|
|
Company *c;
|
2007-05-19 09:40:18 +00:00
|
|
|
|
2009-05-16 23:34:14 +00:00
|
|
|
c = Company::Get(_current_company);
|
2019-12-15 16:10:46 +00:00
|
|
|
for (EngineRenew *er : EngineRenew::Iterate()) {
|
2008-09-30 20:39:50 +00:00
|
|
|
if (er->group_id == g->index) RemoveEngineReplacementForCompany(c, er->from, g->index, flags);
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-22 19:48:11 +00:00
|
|
|
VehicleType vt = g->vehicle_type;
|
|
|
|
|
Squashed commit of the following:
commit b17f39a2016dc11a6a9815f398d690d82a6a59aa
Merge: 67b3190 3bb7c47
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Feb 12 19:44:34 2016 +0100
Merge branch 'merge/trunk27506' into dev
commit 3bb7c4768580198b7316bfeebc4b870d355439e8
Merge: 14929fe 9db36bd
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Feb 12 19:43:53 2016 +0100
Merge remote-tracking branch 'openttd/master' into merge/trunk27506
commit 14929fe3536e2aa5b4d6a43d0d55043da7a2f252
Merge: af15609 4b8c698
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Feb 10 22:14:25 2016 +0100
Merge branch 'master' into merge/trunk27506
commit 67b319060b4b88b72c94b0e0c2c9fdcf1c2fd95d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sat Feb 28 20:17:13 2015 +0100
removed 2 unused function calls
commit af15609c938eb388dd507b16fb7b6d547c54c2da
Merge: 5465c88 b251ba3
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sat Feb 28 15:12:33 2015 +0100
Merge branch 'trunk' into merge_trunk
commit 5465c88c8016c5e7910570ab5795222e8348c703
Author: me <streen01@gmx.de>
Date: Sat Feb 28 10:59:41 2015 +0100
regenerated MSVS project files
forgot to do this, they still retained the old filenames
commit 0391455e29c5ed794fcd0f58c63ff98dc52685ac
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 16:53:05 2015 +0100
removed the patch files from this repo again
that was a rather dum idea, it made the difference patch between
branches trunk and tbtr huge.
the patch files are now being tracked again in the supplimentary repo
'tbtr_proj', that will keep this fork clean and creating diff-patches
will be much easier
commit 8395d40386c8d620c90fb4be66cf6679408ac975
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 16:27:40 2015 +0100
fix for reported bug by DC-1: crash in station gui
the template gui item was added to the drop-down list that was also
shown in a station gui, but there was no action present when this item
was selected in a station gui. per default the game would commit suicide
by called NOT_REACHED() at the default case of the according
switch-statement.
commit 833873245d33bd77105a82a584d9bec2362419bc
Merge: 39596be 8688c95
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 15:08:53 2015 +0100
Merge branch 'fix_disableTemplateOrderCheck' into tbtr
commit 8688c95a01ed5933a35a08597bbf45ff148f5a67
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 15:06:25 2015 +0100
added fix by DC-1
don't check the orders list of a virtual vehicle
commit 39596beff9a815a0f9b2ea3abe5d82c3ec5933e7
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 22 10:47:58 2015 +0100
added history of patches for the mod
commit b3ae74ac4e9143202a1fda1333a91c3716ebb21e
Merge: 9a601a1 ee756e1
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 22 10:03:04 2015 +0100
Merge branch 'tbtr' into merge_tbtr
commit ee756e1c2229534f1cc05edb97269b0c83ddde66
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Feb 17 22:25:50 2015 +0100
removed nonsensical comments + disabled code
commit e7d37f0500c56c84a36ce8b93eafb31f800e1086
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Feb 17 21:30:38 2015 +0100
added some missing renames in includes
commit 63c2b13766b077e4f2923f321e95d53356dee2db
Merge: e92e6ba 9752606
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Feb 17 21:22:11 2015 +0100
Merge branch 'feat_renameFiles' into merge_renameFiles
Conflicts:
src/tbtr_template_gui_create_virtualtrain.cpp
commit 975260643d212f8cac72485f2011011210622849
Author: Thomas Schmidt <streen01@gmx.de>
Date: Mon Feb 9 22:11:18 2015 +0100
replaced source file prefix: aaa -> tbtr
commit e92e6ba7089564886d17dd5c1fd8d85ea0ca4ac7
Merge: 62d2f80 ac16eab
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 15:02:19 2015 +0100
Merge branch 'rm_TODOs' into dev
Conflicts:
src/aaa_template_gui_main.cpp
commit 62d2f809edf170cfbeb0599822c4c3d4f9a1fefe
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:59:36 2015 +0100
i++ -> ++i
commit ac16eabc082f62b9fe2ef6c11a314f8e9a28c26b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:34:36 2015 +0100
rm'ed TODOs
commit 22f642f32265882b8f99b409b517823991c08101
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:17:49 2015 +0100
rm TODO
yes, depends on the selected template because the button "Start
replacing" means, to start the replacement for the currently selected
group and template (create a templatereplacement object for this
combination)
commit 60d8192838e340a3cf6899979361c997df73b716
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:17:26 2015 +0100
rm'ed TODO: included task in TODO-list
commit 39e42674ac9f5ad5dd056b613e80ef4e754c1153
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 11:19:36 2015 +0100
changed window class in use: WC_NONE -> WC_TEMPLATE_GUI_MAIN
commit cadfac96e21aeb862b75e0454197ddce89fb728c
Author: Thomas Schmidt <streen01@gmx.de>
Date: Mon Jan 26 23:18:29 2015 +0100
removed a weird call to deleteAllTmplReplacements
was a TODO task, it was set to delete all template replacements
belonging to group with id -1, which does not exist, ever
commit dc1058464c29f61b6197dec556ec468d1ff38451
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 25 23:27:03 2015 +0100
removed some TODOs
commit 7afeb17db512600424039099a0f4bd78882fcd8e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 25 11:35:47 2015 +0100
removed all MYGUI comments
tried to replace them with useful comments where necessary
added a few new TODOs here and there
commit 6b9453224a77811062254e6bce7dac4074b829a8
Merge: 292a5aa 687bc4c
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 20:47:06 2015 +0100
Merge branch 'fix_compiler_warnings' into dev
commit 687bc4c34fbb9ddeaf15b4857b235a9709dd85be
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 20:43:26 2015 +0100
fixed all remaining warnings
commit ada08d7097772e325b7852fd058d8bad7036ae4d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 18:25:45 2015 +0100
removed testing code that produced a warning
commit f3b1568384f36998aeb1fa51c1fab4cfb96c7f93
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 00:07:34 2015 +0100
removed unused variable REPLACEMENT_IN_PROGRESS
commit 5aa9098880070cfaa3d2815f445497b2886933f9
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 00:02:43 2015 +0100
removed variable 'mode' from ClickedOnVehicle()
member function of class TemplateCreateWindow
in the depot gui the mode variable is used to decide whether a vehicle
is started or dragged or ...
here, we only drag so the mode is never used
commit 292a5aa9dba9cf1d0003e84055fb95357f922454
Merge: 8f6df8c 2bb12bc
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Jan 14 23:41:29 2015 +0100
Merge branch 'feat_mergePatch0.4c' into dev
commit 2bb12bcf283cccc8869bf537b79b22f479cb7203
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Jan 14 23:32:04 2015 +0100
added vi's .swp files to .gitignore
commit aecf6f549b32f92342f8e0b65158bebef6270537
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Jan 13 20:15:25 2015 +0100
corrected UpdateViewport code
was VehicleUpdateViewport(Vehicle*, bool) before
is Vehicle::UpdateViewport(bool, bool) now
commit ae199283fd5ac0199cef1c4c980561122d030199
Author: Thomas Schmidt <streen01@gmx.de>
Date: Mon Jan 12 22:34:22 2015 +0100
updated code for EngineNumberSorter
commit 9735035c6dd4ded9bb76958722dc25e26ced5f05
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 11 18:36:17 2015 +0100
removed unused parameter 'part_of_chain'
from cargo movement code
commit b8b86e1f2592288ddcfb46a0a5d81c3257da60d3
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 4 21:44:17 2015 +0100
Reimplemented moving of cargo
- uses the new shift function
- manages to spread the old cargo of replaced vehicles from a chain across the memebers of the newly constructed chain
some TODOs are left within the code and some testing needs to be done,
how this behaves when there is more than one vehicle being replaced
commit 0d76e1bfe10ef207ac5e4018976e9fba0b0bb25e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sat Jan 3 01:05:54 2015 +0100
fixed saveload code for TemplateVehicle
commit ba0ea6975f48fe38c2b5376ebc83c23d6bb6151c
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 11:32:23 2015 +0100
final changes for the merge
- removed the WDF_UNLICK_BUTTON
- updated ctor calls to Window()
- disabled the engine number sorter
commit 9cc213335046b3febfe6649fde40b00e1bb43d5b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 11:29:03 2015 +0100
disabled cargo movement during templrpl
need to reimplement this step since the cargo is now moved
packet-by-packet and not as a complete list from a vehicle onto another
vehicle anymore
commit 39743806d0156f8547670c525af0e59083dbcd49
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 11:16:54 2015 +0100
replaced cargo function 'Count'
- not available anymore: VehicleCargoList::Count()
- using StoredCount() for now, should check if this is the correct count
commit 9b240bbf9b2ee5659bbcb518e9e2767103861254
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:27:56 2015 +0100
final corrections for template_gui_create_virtualtrain
commit cf0d48d8fa052ff521e1fac0ec75d75107c9b76e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:20:30 2015 +0100
disbabled usage of not-anymore-existing newgrf_engine.h::ListPositionOfEngine
commit 81da16b7f0c3ea2417b24707329d1d971a67e82e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:09:53 2015 +0100
fixed typo in value WID_BV_SORT_ASSENDING_DESCENDING
commit c8f81a5c3df5ccf4858bda64a53979af510ccd87
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:09:25 2015 +0100
create_virtual_train: uint GetEngineListHeight not static
commit bd29d99f80bd824e28104f3bc839fc2a5abdd297
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 00:57:25 2015 +0100
template_gui_create: static WindowDesc not const
commit edee9c1c544845459102328209b98d424cfd3248
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 00:44:50 2015 +0100
updated call to Window::FinishInitNested
commit 25fc3cb7ed6db15f42bd3fdff9506621fbba3d72
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Jan 1 23:56:48 2015 +0100
updated ctor calls for classes derived from Window
- first param in the constructor used to be const WindowDesc*, now it is
WindowDesc*
commit 54d710170f1ce9cf5539cd525744ca61f4089e7b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Jan 1 02:50:29 2015 +0100
updated constr calls to WindowDesc::WindowDesc
need a const char* at 2nd pos now
commit 7c954141f00666dec4c9559019a1a4af3b452372
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:30:02 2014 +0100
applied patch vehicle.cpp
commit aa12720049a3dfb1c2e02d453813bd567b67ff60
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:22:54 2014 +0100
applied patch vehicle_gui.cpp (failed hunks 2,4,5/6)
commit 2b8e70f15478072264f1e063418f8de0744a98e1
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:13:29 2014 +0100
applied patch train_cmd.cpp (failed hunk 1/8)
commit 47499523bf1ed0cce5fdf6cc2a7102e571dcb07d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:07:00 2014 +0100
applied patch newgrf_engine.cpp
commit 7a40c62a7b5ab8059981270252a7def69eacb7d7
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:02:52 2014 +0100
applied patch vehicle_cmd.cpp (failed hunks 2,3/3)
commit 277839abd8cb7eb277e4ed6cb72e0f3da5b7e479
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:56:35 2014 +0100
applied patch saveload.h (failed hunk 1/1)
commit 7b64c87ad3dede6442a88dafa5aa8a6a3e0db812
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:53:56 2014 +0100
applied patch group_gui.cpp (failed hunks 2,3/4)
commit 8075261c526004e21534fa0ab80429132d5f634b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:46:24 2014 +0100
applied patch vehiclelist.cpp (failed hunk 1/2)
commit b1c197c0f38e45fb50dad7f7e33f1438b150a34f
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:42:04 2014 +0100
applied patch train.h (failed hunk 1/3)
commit 81bfa209e92fa74387420cc85851767d2737c1b0
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch viewport.cpp.patch (file src/viewport.cpp)
commit 5c083054544eabac9260a75033198c665b169215
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch train_gui.cpp.patch (file src/train_gui.cpp)
commit 3c3534621c6b37530035faadfa092d70fed724c9
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch source.list.patch (file source.list)
commit 6bbb071431882d4bab43023f7194f96c824e78e5
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch saveload_internal.h.patch (file src/saveload/saveload_internal.h)
commit 158640eb786cc7867c9e689eb8a92a209e528a83
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch saveload.cpp.patch (file src/saveload/saveload.cpp)
commit e171ad716c126e98bc045f5ce574ac6161f3ab4f
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs90.vcproj.patch (file projects/openttd_vs90.vcproj)
commit b77486d89c12a80f73f088759da760abd0af7f49
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs80.vcproj.patch (file projects/openttd_vs80.vcproj)
commit 57f9c52fc580da51e20bd40f116fe66c9a0f3669
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs100.vcxproj.patch (file projects/openttd_vs100.vcxproj)
commit bda1f739a415600a7f522b1c7f9ca53fa7713ed3
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs100.vcxproj.filters.patch (file projects/openttd_vs100.vcxproj.filters)
commit ed96771b03e726e5cb56cac9a8328c3a1e63856b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch newgrf_spritegroup.cpp.patch (file src/newgrf_spritegroup.cpp)
commit 3df57e0d855fef5f54be4fd8d25e231a7eb3c3f1
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch group_cmd.cpp.patch (file src/group_cmd.cpp)
commit da31ca4b67d6993f127c6cecac717eb286ead4e6
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch english.txt.patch (file src/lang/english.txt)
commit ddc0af7139fccbae4060c70440f17c763e3bba96
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch depot_gui.cpp.patch (file src/depot_gui.cpp)
commit 88aca9db192c6a2b92185f56505caf8b91d23ab4
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch autoreplace_cmd.cpp.patch (file src/autoreplace_cmd.cpp)
commit 45ca80f7c9847ac3afe181a0badeb12bbbd5ed0d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch articulated_vehicles.cpp.patch (file src/articulated_vehicles.cpp)
commit 44bd0bf2e77f366b61f96b0f4ca564f2e2e5814a
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch afterload.cpp.patch (file src/saveload/afterload.cpp)
commit 679f9b327f9d3f3bec327ae0266f289981972c85
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_veh_sl.cpp.patch (file src/saveload/aaa_template_veh_sl.cpp)
commit ebcec221ec7c1988e85ba458283ff362e034e6d5
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle.h.patch (file src/aaa_template_vehicle.h)
commit ad690e74b95d2aa07157b73834eef672c63ef901
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle_func.h.patch (file src/aaa_template_vehicle_func.h)
commit 5982153c369432fc694daaa91a06dfefeeb29485
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle_func.cpp.patch (file src/aaa_template_vehicle_func.cpp)
commit 773f889e165b013de96736fa380d5ab5c311b3dd
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle.cpp.patch (file src/aaa_template_vehicle.cpp)
commit 03af781d69a09863d3b76ee4911e5eecd90a7cf5
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_replacement_sl.cpp.patch (file src/saveload/aaa_template_replacement_sl.cpp)
commit ab6cb0562fd390d551670dbc27e0c3c94c8554db
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_gui_replaceall.cpp.patch (file src/aaa_template_gui_replaceall.cpp)
commit d88452a6195c55e39bceb3ea7689fc546c4eee6a
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_gui_main.cpp.patch (file src/aaa_template_gui_main.cpp)
commit ab6ac687f355d400ad9ebc154e75477671a8e0fa
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:42:21 2014 +0100
applied patch aaa_template_gui_create_virtualtrain.cpp.patch (file src/aaa_template_gui_create_virtualtrain.cpp)
commit 288d14b9b145cb045b6a287d23cf3be4f2712ede
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:38:12 2014 +0100
applied patch aaa_template_gui_create.cpp.patch (file src/aaa_template_gui_create.cpp)
commit 5342db70e07fb7c1f3c41654abd2c6a4c51472c4
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:18:32 2014 +0100
applied aaa_* header files
commit 6f14e94a0ad715a33a2653cf6c12e1c2981ace8d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:29:55 2014 +0100
applied vehicle_base.h.patch
commit b76a5ce921fab5d81b60755ce66db71e38664e9b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:29:28 2014 +0100
applied window_type.h.patch
commit d33d738c7e3477de3f12affcc74c88194a61c442
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:28:30 2014 +0100
applied newgrf_engine.h.patch
commit 931fd1143706bc76aa145e1430645cb4496f9f4a
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:27:21 2014 +0100
applied vehicle_gui.h.patch
commit f6c4ab089dad5a4a01401e18cffa8f20e02f733e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:00:52 2014 +0100
applied vehicle_gui_base.h.patch
commit 5f7378136758fcc4987791d264856169950cbfe2
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 12:34:23 2014 +0100
applied build_vehicle_widget.h.patch
commit 5c6fc73847a2f34573260721bb68c7b552d546bc
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 12:01:10 2014 +0100
applied autoreplace_func.h
commit 7636f27011841d01e5f954c855dfa0cf1859e0e0
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 12:01:00 2014 +0100
applied newgrf.h
Remove some spurious whitespace changes, update projects files.
2016-02-13 19:26:47 +00:00
|
|
|
/* Delete all template replacements using the just deleted group */
|
2023-03-24 21:47:14 +00:00
|
|
|
DeleteTemplateReplacementsByGroupID(g);
|
Squashed commit of the following:
commit b17f39a2016dc11a6a9815f398d690d82a6a59aa
Merge: 67b3190 3bb7c47
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Feb 12 19:44:34 2016 +0100
Merge branch 'merge/trunk27506' into dev
commit 3bb7c4768580198b7316bfeebc4b870d355439e8
Merge: 14929fe 9db36bd
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Feb 12 19:43:53 2016 +0100
Merge remote-tracking branch 'openttd/master' into merge/trunk27506
commit 14929fe3536e2aa5b4d6a43d0d55043da7a2f252
Merge: af15609 4b8c698
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Feb 10 22:14:25 2016 +0100
Merge branch 'master' into merge/trunk27506
commit 67b319060b4b88b72c94b0e0c2c9fdcf1c2fd95d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sat Feb 28 20:17:13 2015 +0100
removed 2 unused function calls
commit af15609c938eb388dd507b16fb7b6d547c54c2da
Merge: 5465c88 b251ba3
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sat Feb 28 15:12:33 2015 +0100
Merge branch 'trunk' into merge_trunk
commit 5465c88c8016c5e7910570ab5795222e8348c703
Author: me <streen01@gmx.de>
Date: Sat Feb 28 10:59:41 2015 +0100
regenerated MSVS project files
forgot to do this, they still retained the old filenames
commit 0391455e29c5ed794fcd0f58c63ff98dc52685ac
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 16:53:05 2015 +0100
removed the patch files from this repo again
that was a rather dum idea, it made the difference patch between
branches trunk and tbtr huge.
the patch files are now being tracked again in the supplimentary repo
'tbtr_proj', that will keep this fork clean and creating diff-patches
will be much easier
commit 8395d40386c8d620c90fb4be66cf6679408ac975
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 16:27:40 2015 +0100
fix for reported bug by DC-1: crash in station gui
the template gui item was added to the drop-down list that was also
shown in a station gui, but there was no action present when this item
was selected in a station gui. per default the game would commit suicide
by called NOT_REACHED() at the default case of the according
switch-statement.
commit 833873245d33bd77105a82a584d9bec2362419bc
Merge: 39596be 8688c95
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 15:08:53 2015 +0100
Merge branch 'fix_disableTemplateOrderCheck' into tbtr
commit 8688c95a01ed5933a35a08597bbf45ff148f5a67
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Feb 26 15:06:25 2015 +0100
added fix by DC-1
don't check the orders list of a virtual vehicle
commit 39596beff9a815a0f9b2ea3abe5d82c3ec5933e7
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 22 10:47:58 2015 +0100
added history of patches for the mod
commit b3ae74ac4e9143202a1fda1333a91c3716ebb21e
Merge: 9a601a1 ee756e1
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 22 10:03:04 2015 +0100
Merge branch 'tbtr' into merge_tbtr
commit ee756e1c2229534f1cc05edb97269b0c83ddde66
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Feb 17 22:25:50 2015 +0100
removed nonsensical comments + disabled code
commit e7d37f0500c56c84a36ce8b93eafb31f800e1086
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Feb 17 21:30:38 2015 +0100
added some missing renames in includes
commit 63c2b13766b077e4f2923f321e95d53356dee2db
Merge: e92e6ba 9752606
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Feb 17 21:22:11 2015 +0100
Merge branch 'feat_renameFiles' into merge_renameFiles
Conflicts:
src/tbtr_template_gui_create_virtualtrain.cpp
commit 975260643d212f8cac72485f2011011210622849
Author: Thomas Schmidt <streen01@gmx.de>
Date: Mon Feb 9 22:11:18 2015 +0100
replaced source file prefix: aaa -> tbtr
commit e92e6ba7089564886d17dd5c1fd8d85ea0ca4ac7
Merge: 62d2f80 ac16eab
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 15:02:19 2015 +0100
Merge branch 'rm_TODOs' into dev
Conflicts:
src/aaa_template_gui_main.cpp
commit 62d2f809edf170cfbeb0599822c4c3d4f9a1fefe
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:59:36 2015 +0100
i++ -> ++i
commit ac16eabc082f62b9fe2ef6c11a314f8e9a28c26b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:34:36 2015 +0100
rm'ed TODOs
commit 22f642f32265882b8f99b409b517823991c08101
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:17:49 2015 +0100
rm TODO
yes, depends on the selected template because the button "Start
replacing" means, to start the replacement for the currently selected
group and template (create a templatereplacement object for this
combination)
commit 60d8192838e340a3cf6899979361c997df73b716
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 14:17:26 2015 +0100
rm'ed TODO: included task in TODO-list
commit 39e42674ac9f5ad5dd056b613e80ef4e754c1153
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Feb 8 11:19:36 2015 +0100
changed window class in use: WC_NONE -> WC_TEMPLATE_GUI_MAIN
commit cadfac96e21aeb862b75e0454197ddce89fb728c
Author: Thomas Schmidt <streen01@gmx.de>
Date: Mon Jan 26 23:18:29 2015 +0100
removed a weird call to deleteAllTmplReplacements
was a TODO task, it was set to delete all template replacements
belonging to group with id -1, which does not exist, ever
commit dc1058464c29f61b6197dec556ec468d1ff38451
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 25 23:27:03 2015 +0100
removed some TODOs
commit 7afeb17db512600424039099a0f4bd78882fcd8e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 25 11:35:47 2015 +0100
removed all MYGUI comments
tried to replace them with useful comments where necessary
added a few new TODOs here and there
commit 6b9453224a77811062254e6bce7dac4074b829a8
Merge: 292a5aa 687bc4c
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 20:47:06 2015 +0100
Merge branch 'fix_compiler_warnings' into dev
commit 687bc4c34fbb9ddeaf15b4857b235a9709dd85be
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 20:43:26 2015 +0100
fixed all remaining warnings
commit ada08d7097772e325b7852fd058d8bad7036ae4d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 18:25:45 2015 +0100
removed testing code that produced a warning
commit f3b1568384f36998aeb1fa51c1fab4cfb96c7f93
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 00:07:34 2015 +0100
removed unused variable REPLACEMENT_IN_PROGRESS
commit 5aa9098880070cfaa3d2815f445497b2886933f9
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 18 00:02:43 2015 +0100
removed variable 'mode' from ClickedOnVehicle()
member function of class TemplateCreateWindow
in the depot gui the mode variable is used to decide whether a vehicle
is started or dragged or ...
here, we only drag so the mode is never used
commit 292a5aa9dba9cf1d0003e84055fb95357f922454
Merge: 8f6df8c 2bb12bc
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Jan 14 23:41:29 2015 +0100
Merge branch 'feat_mergePatch0.4c' into dev
commit 2bb12bcf283cccc8869bf537b79b22f479cb7203
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Jan 14 23:32:04 2015 +0100
added vi's .swp files to .gitignore
commit aecf6f549b32f92342f8e0b65158bebef6270537
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Jan 13 20:15:25 2015 +0100
corrected UpdateViewport code
was VehicleUpdateViewport(Vehicle*, bool) before
is Vehicle::UpdateViewport(bool, bool) now
commit ae199283fd5ac0199cef1c4c980561122d030199
Author: Thomas Schmidt <streen01@gmx.de>
Date: Mon Jan 12 22:34:22 2015 +0100
updated code for EngineNumberSorter
commit 9735035c6dd4ded9bb76958722dc25e26ced5f05
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 11 18:36:17 2015 +0100
removed unused parameter 'part_of_chain'
from cargo movement code
commit b8b86e1f2592288ddcfb46a0a5d81c3257da60d3
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Jan 4 21:44:17 2015 +0100
Reimplemented moving of cargo
- uses the new shift function
- manages to spread the old cargo of replaced vehicles from a chain across the memebers of the newly constructed chain
some TODOs are left within the code and some testing needs to be done,
how this behaves when there is more than one vehicle being replaced
commit 0d76e1bfe10ef207ac5e4018976e9fba0b0bb25e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sat Jan 3 01:05:54 2015 +0100
fixed saveload code for TemplateVehicle
commit ba0ea6975f48fe38c2b5376ebc83c23d6bb6151c
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 11:32:23 2015 +0100
final changes for the merge
- removed the WDF_UNLICK_BUTTON
- updated ctor calls to Window()
- disabled the engine number sorter
commit 9cc213335046b3febfe6649fde40b00e1bb43d5b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 11:29:03 2015 +0100
disabled cargo movement during templrpl
need to reimplement this step since the cargo is now moved
packet-by-packet and not as a complete list from a vehicle onto another
vehicle anymore
commit 39743806d0156f8547670c525af0e59083dbcd49
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 11:16:54 2015 +0100
replaced cargo function 'Count'
- not available anymore: VehicleCargoList::Count()
- using StoredCount() for now, should check if this is the correct count
commit 9b240bbf9b2ee5659bbcb518e9e2767103861254
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:27:56 2015 +0100
final corrections for template_gui_create_virtualtrain
commit cf0d48d8fa052ff521e1fac0ec75d75107c9b76e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:20:30 2015 +0100
disbabled usage of not-anymore-existing newgrf_engine.h::ListPositionOfEngine
commit 81da16b7f0c3ea2417b24707329d1d971a67e82e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:09:53 2015 +0100
fixed typo in value WID_BV_SORT_ASSENDING_DESCENDING
commit c8f81a5c3df5ccf4858bda64a53979af510ccd87
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 01:09:25 2015 +0100
create_virtual_train: uint GetEngineListHeight not static
commit bd29d99f80bd824e28104f3bc839fc2a5abdd297
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 00:57:25 2015 +0100
template_gui_create: static WindowDesc not const
commit edee9c1c544845459102328209b98d424cfd3248
Author: Thomas Schmidt <streen01@gmx.de>
Date: Fri Jan 2 00:44:50 2015 +0100
updated call to Window::FinishInitNested
commit 25fc3cb7ed6db15f42bd3fdff9506621fbba3d72
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Jan 1 23:56:48 2015 +0100
updated ctor calls for classes derived from Window
- first param in the constructor used to be const WindowDesc*, now it is
WindowDesc*
commit 54d710170f1ce9cf5539cd525744ca61f4089e7b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Thu Jan 1 02:50:29 2015 +0100
updated constr calls to WindowDesc::WindowDesc
need a const char* at 2nd pos now
commit 7c954141f00666dec4c9559019a1a4af3b452372
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:30:02 2014 +0100
applied patch vehicle.cpp
commit aa12720049a3dfb1c2e02d453813bd567b67ff60
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:22:54 2014 +0100
applied patch vehicle_gui.cpp (failed hunks 2,4,5/6)
commit 2b8e70f15478072264f1e063418f8de0744a98e1
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:13:29 2014 +0100
applied patch train_cmd.cpp (failed hunk 1/8)
commit 47499523bf1ed0cce5fdf6cc2a7102e571dcb07d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:07:00 2014 +0100
applied patch newgrf_engine.cpp
commit 7a40c62a7b5ab8059981270252a7def69eacb7d7
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 02:02:52 2014 +0100
applied patch vehicle_cmd.cpp (failed hunks 2,3/3)
commit 277839abd8cb7eb277e4ed6cb72e0f3da5b7e479
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:56:35 2014 +0100
applied patch saveload.h (failed hunk 1/1)
commit 7b64c87ad3dede6442a88dafa5aa8a6a3e0db812
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:53:56 2014 +0100
applied patch group_gui.cpp (failed hunks 2,3/4)
commit 8075261c526004e21534fa0ab80429132d5f634b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:46:24 2014 +0100
applied patch vehiclelist.cpp (failed hunk 1/2)
commit b1c197c0f38e45fb50dad7f7e33f1438b150a34f
Author: Thomas Schmidt <streen01@gmx.de>
Date: Wed Dec 31 01:42:04 2014 +0100
applied patch train.h (failed hunk 1/3)
commit 81bfa209e92fa74387420cc85851767d2737c1b0
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch viewport.cpp.patch (file src/viewport.cpp)
commit 5c083054544eabac9260a75033198c665b169215
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch train_gui.cpp.patch (file src/train_gui.cpp)
commit 3c3534621c6b37530035faadfa092d70fed724c9
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch source.list.patch (file source.list)
commit 6bbb071431882d4bab43023f7194f96c824e78e5
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch saveload_internal.h.patch (file src/saveload/saveload_internal.h)
commit 158640eb786cc7867c9e689eb8a92a209e528a83
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch saveload.cpp.patch (file src/saveload/saveload.cpp)
commit e171ad716c126e98bc045f5ce574ac6161f3ab4f
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs90.vcproj.patch (file projects/openttd_vs90.vcproj)
commit b77486d89c12a80f73f088759da760abd0af7f49
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs80.vcproj.patch (file projects/openttd_vs80.vcproj)
commit 57f9c52fc580da51e20bd40f116fe66c9a0f3669
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs100.vcxproj.patch (file projects/openttd_vs100.vcxproj)
commit bda1f739a415600a7f522b1c7f9ca53fa7713ed3
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch openttd_vs100.vcxproj.filters.patch (file projects/openttd_vs100.vcxproj.filters)
commit ed96771b03e726e5cb56cac9a8328c3a1e63856b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch newgrf_spritegroup.cpp.patch (file src/newgrf_spritegroup.cpp)
commit 3df57e0d855fef5f54be4fd8d25e231a7eb3c3f1
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:10 2014 +0100
applied patch group_cmd.cpp.patch (file src/group_cmd.cpp)
commit da31ca4b67d6993f127c6cecac717eb286ead4e6
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch english.txt.patch (file src/lang/english.txt)
commit ddc0af7139fccbae4060c70440f17c763e3bba96
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch depot_gui.cpp.patch (file src/depot_gui.cpp)
commit 88aca9db192c6a2b92185f56505caf8b91d23ab4
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch autoreplace_cmd.cpp.patch (file src/autoreplace_cmd.cpp)
commit 45ca80f7c9847ac3afe181a0badeb12bbbd5ed0d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch articulated_vehicles.cpp.patch (file src/articulated_vehicles.cpp)
commit 44bd0bf2e77f366b61f96b0f4ca564f2e2e5814a
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch afterload.cpp.patch (file src/saveload/afterload.cpp)
commit 679f9b327f9d3f3bec327ae0266f289981972c85
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_veh_sl.cpp.patch (file src/saveload/aaa_template_veh_sl.cpp)
commit ebcec221ec7c1988e85ba458283ff362e034e6d5
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle.h.patch (file src/aaa_template_vehicle.h)
commit ad690e74b95d2aa07157b73834eef672c63ef901
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle_func.h.patch (file src/aaa_template_vehicle_func.h)
commit 5982153c369432fc694daaa91a06dfefeeb29485
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle_func.cpp.patch (file src/aaa_template_vehicle_func.cpp)
commit 773f889e165b013de96736fa380d5ab5c311b3dd
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_vehicle.cpp.patch (file src/aaa_template_vehicle.cpp)
commit 03af781d69a09863d3b76ee4911e5eecd90a7cf5
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_replacement_sl.cpp.patch (file src/saveload/aaa_template_replacement_sl.cpp)
commit ab6cb0562fd390d551670dbc27e0c3c94c8554db
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_gui_replaceall.cpp.patch (file src/aaa_template_gui_replaceall.cpp)
commit d88452a6195c55e39bceb3ea7689fc546c4eee6a
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:43:09 2014 +0100
applied patch aaa_template_gui_main.cpp.patch (file src/aaa_template_gui_main.cpp)
commit ab6ac687f355d400ad9ebc154e75477671a8e0fa
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:42:21 2014 +0100
applied patch aaa_template_gui_create_virtualtrain.cpp.patch (file src/aaa_template_gui_create_virtualtrain.cpp)
commit 288d14b9b145cb045b6a287d23cf3be4f2712ede
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:38:12 2014 +0100
applied patch aaa_template_gui_create.cpp.patch (file src/aaa_template_gui_create.cpp)
commit 5342db70e07fb7c1f3c41654abd2c6a4c51472c4
Author: Thomas Schmidt <streen01@gmx.de>
Date: Tue Dec 30 01:18:32 2014 +0100
applied aaa_* header files
commit 6f14e94a0ad715a33a2653cf6c12e1c2981ace8d
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:29:55 2014 +0100
applied vehicle_base.h.patch
commit b76a5ce921fab5d81b60755ce66db71e38664e9b
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:29:28 2014 +0100
applied window_type.h.patch
commit d33d738c7e3477de3f12affcc74c88194a61c442
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:28:30 2014 +0100
applied newgrf_engine.h.patch
commit 931fd1143706bc76aa145e1430645cb4496f9f4a
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:27:21 2014 +0100
applied vehicle_gui.h.patch
commit f6c4ab089dad5a4a01401e18cffa8f20e02f733e
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 17:00:52 2014 +0100
applied vehicle_gui_base.h.patch
commit 5f7378136758fcc4987791d264856169950cbfe2
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 12:34:23 2014 +0100
applied build_vehicle_widget.h.patch
commit 5c6fc73847a2f34573260721bb68c7b552d546bc
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 12:01:10 2014 +0100
applied autoreplace_func.h
commit 7636f27011841d01e5f954c855dfa0cf1859e0e0
Author: Thomas Schmidt <streen01@gmx.de>
Date: Sun Dec 28 12:01:00 2014 +0100
applied newgrf.h
Remove some spurious whitespace changes, update projects files.
2016-02-13 19:26:47 +00:00
|
|
|
|
2016-04-05 17:40:16 +00:00
|
|
|
/* notify tracerestrict that group is about to be deleted */
|
|
|
|
TraceRestrictRemoveGroupID(g->index);
|
|
|
|
|
2007-05-19 09:40:18 +00:00
|
|
|
/* Delete the Replace Vehicle Windows */
|
2023-09-15 19:59:08 +00:00
|
|
|
CloseWindowById(WC_REPLACE_VEHICLE, g->vehicle_type);
|
2007-08-02 12:51:57 +00:00
|
|
|
delete g;
|
2007-05-22 19:48:11 +00:00
|
|
|
|
2010-09-08 21:37:13 +00:00
|
|
|
InvalidateWindowData(GetWindowClassForVehicleType(vt), VehicleListIdentifier(VL_GROUP_LIST, vt, _current_company).Pack());
|
2019-01-31 13:57:44 +00:00
|
|
|
InvalidateWindowData(WC_COMPANY_COLOUR, _current_company, vt);
|
2020-09-19 10:58:44 +00:00
|
|
|
InvalidateWindowData(WC_TEMPLATEGUI_MAIN, 0, 0, 0);
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
|
2007-06-18 19:53:50 +00:00
|
|
|
return CommandCost();
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-04-08 21:09:06 +00:00
|
|
|
* Alter a group
|
2007-05-19 09:40:18 +00:00
|
|
|
* @param tile unused
|
2009-09-18 14:23:58 +00:00
|
|
|
* @param flags type of operation
|
2007-05-19 09:40:18 +00:00
|
|
|
* @param p1 index of array group
|
|
|
|
* - p1 bit 0-15 : GroupID
|
2014-04-08 21:09:06 +00:00
|
|
|
* - p1 bit 16: 0 - Rename grouop
|
|
|
|
* 1 - Set group parent
|
|
|
|
* @param p2 parent group index
|
2009-09-18 14:23:58 +00:00
|
|
|
* @param text the new name or an empty string when resetting to the default
|
|
|
|
* @return the cost of this operation or an error
|
2007-05-19 09:40:18 +00:00
|
|
|
*/
|
2024-01-07 16:41:53 +00:00
|
|
|
CommandCost CmdAlterGroup(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint32_t p2, const char *text)
|
2007-05-19 09:40:18 +00:00
|
|
|
{
|
2014-04-08 21:09:06 +00:00
|
|
|
Group *g = Group::GetIfValid(GB(p1, 0, 16));
|
2019-04-10 21:07:06 +00:00
|
|
|
if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
|
2007-05-22 19:48:11 +00:00
|
|
|
|
2014-04-08 21:09:06 +00:00
|
|
|
if (!HasBit(p1, 16)) {
|
|
|
|
/* Rename group */
|
|
|
|
bool reset = StrEmpty(text);
|
|
|
|
|
|
|
|
if (!reset) {
|
|
|
|
if (Utf8StringLength(text) >= MAX_LENGTH_GROUP_NAME_CHARS) return CMD_ERROR;
|
|
|
|
}
|
2008-09-15 19:02:50 +00:00
|
|
|
|
2014-04-08 21:09:06 +00:00
|
|
|
if (flags & DC_EXEC) {
|
|
|
|
/* Assign the new one */
|
2020-05-17 21:31:59 +00:00
|
|
|
if (reset) {
|
|
|
|
g->name.clear();
|
|
|
|
} else {
|
|
|
|
g->name = text;
|
|
|
|
}
|
2014-04-08 21:09:06 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Set group parent */
|
|
|
|
const Group *pg = Group::GetIfValid(GB(p2, 0, 16));
|
|
|
|
|
2019-04-10 21:07:06 +00:00
|
|
|
if (pg != nullptr) {
|
2014-04-08 21:09:06 +00:00
|
|
|
if (pg->owner != _current_company) return CMD_ERROR;
|
|
|
|
if (pg->vehicle_type != g->vehicle_type) return CMD_ERROR;
|
|
|
|
|
|
|
|
/* Ensure request parent isn't child of group.
|
|
|
|
* This is the only place that infinite loops are prevented. */
|
2019-03-26 00:17:33 +00:00
|
|
|
if (GroupIsInGroup(pg->index, g->index)) return_cmd_error(STR_ERROR_GROUP_CAN_T_SET_PARENT_RECURSION);
|
2014-04-08 21:09:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & DC_EXEC) {
|
2019-04-10 21:07:06 +00:00
|
|
|
g->parent = (pg == nullptr) ? INVALID_GROUP : pg->index;
|
2019-01-13 22:29:17 +00:00
|
|
|
GroupStatistics::UpdateAutoreplace(g->owner);
|
2023-03-24 21:47:14 +00:00
|
|
|
if (g->vehicle_type == VEH_TRAIN) ReindexTemplateReplacementsRecursive();
|
2019-01-31 13:57:44 +00:00
|
|
|
|
2023-12-27 20:25:38 +00:00
|
|
|
if (!HasBit(g->livery.in_use, 0) || !HasBit(g->livery.in_use, 1)) {
|
|
|
|
/* Update livery with new parent's colours if either colour is default. */
|
2019-01-31 13:57:44 +00:00
|
|
|
const Livery *livery = GetParentLivery(g);
|
2023-12-27 20:25:38 +00:00
|
|
|
if (!HasBit(g->livery.in_use, 0)) g->livery.colour1 = livery->colour1;
|
|
|
|
if (!HasBit(g->livery.in_use, 1)) g->livery.colour2 = livery->colour2;
|
2019-01-31 13:57:44 +00:00
|
|
|
|
2023-12-27 15:26:33 +00:00
|
|
|
PropagateChildLivery(g, true);
|
2019-01-31 13:57:44 +00:00
|
|
|
MarkWholeScreenDirty();
|
|
|
|
}
|
2014-04-08 21:09:06 +00:00
|
|
|
}
|
2008-09-15 19:02:50 +00:00
|
|
|
}
|
2007-06-27 20:53:25 +00:00
|
|
|
|
2007-05-19 09:40:18 +00:00
|
|
|
if (flags & DC_EXEC) {
|
2019-01-13 22:29:17 +00:00
|
|
|
InvalidateWindowData(WC_REPLACE_VEHICLE, g->vehicle_type, 1);
|
2010-09-08 21:37:13 +00:00
|
|
|
InvalidateWindowData(GetWindowClassForVehicleType(g->vehicle_type), VehicleListIdentifier(VL_GROUP_LIST, g->vehicle_type, _current_company).Pack());
|
2019-01-31 13:57:44 +00:00
|
|
|
InvalidateWindowData(WC_COMPANY_COLOUR, g->owner, g->vehicle_type);
|
2020-09-13 21:24:46 +00:00
|
|
|
InvalidateWindowClassesData(WC_VEHICLE_VIEW);
|
|
|
|
InvalidateWindowClassesData(WC_VEHICLE_DETAILS);
|
2020-09-19 10:58:44 +00:00
|
|
|
InvalidateWindowData(WC_TEMPLATEGUI_MAIN, 0, 0, 0);
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
|
2007-06-18 19:53:50 +00:00
|
|
|
return CommandCost();
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
|
2016-03-08 19:27:03 +00:00
|
|
|
/**
|
|
|
|
* Create a new vehicle group.
|
|
|
|
* @param tile unused
|
|
|
|
* @param flags type of operation
|
|
|
|
* @param p1 packed VehicleListIdentifier
|
2022-11-19 22:40:29 +00:00
|
|
|
* @param p2 bitmask
|
|
|
|
* - bit 0-7 Cargo filter
|
2016-03-08 19:27:03 +00:00
|
|
|
* @param text the new name or an empty string when setting to the default
|
|
|
|
* @return the cost of this operation or an error
|
|
|
|
*/
|
2024-01-07 16:41:53 +00:00
|
|
|
CommandCost CmdCreateGroupFromList(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint32_t p2, const char *text)
|
2016-03-08 19:27:03 +00:00
|
|
|
{
|
|
|
|
VehicleListIdentifier vli;
|
|
|
|
VehicleList list;
|
2016-11-11 18:46:15 +00:00
|
|
|
if (!vli.UnpackIfValid(p1)) return CMD_ERROR;
|
2016-03-08 19:27:03 +00:00
|
|
|
if (!IsCompanyBuildableVehicleType(vli.vtype)) return CMD_ERROR;
|
2022-11-19 22:40:29 +00:00
|
|
|
if (!GenerateVehicleSortList(&list, vli, GB(p2, 0, 8))) return CMD_ERROR;
|
2016-03-08 19:27:03 +00:00
|
|
|
|
2019-03-17 20:29:17 +00:00
|
|
|
CommandCost ret = DoCommand(tile, vli.vtype, INVALID_GROUP, flags, CMD_CREATE_GROUP);
|
2016-03-08 19:27:03 +00:00
|
|
|
if (ret.Failed()) return ret;
|
|
|
|
|
|
|
|
if (!StrEmpty(text)) {
|
|
|
|
if (Utf8StringLength(text) >= MAX_LENGTH_GROUP_NAME_CHARS) return CMD_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & DC_EXEC) {
|
|
|
|
Group *g = Group::GetIfValid(_new_group_id);
|
2019-04-11 17:14:13 +00:00
|
|
|
if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
|
2016-03-08 19:27:03 +00:00
|
|
|
|
|
|
|
if (!StrEmpty(text)) {
|
|
|
|
DoCommand(tile, g->index, 0, flags, CMD_ALTER_GROUP, text);
|
|
|
|
}
|
|
|
|
|
2019-03-27 18:12:04 +00:00
|
|
|
for (uint i = 0; i < list.size(); i++) {
|
2016-03-08 19:27:03 +00:00
|
|
|
const Vehicle *v = list[i];
|
|
|
|
|
|
|
|
/* Just try and don't care if some vehicle's can't be added. */
|
|
|
|
DoCommand(tile, g->index, v->index, flags, CMD_ADD_VEHICLE_GROUP);
|
|
|
|
}
|
|
|
|
|
|
|
|
MarkWholeScreenDirty();
|
|
|
|
}
|
|
|
|
|
|
|
|
return CommandCost();
|
|
|
|
}
|
|
|
|
|
2007-05-19 09:40:18 +00:00
|
|
|
|
2012-04-17 19:44:12 +00:00
|
|
|
/**
|
|
|
|
* Do add a vehicle to a group.
|
|
|
|
* @param v Vehicle to add.
|
|
|
|
* @param new_g Group to add to.
|
|
|
|
*/
|
|
|
|
static void AddVehicleToGroup(Vehicle *v, GroupID new_g)
|
|
|
|
{
|
|
|
|
GroupStatistics::CountVehicle(v, -1);
|
|
|
|
|
|
|
|
switch (v->type) {
|
|
|
|
default: NOT_REACHED();
|
|
|
|
case VEH_TRAIN:
|
|
|
|
SetTrainGroupID(Train::From(v), new_g);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VEH_ROAD:
|
|
|
|
case VEH_SHIP:
|
|
|
|
case VEH_AIRCRAFT:
|
|
|
|
if (v->IsEngineCountable()) UpdateNumEngineGroup(v, v->group_id, new_g);
|
|
|
|
v->group_id = new_g;
|
2019-04-10 21:07:06 +00:00
|
|
|
for (Vehicle *u = v; u != nullptr; u = u->Next()) {
|
2019-01-31 13:57:44 +00:00
|
|
|
u->colourmap = PAL_NONE;
|
|
|
|
u->InvalidateNewGRFCache();
|
2020-08-25 00:26:44 +00:00
|
|
|
u->InvalidateImageCache();
|
2019-01-31 13:57:44 +00:00
|
|
|
u->UpdateViewport(true);
|
|
|
|
}
|
2012-04-17 19:44:12 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
GroupStatistics::CountVehicle(v, 1);
|
|
|
|
}
|
|
|
|
|
2007-05-19 09:40:18 +00:00
|
|
|
/**
|
|
|
|
* Add a vehicle to a group
|
|
|
|
* @param tile unused
|
2009-09-18 14:23:58 +00:00
|
|
|
* @param flags type of operation
|
2007-05-19 09:40:18 +00:00
|
|
|
* @param p1 index of array group
|
|
|
|
* - p1 bit 0-15 : GroupID
|
|
|
|
* @param p2 vehicle to add to a group
|
2010-08-19 20:42:00 +00:00
|
|
|
* - p2 bit 0-19 : VehicleID
|
2012-04-17 19:44:12 +00:00
|
|
|
* - p2 bit 31 : Add shared vehicles as well.
|
2009-09-18 14:23:58 +00:00
|
|
|
* @param text unused
|
|
|
|
* @return the cost of this operation or an error
|
2007-05-19 09:40:18 +00:00
|
|
|
*/
|
2024-01-07 16:41:53 +00:00
|
|
|
CommandCost CmdAddVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint32_t p2, const char *text)
|
2007-05-19 09:40:18 +00:00
|
|
|
{
|
2012-04-17 19:44:12 +00:00
|
|
|
Vehicle *v = Vehicle::GetIfValid(GB(p2, 0, 20));
|
2007-05-19 09:40:18 +00:00
|
|
|
GroupID new_g = p1;
|
|
|
|
|
2019-04-10 21:07:06 +00:00
|
|
|
if (v == nullptr || (!Group::IsValidID(new_g) && !IsDefaultGroupID(new_g) && new_g != NEW_GROUP)) return CMD_ERROR;
|
2007-08-31 17:31:54 +00:00
|
|
|
|
2009-05-17 01:00:56 +00:00
|
|
|
if (Group::IsValidID(new_g)) {
|
2009-05-16 23:34:14 +00:00
|
|
|
Group *g = Group::Get(new_g);
|
2008-09-30 20:39:50 +00:00
|
|
|
if (g->owner != _current_company || g->vehicle_type != v->type) return CMD_ERROR;
|
2007-05-23 14:02:10 +00:00
|
|
|
}
|
2007-05-22 19:48:11 +00:00
|
|
|
|
2008-09-30 20:39:50 +00:00
|
|
|
if (v->owner != _current_company || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
2007-05-19 09:40:18 +00:00
|
|
|
|
2012-04-17 19:44:16 +00:00
|
|
|
if (new_g == NEW_GROUP) {
|
|
|
|
/* Create new group. */
|
2019-05-10 17:19:07 +00:00
|
|
|
CommandCost ret = CmdCreateGroup(0, flags, v->type, INVALID_GROUP, nullptr);
|
2012-04-17 19:44:16 +00:00
|
|
|
if (ret.Failed()) return ret;
|
|
|
|
|
|
|
|
new_g = _new_group_id;
|
|
|
|
}
|
|
|
|
|
2007-05-19 09:40:18 +00:00
|
|
|
if (flags & DC_EXEC) {
|
2012-04-17 19:44:12 +00:00
|
|
|
AddVehicleToGroup(v, new_g);
|
|
|
|
|
|
|
|
if (HasBit(p2, 31)) {
|
|
|
|
/* Add vehicles in the shared order list as well. */
|
2019-04-10 21:07:06 +00:00
|
|
|
for (Vehicle *v2 = v->FirstShared(); v2 != nullptr; v2 = v2->NextShared()) {
|
2012-04-17 19:44:12 +00:00
|
|
|
if (v2->group_id != new_g) AddVehicleToGroup(v2, new_g);
|
|
|
|
}
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
|
2011-10-03 17:26:37 +00:00
|
|
|
GroupStatistics::UpdateAutoreplace(v->owner);
|
2011-10-03 17:21:41 +00:00
|
|
|
|
2007-05-19 09:40:18 +00:00
|
|
|
/* Update the Replace Vehicle Windows */
|
2009-09-13 19:15:59 +00:00
|
|
|
SetWindowDirty(WC_REPLACE_VEHICLE, v->type);
|
2019-01-31 13:57:44 +00:00
|
|
|
SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
|
|
|
|
SetWindowDirty(WC_VEHICLE_VIEW, v->index);
|
|
|
|
SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
|
2010-09-08 21:37:13 +00:00
|
|
|
InvalidateWindowData(GetWindowClassForVehicleType(v->type), VehicleListIdentifier(VL_GROUP_LIST, v->type, _current_company).Pack());
|
2020-09-13 21:24:46 +00:00
|
|
|
InvalidateWindowData(WC_VEHICLE_VIEW, v->index);
|
|
|
|
InvalidateWindowData(WC_VEHICLE_DETAILS, v->index);
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
|
2007-06-18 19:53:50 +00:00
|
|
|
return CommandCost();
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
|
2021-06-27 01:28:52 +00:00
|
|
|
static Town* GetTownFromDestination(const DestinationID destination)
|
2021-06-20 06:35:28 +00:00
|
|
|
{
|
|
|
|
Town* town = nullptr;
|
|
|
|
|
2021-06-27 01:28:52 +00:00
|
|
|
BaseStation *st = BaseStation::GetIfValid(destination);
|
|
|
|
if (st != nullptr) {
|
2021-06-20 06:35:28 +00:00
|
|
|
town = st->town;
|
|
|
|
}
|
|
|
|
|
|
|
|
return town;
|
|
|
|
}
|
|
|
|
|
2021-06-27 01:28:52 +00:00
|
|
|
static void GetAutoGroupMostRelevantTowns(const Vehicle *vehicle, Town* &from, Town* &to)
|
2021-06-20 06:35:28 +00:00
|
|
|
{
|
|
|
|
std::vector<Town*> unique_destinations;
|
|
|
|
|
|
|
|
const int num = vehicle->GetNumOrders();
|
|
|
|
|
|
|
|
for (int x = 0; x < num; x++)
|
|
|
|
{
|
|
|
|
Order *order = vehicle->GetOrder(x);
|
2021-06-20 22:47:50 +00:00
|
|
|
|
|
|
|
if (order->GetType() != OT_GOTO_STATION) continue;
|
|
|
|
|
2021-06-20 06:35:28 +00:00
|
|
|
const DestinationID dest = order->GetDestination();
|
|
|
|
Town *town = GetTownFromDestination(dest);
|
|
|
|
|
|
|
|
if (town != nullptr && unique_destinations.end() == std::find(unique_destinations.begin(), unique_destinations.end(), town))
|
|
|
|
{
|
|
|
|
unique_destinations.push_back(town);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (unique_destinations.empty()) return;
|
|
|
|
|
|
|
|
from = unique_destinations[0];
|
|
|
|
|
|
|
|
if (unique_destinations.size() > 1) {
|
|
|
|
to = unique_destinations[unique_destinations.size() - 1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-27 01:28:52 +00:00
|
|
|
static CargoTypes GetVehicleCargoList(const Vehicle *vehicle)
|
2021-06-20 06:35:28 +00:00
|
|
|
{
|
2021-06-27 01:28:52 +00:00
|
|
|
CargoTypes cargoes = 0;
|
2021-06-20 06:35:28 +00:00
|
|
|
|
2021-06-27 01:28:52 +00:00
|
|
|
for (const Vehicle *u = vehicle; u != nullptr; u = u->Next()) {
|
|
|
|
if (u->cargo_cap == 0) continue;
|
2021-06-20 06:35:28 +00:00
|
|
|
|
2021-06-27 01:28:52 +00:00
|
|
|
SetBit(cargoes, u->cargo_type);
|
|
|
|
}
|
|
|
|
return cargoes;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string GenerateAutoNameForVehicleGroup(const Vehicle *v)
|
|
|
|
{
|
2021-06-20 22:47:50 +00:00
|
|
|
Town *town_from = nullptr;
|
|
|
|
Town *town_to = nullptr;
|
2021-06-20 08:22:16 +00:00
|
|
|
|
2021-06-27 01:28:52 +00:00
|
|
|
GetAutoGroupMostRelevantTowns(v, town_from, town_to);
|
|
|
|
if (town_from == nullptr) return "";
|
2021-06-20 06:35:28 +00:00
|
|
|
|
2021-06-27 01:28:52 +00:00
|
|
|
CargoTypes cargoes = GetVehicleCargoList(v);
|
2021-06-20 06:35:28 +00:00
|
|
|
|
2024-01-05 21:12:54 +00:00
|
|
|
StringID str;
|
2021-06-27 01:28:52 +00:00
|
|
|
if (town_from == town_to || town_to == nullptr) {
|
|
|
|
SetDParam(0, town_from->index);
|
|
|
|
SetDParam(1, (cargoes != 0) ? STR_VEHICLE_AUTO_GROUP_CARGO_LIST : STR_EMPTY);
|
|
|
|
SetDParam(2, cargoes);
|
2024-01-05 21:12:54 +00:00
|
|
|
str = STR_VEHICLE_AUTO_GROUP_LOCAL_ROUTE;
|
2021-06-27 01:28:52 +00:00
|
|
|
} else {
|
|
|
|
SetDParam(0, town_from->index);
|
|
|
|
SetDParam(1, town_to->index);
|
|
|
|
SetDParam(2, (cargoes != 0) ? STR_VEHICLE_AUTO_GROUP_CARGO_LIST : STR_EMPTY);
|
|
|
|
SetDParam(3, cargoes);
|
2024-01-05 21:12:54 +00:00
|
|
|
str = STR_VEHICLE_AUTO_GROUP_ROUTE;
|
2021-06-20 06:35:28 +00:00
|
|
|
}
|
2024-01-05 21:12:54 +00:00
|
|
|
return GetString(str);
|
2021-06-20 06:35:28 +00:00
|
|
|
}
|
|
|
|
|
2007-05-19 09:40:18 +00:00
|
|
|
/**
|
|
|
|
* Add all shared vehicles of all vehicles from a group
|
|
|
|
* @param tile unused
|
2009-09-18 14:23:58 +00:00
|
|
|
* @param flags type of operation
|
2007-05-19 09:40:18 +00:00
|
|
|
* @param p1 index of group array
|
|
|
|
* - p1 bit 0-15 : GroupID
|
|
|
|
* @param p2 type of vehicles
|
2009-09-18 14:23:58 +00:00
|
|
|
* @param text unused
|
|
|
|
* @return the cost of this operation or an error
|
2007-05-19 09:40:18 +00:00
|
|
|
*/
|
2024-01-07 16:41:53 +00:00
|
|
|
CommandCost CmdAddSharedVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint32_t p2, const char *text)
|
2007-05-19 09:40:18 +00:00
|
|
|
{
|
2010-04-17 13:31:41 +00:00
|
|
|
VehicleType type = Extract<VehicleType, 0, 3>(p2);
|
|
|
|
GroupID id_g = p1;
|
|
|
|
if (!Group::IsValidID(id_g) || !IsCompanyBuildableVehicleType(type)) return CMD_ERROR;
|
2007-05-19 09:40:18 +00:00
|
|
|
|
|
|
|
if (flags & DC_EXEC) {
|
|
|
|
/* Find the first front engine which belong to the group id_g
|
|
|
|
* then add all shared vehicles of this front engine to the group id_g */
|
2024-02-25 14:49:31 +00:00
|
|
|
for (const Vehicle *v : Vehicle::IterateTypeFrontOnly(type)) {
|
2024-02-25 13:38:49 +00:00
|
|
|
if (v->IsPrimaryVehicle()) {
|
2007-05-19 09:40:18 +00:00
|
|
|
if (v->group_id != id_g) continue;
|
|
|
|
|
|
|
|
/* For each shared vehicles add it to the group */
|
2019-04-10 21:07:06 +00:00
|
|
|
for (Vehicle *v2 = v->FirstShared(); v2 != nullptr; v2 = v2->NextShared()) {
|
2010-03-14 20:53:31 +00:00
|
|
|
if (v2->group_id != id_g) DoCommand(tile, id_g, v2->index, flags, CMD_ADD_VEHICLE_GROUP, text);
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-05-22 19:48:11 +00:00
|
|
|
|
2010-09-08 21:37:13 +00:00
|
|
|
InvalidateWindowData(GetWindowClassForVehicleType(type), VehicleListIdentifier(VL_GROUP_LIST, type, _current_company).Pack());
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
|
2007-06-18 19:53:50 +00:00
|
|
|
return CommandCost();
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove all vehicles from a group
|
|
|
|
* @param tile unused
|
2009-09-18 14:23:58 +00:00
|
|
|
* @param flags type of operation
|
2007-05-19 09:40:18 +00:00
|
|
|
* @param p1 index of group array
|
|
|
|
* - p1 bit 0-15 : GroupID
|
2011-11-20 14:39:12 +00:00
|
|
|
* @param p2 unused
|
2009-09-18 14:23:58 +00:00
|
|
|
* @param text unused
|
|
|
|
* @return the cost of this operation or an error
|
2007-05-19 09:40:18 +00:00
|
|
|
*/
|
2024-01-07 16:41:53 +00:00
|
|
|
CommandCost CmdRemoveAllVehiclesGroup(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint32_t p2, const char *text)
|
2007-05-19 09:40:18 +00:00
|
|
|
{
|
2010-04-17 13:31:41 +00:00
|
|
|
GroupID old_g = p1;
|
|
|
|
Group *g = Group::GetIfValid(old_g);
|
2007-05-19 09:40:18 +00:00
|
|
|
|
2019-04-10 21:07:06 +00:00
|
|
|
if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
|
2007-05-22 19:48:11 +00:00
|
|
|
|
2007-05-19 09:40:18 +00:00
|
|
|
if (flags & DC_EXEC) {
|
|
|
|
/* Find each Vehicle that belongs to the group old_g and add it to the default group */
|
2024-02-25 14:49:31 +00:00
|
|
|
for (const Vehicle *v : Vehicle::IterateFrontOnly()) {
|
2011-11-20 14:39:12 +00:00
|
|
|
if (v->IsPrimaryVehicle()) {
|
2007-05-19 09:40:18 +00:00
|
|
|
if (v->group_id != old_g) continue;
|
|
|
|
|
|
|
|
/* Add The Vehicle to the default group */
|
2010-03-14 20:53:31 +00:00
|
|
|
DoCommand(tile, DEFAULT_GROUP, v->index, flags, CMD_ADD_VEHICLE_GROUP, text);
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
}
|
2007-05-22 19:48:11 +00:00
|
|
|
|
2011-11-20 14:39:12 +00:00
|
|
|
InvalidateWindowData(GetWindowClassForVehicleType(g->vehicle_type), VehicleListIdentifier(VL_GROUP_LIST, g->vehicle_type, _current_company).Pack());
|
2007-05-22 19:48:11 +00:00
|
|
|
}
|
|
|
|
|
2007-06-18 19:53:50 +00:00
|
|
|
return CommandCost();
|
2007-05-22 19:48:11 +00:00
|
|
|
}
|
|
|
|
|
2019-01-31 13:57:44 +00:00
|
|
|
/**
|
|
|
|
* Set the livery for a vehicle group.
|
|
|
|
* @param tile Unused.
|
|
|
|
* @param flags Command flags.
|
|
|
|
* @param p1
|
|
|
|
* - p1 bit 0-15 Group ID.
|
|
|
|
* @param p2
|
|
|
|
* - p2 bit 8 Set secondary instead of primary colour
|
|
|
|
* - p2 bit 16-23 Colour.
|
|
|
|
*/
|
2024-01-07 16:41:53 +00:00
|
|
|
CommandCost CmdSetGroupLivery(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint32_t p2, const char *text)
|
2019-01-31 13:57:44 +00:00
|
|
|
{
|
|
|
|
Group *g = Group::GetIfValid(p1);
|
|
|
|
bool primary = !HasBit(p2, 8);
|
|
|
|
Colours colour = Extract<Colours, 16, 8>(p2);
|
|
|
|
|
2019-04-10 21:07:06 +00:00
|
|
|
if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
|
2019-01-31 13:57:44 +00:00
|
|
|
|
2019-02-03 09:16:48 +00:00
|
|
|
if (colour >= COLOUR_END && colour != INVALID_COLOUR) return CMD_ERROR;
|
|
|
|
|
2019-01-31 13:57:44 +00:00
|
|
|
if (flags & DC_EXEC) {
|
|
|
|
if (primary) {
|
|
|
|
SB(g->livery.in_use, 0, 1, colour != INVALID_COLOUR);
|
2024-01-21 13:23:04 +00:00
|
|
|
if (colour == INVALID_COLOUR) colour = GetParentLivery(g)->colour1;
|
2019-01-31 13:57:44 +00:00
|
|
|
g->livery.colour1 = colour;
|
|
|
|
} else {
|
|
|
|
SB(g->livery.in_use, 1, 1, colour != INVALID_COLOUR);
|
2024-01-21 13:23:04 +00:00
|
|
|
if (colour == INVALID_COLOUR) colour = GetParentLivery(g)->colour2;
|
2019-01-31 13:57:44 +00:00
|
|
|
g->livery.colour2 = colour;
|
|
|
|
}
|
|
|
|
|
2023-12-27 15:26:33 +00:00
|
|
|
PropagateChildLivery(g, true);
|
2019-01-31 13:57:44 +00:00
|
|
|
MarkWholeScreenDirty();
|
|
|
|
}
|
|
|
|
|
|
|
|
return CommandCost();
|
|
|
|
}
|
|
|
|
|
2014-04-08 21:09:06 +00:00
|
|
|
/**
|
2019-03-29 23:44:28 +00:00
|
|
|
* Set group flag for a group and its sub-groups.
|
2014-04-08 21:09:06 +00:00
|
|
|
* @param g initial group.
|
2019-03-29 23:44:28 +00:00
|
|
|
* @param set 1 to set or 0 to clear protection.
|
2014-04-08 21:09:06 +00:00
|
|
|
*/
|
2019-03-29 23:44:28 +00:00
|
|
|
static void SetGroupFlag(Group *g, GroupFlags flag, bool set, bool children)
|
2014-04-08 21:09:06 +00:00
|
|
|
{
|
2019-03-29 23:44:28 +00:00
|
|
|
if (set) {
|
|
|
|
SetBit(g->flags, flag);
|
2019-03-29 23:24:40 +00:00
|
|
|
} else {
|
2019-03-29 23:44:28 +00:00
|
|
|
ClrBit(g->flags, flag);
|
2019-03-29 23:24:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!children) return;
|
2014-04-08 21:09:06 +00:00
|
|
|
|
2021-05-14 01:04:37 +00:00
|
|
|
IterateDescendantsOfGroup(g, [&](Group *pg) {
|
|
|
|
SetGroupFlag(pg, flag, set, false);
|
|
|
|
});
|
2014-04-08 21:09:06 +00:00
|
|
|
}
|
2007-05-22 19:48:11 +00:00
|
|
|
|
|
|
|
/**
|
2019-03-29 23:44:28 +00:00
|
|
|
* (Un)set group flag from a group
|
2007-05-22 19:48:11 +00:00
|
|
|
* @param tile unused
|
2009-09-18 14:23:58 +00:00
|
|
|
* @param flags type of operation
|
2007-05-22 19:48:11 +00:00
|
|
|
* @param p1 index of group array
|
2019-03-29 23:44:28 +00:00
|
|
|
* - p1 bit 0-15 : GroupID
|
|
|
|
* - p1 bit 16-18 : Flag to set, by value not bit.
|
2007-05-22 19:48:11 +00:00
|
|
|
* @param p2
|
|
|
|
* - p2 bit 0 : 1 to set or 0 to clear protection.
|
2014-04-08 21:09:06 +00:00
|
|
|
* - p2 bit 1 : 1 to apply to sub-groups.
|
2009-09-18 14:23:58 +00:00
|
|
|
* @param text unused
|
|
|
|
* @return the cost of this operation or an error
|
2007-05-22 19:48:11 +00:00
|
|
|
*/
|
2024-01-07 16:41:53 +00:00
|
|
|
CommandCost CmdSetGroupFlag(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint32_t p2, const char *text)
|
2007-05-22 19:48:11 +00:00
|
|
|
{
|
2019-03-29 23:44:28 +00:00
|
|
|
Group *g = Group::GetIfValid(GB(p1, 0, 16));
|
2019-04-10 21:07:06 +00:00
|
|
|
if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
|
2007-05-22 19:48:11 +00:00
|
|
|
|
2019-03-29 23:44:28 +00:00
|
|
|
/* GroupFlags are stored in as an 8 bit bitfield but passed here by value,
|
|
|
|
* so 3 bits is sufficient to cover each possible value. */
|
|
|
|
GroupFlags flag = (GroupFlags)GB(p1, 16, 3);
|
|
|
|
if (flag >= GroupFlags::GF_END) return CMD_ERROR;
|
|
|
|
|
2007-05-22 19:48:11 +00:00
|
|
|
if (flags & DC_EXEC) {
|
2019-03-29 23:44:28 +00:00
|
|
|
SetGroupFlag(g, flag, HasBit(p2, 0), HasBit(p2, 1));
|
2007-05-22 19:48:11 +00:00
|
|
|
|
2012-10-01 19:43:10 +00:00
|
|
|
SetWindowDirty(GetWindowClassForVehicleType(g->vehicle_type), VehicleListIdentifier(VL_GROUP_LIST, g->vehicle_type, _current_company).Pack());
|
2008-11-29 21:27:15 +00:00
|
|
|
InvalidateWindowData(WC_REPLACE_VEHICLE, g->vehicle_type);
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
|
2007-06-18 19:53:50 +00:00
|
|
|
return CommandCost();
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Affect the groupID of a train to new_g.
|
|
|
|
* @note called in CmdAddVehicleGroup and CmdMoveRailVehicle
|
|
|
|
* @param v First vehicle of the chain.
|
|
|
|
* @param new_g index of array group
|
|
|
|
*/
|
2009-07-01 22:22:01 +00:00
|
|
|
void SetTrainGroupID(Train *v, GroupID new_g)
|
2007-05-19 09:40:18 +00:00
|
|
|
{
|
2009-05-17 01:00:56 +00:00
|
|
|
if (!Group::IsValidID(new_g) && !IsDefaultGroupID(new_g)) return;
|
2007-05-19 09:40:18 +00:00
|
|
|
|
2009-12-13 22:17:12 +00:00
|
|
|
assert(v->IsFrontEngine() || IsDefaultGroupID(new_g));
|
2007-05-19 09:40:18 +00:00
|
|
|
|
2019-04-10 21:07:06 +00:00
|
|
|
for (Vehicle *u = v; u != nullptr; u = u->Next()) {
|
2011-10-03 17:22:09 +00:00
|
|
|
if (u->IsEngineCountable()) UpdateNumEngineGroup(u, u->group_id, new_g);
|
2007-05-19 09:40:18 +00:00
|
|
|
|
|
|
|
u->group_id = new_g;
|
2019-01-31 13:57:44 +00:00
|
|
|
u->colourmap = PAL_NONE;
|
|
|
|
u->InvalidateNewGRFCache();
|
2020-08-25 00:26:44 +00:00
|
|
|
u->InvalidateImageCache();
|
2019-01-31 13:57:44 +00:00
|
|
|
u->UpdateViewport(true);
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Update the Replace Vehicle Windows */
|
2011-10-03 17:26:37 +00:00
|
|
|
GroupStatistics::UpdateAutoreplace(v->owner);
|
2009-09-13 19:15:59 +00:00
|
|
|
SetWindowDirty(WC_REPLACE_VEHICLE, VEH_TRAIN);
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Recalculates the groupID of a train. Should be called each time a vehicle is added
|
|
|
|
* to/removed from the chain,.
|
|
|
|
* @note this needs to be called too for 'wagon chains' (in the depot, without an engine)
|
|
|
|
* @note Called in CmdBuildRailVehicle, CmdBuildRailWagon, CmdMoveRailVehicle, CmdSellRailWagon
|
|
|
|
* @param v First vehicle of the chain.
|
|
|
|
*/
|
2009-07-01 22:22:01 +00:00
|
|
|
void UpdateTrainGroupID(Train *v)
|
2007-05-19 09:40:18 +00:00
|
|
|
{
|
2009-07-01 23:49:13 +00:00
|
|
|
assert(v->IsFrontEngine() || v->IsFreeWagon());
|
2007-05-19 09:40:18 +00:00
|
|
|
|
2009-07-01 22:22:01 +00:00
|
|
|
GroupID new_g = v->IsFrontEngine() ? v->group_id : (GroupID)DEFAULT_GROUP;
|
2019-04-10 21:07:06 +00:00
|
|
|
for (Vehicle *u = v; u != nullptr; u = u->Next()) {
|
2011-10-03 17:22:09 +00:00
|
|
|
if (u->IsEngineCountable()) UpdateNumEngineGroup(u, u->group_id, new_g);
|
2007-05-19 09:40:18 +00:00
|
|
|
|
|
|
|
u->group_id = new_g;
|
2019-01-31 13:57:44 +00:00
|
|
|
u->colourmap = PAL_NONE;
|
|
|
|
u->InvalidateNewGRFCache();
|
2020-08-25 00:26:44 +00:00
|
|
|
u->InvalidateImageCache();
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Update the Replace Vehicle Windows */
|
2011-10-03 17:26:37 +00:00
|
|
|
GroupStatistics::UpdateAutoreplace(v->owner);
|
2009-09-13 19:15:59 +00:00
|
|
|
SetWindowDirty(WC_REPLACE_VEHICLE, VEH_TRAIN);
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
|
2011-01-18 22:31:06 +00:00
|
|
|
/**
|
|
|
|
* Get the number of engines with EngineID id_e in the group with GroupID
|
2014-12-24 16:49:57 +00:00
|
|
|
* id_g and its sub-groups.
|
2011-01-18 22:31:06 +00:00
|
|
|
* @param company The company the group belongs to
|
|
|
|
* @param id_g The GroupID of the group used
|
|
|
|
* @param id_e The EngineID of the engine to count
|
|
|
|
* @return The number of engines with EngineID id_e in the group
|
|
|
|
*/
|
2008-09-30 20:39:50 +00:00
|
|
|
uint GetGroupNumEngines(CompanyID company, GroupID id_g, EngineID id_e)
|
2008-01-09 21:27:39 +00:00
|
|
|
{
|
2014-04-08 21:09:06 +00:00
|
|
|
uint count = 0;
|
2011-10-03 17:22:56 +00:00
|
|
|
const Engine *e = Engine::Get(id_e);
|
2021-05-14 01:04:37 +00:00
|
|
|
IterateDescendantsOfGroup(id_g, [&](Group *g) {
|
2024-01-21 14:09:44 +00:00
|
|
|
count += GroupStatistics::Get(company, g->index, e->type).GetNumEngines(id_e);
|
2021-05-14 01:04:37 +00:00
|
|
|
});
|
2024-01-21 14:09:44 +00:00
|
|
|
return count + GroupStatistics::Get(company, id_g, e->type).GetNumEngines(id_e);
|
2008-01-09 21:27:39 +00:00
|
|
|
}
|
2007-05-19 09:40:18 +00:00
|
|
|
|
2019-03-26 00:07:20 +00:00
|
|
|
/**
|
|
|
|
* Get the number of vehicles in the group with GroupID
|
|
|
|
* id_g and its sub-groups.
|
|
|
|
* @param company The company the group belongs to
|
|
|
|
* @param id_g The GroupID of the group used
|
|
|
|
* @param type The vehicle type of the group
|
|
|
|
* @return The number of vehicles in the group
|
|
|
|
*/
|
|
|
|
uint GetGroupNumVehicle(CompanyID company, GroupID id_g, VehicleType type)
|
|
|
|
{
|
|
|
|
uint count = 0;
|
2021-05-14 01:04:37 +00:00
|
|
|
IterateDescendantsOfGroup(id_g, [&](Group *g) {
|
|
|
|
count += GroupStatistics::Get(company, g->index, type).num_vehicle;
|
|
|
|
});
|
2019-03-26 00:07:20 +00:00
|
|
|
return count + GroupStatistics::Get(company, id_g, type).num_vehicle;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the number of vehicles above profit minimum age in the group with GroupID
|
|
|
|
* id_g and its sub-groups.
|
|
|
|
* @param company The company the group belongs to
|
|
|
|
* @param id_g The GroupID of the group used
|
|
|
|
* @param type The vehicle type of the group
|
|
|
|
* @return The number of vehicles above profit minimum age in the group
|
|
|
|
*/
|
2023-01-22 13:14:02 +00:00
|
|
|
uint GetGroupNumVehicleMinAge(CompanyID company, GroupID id_g, VehicleType type)
|
2019-03-26 00:07:20 +00:00
|
|
|
{
|
|
|
|
uint count = 0;
|
2021-05-14 01:04:37 +00:00
|
|
|
IterateDescendantsOfGroup(id_g, [&](Group *g) {
|
2023-01-23 19:10:07 +00:00
|
|
|
count += GroupStatistics::Get(company, g->index, type).num_vehicle_min_age;
|
2021-05-14 01:04:37 +00:00
|
|
|
});
|
2023-01-22 13:14:02 +00:00
|
|
|
return count + GroupStatistics::Get(company, id_g, type).num_vehicle_min_age;
|
2019-03-26 00:07:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-01-22 13:14:02 +00:00
|
|
|
* Get last year's profit of vehicles above minimum age
|
|
|
|
* for the group with GroupID id_g and its sub-groups.
|
2019-03-26 00:07:20 +00:00
|
|
|
* @param company The company the group belongs to
|
|
|
|
* @param id_g The GroupID of the group used
|
|
|
|
* @param type The vehicle type of the group
|
2023-01-22 13:14:02 +00:00
|
|
|
* @return Last year's profit of vehicles above minimum age for the group
|
2019-03-26 00:07:20 +00:00
|
|
|
*/
|
2023-01-22 13:14:02 +00:00
|
|
|
Money GetGroupProfitLastYearMinAge(CompanyID company, GroupID id_g, VehicleType type)
|
2019-03-26 00:07:20 +00:00
|
|
|
{
|
|
|
|
Money sum = 0;
|
2021-05-14 01:04:37 +00:00
|
|
|
IterateDescendantsOfGroup(id_g, [&](Group *g) {
|
2023-01-23 19:10:07 +00:00
|
|
|
sum += GroupStatistics::Get(company, g->index, type).profit_last_year_min_age;
|
2021-05-14 01:04:37 +00:00
|
|
|
});
|
2023-01-22 13:14:02 +00:00
|
|
|
return sum + GroupStatistics::Get(company, id_g, type).profit_last_year_min_age;
|
2019-03-26 00:07:20 +00:00
|
|
|
}
|
|
|
|
|
2008-09-30 20:39:50 +00:00
|
|
|
void RemoveAllGroupsForCompany(const CompanyID company)
|
2007-05-19 09:40:18 +00:00
|
|
|
{
|
2023-04-03 19:59:47 +00:00
|
|
|
ReindexTemplateReplacementsRecursiveGuard guard;
|
|
|
|
|
2019-12-16 17:01:57 +00:00
|
|
|
for (Group *g : Group::Iterate()) {
|
2017-01-21 00:48:28 +00:00
|
|
|
if (company == g->owner) {
|
2023-03-24 21:47:14 +00:00
|
|
|
DeleteTemplateReplacementsByGroupID(g);
|
2017-01-21 00:48:28 +00:00
|
|
|
delete g;
|
|
|
|
}
|
2007-05-19 09:40:18 +00:00
|
|
|
}
|
|
|
|
}
|
2014-04-08 21:09:06 +00:00
|
|
|
|
|
|
|
|
2014-04-08 21:52:53 +00:00
|
|
|
/**
|
|
|
|
* Test if GroupID group is a descendant of (or is) GroupID search
|
|
|
|
* @param search The GroupID to search in
|
|
|
|
* @param group The GroupID to search for
|
|
|
|
* @return True iff group is search or a descendant of search
|
|
|
|
*/
|
2014-04-08 21:09:06 +00:00
|
|
|
bool GroupIsInGroup(GroupID search, GroupID group)
|
|
|
|
{
|
2014-12-24 16:49:57 +00:00
|
|
|
if (!Group::IsValidID(search)) return search == group;
|
2014-04-08 21:09:06 +00:00
|
|
|
|
|
|
|
do {
|
|
|
|
if (search == group) return true;
|
|
|
|
search = Group::Get(search)->parent;
|
|
|
|
} while (search != INVALID_GROUP);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|