MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / SetActiveTask

Method SetActiveTask

ogsr_engine/xrGame/GametaskManager.cpp:308–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306}
307
308void 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
352SGameTaskObjective* CGameTaskManager::ActiveObjective()
353{

Callers 1

OnDbClickMethod · 0.80

Calls 9

MsgFunction · 0.85
CStringTableClass · 0.85
DisableAllPointersMethod · 0.80
LinkedMapLocationMethod · 0.80
EnablePointerMethod · 0.80
sizeMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45
translateMethod · 0.45

Tested by

no test coverage detected