| 249 | const PlayerIdentity* identity = FindIdentity(player); |
| 250 | if (!identity || !person) |
| 251 | return; |
| 252 | |
| 253 | AIUnitInfo& info = person->GetInfo(); |
| 254 | info._squadTitle = RString(); |
| 255 | info._squadPicture = nullptr; |
| 256 | if (identity->squad) |
| 257 | { |
| 258 | info._squadTitle = identity->squad->title; |
| 259 | if (identity->squad->picture.GetLength() > 0) |
| 260 | { |
| 261 | const RString picture = Poseidon::FindNetworkSquadPicturePath( |
| 262 | Poseidon::GetUserDirectory(), identity->squad->nick, identity->squad->picture, |
| 263 | [](const RString& path) { return Poseidon::FileExistsUtf8(path); }); |
| 264 | if (picture.GetLength() > 0) |
| 265 | info._squadPicture = GlobLoadTexture(picture); |
| 266 | } |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | bool NetworkClient::TryApplySelectPlayer(const SelectPlayerMessage& pl, bool allowPending) |
| 271 | { |
| 272 | NET_ERROR(pl.player == _player); |
| 273 | NetworkId person = pl.person; |
| 274 | NetworkObject* object = GetObject(person); |
| 275 | Person* veh = dynamic_cast<Person*>(object); |
| 276 | if (!veh) |
| 277 | { |
| 278 | if (allowPending) |
| 279 | { |
| 280 | _pendingSelectPlayer = true; |
| 281 | _pendingSelectPlayerMessage = pl; |
| 282 | LOG_DEBUG(Network, "SelectPlayer: pending player={} person={}:{}", pl.player, pl.person.creator, |
| 283 | pl.person.id); |
| 284 | } |
| 285 | else |
| 286 | { |
| 287 | RptF("Client: Player (%d) is not vehicle with brain (%x)", (int)pl.player, pl.person.id); |
| 288 | } |
| 289 | return false; |
| 290 | } |
| 291 | AIUnit* unit = veh->Brain(); |
| 292 | if (!unit || unit->GetLifeState() == AIUnit::LSDead) |
| 293 | { |
| 294 | if (allowPending) |
| 295 | { |
| 296 | _pendingSelectPlayer = true; |
| 297 | _pendingSelectPlayerMessage = pl; |
| 298 | LOG_DEBUG(Network, "SelectPlayer: pending player={} person={}:{} brain={}", pl.player, pl.person.creator, |
| 299 | pl.person.id, unit != nullptr); |
| 300 | return false; |
| 301 | } |
| 302 | LOG_WARN(Network, "SelectPlayer: person {}:{} has no living brain", pl.person.creator, pl.person.id); |
| 303 | return false; |
| 304 | } |
| 305 | LLink<Person> selectedPerson(veh); |
| 306 | EntityAI* selectedVehicle = unit->GetVehicle(); |
| 307 | LOG_DEBUG(Network, "SelectPlayer: player={} person={}:{} respawn={} vehicle='{}'", pl.player, pl.person.creator, |
| 308 | pl.person.id, pl.respawn, selectedVehicle ? (const char*)selectedVehicle->GetDebugName() : "<none>"); |
nothing calls this directly
no test coverage detected