2 // nazghul - an old-school RPG engine
3 // Copyright (C) 2004 Gordon McNutt
5 // This program is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License as published by the Free
7 // Software Foundation; either version 2 of the License, or (at your option)
10 // This program is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 // You should have received a copy of the GNU General Public License along with
16 // this program; if not, write to the Free Foundation, Inc., 59 Temple Place,
17 // Suite 330, Boston, MA 02111-1307 USA
20 // gmcnutt@users.sourceforge.net
29 const int EFFECT_ID = 0xeffec1;
31 struct effect *effect_new(char *tag, scheme *sc, pointer exec_proc,
32 pointer apply_proc, pointer rm_proc,
38 et = (struct effect*)calloc(1, sizeof(*et));
44 et->exec = closure_new_ref(sc, exec_proc);
48 et->apply = closure_new_ref(sc, apply_proc);
52 et->rm = closure_new_ref(sc, rm_proc);
56 et->restart = closure_new_ref(sc, restart);
59 et->tag = strdup(tag);
62 /* Effects with no name should be considered invisible to the UI */
64 et->name = strdup(name);
71 extern void effect_del(struct effect *et)
75 closure_unref_safe(et->exec);
76 closure_unref_safe(et->apply);
77 closure_unref_safe(et->rm);
78 closure_unref_safe(et->restart);
79 /* Need to free sprite? Nope -- sprites are global resources
80 * managed by the session. When the session is torn down it frees all
81 * of the sprites created when it loaded. */