Crossfire Server, Branches 1.12  R18729
plugin_common.c
Go to the documentation of this file.
1 /*****************************************************************************/
2 /* Crossfire Plugin Interface Common Parts */
3 /* Version: 2.0beta8 (also known as "Alexander") */
4 /* Contact: yann.chachkoff@myrealbox.com */
5 /*****************************************************************************/
6 /* The CPICP are the various functions of the server that can be used by all */
7 /* plugins. It is recommended that plugins do not call the server-provided */
8 /* functions directly, but instead use the wrappers provided here by the */
9 /* CPICP interface. By doing so, various validity checks can be performed */
10 /* by CPICP, protecting the server from potential nasty effects of passing */
11 /* it wrong parameter values. */
12 /*****************************************************************************/
13 /* That code is placed under the GNU General Public Licence (GPL) */
14 /* (C)2001-2005 by Chachkoff Yann (Feel free to deliver your complaints) */
15 /*****************************************************************************/
16 /* CrossFire, A Multiplayer game for X-windows */
17 /* */
18 /* Copyright (C) 2000 Mark Wedel */
19 /* Copyright (C) 1992 Frank Tore Johansen */
20 /* */
21 /* This program is free software; you can redistribute it and/or modify */
22 /* it under the terms of the GNU General Public License as published by */
23 /* the Free Software Foundation; either version 2 of the License, or */
24 /* (at your option) any later version. */
25 /* */
26 /* This program is distributed in the hope that it will be useful, */
27 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
28 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
29 /* GNU General Public License for more details. */
30 /* */
31 /* You should have received a copy of the GNU General Public License */
32 /* along with this program; if not, write to the Free Software */
33 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
34 /* */
35 /*****************************************************************************/
36 
37 #include <plugin_common.h>
38 #include <assert.h>
39 
54 
125 
126 #define GET_HOOK(x, y, z) { \
127  getHooks(&z, 1, y, &x); \
128  if (z != CFAPI_FUNC) { \
129  printf("unable to find hook %s!\n", y); \
130  return 0; \
131  } \
132 }
133 
134 int cf_init_plugin(f_plug_api getHooks) {
135  int z;
136 
137  GET_HOOK(cfapiSystem_strdup_local, "cfapi_system_strdup_local", z);
138  GET_HOOK(cfapiSystem_add_string, "cfapi_system_add_string", z);
139  GET_HOOK(cfapiSystem_register_global_event, "cfapi_system_register_global_event", z);
140  GET_HOOK(cfapiSystem_remove_string, "cfapi_system_remove_string", z);
141  GET_HOOK(cfapiSystem_directory, "cfapi_system_directory", z);
142  GET_HOOK(cfapiSystem_unregister_global_event, "cfapi_system_unregister_global_event", z);
143  GET_HOOK(cfapiSystem_find_animation, "cfapi_system_find_animation", z);
144  GET_HOOK(cfapiSystem_find_face, "cfapi_system_find_face", z);
145  GET_HOOK(cfapiSystem_re_cmp, "cfapi_system_re_cmp", z);
146  GET_HOOK(cfapiObject_get_property, "cfapi_object_get_property", z);
147  GET_HOOK(cfapiObject_set_property, "cfapi_object_set_property", z);
148  GET_HOOK(cfapiObject_apply, "cfapi_object_apply", z);
149  GET_HOOK(cfapiObject_identify, "cfapi_object_identify", z);
150  GET_HOOK(cfapiObject_describe, "cfapi_object_describe", z);
151  GET_HOOK(cfapiObject_drain, "cfapi_object_drain", z);
152  GET_HOOK(cfapiObject_fix, "cfapi_object_fix", z);
153  GET_HOOK(cfapiObject_give_skill, "cfapi_object_give_skill", z);
154  GET_HOOK(cfapiObject_transmute, "cfapi_object_transmute", z);
155  GET_HOOK(cfapiObject_remove, "cfapi_object_remove", z);
156  GET_HOOK(cfapiObject_delete, "cfapi_object_delete", z);
157  GET_HOOK(cfapiObject_clone, "cfapi_object_clone", z);
158  GET_HOOK(cfapiObject_find, "cfapi_object_find", z);
159  GET_HOOK(cfapiObject_create, "cfapi_object_create", z);
160  GET_HOOK(cfapiObject_insert, "cfapi_object_insert", z);
161  GET_HOOK(cfapiObject_split, "cfapi_object_split", z);
162  GET_HOOK(cfapiObject_merge, "cfapi_object_merge", z);
163  GET_HOOK(cfapiObject_distance, "cfapi_object_distance", z);
164  GET_HOOK(cfapiObject_update, "cfapi_object_update", z);
165  GET_HOOK(cfapiObject_clear, "cfapi_object_clear", z);
166  GET_HOOK(cfapiObject_reset, "cfapi_object_reset", z);
167  GET_HOOK(cfapiObject_activate_rune, "cfapi_object_spring_trap", z);
168  GET_HOOK(cfapiObject_check_trigger, "cfapi_object_check_trigger", z);
169  GET_HOOK(cfapiObject_query_money, "cfapi_object_query_money", z);
170  GET_HOOK(cfapiObject_query_cost, "cfapi_object_query_cost", z);
171  GET_HOOK(cfapiObject_cast, "cfapi_object_cast", z);
172  GET_HOOK(cfapiObject_learn_spell, "cfapi_object_learn_spell", z);
173  GET_HOOK(cfapiObject_forget_spell, "cfapi_object_forget_spell", z);
174  GET_HOOK(cfapiObject_check_spell, "cfapi_object_check_spell", z);
175  GET_HOOK(cfapiObject_pay_amount, "cfapi_object_pay_amount", z);
176  GET_HOOK(cfapiObject_pay_item, "cfapi_object_pay_item", z);
177  GET_HOOK(cfapiObject_transfer, "cfapi_object_transfer", z);
178  GET_HOOK(cfapiObject_find_archetype_inside, "cfapi_object_find_archetype_inside", z);
179  GET_HOOK(cfapiObject_remove, "cfapi_object_remove", z);
180  GET_HOOK(cfapiObject_delete, "cfapi_object_delete", z);
181  GET_HOOK(cfapiObject_out_of_map, "cfapi_map_out_of_map", z);
182  GET_HOOK(cfapiObject_drop, "cfapi_object_drop", z);
183  GET_HOOK(cfapiObject_change_abil, "cfapi_object_change_abil", z);
184  GET_HOOK(cfapiObject_say, "cfapi_object_say", z);
185  GET_HOOK(cfapiMap_create_path, "cfapi_map_create_path", z);
186  GET_HOOK(cfapiMap_get_property, "cfapi_map_get_property", z);
187  GET_HOOK(cfapiMap_set_property, "cfapi_map_set_property", z);
188  GET_HOOK(cfapiMap_get_map, "cfapi_map_get_map", z);
189  GET_HOOK(cfapiMap_message, "cfapi_map_message", z);
190  GET_HOOK(cfapiMap_get_object_at, "cfapi_map_get_object_at", z);
191  GET_HOOK(cfapiMap_present_arch_by_name, "cfapi_map_present_arch_by_name", z);
192  GET_HOOK(cfapiMap_change_light, "cfapi_map_change_light", z);
193  GET_HOOK(cfapiMap_has_been_loaded, "cfapi_map_has_been_loaded", z);
194  GET_HOOK(cfapiMap_trigger_connected, "cfapi_map_trigger_connected", z);
195  GET_HOOK(cfapiPlayer_find, "cfapi_player_find", z);
196  GET_HOOK(cfapiPlayer_message, "cfapi_player_message", z);
197  GET_HOOK(cfapiObject_teleport, "cfapi_object_teleport", z);
198  GET_HOOK(cfapiObject_pickup, "cfapi_object_pickup", z);
199  GET_HOOK(cfapiObject_get_key, "cfapi_object_get_key", z);
200  GET_HOOK(cfapiObject_set_key, "cfapi_object_set_key", z);
201  GET_HOOK(cfapiObject_move, "cfapi_object_move", z);
202  GET_HOOK(cfapiObject_apply_below, "cfapi_object_apply_below", z);
203  GET_HOOK(cfapiArchetype_get_property, "cfapi_archetype_get_property", z);
204  GET_HOOK(cfapiParty_get_property, "cfapi_party_get_property", z);
205  GET_HOOK(cfapiRegion_get_property, "cfapi_region_get_property", z);
206  GET_HOOK(cfapiPlayer_can_pay, "cfapi_player_can_pay", z);
207  GET_HOOK(cfapiSystem_log, "cfapi_log", z);
208  GET_HOOK(cfapiSystem_get_time, "cfapi_system_get_time", z);
209  GET_HOOK(cfapiSystem_timer_create, "cfapi_system_timer_create", z);
210  GET_HOOK(cfapiSystem_timer_destroy, "cfapi_system_timer_destroy", z);
211  GET_HOOK(cfapiFriendlylist_get_next, "cfapi_friendlylist_get_next", z);
212  GET_HOOK(cfapiSet_random_map_variable, "cfapi_set_random_map_variable", z);
213  GET_HOOK(cfapiGenerate_random_map, "cfapi_generate_random_map", z);
214  GET_HOOK(cfapiObject_change_exp, "cfapi_object_change_exp", z);
215  GET_HOOK(cfapiSystem_get_season_name, "cfapi_system_get_season_name", z);
216  GET_HOOK(cfapiSystem_get_month_name, "cfapi_system_get_month_name", z);
217  GET_HOOK(cfapiSystem_get_weekday_name, "cfapi_system_get_weekday_name", z);
218  GET_HOOK(cfapiSystem_get_periodofday_name, "cfapi_system_get_periodofday_name", z);
219  GET_HOOK(cfapiObject_user_event, "cfapi_object_user_event", z);
220  GET_HOOK(cfapiSystem_find_string, "cfapi_system_find_string", z);
221  return 1;
222 }
223 
224 /* Should get replaced by tons of more explicit wrappers */
225 /*void *cf_map_get_property(mapstruct *map, int propcode) {
226  int type;
227  return cfapiMap_get_property(&type, propcode, map);
228 }*/
229 
230 int cf_map_get_int_property(mapstruct *map, int property) {
231  int type, value;
232 
233  cfapiMap_get_property(&type, map, property, &value);
234  assert(type == CFAPI_INT);
235  return value;
236 }
237 
238 int cf_object_user_event(object *op, object *activator, object *third, const char *message, int fix) {
239  int type, value;
240 
241  cfapiObject_user_event(&type, op, activator, third, message, fix, &value);
242  assert(type == CFAPI_INT);
243  return value;
244 }
245 
247  int type;
248  sstring value;
249 
250  cfapiMap_get_property(&type, map, propcode, &value);
251  assert(type == CFAPI_SSTRING);
252  return value;
253 }
254 
256  int type;
257  mapstruct *value;
258 
259  cfapiMap_get_property(&type, map, propcode, &value);
260  assert(type == CFAPI_PMAP);
261  return value;
262 }
263 
265  int type;
266  region *value;
267 
268  cfapiMap_get_property(&type, map, propcode, &value);
269  assert(type == CFAPI_PREGION);
270  return value;
271 }
272 
273 /* Should get replaced by tons of more explicit wrappers */
274 void cf_map_set_int_property(mapstruct *map, int propcode, int value) {
275  int type;
276 
277  cfapiMap_set_property(&type, map, propcode, value);
278  assert(type == CFAPI_INT);
279 }
280 
281 void cf_map_set_string_property(mapstruct *map, int propcode, const char *value) {
282  int type;
283 
284  cfapiMap_set_property(&type, map, propcode, value);
285  assert(type == CFAPI_STRING);
286 }
287 
288 /* Should get replaced by tons of more explicit wrappers */
289 sint16 cf_object_get_resistance(object *op, int rtype) {
290  int type;
291  sint16 resist;
292 
293  cfapiObject_get_property(&type, op, CFAPI_OBJECT_PROP_RESIST, rtype, &resist);
294  assert(type == CFAPI_INT16);
295  return resist;
296 }
297 void cf_object_set_resistance(object *op, int rtype, sint16 value) {
298  int type;
299 
300  cfapiObject_set_property(&type, op, CFAPI_OBJECT_PROP_RESIST, rtype, value);
301  assert(type == CFAPI_INT16);
302 }
303 
304 /* Should get replaced by tons of more explicit wrappers */
305 void cf_object_set_int_property(object *op, int propcode, int value) {
306  int type;
307 
308  cfapiObject_set_property(&type, op, propcode, value);
309  assert(type == CFAPI_INT);
310 }
311 int cf_object_get_int_property(object *op, int propcode) {
312  int type, value;
313 
314  cfapiObject_get_property(&type, op, propcode, &value);
315  assert(type == CFAPI_INT);
316  return value;
317 }
318 long cf_object_get_long_property(object *op, long propcode) {
319  int type;
320  long value;
321 
322  cfapiObject_get_property(&type, op, propcode, &value);
323  assert(type == CFAPI_LONG);
324  return value;
325 }
326 void cf_object_set_movetype_property(object *op, int propcode, MoveType value) {
327  int type;
328 
329  cfapiObject_set_property(&type, op, propcode, value);
330  assert(type == CFAPI_MOVETYPE);
331 }
332 MoveType cf_object_get_movetype_property(object *op, int propcode) {
333  int type;
334  MoveType value;
335 
336  cfapiObject_get_property(&type, op, propcode, &value);
337  assert(type == CFAPI_MOVETYPE);
338  return value;
339 }
340 object *cf_object_get_object_property(object *op, int propcode) {
341  int type;
342  object *value;
343 
344  cfapiObject_get_property(&type, op, propcode, &value);
345  assert(type == CFAPI_POBJECT);
346  return value;
347 }
348 mapstruct *cf_object_get_map_property(object *op, int propcode) {
349  int type;
350  mapstruct *value;
351 
352  cfapiObject_get_property(&type, op, propcode, &value);
353  assert(type == CFAPI_PMAP);
354  return value;
355 }
356 sint64 cf_object_get_int64_property(object *op, int propcode) {
357  int type;
358  sint64 value;
359 
360  cfapiObject_get_property(&type, op, propcode, &value);
361  assert(type == CFAPI_SINT64);
362  return value;
363 }
364 /* Should get replaced by tons of more explicit wrappers */
365 void cf_object_set_long_property(object *op, int propcode, long value) {
366  int type;
367 
368  cfapiObject_set_property(&type, op, propcode, value);
369  assert(type == CFAPI_LONG);
370 }
371 void cf_object_set_float_property(object *op, int propcode, float value) {
372  int type;
373 
374  cfapiObject_set_property(&type, op, propcode, value);
375  assert(type == CFAPI_FLOAT);
376 }
377 void cf_object_set_int64_property(object *op, int propcode, sint64 value) {
378  int type;
379 
380  cfapiObject_set_property(&type, op, propcode, value);
381  assert(type == CFAPI_SINT64);
382 }
383 float cf_object_get_float_property(object *op, int propcode) {
384  int type;
385  float value;
386 
387  cfapiObject_get_property(&type, op, propcode, &value);
388  assert(type == CFAPI_FLOAT);
389  return value;
390 }
391 archetype *cf_object_get_archetype_property(object *op, int propcode) {
392  int type;
393  archetype *value;
394 
395  cfapiObject_get_property(&type, op, propcode, &value);
396  assert(type == CFAPI_PARCH);
397  return value;
398 }
399 partylist *cf_object_get_partylist_property(object *op, int propcode) {
400  int type;
401  partylist *value;
402 
403  cfapiObject_get_property(&type, op, propcode, &value);
404  assert(type == CFAPI_PPARTY);
405  return value;
406 }
407 double cf_object_get_double_property(object *op, int propcode) {
408  int type;
409  double value;
410 
411  cfapiObject_get_property(&type, op, propcode, &value);
412  assert(type == CFAPI_DOUBLE);
413  return value;
414 }
415 sstring cf_object_get_sstring_property(object *op, int propcode) {
416  int type;
417  sstring value;
418 
419  cfapiObject_get_property(&type, op, propcode, &value);
420  assert(type == CFAPI_SSTRING);
421  return value;
422 }
423 char *cf_object_get_string_property(object *op, int propcode, char *buf, int size) {
424  int type;
425 
426  cfapiObject_get_property(&type, op, propcode, buf, size);
427  assert(type == CFAPI_STRING);
428  return buf;
429 }
430 /* Should get replaced by tons of more explicit wrappers */
431 void cf_object_set_string_property(object *op, int propcode, const char *value) {
432  int type;
433 
434  cfapiObject_set_property(&type, op, propcode, value);
435  assert(type == CFAPI_STRING);
436 }
437 void cf_object_set_object_property(object *op, int propcode, object *value) {
438  int type;
439 
440  cfapiObject_set_property(&type, op, propcode, value);
441  assert(type == CFAPI_POBJECT);
442 }
443 
448 void cf_object_change_exp(object *op, sint64 exp, const char *skill_name, int flag) {
449  int type;
450 
451  cfapiObject_change_exp(&type, op, exp, skill_name && strlen(skill_name) > 0 ? skill_name : NULL, flag);
452  assert(type == CFAPI_NONE);
453 }
454 int cf_player_move(player *pl, int dir) {
455  int type, ret;
456 
457  cfapiObject_move(&type, 1, pl, dir, &ret);
458  assert(type == CFAPI_INT);
459  return ret;
460 }
461 int cf_object_move(object *op, int dir, object*originator) {
462  int type, ret;
463 
464  cfapiObject_move(&type, 0, op, dir, originator, &ret);
465  assert(type == CFAPI_INT);
466  return ret;
467 }
472 int cf_object_apply(object *op, object *tmp, int aflag) {
473  int type, ret;
474 
475  cfapiObject_apply(&type, op, tmp, aflag, &ret);
476  return ret;
477 }
478 
483 void cf_object_apply_below(object *pl) {
484  int type;
485 
486  cfapiObject_apply_below(&type, pl);
487 }
492 void cf_object_remove(object *op) {
493  int type;
494 
495  cfapiObject_remove(&type, op);
496 }
501 void cf_object_free(object *ob) {
502  int type;
503 
504  cfapiObject_delete(&type, ob);
505 }
509 object *cf_object_present_archname_inside(object *op, char *whatstr) {
510  int type;
511  object *value;
512 
513  cfapiObject_find_archetype_inside(&type, op, whatstr, &value);
514  assert(type == CFAPI_POBJECT);
515  return value;
516 }
517 
522 int cf_object_transfer(object *op, int x, int y, int randomly, object *originator) {
523  int type, value;
524 
525  cfapiObject_transfer(&type, op, 0, x, y, randomly, originator, &value);
526  assert(type == CFAPI_INT);
527  return value;
528 }
529 
534 int cf_object_move_to(object *op, int x, int y) {
535  int type, value;
536 
537  cfapiObject_transfer(&type, op, 2, x, y, &value);
538  assert(type == CFAPI_INT);
539  return value;
540 }
541 
546 object *cf_object_change_map(object *op, mapstruct *m, object *originator, int flag, int x, int y) {
547  int type;
548  object *value;
549 
550  cfapiObject_transfer(&type, op, 1, m, originator, flag, x, y, &value);
551  assert(type == CFAPI_POBJECT);
552  return value;
553 }
554 
559 object *cf_map_get_object_at(mapstruct *m, int x, int y) {
560  int type;
561  object *value;
562 
563  cfapiMap_get_object_at(&type, m, x, y, &value);
564  assert(type == CFAPI_POBJECT);
565  return value;
566 }
571 void cf_map_message(mapstruct *m, const char *msg, int color) {
572  int type;
573 
574  cfapiMap_message(&type, m, msg, color);
575 }
576 
587 object *cf_object_clone(object *op, int clonetype) {
588  int type;
589  object *value;
590 
591  cfapiObject_clone(&type, op, clonetype, &value);
592  assert(type == CFAPI_POBJECT);
593  return value;
594 }
595 
600 int cf_object_pay_item(object *op, object *pl) {
601  int type, value;
602 
603  cfapiObject_pay_item(&type, op, pl, &value);
604  assert(type == CFAPI_INT);
605  return value;
606 }
607 
612 int cf_object_pay_amount(object *pl, uint64 to_pay) {
613  int type, value;
614 
615  cfapiObject_pay_amount(&type, pl, to_pay, &value);
616  assert(type == CFAPI_INT);
617  return value;
618 }
619 
624 int cf_object_cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg) {
625  int type, value;
626 
627  cfapiObject_cast(&type, op, caster, dir, spell_ob, stringarg, &value);
628  assert(type == CFAPI_INT);
629  return value;
630 }
636 int cf_object_cast_ability(object *caster, object *ctoo, int dir, object *sp, char *flags) {
637  int type, value;
638 
639  cfapiObject_cast(&type, caster, ctoo, dir, sp, flags, &value);
640  assert(type == CFAPI_INT);
641  return value;
642 }
643 
648 void cf_object_learn_spell(object *op, object *spell, int special_prayer) {
649  int type;
650 
651  cfapiObject_learn_spell(&type, op, spell, special_prayer);
652  assert(type == CFAPI_NONE);
653 }
654 
660 void cf_object_forget_spell(object *op, object *sp) {
661  int type;
662 
663  cfapiObject_forget_spell(&type, op, sp);
664 }
665 
670 object *cf_object_check_for_spell(object *op, const char *name) {
671  int type;
672  object *value;
673 
674  cfapiObject_check_spell(&type, op, name, &value);
675  assert(type == CFAPI_POBJECT);
676  return value;
677 }
678 
679 void cf_player_message(object *op, char *txt, int flags) {
680  int type;
681 
682  cfapiPlayer_message(&type, flags, 0, op, txt);
683  assert(type == CFAPI_NONE);
684 }
685 
690 player *cf_player_find(const char *plname) {
691  int type;
692  player *value;
693 
694  cfapiPlayer_find(&type, plname, &value);
695  assert(type == CFAPI_PPLAYER);
696  return value;
697 }
698 
700  int type;
701  sstring value;
702 
704  assert(type == CFAPI_SSTRING);
705  return value;
706 }
707 
708 void cf_player_set_title(object *op, const char *title) {
709  int type;
710 
712 }
713 
715  int type;
716  sstring value;
717 
719  assert(type == CFAPI_SSTRING);
720  return value;
721 }
722 
723 object *cf_player_get_marked_item(object *op) {
724  int type;
725  object *value;
726 
728  assert(type == CFAPI_POBJECT);
729  return value;
730 }
731 
732 void cf_player_set_marked_item(object *op, object *ob) {
733  int type;
734 
736 }
737 
740 }
741 
742 void cf_player_set_party(object *op, partylist *party) {
743  int type;
744 
746 }
747 
752 int cf_player_can_pay(object *pl) {
753  int type, value;
754 
755  cfapiPlayer_can_pay(&type, pl, &value);
756  assert(type == CFAPI_INT);
757  return value;
758 }
759 
764 mapstruct *cf_map_get_map(const char *name, int flags) {
765  int type;
766  mapstruct *ret;
767 
768  cfapiMap_get_map(&type, 1, name, flags, &ret);
769  assert(type == CFAPI_PMAP);
770  return ret;
771 }
772 
777 mapstruct *cf_get_empty_map(int sizex, int sizey) {
778  int type;
779  mapstruct *ret;
780 
781  cfapiMap_get_map(&type, 0, sizex, sizey, &ret);
782  assert(type == CFAPI_PMAP);
783  return ret;
784 }
785 
790 mapstruct *cf_map_has_been_loaded(const char *name) {
791  int type;
792  mapstruct *ret;
793 
794  cfapiMap_has_been_loaded(&type, name, &ret);
795  assert(type == CFAPI_PMAP);
796  return ret;
797 }
798 
806 }
807 
812 int cf_object_query_money(const object *op) {
813  int type, value;
814 
815  cfapiObject_query_money(&type, op, &value);
816  assert(type == CFAPI_INT);
817  return value;
818 }
819 
824 int cf_object_query_cost(const object *tmp, object *who, int flag) {
825  int type, value;
826 
827  cfapiObject_query_cost(&type, tmp, who, flag, &value);
828  assert(type == CFAPI_INT);
829  return value;
830 }
831 
836 void cf_spring_trap(object *trap, object *victim) {
837  int type;
838 
839  if (trap)
840  cfapiObject_activate_rune(&type, trap, victim);
841 }
842 
847 int cf_object_check_trigger(object *op, object *cause) {
848  int type, value;
849 
850  cfapiObject_check_trigger(&type, op, cause, &value);
851  assert(type == CFAPI_INT);
852  return value;
853 }
854 
859 void cf_map_trigger_connected(objectlink *ol, object *cause, int state) {
860  int type;
861 
862  cfapiMap_trigger_connected(&type, ol, cause, state);
863  assert(type == CFAPI_NONE);
864 }
865 
866 int cf_object_out_of_map(object *op, int x, int y) {
867  int type, value;
868 
869  cfapiObject_out_of_map(&type, op->map, x, y, &value);
870  assert(type == CFAPI_INT);
871  return value;
872 }
873 
874 void cf_object_drop(object *op, object *author) {
875  int type;
876 
877  cfapiObject_drop(&type, op, author);
878 }
879 
880 void cf_object_say(object *op, char *msg) {
881  int type, value;
882 
883  cfapiObject_say(&type, op, msg, &value);
884  assert(type == CFAPI_INT);
885 }
886 
887 object *cf_object_insert_object(object *op, object *container) {
888  int type;
889  object *value;
890 
891  cfapiObject_insert(&type, op, 3, container, &value);
892  assert(type == CFAPI_POBJECT);
893  return value;
894 }
895 
900 char *cf_get_maps_directory(const char *name, char *buf, int size) {
901  int type;
902 
903  cfapiMap_create_path(&type, 0, name, buf, size);
904  assert(type == CFAPI_STRING);
905  return buf;
906 }
907 
912 object *cf_create_object(void) {
913  int type;
914  object *value;
915 
916  cfapiObject_create(&type, 0, &value);
917  assert(type == CFAPI_POBJECT);
918  return value;
919 }
920 
924 object *cf_create_object_by_name(const char *name) {
925  int type;
926  object *value;
927 
928  cfapiObject_create(&type, 1, name, &value);
929  assert(type == CFAPI_POBJECT);
930  return value;
931 }
932 
933 void cf_system_register_global_event(int event, const char *name, f_plug_api hook) {
934  int type;
935 
936  cfapiSystem_register_global_event(&type, event, name, hook);
937  assert(type == CFAPI_NONE);
938 }
939 
940 void cf_system_unregister_global_event(int event, const char *name) {
941  int type;
942 
943  cfapiSystem_unregister_global_event(&type, event, name);
944  assert(type == CFAPI_NONE);
945 }
946 
961 const char *cf_get_directory(int id) {
962  int type;
963  const char *ret;
964 
965  cfapiSystem_directory(&type, id, &ret);
966  assert(type == CFAPI_STRING);
967  return ret;
968 }
969 
974 const char *cf_re_cmp(const char *str, const char *regexp) {
975  int type;
976  const char *result;
977 
978  cfapiSystem_re_cmp(&type, str, regexp, &result);
979  assert(type == CFAPI_STRING);
980  return result;
981 }
982 
987 void cf_fix_object(object *op) {
988  int type;
989 
990  if (op)
991  cfapiObject_fix(&type, op);
992 }
993 
998 sstring cf_add_string(const char *str) {
999  int type;
1000  sstring ret;
1001 
1002  if (!str)
1003  return NULL;
1004  cfapiSystem_add_string(&type, str, &ret);
1005  assert(type == CFAPI_SSTRING);
1006  return ret;
1007 }
1008 
1014  int type;
1015 
1016  if (str)
1017  cfapiSystem_remove_string(&type, str);
1018 }
1019 
1020 sstring cf_find_string(const char *str) {
1021  int type;
1022  sstring ret;
1023 
1024  if (!str)
1025  return NULL;
1026 
1027  cfapiSystem_find_string(&type, str, &ret);
1028  assert(type == CFAPI_SSTRING);
1029  return ret;
1030 }
1031 
1032 char *cf_query_name(object *ob, char *name, int size) {
1033  int type;
1034 
1035  cfapiObject_get_property(&type, ob, CFAPI_OBJECT_PROP_NAME, name, size);
1036  assert(type == CFAPI_STRING);
1037  return name;
1038 }
1039 
1041  int type;
1042  sstring value;
1043 
1045  assert(type == CFAPI_SSTRING);
1046  return value;
1047 }
1048 
1049 char *cf_query_base_name(object *ob, int plural, char *name, int size) {
1050  int type;
1051 
1052  cfapiObject_get_property(&type, ob, CFAPI_OBJECT_PROP_BASE_NAME, name, size);
1053  assert(type == CFAPI_STRING);
1054  return name;
1055 }
1056 
1058  int type;
1059  sstring value;
1060 
1062  assert(type == CFAPI_SSTRING);
1063  return value;
1064 }
1065 
1066 void cf_object_set_weight(object *ob, int weight) {
1067  int type;
1068 
1070  assert(type == CFAPI_INT);
1071 }
1072 
1074  int type;
1075 
1076  cfapiObject_set_property(&type, ob, CFAPI_OBJECT_PROP_WEIGHT_LIMIT, weight_limit);
1077  assert(type == CFAPI_INT);
1078 }
1079 
1080 int cf_object_get_weight(object *ob) {
1081  int type, weight;
1082 
1084  assert(type == CFAPI_INT);
1085  return weight;
1086 }
1087 
1089  int type, limit;
1090 
1092  assert(type == CFAPI_INT);
1093  return limit;
1094 }
1095 
1099 int cf_object_set_nrof(object *ob, int nrof) {
1100  int type;
1101 
1102  if (nrof < 0)
1103  return -1;
1104 
1106  return 0;
1107 }
1108 
1109 int cf_object_get_nrof(object *ob) {
1110  int type, nrof;
1111 
1113  return nrof;
1114 }
1115 
1116 int cf_object_get_flag(object *ob, int flag) {
1117  int type;
1118  int rv;
1119 
1120  cfapiObject_get_property(&type, ob, CFAPI_OBJECT_PROP_FLAGS, flag, &rv);
1121  if (rv != 0)
1122  return 1;
1123  else
1124  return 0;
1125 }
1126 
1127 void cf_object_set_flag(object *ob, int flag, int value) {
1128  int type;
1129 
1130  cfapiObject_set_property(&type, ob, CFAPI_OBJECT_PROP_FLAGS, flag, value ? 1 : 0);
1131 }
1132 
1137 object *cf_object_insert_in_ob(object *op, object *where) {
1138  int type;
1139  object *value;
1140 
1141  if (!cf_object_get_flag(op, FLAG_REMOVED)) {
1142  cfapiObject_remove(&type, op);
1143  }
1144 
1145  cfapiObject_insert(&type, op, 3, where, &value);
1146  assert(type == CFAPI_POBJECT);
1147  return value;
1148 }
1149 
1154 object *cf_map_insert_object_there(object *op, mapstruct *m, object *originator, int flag) {
1155  int type;
1156  object *value;
1157 
1158  cfapiObject_insert(&type, op, 1, m, originator, flag, &value);
1159  assert(type == CFAPI_POBJECT);
1160  return value;
1161 }
1162 
1168 object *cf_map_insert_object(mapstruct *where, object *op, int x, int y) {
1169  int type;
1170  object *value;
1171 
1172  cfapiObject_insert(&type, op, 0, where, NULL, 0 , x, y, &value);
1173  assert(type == CFAPI_POBJECT);
1174  return value;
1175 }
1176 
1177 int cf_object_teleport(object *op, mapstruct *map, int x, int y) {
1178  int type, value;
1179 
1180  cfapiObject_teleport(&type, op, map, x, y, &value);
1181  assert(type == CFAPI_INT);
1182  return value;
1183 }
1184 
1188 object *cf_map_present_arch_by_name(const char *str, mapstruct *map, int nx, int ny) {
1189  int type;
1190  object *value;
1191 
1192  cfapiMap_present_arch_by_name(&type, str, map, nx, ny, &value);
1193  assert(type == CFAPI_POBJECT);
1194  return value;
1195 }
1196 
1199 }
1200 
1203 }
1204 
1207 }
1208 
1211 }
1212 
1215 }
1216 
1219 }
1220 
1223 }
1224 
1227 }
1228 
1231 }
1232 
1237 int cf_map_change_light(mapstruct *m, int change) {
1238  int type, value;
1239 
1240  cfapiMap_change_light(&type, m, change, &value);
1241  assert(type == CFAPI_INT);
1242  return value;
1243 }
1244 
1245 void cf_object_update(object *op, int flags) {
1246  int type;
1247 
1248  cfapiObject_update(&type, op, flags);
1249 }
1250 
1251 void cf_object_pickup(object *op, object *what) {
1252  int type;
1253 
1254  cfapiObject_pickup(&type, op, what);
1255  assert(type == CFAPI_NONE);
1256 }
1257 
1263 char *cf_strdup_local(const char *str) {
1264  int type;
1265  char *dup;
1266 
1267  if (str == NULL)
1268  return NULL;
1269  cfapiSystem_strdup_local(&type, str, &dup);
1270  assert(type == CFAPI_STRING);
1271  return dup;
1272 }
1273 
1278 int cf_map_get_flags(mapstruct *oldmap, mapstruct **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny) {
1279  int type, value;
1280 
1281  cfapiMap_get_property(&type, oldmap, CFAPI_MAP_PROP_FLAGS, newmap, x, y, nx, ny, &value);
1282  assert(type == CFAPI_INT);
1283  return value;
1284 }
1285 
1290 int cf_random_map_set_variable(RMParms *rp, const char *buf) {
1291  int type, ret;
1292 
1293  cfapiSet_random_map_variable(&type, rp, buf, &ret);
1294  assert(type == CFAPI_INT);
1295  return ret;
1296 }
1297 
1302 mapstruct *cf_random_map_generate(const char *OutFileName, RMParms *RP, char **use_layout) {
1303  int type;
1304  mapstruct *map;
1305 
1306  cfapiGenerate_random_map(&type, OutFileName, RP, use_layout, &map);
1307  assert(type == CFAPI_PMAP);
1308  return map;
1309 }
1310 
1315 int cf_find_animation(const char *name) {
1316  int type, anim;
1317 
1318  cfapiSystem_find_animation(&type, name, &anim);
1319  assert(type == CFAPI_INT);
1320  return anim;
1321 }
1322 
1327 int cf_find_face(const char *name, int error) {
1328  int type, anim;
1329 
1330  cfapiSystem_find_face(&type, name, error, &anim);
1331  assert(type == CFAPI_INT);
1332  return anim;
1333 }
1334 
1339 void cf_log(LogLevel logLevel, const char *format, ...) {
1340  int type;
1341  /* Copied from common/logger.c */
1342  char buf[20480]; /* This needs to be really really big - larger than any other buffer, since that buffer may
1343  need to be put in this one. */
1344  va_list ap;
1345 
1346  va_start(ap, format);
1347  buf[0] = '\0';
1348  vsprintf(buf, format, ap);
1349  va_end(ap);
1350 
1351  cfapiSystem_log(&type, logLevel, buf);
1352  assert(type == CFAPI_NONE);
1353 }
1354 
1359 void cf_log_plain(LogLevel logLevel, const char *message) {
1360  int type;
1361 
1362  cfapiSystem_log(&type, logLevel, message);
1363  assert(type == CFAPI_NONE);
1364 }
1365 
1367  int type;
1368 
1369  cfapiSystem_get_time(&type, tod);
1370  assert(type == CFAPI_NONE);
1371 }
1372 
1373 const char *cf_get_season_name(int index) {
1374  int type;
1375  char *result;
1376 
1377  cfapiSystem_get_season_name(&type, index, &result);
1378  assert(type == CFAPI_STRING);
1379  return result;
1380 }
1381 
1382 const char *cf_get_month_name(int index) {
1383  int type;
1384  char *result;
1385 
1386  cfapiSystem_get_month_name(&type, index, &result);
1387  assert(type == CFAPI_STRING);
1388  return result;
1389 }
1390 
1391 const char *cf_get_weekday_name(int index) {
1392  int type;
1393  char *result;
1394 
1395  cfapiSystem_get_weekday_name(&type, index, &result);
1396  assert(type == CFAPI_STRING);
1397  return result;
1398 }
1399 
1400 const char *cf_get_periodofday_name(int index) {
1401  int type;
1402  char *result;
1403 
1404  cfapiSystem_get_periodofday_name(&type, index, &result);
1405  assert(type == CFAPI_STRING);
1406  return result;
1407 }
1408 
1421 int cf_timer_create(object *ob, long delay, int mode) {
1422  int type, timer;
1423 
1424  cfapiSystem_timer_create(&type, ob, delay, mode, &timer);
1425  assert(type == CFAPI_INT);
1426  return timer;
1427 }
1428 
1437 int cf_timer_destroy(int id) {
1438  int type, code;
1439 
1440  cfapiSystem_timer_destroy(&type, id, &code);
1441  assert(type == CFAPI_INT);
1442  return code;
1443 }
1444 
1454 const char *cf_object_get_key(object *op, const char *keyname) {
1455  int type;
1456  const char *value;
1457 
1458  cfapiObject_get_key(&type, op, keyname, &value);
1459  assert(type == CFAPI_SSTRING);
1460  return value;
1461 }
1462 
1476 int cf_object_set_key(object *op, const char *keyname, const char *value, int add_key) {
1477  int type, ret;
1478 
1479  cfapiObject_set_key(&type, op, keyname, value, add_key, &ret);
1480  assert(type == CFAPI_INT);
1481  return ret;
1482 }
1483 
1488 int cf_object_change_abil(object *op, object *tmp) {
1489  int type, ret;
1490 
1491  cfapiObject_change_abil(&type, op, tmp, &ret);
1492  assert(type == CFAPI_INT);
1493  return ret;
1494 }
1495 
1496 /* Archetype-related functions */
1497 
1504  int type;
1505  archetype *value;
1506 
1507  cfapiArchetype_get_property(&type, NULL, CFAPI_ARCH_PROP_NEXT, &value);
1508  assert(type == CFAPI_PARCH);
1509  return value;
1510 }
1511 
1520  int type;
1521  sstring name;
1522 
1524  assert(type == CFAPI_SSTRING);
1525  return name;
1526 }
1527 
1537  int type;
1538  archetype *value;
1539 
1540  cfapiArchetype_get_property(&type, arch, CFAPI_ARCH_PROP_NEXT, &value);
1541  assert(type == CFAPI_PARCH);
1542  return value;
1543 }
1544 
1553  int type;
1554  archetype *value;
1555 
1556  cfapiArchetype_get_property(&type, arch, CFAPI_ARCH_PROP_MORE, &value);
1557  assert(type == CFAPI_PARCH);
1558  return value;
1559 }
1560 
1569  int type;
1570  archetype *value;
1571 
1572  cfapiArchetype_get_property(&type, arch, CFAPI_ARCH_PROP_HEAD, &value);
1573  assert(type == CFAPI_PARCH);
1574  return value;
1575 }
1576 
1585  int type;
1586  object *value;
1587 
1588  cfapiArchetype_get_property(&type, arch, CFAPI_ARCH_PROP_CLONE, &value);
1589  assert(type == CFAPI_POBJECT);
1590  return value;
1591 }
1592 
1593 /* Party-related functions */
1594 
1601  int type;
1602  partylist *value;
1603 
1604  cfapiParty_get_property(&type, NULL, CFAPI_PARTY_PROP_NEXT, &value);
1605  assert(type == CFAPI_PPARTY);
1606  return value;
1607 }
1608 
1615 const char *cf_party_get_name(partylist *party) {
1616  int type;
1617  sstring value;
1618 
1619  cfapiParty_get_property(&type, party, CFAPI_PARTY_PROP_NAME, &value);
1620  assert(type == CFAPI_SSTRING);
1621  return value;
1622 }
1623 
1632  int type;
1633  partylist *value;
1634 
1635  cfapiParty_get_property(&type, party, CFAPI_PARTY_PROP_NEXT, &value);
1636  assert(type == CFAPI_PPARTY);
1637  return value;
1638 }
1639 
1647 const char *cf_party_get_password(partylist *party) {
1648  int type;
1649  sstring value;
1650 
1651  cfapiParty_get_property(&type, party, CFAPI_PARTY_PROP_PASSWORD, &value);
1652  assert(type == CFAPI_SSTRING);
1653  return value;
1654 }
1655 
1664  int type;
1665  player *value;
1666 
1667  cfapiParty_get_property(&type, party, CFAPI_PARTY_PROP_PLAYER, NULL, &value);
1668  assert(type == CFAPI_PPLAYER);
1669  return value;
1670 }
1671 
1682  int type;
1683  player *value;
1684 
1685  cfapiParty_get_property(&type, party, CFAPI_PARTY_PROP_PLAYER, op, &value);
1686  assert(type == CFAPI_PPLAYER);
1687  return value;
1688 }
1689 
1696  int type;
1697  region *value;
1698 
1699  cfapiRegion_get_property(&type, NULL, CFAPI_REGION_PROP_NEXT, &value);
1700  assert(type == CFAPI_PREGION);
1701  return value;
1702 }
1703 
1711 const char *cf_region_get_name(region *reg) {
1712  int type;
1713  sstring value;
1714 
1715  cfapiRegion_get_property(&type, reg, CFAPI_REGION_PROP_NAME, &value);
1716  assert(type == CFAPI_SSTRING);
1717  return value;
1718 }
1719 
1728  int type;
1729  region *value;
1730 
1731  cfapiRegion_get_property(&type, reg, CFAPI_REGION_PROP_NEXT, &value);
1732  assert(type == CFAPI_PREGION);
1733  return value;
1734 }
1735 
1744  int type;
1745  region *value;
1746 
1748  assert(type == CFAPI_PREGION);
1749  return value;
1750 }
1751 
1759 const char *cf_region_get_longname(region *reg) {
1760  int type;
1761  sstring value;
1762 
1764  assert(type == CFAPI_SSTRING);
1765  return value;
1766 }
1767 
1775 const char *cf_region_get_message(region *reg) {
1776  int type;
1777  sstring value;
1778 
1780  assert(type == CFAPI_SSTRING);
1781  return value;
1782 }
1783 
1784 /* Friendlylist functions. */
1785 
1792  int type;
1793  object *value;
1794 
1795  cfapiFriendlylist_get_next(&type, NULL, &value);
1796  assert(type == CFAPI_POBJECT);
1797  return value;
1798 }
1799 
1807 object *cf_friendlylist_get_next(object *ob) {
1808  int type;
1809  object *value;
1810 
1811  cfapiFriendlylist_get_next(&type, ob, &value);
1812  assert(type == CFAPI_POBJECT);
1813  return value;
1814 }
1815 
1816 #ifdef WIN32
1817 int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info) {
1818  /* Get the time, if they want it */
1819  if (time_Info != NULL) {
1820  time_Info->tv_sec = time(NULL);
1821  time_Info->tv_usec = timeGetTime()*1000;
1822  }
1823  /* Get the timezone, if they want it */
1824  if (timezone_Info != NULL) {
1825  _tzset();
1826  timezone_Info->tz_minuteswest = _timezone;
1827  timezone_Info->tz_dsttime = _daylight;
1828  }
1829  /* And return */
1830  return 0;
1831 }
1832 #endif
partylist * cf_object_get_partylist_property(object *op, int propcode)
void cf_object_update(object *op, int flags)
region * cf_region_get_parent(region *reg)
int tz_dsttime
Definition: win32.c:41
#define CFAPI_PARTY_PROP_PASSWORD
Definition: plugin.h:311
int cf_object_query_cost(const object *tmp, object *who, int flag)
static f_plug_api cfapiCheck_inventory
Definition: plugin_common.c:76
Definition: player.h:146
const char * cf_get_directory(int id)
#define CFAPI_OBJECT_PROP_NAME
Definition: plugin.h:176
object * cf_player_get_marked_item(object *op)
const char * cf_object_get_key(object *op, const char *keyname)
#define CFAPI_PREGION
Definition: plugin.h:113
#define CFAPI_PLAYER_PROP_TITLE
Definition: plugin.h:282
signed short sint16
Definition: global.h:72
void cf_map_trigger_connected(objectlink *ol, object *cause, int state)
#define CFAPI_MAP_PROP_ENTER_Y
Definition: plugin.h:297
static f_plug_api cfapiSystem_register_global_event
Definition: plugin_common.c:42
Definition: object.h:298
#define CFAPI_REGION_PROP_MESSAGE
Definition: plugin.h:318
#define CFAPI_MAP_PROP_FLAGS
Definition: plugin.h:284
#define CFAPI_MAP_PROP_DARKNESS
Definition: plugin.h:293
void cf_object_set_flag(object *ob, int flag, int value)
#define CFAPI_OBJECT_PROP_WEIGHT
Definition: plugin.h:212
static f_plug_api cfapiMap_change_light
static f_plug_api cfapiSystem_log
Definition: plugin_common.c:48
int cf_map_get_width(mapstruct *map)
static f_plug_api cfapiObject_pay_amount
Definition: plugin_common.c:85
static f_plug_api cfapiSystem_find_face
Definition: plugin_common.c:47
const char * cf_get_weekday_name(int index)
static f_plug_api cfapiMap_get_object_at
Definition: plugin_common.c:97
static f_plug_api cfapiObject_drain
Definition: plugin_common.c:60
int cf_map_get_flags(mapstruct *oldmap, mapstruct **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny)
static f_plug_api cfapiMap_present_arch_by_name
Definition: plugin_common.c:98
#define CFAPI_MAP_PROP_DIFFICULTY
Definition: plugin.h:285
#define CFAPI_MAP_PROP_HEIGHT
Definition: plugin.h:295
void cf_spring_trap(object *trap, object *victim)
void cf_object_set_object_property(object *op, int propcode, object *value)
player * cf_party_get_first_player(partylist *party)
sstring cf_object_get_sstring_property(object *op, int propcode)
void cf_object_set_long_property(object *op, int propcode, long value)
object * cf_object_insert_object(object *op, object *container)
static f_plug_api cfapiPlayer_find
void cf_object_say(object *op, char *msg)
void cf_system_register_global_event(int event, const char *name, f_plug_api hook)
int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info)
Definition: win32.c:54
static f_plug_api cfapiObject_change_exp
long cf_object_get_long_property(object *op, long propcode)
unsigned char MoveType
Definition: define.h:725
static f_plug_api cfapiObject_get_key
static f_plug_api cfapiObject_say
Definition: plugin_common.c:92
object * cf_archetype_get_clone(archetype *arch)
mapstruct * cf_get_empty_map(int sizex, int sizey)
#define CFAPI_ARCH_PROP_MORE
Definition: plugin.h:306
#define CFAPI_INT16
Definition: plugin.h:114
object * cf_create_object_by_name(const char *name)
static f_plug_api cfapiObject_distance
Definition: plugin_common.c:72
static f_plug_api cfapiObject_remove
Definition: plugin_common.c:64
static f_plug_api cfapiObject_fix
Definition: plugin_common.c:61
#define CFAPI_OBJECT_PROP_FLAGS
Definition: plugin.h:242
static f_plug_api cfapiObject_check_trigger
Definition: plugin_common.c:78
int cf_map_get_enter_x(mapstruct *map)
#define CFAPI_SINT64
Definition: plugin.h:116
const char * cf_region_get_message(region *reg)
#define CFAPI_OBJECT_PROP_NAME_PLURAL
Definition: plugin.h:177
mapstruct * cf_map_has_been_loaded(const char *name)
partylist * cf_player_get_party(object *op)
static f_plug_api cfapiObject_set_key
int cf_object_check_trigger(object *op, object *cause)
void *(* f_plug_api)(int *type,...)
Definition: plugin.h:121
mapstruct * cf_map_get_first(void)
region * cf_region_get_first(void)
#define CFAPI_OBJECT_PROP_MESSAGE
Definition: plugin.h:182
void cf_player_set_marked_item(object *op, object *ob)
void cf_object_set_weight_limit(object *ob, int weight_limit)
static f_plug_api cfapiObject_query_cost
Definition: plugin_common.c:80
#define CFAPI_MAP_PROP_RESET_TIMEOUT
Definition: plugin.h:290
static f_plug_api cfapiObject_move
#define CFAPI_DOUBLE
Definition: plugin.h:108
object * cf_map_get_object_at(mapstruct *m, int x, int y)
#define CFAPI_REGION_PROP_NEXT
Definition: plugin.h:315
void cf_player_set_party(object *op, partylist *party)
static f_plug_api cfapiSystem_get_time
Definition: plugin_common.c:49
object * cf_object_get_object_property(object *op, int propcode)
#define CFAPI_MAP_PROP_NEXT
Definition: plugin.h:299
mapstruct * cf_map_get_map_property(mapstruct *map, int propcode)
void cf_fix_object(object *op)
static f_plug_api cfapiObject_describe
Definition: plugin_common.c:59
Definition: object.h:321
#define CFAPI_PMAP
Definition: plugin.h:106
void cf_object_set_string_property(object *op, int propcode, const char *value)
int cf_object_apply(object *op, object *tmp, int aflag)
#define CFAPI_POBJECT
Definition: plugin.h:105
static f_plug_api cfapiObject_find_archetype_inside
Definition: plugin_common.c:88
#define FLAG_REMOVED
Definition: define.h:528
const char * cf_party_get_password(partylist *party)
const char * cf_get_periodofday_name(int index)
static f_plug_api cfapiSystem_find_animation
Definition: plugin_common.c:46
void cf_object_free(object *ob)
static f_plug_api cfapiObject_pay_item
Definition: plugin_common.c:86
int cf_object_get_int_property(object *op, int propcode)
static f_plug_api cfapiObject_merge
Definition: plugin_common.c:71
static f_plug_api cfapiRegion_get_property
#define CFAPI_NONE
Definition: plugin.h:100
static f_plug_api cfapiSystem_get_weekday_name
int cf_map_get_players(mapstruct *map)
void cf_map_set_string_property(mapstruct *map, int propcode, const char *value)
#define CFAPI_FLOAT
Definition: plugin.h:107
static f_plug_api cfapiSystem_timer_create
Definition: plugin_common.c:50
#define CFAPI_PARCH
Definition: plugin.h:109
static f_plug_api cfapiMap_set_property
Definition: plugin_common.c:94
void cf_object_apply_below(object *pl)
archetype * cf_archetype_get_more(archetype *arch)
int cf_random_map_set_variable(RMParms *rp, const char *buf)
object * cf_map_present_arch_by_name(const char *str, mapstruct *map, int nx, int ny)
#define CFAPI_MAP_PROP_PLAYERS
Definition: plugin.h:291
static f_plug_api cfapiObject_query_money
Definition: plugin_common.c:79
static f_plug_api cfapiSystem_remove_string
Definition: plugin_common.c:43
void cf_object_pickup(object *op, object *what)
static f_plug_api cfapiObject_out_of_map
Definition: plugin_common.c:89
static f_plug_api cfapiObject_give_skill
Definition: plugin_common.c:62
partylist * cf_party_get_next(partylist *party)
void cf_log(LogLevel logLevel, const char *format,...)
void cf_object_change_exp(object *op, sint64 exp, const char *skill_name, int flag)
static f_plug_api cfapiObject_set_property
Definition: plugin_common.c:56
#define CFAPI_PLAYER_PROP_IP
Definition: plugin.h:275
region * cf_region_get_next(region *reg)
void cf_object_set_weight(object *ob, int weight)
int cf_map_change_light(mapstruct *m, int change)
int cf_map_get_reset_timeout(mapstruct *map)
#define CFAPI_PARTY_PROP_PLAYER
Definition: plugin.h:312
static f_plug_api cfapiObject_apply_below
int cf_find_animation(const char *name)
char * cf_object_get_string_property(object *op, int propcode, char *buf, int size)
static f_plug_api cfapiObject_find
Definition: plugin_common.c:67
#define CFAPI_STRING
Definition: plugin.h:104
sstring cf_add_string(const char *str)
#define CFAPI_MAP_PROP_RESET_TIME
Definition: plugin.h:289
#define CFAPI_ARCH_PROP_HEAD
Definition: plugin.h:305
int cf_object_pay_item(object *op, object *pl)
static f_plug_api cfapiObject_clear
Definition: plugin_common.c:74
object * cf_object_check_for_spell(object *op, const char *name)
static f_plug_api cfapiObject_split
Definition: plugin_common.c:70
struct mapdef * map
Definition: object.h:155
Definition: map.h:297
sstring cf_query_name_pl(object *ob)
static f_plug_api cfapiObject_reset
Definition: plugin_common.c:75
#define CFAPI_ARCH_PROP_NEXT
Definition: plugin.h:304
static f_plug_api cfapiObject_get_property
Definition: plugin_common.c:55
int cf_timer_destroy(int id)
object * cf_object_clone(object *op, int clonetype)
static f_plug_api cfapiObject_user_event
const char * cf_get_season_name(int index)
void cf_system_unregister_global_event(int event, const char *name)
int cf_timer_create(object *ob, long delay, int mode)
double cf_object_get_double_property(object *op, int propcode)
static f_plug_api cfapiArchetype_get_property
int cf_object_get_weight_limit(object *ob)
static f_plug_api cfapiMap_message
Definition: plugin_common.c:96
int cf_object_get_weight(object *ob)
int cf_object_query_money(const object *op)
int cf_object_teleport(object *op, mapstruct *map, int x, int y)
static f_plug_api cfapiObject_delete
Definition: plugin_common.c:65
#define CFAPI_OBJECT_PROP_WEIGHT_LIMIT
Definition: plugin.h:213
#define CFAPI_LONG
Definition: plugin.h:102
char * cf_get_maps_directory(const char *name, char *buf, int size)
#define CFAPI_SSTRING
Definition: plugin.h:117
char * cf_query_name(object *ob, char *name, int size)
int cf_object_set_nrof(object *ob, int nrof)
int cf_object_transfer(object *op, int x, int y, int randomly, object *originator)
#define CFAPI_PPLAYER
Definition: plugin.h:111
object * cf_object_insert_in_ob(object *op, object *where)
object * cf_map_insert_object(mapstruct *where, object *op, int x, int y)
static f_plug_api cfapiSystem_timer_destroy
Definition: plugin_common.c:51
int cf_map_get_reset_time(mapstruct *map)
int cf_object_set_key(object *op, const char *keyname, const char *value, int add_key)
static f_plug_api cfapiSystem_unregister_global_event
Definition: plugin_common.c:44
int cf_find_face(const char *name, int error)
static f_plug_api cfapiObject_drop
Definition: plugin_common.c:90
static f_plug_api cfapiMap_get_property
Definition: plugin_common.c:93
static f_plug_api cfapiPlayer_send_inventory
void cf_player_set_title(object *op, const char *title)
#define CFAPI_REGION_PROP_LONGNAME
Definition: plugin.h:317
sint16 cf_object_get_resistance(object *op, int rtype)
static f_plug_api cfapiSystem_get_periodofday_name
const char * cf_region_get_longname(region *reg)
int cf_init_plugin(f_plug_api getHooks)
static f_plug_api cfapiPlayer_can_pay
static f_plug_api cfapiSystem_re_cmp
Definition: plugin_common.c:53
#define CFAPI_PARTY_PROP_NAME
Definition: plugin.h:309
static f_plug_api cfapiObject_transmute
Definition: plugin_common.c:63
#define CFAPI_PLAYER_PROP_PARTY
Definition: plugin.h:277
LogLevel
Definition: logger.h:37
int cf_player_move(player *pl, int dir)
archetype * cf_archetype_get_next(archetype *arch)
void cf_object_set_int_property(object *op, int propcode, int value)
player * cf_party_get_next_player(partylist *party, player *op)
static const flag_definition flags[]
sstring cf_map_get_sstring_property(mapstruct *map, int propcode)
static f_plug_api cfapiObject_apply
Definition: plugin_common.c:57
int cf_object_get_flag(object *ob, int flag)
static f_plug_api cfapiObject_cast
Definition: plugin_common.c:81
const char * sstring
Definition: global.h:84
void cf_object_set_movetype_property(object *op, int propcode, MoveType value)
static f_plug_api cfapiObject_insert
Definition: plugin_common.c:69
static f_plug_api cfapiParty_get_property
archetype * cf_archetype_get_head(archetype *arch)
static f_plug_api cfapiObject_activate_rune
Definition: plugin_common.c:77
#define CFAPI_OBJECT_PROP_BASE_NAME
Definition: plugin.h:233
#define CFAPI_REGION_PROP_PARENT
Definition: plugin.h:316
mapstruct * cf_random_map_generate(const char *OutFileName, RMParms *RP, char **use_layout)
#define CFAPI_INT
Definition: plugin.h:101
static f_plug_api cfapiObject_pickup
static f_plug_api cfapiMap_get_map
Definition: plugin_common.c:95
static f_plug_api cfapiMap_has_been_loaded
#define CFAPI_ARCH_PROP_NAME
Definition: plugin.h:303
static f_plug_api cfapiMap_trigger_connected
sstring cf_player_get_title(object *op)
int cf_map_get_int_property(mapstruct *map, int property)
void cf_object_forget_spell(object *op, object *sp)
void cf_map_set_int_property(mapstruct *map, int propcode, int value)
const char * cf_region_get_name(region *reg)
static f_plug_api cfapiObject_transfer
Definition: plugin_common.c:87
float cf_object_get_float_property(object *op, int propcode)
static f_plug_api cfapiObject_check_spell
Definition: plugin_common.c:84
sstring cf_archetype_get_name(archetype *arch)
int cf_object_get_nrof(object *ob)
int cf_object_pay_amount(object *pl, uint64 to_pay)
static f_plug_api cfapiObject_teleport
Definition: tod.h:61
int cf_map_get_darkness(mapstruct *map)
region * cf_map_get_region_property(mapstruct *map, int propcode)
MoveType cf_object_get_movetype_property(object *op, int propcode)
void cf_object_remove(object *op)
int cf_object_out_of_map(object *op, int x, int y)
const char * cf_party_get_name(partylist *party)
int cf_object_change_abil(object *op, object *tmp)
#define CFAPI_MOVETYPE
Definition: plugin.h:118
sstring cf_player_get_ip(object *op)
const uint32 weight_limit[MAX_STAT+1]
Definition: living.c:143
static f_plug_api cfapiObject_update
Definition: plugin_common.c:73
#define CFAPI_MAP_PROP_WIDTH
Definition: plugin.h:294
const char * cf_re_cmp(const char *str, const char *regexp)
int cf_object_move_to(object *op, int x, int y)
static f_plug_api cfapiObject_learn_spell
Definition: plugin_common.c:82
#define CFAPI_PARTY_PROP_NEXT
Definition: plugin.h:310
int cf_object_cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
void cf_object_drop(object *op, object *author)
object * cf_friendlylist_get_next(object *ob)
object * cf_object_present_archname_inside(object *op, char *whatstr)
void cf_get_time(timeofday_t *tod)
#define CFAPI_OBJECT_PROP_NROF
Definition: plugin.h:188
sstring cf_object_get_msg(object *ob)
static f_plug_api cfapiObject_create
Definition: plugin_common.c:68
int cf_map_get_enter_y(mapstruct *map)
#define CFAPI_ARCH_PROP_CLONE
Definition: plugin.h:307
#define GET_HOOK(x, y, z)
#define CFAPI_PLAYER_PROP_MARKED_ITEM
Definition: plugin.h:276
static f_plug_api cfapiFriendlylist_get_next
void cf_object_set_float_property(object *op, int propcode, float value)
int cf_object_user_event(object *op, object *activator, object *third, const char *message, int fix)
player * cf_player_find(const char *plname)
mapstruct * cf_object_get_map_property(object *op, int propcode)
int cf_object_move(object *op, int dir, object *originator)
mapstruct * cf_map_get_map(const char *name, int flags)
static f_plug_api cfapiSet_random_map_variable
static f_plug_api cfapiSystem_get_season_name
object * cf_map_insert_object_there(object *op, mapstruct *m, object *originator, int flag)
static f_plug_api cfapiSystem_directory
Definition: plugin_common.c:52
#define CFAPI_OBJECT_PROP_RESIST
Definition: plugin.h:194
char * cf_query_base_name(object *ob, int plural, char *name, int size)
void cf_map_message(mapstruct *m, const char *msg, int color)
sstring cf_find_string(const char *str)
Definition: win32.c:39
void cf_object_set_resistance(object *op, int rtype, sint16 value)
Definition: map.h:346
static f_plug_api cfapiPlayer_message
object * cf_object_change_map(object *op, mapstruct *m, object *originator, int flag, int x, int y)
void cf_object_set_int64_property(object *op, int propcode, sint64 value)
archetype * cf_archetype_get_first(void)
void cf_player_message(object *op, char *txt, int flags)
object * cf_create_object(void)
void cf_object_learn_spell(object *op, object *spell, int special_prayer)
archetype * cf_object_get_archetype_property(object *op, int propcode)
static f_plug_api cfapiObject_identify
Definition: plugin_common.c:58
static f_plug_api cfapiSystem_strdup_local
Definition: plugin_common.c:45
static f_plug_api cfapiObject_clone
Definition: plugin_common.c:66
static f_plug_api cfapiGenerate_random_map
void cf_log_plain(LogLevel logLevel, const char *message)
static f_plug_api cfapiSystem_get_month_name
partylist * cf_party_get_first(void)
void cf_free_string(sstring str)
static f_plug_api cfapiMap_create_path
Definition: plugin_common.c:99
#define CFAPI_MAP_PROP_ENTER_X
Definition: plugin.h:296
const char * cf_get_month_name(int index)
int cf_object_cast_ability(object *caster, object *ctoo, int dir, object *sp, char *flags)
char * cf_strdup_local(const char *str)
object * cf_friendlylist_get_first(void)
int cf_player_can_pay(object *pl)
static f_plug_api cfapiObject_forget_spell
Definition: plugin_common.c:83
sint64 cf_object_get_int64_property(object *op, int propcode)
static f_plug_api cfapiSystem_add_string
Definition: plugin_common.c:40
static f_plug_api cfapiSystem_find_string
Definition: plugin_common.c:41
int tz_minuteswest
Definition: win32.c:40
#define CFAPI_REGION_PROP_NAME
Definition: plugin.h:314
static f_plug_api cfapiObject_change_abil
Definition: plugin_common.c:91
int cf_map_get_height(mapstruct *map)
#define CFAPI_PPARTY
Definition: plugin.h:112
int cf_map_get_difficulty(mapstruct *map)