------------------------------------------------------------------------
| 444 | |
| 445 | //------------------------------------------------------------------------ |
| 446 | void 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 | //------------------------------------------------------------------------ |
| 480 | void CLevelRotation::Initialise(int nSeed) |
no test coverage detected