summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-11-14 16:09:58 +0000
committerfrosch <frosch@openttd.org>2011-11-14 16:09:58 +0000
commitb53092e82bdbc7c1e73a4fa5ff89070eb0457c0f (patch)
tree1d9cca35fbb6d2853e4ef58d7860804bad33a4cf
parent9309ef58a0cd1d06bf5741289814db0fb0a9296c (diff)
downloadopenttd-b53092e82bdbc7c1e73a4fa5ff89070eb0457c0f.tar.xz
(svn r23212) -Fix [FS#4834] (r22980): Deleting groups did not update statistics of DEFAULT group.
-rw-r--r--src/group_cmd.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/group_cmd.cpp b/src/group_cmd.cpp
index 9ae39025c..a636684e9 100644
--- a/src/group_cmd.cpp
+++ b/src/group_cmd.cpp
@@ -313,14 +313,10 @@ CommandCost CmdDeleteGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
Group *g = Group::GetIfValid(p1);
if (g == NULL || g->owner != _current_company) return CMD_ERROR;
- if (flags & DC_EXEC) {
- Vehicle *v;
-
- /* Add all vehicles belong to the group to the default group */
- FOR_ALL_VEHICLES(v) {
- if (v->group_id == g->index && v->type == g->vehicle_type) v->group_id = DEFAULT_GROUP;
- }
+ /* Remove all vehicles from the group */
+ DoCommand(0, p1, 0, flags, CMD_REMOVE_ALL_VEHICLES_GROUP);
+ if (flags & DC_EXEC) {
/* Update backupped orders if needed */
OrderBackup::ClearGroup(g->index);