MCPcopy Create free account
hub / github.com/MergHQ/CRYENGINE / ChangeLevel

Method ChangeLevel

Code/CryEngine/CryAction/LevelSystem.cpp:446–477  ·  view source on GitHub ↗

------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

444
445//------------------------------------------------------------------------
446void CLevelRotation::ChangeLevel(IConsoleCmdArgs* pArgs)
447{
448 SGameContextParams ctx;
449 const char* nextGameRules = GetNextGameRules();
450 if (nextGameRules && nextGameRules[0])
451 ctx.gameRules = nextGameRules;
452 else if (IEntity* pEntity = CCryAction::GetCryAction()->GetIGameRulesSystem()->GetCurrentGameRulesEntity())
453 ctx.gameRules = pEntity->GetClass()->GetName();
454 else if (ILevelInfo* pLevelInfo = CCryAction::GetCryAction()->GetILevelSystem()->GetLevelInfo(GetNextLevel()))
455 ctx.gameRules = pLevelInfo->GetDefaultGameType()->name;
456
457 ctx.levelName = GetNextLevel();
458
459 if (CCryAction::GetCryAction()->StartedGameContext())
460 {
461 CCryAction::GetCryAction()->ChangeGameContext(&ctx);
462 }
463 else
464 {
465 gEnv->pConsole->ExecuteString(string("sv_gamerules ") + ctx.gameRules);
466
467 string command = string("map ") + ctx.levelName;
468 if (pArgs)
469 for (int i = 1; i < pArgs->GetArgCount(); ++i)
470 command += string(" ") + pArgs->GetArg(i);
471 command += " s";
472 gEnv->pConsole->ExecuteString(command);
473 }
474
475 if (!Advance())
476 First();
477}
478
479//------------------------------------------------------------------------
480void CLevelRotation::Initialise(int nSeed)

Callers 2

NextLevelMethod · 0.80
CmdNextLevelMethod · 0.80

Calls 13

stringClass · 0.85
GetIGameRulesSystemMethod · 0.80
GetLevelInfoMethod · 0.80
GetILevelSystemMethod · 0.80
GetDefaultGameTypeMethod · 0.80
StartedGameContextMethod · 0.80
ExecuteStringMethod · 0.80
GetNameMethod · 0.45
GetClassMethod · 0.45
ChangeGameContextMethod · 0.45
GetArgCountMethod · 0.45

Tested by

no test coverage detected