equal
deleted
inserted
replaced
214 { |
214 { |
215 GroupID new_g = p1; |
215 GroupID new_g = p1; |
216 |
216 |
217 if (!IsValidVehicleID(p2) || (!IsValidGroupID(new_g) && !IsDefaultGroupID(new_g))) return CMD_ERROR; |
217 if (!IsValidVehicleID(p2) || (!IsValidGroupID(new_g) && !IsDefaultGroupID(new_g))) return CMD_ERROR; |
218 |
218 |
|
219 Vehicle *v = GetVehicle(p2); |
|
220 |
219 if (IsValidGroupID(new_g)) { |
221 if (IsValidGroupID(new_g)) { |
220 Group *g = GetGroup(new_g); |
222 Group *g = GetGroup(new_g); |
221 if (g->owner != _current_player) return CMD_ERROR; |
223 if (g->owner != _current_player || g->vehicle_type != v->type) return CMD_ERROR; |
222 } |
224 } |
223 |
225 |
224 Vehicle *v = GetVehicle(p2); |
|
225 if (v->owner != _current_player || !v->IsPrimaryVehicle()) return CMD_ERROR; |
226 if (v->owner != _current_player || !v->IsPrimaryVehicle()) return CMD_ERROR; |
226 |
227 |
227 if (flags & DC_EXEC) { |
228 if (flags & DC_EXEC) { |
228 DecreaseGroupNumVehicle(v->group_id); |
229 DecreaseGroupNumVehicle(v->group_id); |
229 IncreaseGroupNumVehicle(new_g); |
230 IncreaseGroupNumVehicle(new_g); |