Creates an instance of an Effect
| 219 | |
| 220 | // Creates an instance of an Effect |
| 221 | int EfxCreate(int type, int monitor, int screen, int id, bool is_tab_stop) { |
| 222 | ASSERT(type != EFX_NONE); |
| 223 | ASSERT(monitor >= 0 && monitor < MAX_MONITOR); |
| 224 | ASSERT(screen >= 0 && screen < MAX_TELCOM_SCREENS); |
| 225 | |
| 226 | bool make_focus = false; |
| 227 | |
| 228 | // find an available index |
| 229 | for (int i = 0; i < MAX_TCEFFECTS; i++) { |
| 230 | if (TCEffects[i].type == EFX_NONE) { |
| 231 | // we found a slot |
| 232 | TCEffects[i].type = type; |
| 233 | TCEffects[i].monitor = monitor; |
| 234 | TCEffects[i].screen = screen; |
| 235 | TCEffects[i].id = id; |
| 236 | |
| 237 | if (is_tab_stop && !Screen_has_effect_with_focus[screen]) { |
| 238 | // this effect should get focus |
| 239 | make_focus = true; |
| 240 | } |
| 241 | |
| 242 | EfxInit(&TCEffects[i], is_tab_stop, make_focus); |
| 243 | return i; |
| 244 | } |
| 245 | } |
| 246 | return INVALID_EFFECT_HANDLE; |
| 247 | } |
| 248 | |
| 249 | // Frees up any memory allocated for effect, sets type to EFX_NONE |
| 250 | void EfxFreeEffect(tceffect *tce) { |
no test coverage detected