! \param type given magazine type \param ammo minimal amount of ammo magazine must contain \return index of magazine in array or -1 if not found */
| 1195 | \return index of magazine in array or -1 if not found |
| 1196 | */ |
| 1197 | int EntityAI::FindBestMagazine(const MagazineType* type, int ammo) const |
| 1198 | { |
| 1199 | int best = -1; |
| 1200 | for (int j = 0; j < NMagazines(); j++) |
| 1201 | { |
| 1202 | const Magazine* reserve = GetMagazine(j); |
| 1203 | if (!reserve) |
| 1204 | { |
| 1205 | continue; |
| 1206 | } |
| 1207 | if (reserve->_type != type) |
| 1208 | { |
| 1209 | continue; |
| 1210 | } |
| 1211 | if (reserve->_ammo > ammo) |
| 1212 | { |
| 1213 | ammo = reserve->_ammo; |
| 1214 | best = j; |
| 1215 | } |
| 1216 | } |
| 1217 | return best; |
| 1218 | } |
| 1219 | |
| 1220 | static void GetReloadActions(EntityAI* veh, UIActions& actions, int iSlot, const MuzzleType* currentMuzzle) |
| 1221 | { |
no outgoing calls
no test coverage detected