1 | /* |
1 | /* |
2 | * static char *rcsid_plugins_c = |
2 | * static char *rcsid_plugins_c = |
3 | * "$Id: plugins.c,v 1.6 2006/03/06 22:59:26 root Exp $"; |
3 | * "$Id: plugins.c,v 1.7 2006/03/07 13:44:43 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /*****************************************************************************/ |
6 | /*****************************************************************************/ |
7 | /* CrossFire, A Multiplayer game for X-windows */ |
7 | /* CrossFire, A Multiplayer game for X-windows */ |
8 | /* */ |
8 | /* */ |
… | |
… | |
137 | static void plugin_load_temporary_map(mapstruct *map) |
137 | static void plugin_load_temporary_map(mapstruct *map) |
138 | { |
138 | { |
139 | execute_global_event (EVENT_MAPIN, map); |
139 | execute_global_event (EVENT_MAPIN, map); |
140 | } |
140 | } |
141 | |
141 | |
|
|
142 | static void plugin_clean_temporary_map(mapstruct *map) |
|
|
143 | { |
|
|
144 | execute_global_event (EVENT_MAPCLEAN, map); |
|
|
145 | } |
|
|
146 | |
142 | static void plugin_object_free(object *ob) |
147 | static void plugin_object_free(object *ob) |
143 | { |
148 | { |
144 | execute_global_event (EVENT_FREE_OB, ob); |
149 | execute_global_event (EVENT_FREE_OB, ob); |
145 | } |
150 | } |
146 | |
151 | |
… | |
… | |
306 | break; |
311 | break; |
307 | |
312 | |
308 | case EVENT_MAPLOAD: |
313 | case EVENT_MAPLOAD: |
309 | case EVENT_MAPOUT: |
314 | case EVENT_MAPOUT: |
310 | case EVENT_MAPIN: |
315 | case EVENT_MAPIN: |
|
|
316 | case EVENT_MAPCLEAN: |
311 | /* map argument */ |
317 | /* map argument */ |
312 | map = va_arg(args, mapstruct*); |
318 | map = va_arg(args, mapstruct*); |
313 | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
319 | for (cp = plugins_list; cp != NULL; cp = cp->next) { |
314 | if (cp->gevent[eventcode] != NULL) |
320 | if (cp->gevent[eventcode] != NULL) |
315 | cp->gevent[eventcode](&rt, eventcode, map); |
321 | cp->gevent[eventcode](&rt, eventcode, map); |
… | |
… | |
416 | crossfire_plugin* cp; |
422 | crossfire_plugin* cp; |
417 | crossfire_plugin* ccp; |
423 | crossfire_plugin* ccp; |
418 | |
424 | |
419 | load_original_map_callback = plugin_load_original_map; |
425 | load_original_map_callback = plugin_load_original_map; |
420 | load_temporary_map_callback = plugin_load_temporary_map; |
426 | load_temporary_map_callback = plugin_load_temporary_map; |
|
|
427 | clean_temporary_map_callback = plugin_clean_temporary_map; |
421 | object_free_callback = plugin_object_free; |
428 | object_free_callback = plugin_object_free; |
422 | |
429 | |
423 | /* Open the plugin lib and load the required functions */ |
430 | /* Open the plugin lib and load the required functions */ |
424 | ptr = plugins_dlopen(libfile); |
431 | ptr = plugins_dlopen(libfile); |
425 | if (ptr == NULL) { |
432 | if (ptr == NULL) { |