MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / Phase_Next

Method Phase_Next

Source/GameData.cpp:534–579  ·  view source on GitHub ↗

* Proceed to next phase/mission * * @return false If no more missions */

Source from the content-addressed store, hash-verified

532 * @return false If no more missions
533 */
534bool sGameData::Phase_Next() {
535
536 if (!mMission_Current) {
537 mMission_Current = mCampaign.getMission(mMission_Number);
538 if (!mMission_Current)
539 return false;
540
541 mMission_Phases_Remaining = (int16)mMission_Current->NumberOfPhases();
542 }
543
544 // Next Phase
545 ++mMission_Phase;
546 --mMission_Phases_Remaining;
547
548 mPhase_Current = mMission_Current->PhaseGet(mMission_Phase);
549
550 // Still got phases to complete?
551 if (mMission_Phases_Remaining)
552 return true;
553
554 // Mission Complete
555 for (auto& Troop : mSoldiers_Allocated) {
556 Troop.mPhaseCount = 0;
557 }
558
559 mMission_Current = mCampaign.getMission(++mMission_Number);
560 if (!mMission_Current)
561 return false;
562
563 mMission_Phase = 1;
564
565 mMission_Phases_Remaining = (int16) mMission_Current->NumberOfPhases();
566
567 mPhase_Current = mMission_Current->PhaseGet(mMission_Phase);
568 if (!mPhase_Current)
569 return false;
570
571 mRecruits_Available_Count += 0x0F;
572 mMission_Recruits_AliveCount = mRecruits_Available_Count;
573 mMission_Recruits_AliveCount -= 0x0F;
574 mMission_Recruitment = -1;
575
576 mGamePhase_Data.mSoldiers_Prepare_SetFromSpritePtrs = false;
577 mGamePhase_Data.mHeroesCount = mHeroes.size();
578 return true;
579}
580
581std::string sGameData::ToJson(const std::string& pSaveName) {
582 auto now = std::chrono::system_clock::now();

Callers 10

phase_loopFunction · 0.80
GUI_Button_SelectMap0Method · 0.80
GUI_Button_SelectMap1Method · 0.80
GUI_Button_SelectMap2Method · 0.80
GUI_Button_SelectMap3Method · 0.80
GameOverCheckMethod · 0.80
RunTestsMethod · 0.80
phaseCreateMethod · 0.80
missionCreateMethod · 0.80

Calls 4

NumberOfPhasesMethod · 0.80
PhaseGetMethod · 0.80
getMissionMethod · 0.45
sizeMethod · 0.45

Tested by 1

RunTestsMethod · 0.64