| 221 | } |
| 222 | |
| 223 | bool AIUnit::ProcessGetIn(Transport& veh) |
| 224 | { |
| 225 | if (!IsLocal()) |
| 226 | { |
| 227 | return false; |
| 228 | } |
| 229 | if (!IsFreeSoldier()) |
| 230 | { |
| 231 | return false; |
| 232 | } |
| 233 | if (IsPlayer() && veh.GetLock() == LSLocked) |
| 234 | { |
| 235 | return false; |
| 236 | } |
| 237 | if (GetGroup()->IsPlayerGroup() && veh.GetLock() == LSLocked) |
| 238 | { |
| 239 | return false; |
| 240 | } |
| 241 | |
| 242 | AIGroup* grp = GetGroup(); |
| 243 | AI_ERROR(grp); |
| 244 | AICenter* center = grp->GetCenter(); |
| 245 | AI_ERROR(center); |
| 246 | |
| 247 | // avoid get in enemy vehicle |
| 248 | if (AvoidBeInWith(center, veh.Commander())) |
| 249 | { |
| 250 | if (_vehicleAssigned == &veh) |
| 251 | { |
| 252 | UnassignVehicle(); |
| 253 | grp->UnassignVehicle(&veh); |
| 254 | } |
| 255 | return false; |
| 256 | } |
| 257 | if (AvoidBeInWith(center, veh.Driver())) |
| 258 | { |
| 259 | if (_vehicleAssigned == &veh) |
| 260 | { |
| 261 | UnassignVehicle(); |
| 262 | grp->UnassignVehicle(&veh); |
| 263 | } |
| 264 | return false; |
| 265 | } |
| 266 | if (AvoidBeInWith(center, veh.Gunner())) |
| 267 | { |
| 268 | if (_vehicleAssigned == &veh) |
| 269 | { |
| 270 | UnassignVehicle(); |
| 271 | grp->UnassignVehicle(&veh); |
| 272 | } |
| 273 | return false; |
| 274 | } |
| 275 | for (int i = 0; i < veh.GetManCargo().Size(); i++) |
| 276 | { |
| 277 | Person* man = veh.GetManCargo()[i]; |
| 278 | if (AvoidBeInWith(center, man)) |
| 279 | { |
| 280 | if (_vehicleAssigned == &veh) |
no test coverage detected