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

Function phase_loop

Source/Start_Emscripten.cpp:82–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82void phase_loop() {
83 static int16 result = -1;
84
85 // No recruits left?
86 if (result != 1) {
87 if (!g_Fodder->mGame_Data.mRecruits_Available_Count) {
88 emscripten_cancel_main_loop();
89 emscripten_set_main_loop(menu_loop, 24, 1);
90
91 result = -1;
92 }
93 }
94
95 if (result == 0) {
96 // Game Won?
97 if (!g_Fodder->mGame_Data.Phase_Next()) {
98 emscripten_cancel_main_loop();
99 emscripten_set_main_loop(menu_loop, 24, 1);
100 // Break to version screen
101 return;
102 }
103 result = -1;
104 }
105
106 if (result == -1) {
107 if (g_Fodder->mPhase_Aborted2) {
108 g_Fodder->mPhase_Aborted2 = false;
109 emscripten_cancel_main_loop();
110 emscripten_set_main_loop(menu_loop, 24, 1);
111 return;
112 }
113 g_Fodder->Phase_EngineReset();
114 g_Fodder->Phase_SquadPrepare();
115 g_Fodder->Phase_Prepare();
116 }
117
118 // -1 = Phase Try Again
119 // 0 = Phase Won
120 // 1 = Phase Running
121
122 result = g_Fodder->Phase_Cycle();
123 g_Fodder->Cycle_End();
124}
125
126int start(int argc, char *argv[]) {
127

Callers

nothing calls this directly

Calls 5

Phase_NextMethod · 0.80
Phase_EngineResetMethod · 0.80
Phase_SquadPrepareMethod · 0.80
Phase_PrepareMethod · 0.80
Phase_CycleMethod · 0.80

Tested by

no test coverage detected