(svn r11019) -Fix [FS#1176]: Vehicles in a group must always have the same type when adding new vehicles to a group. Patch by SmatZ.
authorrubidium
Fri, 31 Aug 2007 17:31:54 +0000
changeset 7504 762f0780d53b
parent 7503 3f0b9663c72e
child 7505 55e7acbf7a69
(svn r11019) -Fix [FS#1176]: Vehicles in a group must always have the same type when adding new vehicles to a group. Patch by SmatZ.
src/group_cmd.cpp
--- a/src/group_cmd.cpp	Fri Aug 31 17:15:46 2007 +0000
+++ b/src/group_cmd.cpp	Fri Aug 31 17:31:54 2007 +0000
@@ -216,12 +216,13 @@
 
 	if (!IsValidVehicleID(p2) || (!IsValidGroupID(new_g) && !IsDefaultGroupID(new_g))) return CMD_ERROR;
 
+	Vehicle *v = GetVehicle(p2);
+
 	if (IsValidGroupID(new_g)) {
 		Group *g = GetGroup(new_g);
-		if (g->owner != _current_player) return CMD_ERROR;
+		if (g->owner != _current_player || g->vehicle_type != v->type) return CMD_ERROR;
 	}
 
-	Vehicle *v = GetVehicle(p2);
 	if (v->owner != _current_player || !v->IsPrimaryVehicle()) return CMD_ERROR;
 
 	if (flags & DC_EXEC) {