MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / GameLoop_Unit

Function GameLoop_Unit

src/unit.c:123–314  ·  view source on GitHub ↗

* Loop over all units, performing various of tasks. */

Source from the content-addressed store, hash-verified

121 * Loop over all units, performing various of tasks.
122 */
123void GameLoop_Unit(void)
124{
125 PoolFindStruct find;
126 bool tickMovement = false;
127 bool tickRotation = false;
128 bool tickBlinking = false;
129 bool tickUnknown4 = false;
130 bool tickScript = false;
131 bool tickUnknown5 = false;
132 bool tickDeviation = false;
133
134 if (g_debugScenario) return;
135
136 if (s_tickUnitMovement <= g_timerGame) {
137 tickMovement = true;
138 s_tickUnitMovement = g_timerGame + 3;
139 }
140
141 if (s_tickUnitRotation <= g_timerGame) {
142 tickRotation = true;
143 s_tickUnitRotation = g_timerGame + Tools_AdjustToGameSpeed(4, 2, 8, true);
144 }
145
146 if (s_tickUnitBlinking <= g_timerGame) {
147 tickBlinking = true;
148 s_tickUnitBlinking = g_timerGame + 3;
149 }
150
151 if (s_tickUnitUnknown4 <= g_timerGame) {
152 tickUnknown4 = true;
153 s_tickUnitUnknown4 = g_timerGame + 20;
154 }
155
156 if (s_tickUnitScript <= g_timerGame) {
157 tickScript = true;
158 s_tickUnitScript = g_timerGame + 5;
159 }
160
161 if (s_tickUnitUnknown5 <= g_timerGame) {
162 tickUnknown5 = true;
163 s_tickUnitUnknown5 = g_timerGame + 5;
164 }
165
166 if (s_tickUnitDeviation <= g_timerGame) {
167 tickDeviation = true;
168 s_tickUnitDeviation = g_timerGame + 60;
169 }
170
171 find.houseID = HOUSE_INVALID;
172 find.index = 0xFFFF;
173 find.type = 0xFFFF;
174
175 while (true) {
176 const UnitInfo *ui;
177 Unit *u;
178
179 u = Unit_Find(&find);
180 if (u == NULL) break;

Callers 1

GameLoop_MainFunction · 0.85

Calls 15

Tools_AdjustToGameSpeedFunction · 0.85
Unit_FindFunction · 0.85
Tools_Index_GetTileFunction · 0.85
Unit_SetOrientationFunction · 0.85
Tile_GetDirectionFunction · 0.85
Unit_MovementTickFunction · 0.85
Tools_Index_GetTypeFunction · 0.85
Tools_Index_GetUnitFunction · 0.85
Unit_RotateFunction · 0.85
Unit_UpdateMapFunction · 0.85
Unit_Deviation_DecreaseFunction · 0.85
Object_GetByPackedTileFunction · 0.85

Tested by

no test coverage detected