equal
deleted
inserted
replaced
123 extern void AiNewDoGameLoop(Player *p); |
123 extern void AiNewDoGameLoop(Player *p); |
124 |
124 |
125 Player *p = GetPlayer(player); |
125 Player *p = GetPlayer(player); |
126 _current_player = player; |
126 _current_player = player; |
127 |
127 |
128 if (_patches.ainew_active) |
128 if (_patches.ainew_active) { |
129 AiNewDoGameLoop(p); |
129 AiNewDoGameLoop(p); |
130 else { |
130 } else { |
131 /* Enable all kind of cheats the old AI needs in order to operate correctly... */ |
131 /* Enable all kind of cheats the old AI needs in order to operate correctly... */ |
132 _is_old_ai_player = true; |
132 _is_old_ai_player = true; |
133 AiDoGameLoop(p); |
133 AiDoGameLoop(p); |
134 _is_old_ai_player = false; |
134 _is_old_ai_player = false; |
135 } |
135 } |
141 * Handles one tick for all the AIs. |
141 * Handles one tick for all the AIs. |
142 */ |
142 */ |
143 void AI_RunGameLoop(void) |
143 void AI_RunGameLoop(void) |
144 { |
144 { |
145 /* Don't do anything if ai is disabled */ |
145 /* Don't do anything if ai is disabled */ |
146 if (!_ai.enabled) |
146 if (!_ai.enabled) return; |
147 return; |
|
148 |
147 |
149 /* New tick */ |
148 /* New tick */ |
150 _ai.tick++; |
149 _ai.tick++; |
151 |
150 |
152 /* Make sure the AI follows the difficulty rule.. */ |
151 /* Make sure the AI follows the difficulty rule.. */ |
210 /** |
209 /** |
211 * Deinitializer for AI-related stuff. |
210 * Deinitializer for AI-related stuff. |
212 */ |
211 */ |
213 void AI_Uninitialize(void) |
212 void AI_Uninitialize(void) |
214 { |
213 { |
215 Player *p; |
214 Player* p; |
216 |
215 |
217 FOR_ALL_PLAYERS(p) { |
216 FOR_ALL_PLAYERS(p) { |
218 if (p->is_active && p->is_ai) { |
217 if (p->is_active && p->is_ai) AI_PlayerDied(p->index); |
219 AI_PlayerDied(p->index); |
218 } |
220 } |
219 } |
221 } |
|
222 } |
|