------------------------- FX_GetValidEffect Finds an unused effect slot Note - in the editor, this function may return NULL, indicating that all effects are being stopped. -------------------------
| 155 | // effects are being stopped. |
| 156 | //------------------------- |
| 157 | static SEffectList *FX_GetValidEffect() |
| 158 | { |
| 159 | if ( nextValidEffect->mEffect == 0 ) |
| 160 | { |
| 161 | return nextValidEffect; |
| 162 | } |
| 163 | |
| 164 | int i; |
| 165 | SEffectList *ef; |
| 166 | |
| 167 | // Blah..plow through the list till we find something that is currently untainted |
| 168 | for ( i = 0, ef = effectList; i < MAX_EFFECTS; i++, ef++ ) |
| 169 | { |
| 170 | if ( ef->mEffect == 0 ) |
| 171 | { |
| 172 | return ef; |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | // report the error. |
| 177 | #ifndef FINAL_BUILD |
| 178 | theFxHelper.Print( "FX system out of effects\n" ); |
| 179 | #endif |
| 180 | |
| 181 | // Hmmm.. just trashing the first effect in the list is a poor approach |
| 182 | FX_FreeMember( &effectList[0] ); |
| 183 | |
| 184 | // Recursive call |
| 185 | return nextValidEffect; |
| 186 | } |
| 187 | |
| 188 | |
| 189 | //------------------------- |
no test coverage detected