| 341 | } |
| 342 | |
| 343 | void DisplayMap::UpdatePlan() |
| 344 | { |
| 345 | // init section |
| 346 | bool actual = false; |
| 347 | int section = _briefing->FindSection("__PLAN"); |
| 348 | if (section < 0) |
| 349 | { |
| 350 | section = _briefing->AddSection(); |
| 351 | } |
| 352 | else |
| 353 | { |
| 354 | _briefing->InitSection(section); |
| 355 | if (_briefing->CurrentSection() == section) |
| 356 | { |
| 357 | actual = true; |
| 358 | } |
| 359 | int s; |
| 360 | while ((s = _briefing->FindSection("__PLAN")) >= 0) |
| 361 | { |
| 362 | if (_briefing->CurrentSection() == s) |
| 363 | { |
| 364 | actual = true; |
| 365 | } |
| 366 | _briefing->RemoveSection(s); |
| 367 | } |
| 368 | } |
| 369 | _briefing->AddName(section, "__PLAN"); |
| 370 | |
| 371 | // plan header |
| 372 | AIUnit* unit = GWorld->FocusOn(); |
| 373 | int source = FindSectionForUnit(_briefing, "Plan", unit); |
| 374 | // JIP: player not assigned yet — try by side from role |
| 375 | if (source < 0 && !unit) |
| 376 | { |
| 377 | const PlayerRole* role = GetNetworkManager().GetMyPlayerRole(); |
| 378 | if (role) |
| 379 | { |
| 380 | RString sideName; |
| 381 | switch (role->side) |
| 382 | { |
| 383 | case TWest: |
| 384 | sideName = "Plan.West"; |
| 385 | break; |
| 386 | case TEast: |
| 387 | sideName = "Plan.East"; |
| 388 | break; |
| 389 | case TGuerrila: |
| 390 | sideName = "Plan.Guerrila"; |
| 391 | break; |
| 392 | case TCivilian: |
| 393 | sideName = "Plan.Civilian"; |
| 394 | break; |
| 395 | default: |
| 396 | break; |
| 397 | } |
| 398 | if (sideName.GetLength() > 0) |
| 399 | source = _briefing->FindSection(sideName); |
| 400 | } |
no test coverage detected