| 306 | } |
| 307 | |
| 308 | void CGameTaskManager::SetActiveTask(const TASK_ID& id, u16 idx, const bool safe) |
| 309 | { |
| 310 | g_active_task_id = id; |
| 311 | |
| 312 | if (safe) |
| 313 | { |
| 314 | auto* t = ActiveTask(); |
| 315 | if (t && t->m_Objectives.size() < (idx + 1)) |
| 316 | { |
| 317 | ASSERT_FMT(!t->m_Objectives.empty(), "!![%s] m_Objectives is empty! Something strange!", __FUNCTION__); |
| 318 | g_active_task_objective_id = t->m_Objectives.size() - 1; //Некторые таски могут содержать всего один objective |
| 319 | |
| 320 | if (g_active_task_objective_id == 0) |
| 321 | Msg("!![%s - 1] g_active_task_objective_idx == 0", __FUNCTION__); |
| 322 | } |
| 323 | else |
| 324 | { |
| 325 | g_active_task_objective_id = idx; |
| 326 | |
| 327 | if (g_active_task_objective_id == 0) |
| 328 | Msg("!![%s - 2] g_active_task_objective_idx == 0", __FUNCTION__); |
| 329 | } |
| 330 | } |
| 331 | else |
| 332 | { |
| 333 | g_active_task_objective_id = idx; |
| 334 | |
| 335 | if (g_active_task_objective_id == 0) |
| 336 | Msg("!![%s - 3] g_active_task_objective_idx == 0", __FUNCTION__); |
| 337 | } |
| 338 | |
| 339 | Level().MapManager().DisableAllPointers(); |
| 340 | SGameTaskObjective* o = ActiveObjective(); |
| 341 | |
| 342 | if (o) |
| 343 | { |
| 344 | CMapLocation* ml = o->LinkedMapLocation(); |
| 345 | if (ml) |
| 346 | ml->EnablePointer(); |
| 347 | } |
| 348 | |
| 349 | Discord.Set_active_task_text(CStringTable().translate(o ? o->description : "st_no_active_task").c_str()); |
| 350 | } |
| 351 | |
| 352 | SGameTaskObjective* CGameTaskManager::ActiveObjective() |
| 353 | { |
no test coverage detected