00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include <plugin_common.h>
00038 #include <assert.h>
00039
00040 static f_plug_api cfapiSystem_add_string = NULL;
00041 static f_plug_api cfapiSystem_find_string = NULL;
00042 static f_plug_api cfapiSystem_register_global_event = NULL;
00043 static f_plug_api cfapiSystem_remove_string = NULL;
00044 static f_plug_api cfapiSystem_unregister_global_event = NULL;
00045 static f_plug_api cfapiSystem_strdup_local = NULL;
00046 static f_plug_api cfapiSystem_find_animation = NULL;
00047 static f_plug_api cfapiSystem_find_face = NULL;
00048 static f_plug_api cfapiSystem_log = NULL;
00049 static f_plug_api cfapiSystem_get_time = NULL;
00050 static f_plug_api cfapiSystem_timer_create = NULL;
00051 static f_plug_api cfapiSystem_timer_destroy = NULL;
00052 static f_plug_api cfapiSystem_directory = NULL;
00053 static f_plug_api cfapiSystem_re_cmp = NULL;
00054
00055 static f_plug_api cfapiObject_get_property = NULL;
00056 static f_plug_api cfapiObject_set_property = NULL;
00057 static f_plug_api cfapiObject_apply = NULL;
00058 static f_plug_api cfapiObject_identify = NULL;
00059 static f_plug_api cfapiObject_describe = NULL;
00060 static f_plug_api cfapiObject_drain = NULL;
00061 static f_plug_api cfapiObject_fix = NULL;
00062 static f_plug_api cfapiObject_give_skill = NULL;
00063 static f_plug_api cfapiObject_transmute = NULL;
00064 static f_plug_api cfapiObject_remove = NULL;
00065 static f_plug_api cfapiObject_delete = NULL;
00066 static f_plug_api cfapiObject_clone = NULL;
00067 static f_plug_api cfapiObject_find = NULL;
00068 static f_plug_api cfapiObject_create = NULL;
00069 static f_plug_api cfapiObject_insert = NULL;
00070 static f_plug_api cfapiObject_split = NULL;
00071 static f_plug_api cfapiObject_merge = NULL;
00072 static f_plug_api cfapiObject_distance = NULL;
00073 static f_plug_api cfapiObject_update = NULL;
00074 static f_plug_api cfapiObject_clear = NULL;
00075 static f_plug_api cfapiObject_reset = NULL;
00076 static f_plug_api cfapiCheck_inventory = NULL;
00077 static f_plug_api cfapiObject_activate_rune = NULL;
00078 static f_plug_api cfapiObject_check_trigger = NULL;
00079 static f_plug_api cfapiObject_query_money = NULL;
00080 static f_plug_api cfapiObject_query_cost = NULL;
00081 static f_plug_api cfapiObject_cast = NULL;
00082 static f_plug_api cfapiObject_learn_spell = NULL;
00083 static f_plug_api cfapiObject_forget_spell = NULL;
00084 static f_plug_api cfapiObject_check_spell = NULL;
00085 static f_plug_api cfapiObject_pay_amount = NULL;
00086 static f_plug_api cfapiObject_pay_item = NULL;
00087 static f_plug_api cfapiObject_transfer = NULL;
00088 static f_plug_api cfapiObject_find_archetype_inside = NULL;
00089 static f_plug_api cfapiObject_out_of_map = NULL;
00090 static f_plug_api cfapiObject_drop = NULL;
00091 static f_plug_api cfapiObject_change_abil = NULL;
00092 static f_plug_api cfapiObject_say = NULL;
00093 static f_plug_api cfapiMap_get_property = NULL;
00094 static f_plug_api cfapiMap_set_property = NULL;
00095 static f_plug_api cfapiMap_get_map = NULL;
00096 static f_plug_api cfapiMap_message = NULL;
00097 static f_plug_api cfapiMap_get_object_at = NULL;
00098 static f_plug_api cfapiMap_present_arch_by_name = NULL;
00099 static f_plug_api cfapiMap_create_path = NULL;
00100 static f_plug_api cfapiMap_has_been_loaded = NULL;
00101 static f_plug_api cfapiMap_change_light = NULL;
00102 static f_plug_api cfapiMap_trigger_connected = NULL;
00103 static f_plug_api cfapiPlayer_find = NULL;
00104 static f_plug_api cfapiPlayer_message = NULL;
00105 static f_plug_api cfapiPlayer_send_inventory = NULL;
00106 static f_plug_api cfapiObject_teleport = NULL;
00107 static f_plug_api cfapiObject_pickup = NULL;
00108 static f_plug_api cfapiObject_get_key = NULL;
00109 static f_plug_api cfapiObject_set_key = NULL;
00110 static f_plug_api cfapiObject_move = NULL;
00111 static f_plug_api cfapiObject_apply_below = NULL;
00112 static f_plug_api cfapiArchetype_get_property = NULL;
00113 static f_plug_api cfapiParty_get_property = NULL;
00114 static f_plug_api cfapiRegion_get_property = NULL;
00115 static f_plug_api cfapiPlayer_can_pay = NULL;
00116 static f_plug_api cfapiFriendlylist_get_next = NULL;
00117 static f_plug_api cfapiSet_random_map_variable = NULL;
00118 static f_plug_api cfapiGenerate_random_map = NULL;
00119 static f_plug_api cfapiObject_change_exp = NULL;
00120 static f_plug_api cfapiSystem_get_month_name = NULL;
00121 static f_plug_api cfapiSystem_get_season_name = NULL;
00122 static f_plug_api cfapiSystem_get_weekday_name = NULL;
00123 static f_plug_api cfapiSystem_get_periodofday_name = NULL;
00124 static f_plug_api cfapiObject_user_event = NULL;
00125
00126 #define GET_HOOK(x, y, z) { \
00127 getHooks(&z, 1, y, &x); \
00128 if (z != CFAPI_FUNC) { \
00129 printf("unable to find hook %s!\n", y); \
00130 return 0; \
00131 } \
00132 }
00133
00134 int cf_init_plugin(f_plug_api getHooks) {
00135 int z;
00136
00137 GET_HOOK(cfapiSystem_strdup_local, "cfapi_system_strdup_local", z);
00138 GET_HOOK(cfapiSystem_add_string, "cfapi_system_add_string", z);
00139 GET_HOOK(cfapiSystem_register_global_event, "cfapi_system_register_global_event", z);
00140 GET_HOOK(cfapiSystem_remove_string, "cfapi_system_remove_string", z);
00141 GET_HOOK(cfapiSystem_directory, "cfapi_system_directory", z);
00142 GET_HOOK(cfapiSystem_unregister_global_event, "cfapi_system_unregister_global_event", z);
00143 GET_HOOK(cfapiSystem_find_animation, "cfapi_system_find_animation", z);
00144 GET_HOOK(cfapiSystem_find_face, "cfapi_system_find_face", z);
00145 GET_HOOK(cfapiSystem_re_cmp, "cfapi_system_re_cmp", z);
00146 GET_HOOK(cfapiObject_get_property, "cfapi_object_get_property", z);
00147 GET_HOOK(cfapiObject_set_property, "cfapi_object_set_property", z);
00148 GET_HOOK(cfapiObject_apply, "cfapi_object_apply", z);
00149 GET_HOOK(cfapiObject_identify, "cfapi_object_identify", z);
00150 GET_HOOK(cfapiObject_describe, "cfapi_object_describe", z);
00151 GET_HOOK(cfapiObject_drain, "cfapi_object_drain", z);
00152 GET_HOOK(cfapiObject_fix, "cfapi_object_fix", z);
00153 GET_HOOK(cfapiObject_give_skill, "cfapi_object_give_skill", z);
00154 GET_HOOK(cfapiObject_transmute, "cfapi_object_transmute", z);
00155 GET_HOOK(cfapiObject_remove, "cfapi_object_remove", z);
00156 GET_HOOK(cfapiObject_delete, "cfapi_object_delete", z);
00157 GET_HOOK(cfapiObject_clone, "cfapi_object_clone", z);
00158 GET_HOOK(cfapiObject_find, "cfapi_object_find", z);
00159 GET_HOOK(cfapiObject_create, "cfapi_object_create", z);
00160 GET_HOOK(cfapiObject_insert, "cfapi_object_insert", z);
00161 GET_HOOK(cfapiObject_split, "cfapi_object_split", z);
00162 GET_HOOK(cfapiObject_merge, "cfapi_object_merge", z);
00163 GET_HOOK(cfapiObject_distance, "cfapi_object_distance", z);
00164 GET_HOOK(cfapiObject_update, "cfapi_object_update", z);
00165 GET_HOOK(cfapiObject_clear, "cfapi_object_clear", z);
00166 GET_HOOK(cfapiObject_reset, "cfapi_object_reset", z);
00167 GET_HOOK(cfapiObject_activate_rune, "cfapi_object_spring_trap", z);
00168 GET_HOOK(cfapiObject_check_trigger, "cfapi_object_check_trigger", z);
00169 GET_HOOK(cfapiObject_query_money, "cfapi_object_query_money", z);
00170 GET_HOOK(cfapiObject_query_cost, "cfapi_object_query_cost", z);
00171 GET_HOOK(cfapiObject_cast, "cfapi_object_cast", z);
00172 GET_HOOK(cfapiObject_learn_spell, "cfapi_object_learn_spell", z);
00173 GET_HOOK(cfapiObject_forget_spell, "cfapi_object_forget_spell", z);
00174 GET_HOOK(cfapiObject_check_spell, "cfapi_object_check_spell", z);
00175 GET_HOOK(cfapiObject_pay_amount, "cfapi_object_pay_amount", z);
00176 GET_HOOK(cfapiObject_pay_item, "cfapi_object_pay_item", z);
00177 GET_HOOK(cfapiObject_transfer, "cfapi_object_transfer", z);
00178 GET_HOOK(cfapiObject_find_archetype_inside, "cfapi_object_find_archetype_inside", z);
00179 GET_HOOK(cfapiObject_remove, "cfapi_object_remove", z);
00180 GET_HOOK(cfapiObject_delete, "cfapi_object_delete", z);
00181 GET_HOOK(cfapiObject_out_of_map, "cfapi_map_out_of_map", z);
00182 GET_HOOK(cfapiObject_drop, "cfapi_object_drop", z);
00183 GET_HOOK(cfapiObject_change_abil, "cfapi_object_change_abil", z);
00184 GET_HOOK(cfapiObject_say, "cfapi_object_say", z);
00185 GET_HOOK(cfapiMap_create_path, "cfapi_map_create_path", z);
00186 GET_HOOK(cfapiMap_get_property, "cfapi_map_get_property", z);
00187 GET_HOOK(cfapiMap_set_property, "cfapi_map_set_property", z);
00188 GET_HOOK(cfapiMap_get_map, "cfapi_map_get_map", z);
00189 GET_HOOK(cfapiMap_message, "cfapi_map_message", z);
00190 GET_HOOK(cfapiMap_get_object_at, "cfapi_map_get_object_at", z);
00191 GET_HOOK(cfapiMap_present_arch_by_name, "cfapi_map_present_arch_by_name", z);
00192 GET_HOOK(cfapiMap_change_light, "cfapi_map_change_light", z);
00193 GET_HOOK(cfapiMap_has_been_loaded, "cfapi_map_has_been_loaded", z);
00194 GET_HOOK(cfapiMap_trigger_connected, "cfapi_map_trigger_connected", z);
00195 GET_HOOK(cfapiPlayer_find, "cfapi_player_find", z);
00196 GET_HOOK(cfapiPlayer_message, "cfapi_player_message", z);
00197 GET_HOOK(cfapiObject_teleport, "cfapi_object_teleport", z);
00198 GET_HOOK(cfapiObject_pickup, "cfapi_object_pickup", z);
00199 GET_HOOK(cfapiObject_get_key, "cfapi_object_get_key", z);
00200 GET_HOOK(cfapiObject_set_key, "cfapi_object_set_key", z);
00201 GET_HOOK(cfapiObject_move, "cfapi_object_move", z);
00202 GET_HOOK(cfapiObject_apply_below, "cfapi_object_apply_below", z);
00203 GET_HOOK(cfapiArchetype_get_property, "cfapi_archetype_get_property", z);
00204 GET_HOOK(cfapiParty_get_property, "cfapi_party_get_property", z);
00205 GET_HOOK(cfapiRegion_get_property, "cfapi_region_get_property", z);
00206 GET_HOOK(cfapiPlayer_can_pay, "cfapi_player_can_pay", z);
00207 GET_HOOK(cfapiSystem_log, "cfapi_log", z);
00208 GET_HOOK(cfapiSystem_get_time, "cfapi_system_get_time", z);
00209 GET_HOOK(cfapiSystem_timer_create, "cfapi_system_timer_create", z);
00210 GET_HOOK(cfapiSystem_timer_destroy, "cfapi_system_timer_destroy", z);
00211 GET_HOOK(cfapiFriendlylist_get_next, "cfapi_friendlylist_get_next", z);
00212 GET_HOOK(cfapiSet_random_map_variable, "cfapi_set_random_map_variable", z);
00213 GET_HOOK(cfapiGenerate_random_map, "cfapi_generate_random_map", z);
00214 GET_HOOK(cfapiObject_change_exp, "cfapi_object_change_exp", z);
00215 GET_HOOK(cfapiSystem_get_season_name, "cfapi_system_get_season_name", z);
00216 GET_HOOK(cfapiSystem_get_month_name, "cfapi_system_get_month_name", z);
00217 GET_HOOK(cfapiSystem_get_weekday_name, "cfapi_system_get_weekday_name", z);
00218 GET_HOOK(cfapiSystem_get_periodofday_name, "cfapi_system_get_periodofday_name", z);
00219 GET_HOOK(cfapiObject_user_event, "cfapi_object_user_event", z);
00220 GET_HOOK(cfapiSystem_find_string, "cfapi_system_find_string", z);
00221 return 1;
00222 }
00223
00224
00225
00226
00227
00228
00229
00230 int cf_map_get_int_property(mapstruct *map, int property) {
00231 int type, value;
00232
00233 cfapiMap_get_property(&type, map, property, &value);
00234 assert(type == CFAPI_INT);
00235 return value;
00236 }
00237
00238 int cf_object_user_event(object *op, object *activator, object *third, const char *message, int fix) {
00239 int type, value;
00240
00241 cfapiObject_user_event(&type, op, activator, third, message, fix, &value);
00242 assert(type == CFAPI_INT);
00243 return value;
00244 }
00245
00246 sstring cf_map_get_sstring_property(mapstruct *map, int propcode) {
00247 int type;
00248 sstring value;
00249
00250 cfapiMap_get_property(&type, map, propcode, &value);
00251 assert(type == CFAPI_SSTRING);
00252 return value;
00253 }
00254
00255 mapstruct *cf_map_get_map_property(mapstruct *map, int propcode) {
00256 int type;
00257 mapstruct *value;
00258
00259 cfapiMap_get_property(&type, map, propcode, &value);
00260 assert(type == CFAPI_PMAP);
00261 return value;
00262 }
00263
00264 region *cf_map_get_region_property(mapstruct *map, int propcode) {
00265 int type;
00266 region *value;
00267
00268 cfapiMap_get_property(&type, map, propcode, &value);
00269 assert(type == CFAPI_PREGION);
00270 return value;
00271 }
00272
00273
00274 void cf_map_set_int_property(mapstruct *map, int propcode, int value) {
00275 int type;
00276
00277 cfapiMap_set_property(&type, map, propcode, value);
00278 assert(type == CFAPI_INT);
00279 }
00280
00281 void cf_map_set_string_property(mapstruct *map, int propcode, const char *value) {
00282 int type;
00283
00284 cfapiMap_set_property(&type, map, propcode, value);
00285 assert(type == CFAPI_STRING);
00286 }
00287
00288
00289 sint16 cf_object_get_resistance(object *op, int rtype) {
00290 int type;
00291 sint16 resist;
00292
00293 cfapiObject_get_property(&type, op, CFAPI_OBJECT_PROP_RESIST, rtype, &resist);
00294 assert(type == CFAPI_INT16);
00295 return resist;
00296 }
00297 void cf_object_set_resistance(object *op, int rtype, sint16 value) {
00298 int type;
00299
00300 cfapiObject_set_property(&type, op, CFAPI_OBJECT_PROP_RESIST, rtype, value);
00301 assert(type == CFAPI_INT16);
00302 }
00303
00304
00305 void cf_object_set_int_property(object *op, int propcode, int value) {
00306 int type;
00307
00308 cfapiObject_set_property(&type, op, propcode, value);
00309 assert(type == CFAPI_INT);
00310 }
00311 int cf_object_get_int_property(object *op, int propcode) {
00312 int type, value;
00313
00314 cfapiObject_get_property(&type, op, propcode, &value);
00315 assert(type == CFAPI_INT);
00316 return value;
00317 }
00318 long cf_object_get_long_property(object *op, long propcode) {
00319 int type;
00320 long value;
00321
00322 cfapiObject_get_property(&type, op, propcode, &value);
00323 assert(type == CFAPI_LONG);
00324 return value;
00325 }
00326 void cf_object_set_movetype_property(object *op, int propcode, MoveType value) {
00327 int type;
00328
00329 cfapiObject_set_property(&type, op, propcode, value);
00330 assert(type == CFAPI_MOVETYPE);
00331 }
00332 MoveType cf_object_get_movetype_property(object *op, int propcode) {
00333 int type;
00334 MoveType value;
00335
00336 cfapiObject_get_property(&type, op, propcode, &value);
00337 assert(type == CFAPI_MOVETYPE);
00338 return value;
00339 }
00340 object *cf_object_get_object_property(object *op, int propcode) {
00341 int type;
00342 object *value;
00343
00344 cfapiObject_get_property(&type, op, propcode, &value);
00345 assert(type == CFAPI_POBJECT);
00346 return value;
00347 }
00348 mapstruct *cf_object_get_map_property(object *op, int propcode) {
00349 int type;
00350 mapstruct *value;
00351
00352 cfapiObject_get_property(&type, op, propcode, &value);
00353 assert(type == CFAPI_PMAP);
00354 return value;
00355 }
00356 sint64 cf_object_get_int64_property(object *op, int propcode) {
00357 int type;
00358 sint64 value;
00359
00360 cfapiObject_get_property(&type, op, propcode, &value);
00361 assert(type == CFAPI_SINT64);
00362 return value;
00363 }
00364
00365 void cf_object_set_long_property(object *op, int propcode, long value) {
00366 int type;
00367
00368 cfapiObject_set_property(&type, op, propcode, value);
00369 assert(type == CFAPI_LONG);
00370 }
00371 void cf_object_set_float_property(object *op, int propcode, float value) {
00372 int type;
00373
00374 cfapiObject_set_property(&type, op, propcode, value);
00375 assert(type == CFAPI_FLOAT);
00376 }
00377 void cf_object_set_int64_property(object *op, int propcode, sint64 value) {
00378 int type;
00379
00380 cfapiObject_set_property(&type, op, propcode, value);
00381 assert(type == CFAPI_SINT64);
00382 }
00383 float cf_object_get_float_property(object *op, int propcode) {
00384 int type;
00385 float value;
00386
00387 cfapiObject_get_property(&type, op, propcode, &value);
00388 assert(type == CFAPI_FLOAT);
00389 return value;
00390 }
00391 archetype *cf_object_get_archetype_property(object *op, int propcode) {
00392 int type;
00393 archetype *value;
00394
00395 cfapiObject_get_property(&type, op, propcode, &value);
00396 assert(type == CFAPI_PARCH);
00397 return value;
00398 }
00399 partylist *cf_object_get_partylist_property(object *op, int propcode) {
00400 int type;
00401 partylist *value;
00402
00403 cfapiObject_get_property(&type, op, propcode, &value);
00404 assert(type == CFAPI_PPARTY);
00405 return value;
00406 }
00407 double cf_object_get_double_property(object *op, int propcode) {
00408 int type;
00409 double value;
00410
00411 cfapiObject_get_property(&type, op, propcode, &value);
00412 assert(type == CFAPI_DOUBLE);
00413 return value;
00414 }
00415 sstring cf_object_get_sstring_property(object *op, int propcode) {
00416 int type;
00417 sstring value;
00418
00419 cfapiObject_get_property(&type, op, propcode, &value);
00420 assert(type == CFAPI_SSTRING);
00421 return value;
00422 }
00423 char *cf_object_get_string_property(object *op, int propcode, char *buf, int size) {
00424 int type;
00425
00426 cfapiObject_get_property(&type, op, propcode, buf, size);
00427 assert(type == CFAPI_STRING);
00428 return buf;
00429 }
00430
00431 void cf_object_set_string_property(object *op, int propcode, const char *value) {
00432 int type;
00433
00434 cfapiObject_set_property(&type, op, propcode, value);
00435 assert(type == CFAPI_STRING);
00436 }
00437 void cf_object_set_object_property(object *op, int propcode, object *value) {
00438 int type;
00439
00440 cfapiObject_set_property(&type, op, propcode, value);
00441 assert(type == CFAPI_POBJECT);
00442 }
00443
00448 void cf_object_change_exp(object *op, sint64 exp, const char *skill_name, int flag) {
00449 int type;
00450
00451 cfapiObject_change_exp(&type, op, exp, skill_name && strlen(skill_name) > 0 ? skill_name : NULL, flag);
00452 assert(type == CFAPI_NONE);
00453 }
00454 int cf_player_move(player *pl, int dir) {
00455 int type, ret;
00456
00457 cfapiObject_move(&type, 1, pl, dir, &ret);
00458 assert(type == CFAPI_INT);
00459 return ret;
00460 }
00461 int cf_object_move(object *op, int dir, object*originator) {
00462 int type, ret;
00463
00464 cfapiObject_move(&type, 0, op, dir, originator, &ret);
00465 assert(type == CFAPI_INT);
00466 return ret;
00467 }
00472 int cf_object_apply(object *op, object *tmp, int aflag) {
00473 int type, ret;
00474
00475 cfapiObject_apply(&type, op, tmp, aflag, &ret);
00476 return ret;
00477 }
00478
00483 void cf_object_apply_below(object *pl) {
00484 int type;
00485
00486 cfapiObject_apply_below(&type, pl);
00487 }
00492 void cf_object_remove(object *op) {
00493 int type;
00494
00495 cfapiObject_remove(&type, op);
00496 }
00501 void cf_object_free(object *ob) {
00502 int type;
00503
00504 cfapiObject_delete(&type, ob);
00505 }
00509 object *cf_object_present_archname_inside(object *op, char *whatstr) {
00510 int type;
00511 object *value;
00512
00513 cfapiObject_find_archetype_inside(&type, op, whatstr, &value);
00514 assert(type == CFAPI_POBJECT);
00515 return value;
00516 }
00517
00522 int cf_object_transfer(object *op, int x, int y, int randomly, object *originator) {
00523 int type, value;
00524
00525 cfapiObject_transfer(&type, op, 0, x, y, randomly, originator, &value);
00526 assert(type == CFAPI_INT);
00527 return value;
00528 }
00529
00534 int cf_object_move_to(object *op, int x, int y) {
00535 int type, value;
00536
00537 cfapiObject_transfer(&type, op, 2, x, y, &value);
00538 assert(type == CFAPI_INT);
00539 return value;
00540 }
00541
00546 object *cf_object_change_map(object *op, mapstruct *m, object *originator, int flag, int x, int y) {
00547 int type;
00548 object *value;
00549
00550 cfapiObject_transfer(&type, op, 1, m, originator, flag, x, y, &value);
00551 assert(type == CFAPI_POBJECT);
00552 return value;
00553 }
00554
00559 object *cf_map_get_object_at(mapstruct *m, int x, int y) {
00560 int type;
00561 object *value;
00562
00563 cfapiMap_get_object_at(&type, m, x, y, &value);
00564 assert(type == CFAPI_POBJECT);
00565 return value;
00566 }
00571 void cf_map_message(mapstruct *m, const char *msg, int color) {
00572 int type;
00573
00574 cfapiMap_message(&type, m, msg, color);
00575 }
00576
00587 object *cf_object_clone(object *op, int clonetype) {
00588 int type;
00589 object *value;
00590
00591 cfapiObject_clone(&type, op, clonetype, &value);
00592 assert(type == CFAPI_POBJECT);
00593 return value;
00594 }
00595
00600 int cf_object_pay_item(object *op, object *pl) {
00601 int type, value;
00602
00603 cfapiObject_pay_item(&type, op, pl, &value);
00604 assert(type == CFAPI_INT);
00605 return value;
00606 }
00607
00612 int cf_object_pay_amount(object *pl, uint64 to_pay) {
00613 int type, value;
00614
00615 cfapiObject_pay_amount(&type, pl, to_pay, &value);
00616 assert(type == CFAPI_INT);
00617 return value;
00618 }
00619
00624 int cf_object_cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg) {
00625 int type, value;
00626
00627 cfapiObject_cast(&type, op, caster, dir, spell_ob, stringarg, &value);
00628 assert(type == CFAPI_INT);
00629 return value;
00630 }
00636 int cf_object_cast_ability(object *caster, object *ctoo, int dir, object *sp, char *flags) {
00637 int type, value;
00638
00639 cfapiObject_cast(&type, caster, ctoo, dir, sp, flags, &value);
00640 assert(type == CFAPI_INT);
00641 return value;
00642 }
00643
00648 void cf_object_learn_spell(object *op, object *spell, int special_prayer) {
00649 int type;
00650
00651 cfapiObject_learn_spell(&type, op, spell, special_prayer);
00652 assert(type == CFAPI_NONE);
00653 }
00654
00660 void cf_object_forget_spell(object *op, object *sp) {
00661 int type;
00662
00663 cfapiObject_forget_spell(&type, op, sp);
00664 }
00665
00670 object *cf_object_check_for_spell(object *op, const char *name) {
00671 int type;
00672 object *value;
00673
00674 cfapiObject_check_spell(&type, op, name, &value);
00675 assert(type == CFAPI_POBJECT);
00676 return value;
00677 }
00678
00679 void cf_player_message(object *op, char *txt, int flags) {
00680 int type;
00681
00682 cfapiPlayer_message(&type, flags, 0, op, txt);
00683 assert(type == CFAPI_NONE);
00684 }
00685
00690 player *cf_player_find(const char *plname) {
00691 int type;
00692 player *value;
00693
00694 cfapiPlayer_find(&type, plname, &value);
00695 assert(type == CFAPI_PPLAYER);
00696 return value;
00697 }
00698
00699 sstring cf_player_get_title(object *op) {
00700 int type;
00701 sstring value;
00702
00703 cfapiObject_get_property(&type, op, CFAPI_PLAYER_PROP_TITLE, &value);
00704 assert(type == CFAPI_SSTRING);
00705 return value;
00706 }
00707
00708 void cf_player_set_title(object *op, const char *title) {
00709 int type;
00710
00711 cfapiObject_set_property(&type, op, CFAPI_PLAYER_PROP_TITLE, title);
00712 }
00713
00714 sstring cf_player_get_ip(object *op) {
00715 int type;
00716 sstring value;
00717
00718 cfapiObject_get_property(&type, op, CFAPI_PLAYER_PROP_IP, &value);
00719 assert(type == CFAPI_SSTRING);
00720 return value;
00721 }
00722
00723 object *cf_player_get_marked_item(object *op) {
00724 int type;
00725 object *value;
00726
00727 cfapiObject_get_property(&type, op, CFAPI_PLAYER_PROP_MARKED_ITEM, &value);
00728 assert(type == CFAPI_POBJECT);
00729 return value;
00730 }
00731
00732 void cf_player_set_marked_item(object *op, object *ob) {
00733 int type;
00734
00735 cfapiObject_set_property(&type, op, CFAPI_PLAYER_PROP_MARKED_ITEM, ob);
00736 }
00737
00738 partylist *cf_player_get_party(object *op) {
00739 return cf_object_get_partylist_property(op, CFAPI_PLAYER_PROP_PARTY);
00740 }
00741
00742 void cf_player_set_party(object *op, partylist *party) {
00743 int type;
00744
00745 cfapiObject_set_property(&type, op, CFAPI_PLAYER_PROP_PARTY, party);
00746 }
00747
00752 int cf_player_can_pay(object *pl) {
00753 int type, value;
00754
00755 cfapiPlayer_can_pay(&type, pl, &value);
00756 assert(type == CFAPI_INT);
00757 return value;
00758 }
00759
00764 mapstruct *cf_map_get_map(const char *name, int flags) {
00765 int type;
00766 mapstruct *ret;
00767
00768 cfapiMap_get_map(&type, 1, name, flags, &ret);
00769 assert(type == CFAPI_PMAP);
00770 return ret;
00771 }
00772
00777 mapstruct *cf_get_empty_map(int sizex, int sizey) {
00778 int type;
00779 mapstruct *ret;
00780
00781 cfapiMap_get_map(&type, 0, sizex, sizey, &ret);
00782 assert(type == CFAPI_PMAP);
00783 return ret;
00784 }
00785
00790 mapstruct *cf_map_has_been_loaded(const char *name) {
00791 int type;
00792 mapstruct *ret;
00793
00794 cfapiMap_has_been_loaded(&type, name, &ret);
00795 assert(type == CFAPI_PMAP);
00796 return ret;
00797 }
00798
00804 mapstruct *cf_map_get_first(void) {
00805 return cf_map_get_map_property(NULL, CFAPI_MAP_PROP_NEXT);
00806 }
00807
00812 int cf_object_query_money(const object *op) {
00813 int type, value;
00814
00815 cfapiObject_query_money(&type, op, &value);
00816 assert(type == CFAPI_INT);
00817 return value;
00818 }
00819
00824 int cf_object_query_cost(const object *tmp, object *who, int flag) {
00825 int type, value;
00826
00827 cfapiObject_query_cost(&type, tmp, who, flag, &value);
00828 assert(type == CFAPI_INT);
00829 return value;
00830 }
00831
00836 void cf_spring_trap(object *trap, object *victim) {
00837 int type;
00838
00839 if (trap)
00840 cfapiObject_activate_rune(&type, trap, victim);
00841 }
00842
00847 int cf_object_check_trigger(object *op, object *cause) {
00848 int type, value;
00849
00850 cfapiObject_check_trigger(&type, op, cause, &value);
00851 assert(type == CFAPI_INT);
00852 return value;
00853 }
00854
00859 void cf_map_trigger_connected(objectlink *ol, object *cause, int state) {
00860 int type;
00861
00862 cfapiMap_trigger_connected(&type, ol, cause, state);
00863 assert(type == CFAPI_NONE);
00864 }
00865
00866 int cf_object_out_of_map(object *op, int x, int y) {
00867 int type, value;
00868
00869 cfapiObject_out_of_map(&type, op->map, x, y, &value);
00870 assert(type == CFAPI_INT);
00871 return value;
00872 }
00873
00874 void cf_object_drop(object *op, object *author) {
00875 int type;
00876
00877 cfapiObject_drop(&type, op, author);
00878 }
00879
00880 void cf_object_say(object *op, char *msg) {
00881 int type, value;
00882
00883 cfapiObject_say(&type, op, msg, &value);
00884 assert(type == CFAPI_INT);
00885 }
00886
00887 object *cf_object_insert_object(object *op, object *container) {
00888 int type;
00889 object *value;
00890
00891 cfapiObject_insert(&type, op, 3, container, &value);
00892 assert(type == CFAPI_POBJECT);
00893 return value;
00894 }
00895
00900 char *cf_get_maps_directory(const char *name, char *buf, int size) {
00901 int type;
00902
00903 cfapiMap_create_path(&type, 0, name, buf, size);
00904 assert(type == CFAPI_STRING);
00905 return buf;
00906 }
00907
00912 object *cf_create_object(void) {
00913 int type;
00914 object *value;
00915
00916 cfapiObject_create(&type, 0, &value);
00917 assert(type == CFAPI_POBJECT);
00918 return value;
00919 }
00920
00924 object *cf_create_object_by_name(const char *name) {
00925 int type;
00926 object *value;
00927
00928 cfapiObject_create(&type, 1, name, &value);
00929 assert(type == CFAPI_POBJECT);
00930 return value;
00931 }
00932
00933 void cf_system_register_global_event(int event, const char *name, f_plug_api hook) {
00934 int type;
00935
00936 cfapiSystem_register_global_event(&type, event, name, hook);
00937 assert(type == CFAPI_NONE);
00938 }
00939
00940 void cf_system_unregister_global_event(int event, const char *name) {
00941 int type;
00942
00943 cfapiSystem_unregister_global_event(&type, event, name);
00944 assert(type == CFAPI_NONE);
00945 }
00946
00961 const char *cf_get_directory(int id) {
00962 int type;
00963 const char *ret;
00964
00965 cfapiSystem_directory(&type, id, &ret);
00966 assert(type == CFAPI_STRING);
00967 return ret;
00968 }
00969
00974 const char *cf_re_cmp(const char *str, const char *regexp) {
00975 int type;
00976 const char *result;
00977
00978 cfapiSystem_re_cmp(&type, str, regexp, &result);
00979 assert(type == CFAPI_STRING);
00980 return result;
00981 }
00982
00987 void cf_fix_object(object *op) {
00988 int type;
00989
00990 if (op)
00991 cfapiObject_fix(&type, op);
00992 }
00993
00998 sstring cf_add_string(const char *str) {
00999 int type;
01000 sstring ret;
01001
01002 if (!str)
01003 return NULL;
01004 cfapiSystem_add_string(&type, str, &ret);
01005 assert(type == CFAPI_SSTRING);
01006 return ret;
01007 }
01008
01013 void cf_free_string(sstring str) {
01014 int type;
01015
01016 if (str)
01017 cfapiSystem_remove_string(&type, str);
01018 }
01019
01020 sstring cf_find_string(const char *str) {
01021 int type;
01022 sstring ret;
01023
01024 if (!str)
01025 return NULL;
01026
01027 cfapiSystem_find_string(&type, str, &ret);
01028 assert(type == CFAPI_SSTRING);
01029 return ret;
01030 }
01031
01032 char *cf_query_name(object *ob, char *name, int size) {
01033 int type;
01034
01035 cfapiObject_get_property(&type, ob, CFAPI_OBJECT_PROP_NAME, name, size);
01036 assert(type == CFAPI_STRING);
01037 return name;
01038 }
01039
01040 sstring cf_query_name_pl(object *ob) {
01041 int type;
01042 sstring value;
01043
01044 cfapiObject_get_property(&type, ob, CFAPI_OBJECT_PROP_NAME_PLURAL, &value);
01045 assert(type == CFAPI_SSTRING);
01046 return value;
01047 }
01048
01049 char *cf_query_base_name(object *ob, int plural, char *name, int size) {
01050 int type;
01051
01052 cfapiObject_get_property(&type, ob, CFAPI_OBJECT_PROP_BASE_NAME, name, size);
01053 assert(type == CFAPI_STRING);
01054 return name;
01055 }
01056
01057 sstring cf_object_get_msg(object *ob) {
01058 int type;
01059 sstring value;
01060
01061 cfapiObject_get_property(&type, ob, CFAPI_OBJECT_PROP_MESSAGE, &value);
01062 assert(type == CFAPI_SSTRING);
01063 return value;
01064 }
01065
01066 void cf_object_set_weight(object *ob, int weight) {
01067 int type;
01068
01069 cfapiObject_set_property(&type, ob, CFAPI_OBJECT_PROP_WEIGHT, weight);
01070 assert(type == CFAPI_INT);
01071 }
01072
01073 void cf_object_set_weight_limit(object *ob, int weight_limit) {
01074 int type;
01075
01076 cfapiObject_set_property(&type, ob, CFAPI_OBJECT_PROP_WEIGHT_LIMIT, weight_limit);
01077 assert(type == CFAPI_INT);
01078 }
01079
01080 int cf_object_get_weight(object *ob) {
01081 int type, weight;
01082
01083 cfapiObject_get_property(&type, ob, CFAPI_OBJECT_PROP_WEIGHT, &weight);
01084 assert(type == CFAPI_INT);
01085 return weight;
01086 }
01087
01088 int cf_object_get_weight_limit(object *ob) {
01089 int type, limit;
01090
01091 cfapiObject_get_property(&type, ob, CFAPI_OBJECT_PROP_WEIGHT_LIMIT, &limit);
01092 assert(type == CFAPI_INT);
01093 return limit;
01094 }
01095
01099 int cf_object_set_nrof(object *ob, int nrof) {
01100 int type;
01101
01102 if (nrof < 0)
01103 return -1;
01104
01105 cfapiObject_set_property(&type, ob, CFAPI_OBJECT_PROP_NROF, nrof);
01106 return 0;
01107 }
01108
01109 int cf_object_get_nrof(object *ob) {
01110 int type, nrof;
01111
01112 cfapiObject_get_property(&type, ob, CFAPI_OBJECT_PROP_NROF, &nrof);
01113 return nrof;
01114 }
01115
01116 int cf_object_get_flag(object *ob, int flag) {
01117 int type;
01118 int rv;
01119
01120 cfapiObject_get_property(&type, ob, CFAPI_OBJECT_PROP_FLAGS, flag, &rv);
01121 if (rv != 0)
01122 return 1;
01123 else
01124 return 0;
01125 }
01126
01127 void cf_object_set_flag(object *ob, int flag, int value) {
01128 int type;
01129
01130 cfapiObject_set_property(&type, ob, CFAPI_OBJECT_PROP_FLAGS, flag, value ? 1 : 0);
01131 }
01132
01137 object *cf_object_insert_in_ob(object *op, object *where) {
01138 int type;
01139 object *value;
01140
01141 if (!cf_object_get_flag(op, FLAG_REMOVED)) {
01142 cfapiObject_remove(&type, op);
01143 }
01144
01145 cfapiObject_insert(&type, op, 3, where, &value);
01146 assert(type == CFAPI_POBJECT);
01147 return value;
01148 }
01149
01154 object *cf_map_insert_object_there(object *op, mapstruct *m, object *originator, int flag) {
01155 int type;
01156 object *value;
01157
01158 cfapiObject_insert(&type, op, 1, m, originator, flag, &value);
01159 assert(type == CFAPI_POBJECT);
01160 return value;
01161 }
01162
01168 object *cf_map_insert_object(mapstruct *where, object *op, int x, int y) {
01169 int type;
01170 object *value;
01171
01172 cfapiObject_insert(&type, op, 0, where, NULL, 0 , x, y, &value);
01173 assert(type == CFAPI_POBJECT);
01174 return value;
01175 }
01176
01177 int cf_object_teleport(object *op, mapstruct *map, int x, int y) {
01178 int type, value;
01179
01180 cfapiObject_teleport(&type, op, map, x, y, &value);
01181 assert(type == CFAPI_INT);
01182 return value;
01183 }
01184
01188 object *cf_map_present_arch_by_name(const char *str, mapstruct *map, int nx, int ny) {
01189 int type;
01190 object *value;
01191
01192 cfapiMap_present_arch_by_name(&type, str, map, nx, ny, &value);
01193 assert(type == CFAPI_POBJECT);
01194 return value;
01195 }
01196
01197 int cf_map_get_difficulty(mapstruct *map) {
01198 return cf_map_get_int_property(map, CFAPI_MAP_PROP_DIFFICULTY);
01199 }
01200
01201 int cf_map_get_reset_time(mapstruct *map) {
01202 return cf_map_get_int_property(map, CFAPI_MAP_PROP_RESET_TIME);
01203 }
01204
01205 int cf_map_get_reset_timeout(mapstruct *map) {
01206 return cf_map_get_int_property(map, CFAPI_MAP_PROP_RESET_TIMEOUT);
01207 }
01208
01209 int cf_map_get_players(mapstruct *map) {
01210 return cf_map_get_int_property(map, CFAPI_MAP_PROP_PLAYERS);
01211 }
01212
01213 int cf_map_get_darkness(mapstruct *map) {
01214 return cf_map_get_int_property(map, CFAPI_MAP_PROP_DARKNESS);
01215 }
01216
01217 int cf_map_get_width(mapstruct *map) {
01218 return cf_map_get_int_property(map, CFAPI_MAP_PROP_WIDTH);
01219 }
01220
01221 int cf_map_get_height(mapstruct *map) {
01222 return cf_map_get_int_property(map, CFAPI_MAP_PROP_HEIGHT);
01223 }
01224
01225 int cf_map_get_enter_x(mapstruct *map) {
01226 return cf_map_get_int_property(map, CFAPI_MAP_PROP_ENTER_X);
01227 }
01228
01229 int cf_map_get_enter_y(mapstruct *map) {
01230 return cf_map_get_int_property(map, CFAPI_MAP_PROP_ENTER_Y);
01231 }
01232
01237 int cf_map_change_light(mapstruct *m, int change) {
01238 int type, value;
01239
01240 cfapiMap_change_light(&type, m, change, &value);
01241 assert(type == CFAPI_INT);
01242 return value;
01243 }
01244
01245 void cf_object_update(object *op, int flags) {
01246 int type;
01247
01248 cfapiObject_update(&type, op, flags);
01249 }
01250
01251 void cf_object_pickup(object *op, object *what) {
01252 int type;
01253
01254 cfapiObject_pickup(&type, op, what);
01255 assert(type == CFAPI_NONE);
01256 }
01257
01263 char *cf_strdup_local(const char *str) {
01264 int type;
01265 char *dup;
01266
01267 if (str == NULL)
01268 return NULL;
01269 cfapiSystem_strdup_local(&type, str, &dup);
01270 assert(type == CFAPI_STRING);
01271 return dup;
01272 }
01273
01278 int cf_map_get_flags(mapstruct *oldmap, mapstruct **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny) {
01279 int type, value;
01280
01281 cfapiMap_get_property(&type, oldmap, CFAPI_MAP_PROP_FLAGS, newmap, x, y, nx, ny, &value);
01282 assert(type == CFAPI_INT);
01283 return value;
01284 }
01285
01290 int cf_random_map_set_variable(RMParms *rp, const char *buf) {
01291 int type, ret;
01292
01293 cfapiSet_random_map_variable(&type, rp, buf, &ret);
01294 assert(type == CFAPI_INT);
01295 return ret;
01296 }
01297
01302 mapstruct *cf_random_map_generate(const char *OutFileName, RMParms *RP, char **use_layout) {
01303 int type;
01304 mapstruct *map;
01305
01306 cfapiGenerate_random_map(&type, OutFileName, RP, use_layout, &map);
01307 assert(type == CFAPI_PMAP);
01308 return map;
01309 }
01310
01315 int cf_find_animation(const char *name) {
01316 int type, anim;
01317
01318 cfapiSystem_find_animation(&type, name, &anim);
01319 assert(type == CFAPI_INT);
01320 return anim;
01321 }
01322
01327 int cf_find_face(const char *name, int error) {
01328 int type, anim;
01329
01330 cfapiSystem_find_face(&type, name, error, &anim);
01331 assert(type == CFAPI_INT);
01332 return anim;
01333 }
01334
01339 void cf_log(LogLevel logLevel, const char *format, ...) {
01340 int type;
01341
01342 char buf[20480];
01343
01344 va_list ap;
01345
01346 va_start(ap, format);
01347 buf[0] = '\0';
01348 vsprintf(buf, format, ap);
01349 va_end(ap);
01350
01351 cfapiSystem_log(&type, logLevel, buf);
01352 assert(type == CFAPI_NONE);
01353 }
01354
01359 void cf_log_plain(LogLevel logLevel, const char *message) {
01360 int type;
01361
01362 cfapiSystem_log(&type, logLevel, message);
01363 assert(type == CFAPI_NONE);
01364 }
01365
01366 void cf_get_time(timeofday_t *tod) {
01367 int type;
01368
01369 cfapiSystem_get_time(&type, tod);
01370 assert(type == CFAPI_NONE);
01371 }
01372
01373 const char *cf_get_season_name(int index) {
01374 int type;
01375 char *result;
01376
01377 cfapiSystem_get_season_name(&type, index, &result);
01378 assert(type == CFAPI_STRING);
01379 return result;
01380 }
01381
01382 const char *cf_get_month_name(int index) {
01383 int type;
01384 char *result;
01385
01386 cfapiSystem_get_month_name(&type, index, &result);
01387 assert(type == CFAPI_STRING);
01388 return result;
01389 }
01390
01391 const char *cf_get_weekday_name(int index) {
01392 int type;
01393 char *result;
01394
01395 cfapiSystem_get_weekday_name(&type, index, &result);
01396 assert(type == CFAPI_STRING);
01397 return result;
01398 }
01399
01400 const char *cf_get_periodofday_name(int index) {
01401 int type;
01402 char *result;
01403
01404 cfapiSystem_get_periodofday_name(&type, index, &result);
01405 assert(type == CFAPI_STRING);
01406 return result;
01407 }
01408
01421 int cf_timer_create(object *ob, long delay, int mode) {
01422 int type, timer;
01423
01424 cfapiSystem_timer_create(&type, ob, delay, mode, &timer);
01425 assert(type == CFAPI_INT);
01426 return timer;
01427 }
01428
01437 int cf_timer_destroy(int id) {
01438 int type, code;
01439
01440 cfapiSystem_timer_destroy(&type, id, &code);
01441 assert(type == CFAPI_INT);
01442 return code;
01443 }
01444
01454 const char *cf_object_get_key(object *op, const char *keyname) {
01455 int type;
01456 const char *value;
01457
01458 cfapiObject_get_key(&type, op, keyname, &value);
01459 assert(type == CFAPI_SSTRING);
01460 return value;
01461 }
01462
01476 int cf_object_set_key(object *op, const char *keyname, const char *value, int add_key) {
01477 int type, ret;
01478
01479 cfapiObject_set_key(&type, op, keyname, value, add_key, &ret);
01480 assert(type == CFAPI_INT);
01481 return ret;
01482 }
01483
01488 int cf_object_change_abil(object *op, object *tmp) {
01489 int type, ret;
01490
01491 cfapiObject_change_abil(&type, op, tmp, &ret);
01492 assert(type == CFAPI_INT);
01493 return ret;
01494 }
01495
01496
01497
01503 archetype *cf_archetype_get_first(void) {
01504 int type;
01505 archetype *value;
01506
01507 cfapiArchetype_get_property(&type, NULL, CFAPI_ARCH_PROP_NEXT, &value);
01508 assert(type == CFAPI_PARCH);
01509 return value;
01510 }
01511
01519 sstring cf_archetype_get_name(archetype *arch) {
01520 int type;
01521 sstring name;
01522
01523 cfapiArchetype_get_property(&type, arch, CFAPI_ARCH_PROP_NAME, &name);
01524 assert(type == CFAPI_SSTRING);
01525 return name;
01526 }
01527
01536 archetype *cf_archetype_get_next(archetype *arch) {
01537 int type;
01538 archetype *value;
01539
01540 cfapiArchetype_get_property(&type, arch, CFAPI_ARCH_PROP_NEXT, &value);
01541 assert(type == CFAPI_PARCH);
01542 return value;
01543 }
01544
01552 archetype *cf_archetype_get_more(archetype *arch) {
01553 int type;
01554 archetype *value;
01555
01556 cfapiArchetype_get_property(&type, arch, CFAPI_ARCH_PROP_MORE, &value);
01557 assert(type == CFAPI_PARCH);
01558 return value;
01559 }
01560
01568 archetype *cf_archetype_get_head(archetype *arch) {
01569 int type;
01570 archetype *value;
01571
01572 cfapiArchetype_get_property(&type, arch, CFAPI_ARCH_PROP_HEAD, &value);
01573 assert(type == CFAPI_PARCH);
01574 return value;
01575 }
01576
01584 object *cf_archetype_get_clone(archetype *arch) {
01585 int type;
01586 object *value;
01587
01588 cfapiArchetype_get_property(&type, arch, CFAPI_ARCH_PROP_CLONE, &value);
01589 assert(type == CFAPI_POBJECT);
01590 return value;
01591 }
01592
01593
01594
01600 partylist *cf_party_get_first(void) {
01601 int type;
01602 partylist *value;
01603
01604 cfapiParty_get_property(&type, NULL, CFAPI_PARTY_PROP_NEXT, &value);
01605 assert(type == CFAPI_PPARTY);
01606 return value;
01607 }
01608
01615 const char *cf_party_get_name(partylist *party) {
01616 int type;
01617 sstring value;
01618
01619 cfapiParty_get_property(&type, party, CFAPI_PARTY_PROP_NAME, &value);
01620 assert(type == CFAPI_SSTRING);
01621 return value;
01622 }
01623
01631 partylist *cf_party_get_next(partylist *party) {
01632 int type;
01633 partylist *value;
01634
01635 cfapiParty_get_property(&type, party, CFAPI_PARTY_PROP_NEXT, &value);
01636 assert(type == CFAPI_PPARTY);
01637 return value;
01638 }
01639
01647 const char *cf_party_get_password(partylist *party) {
01648 int type;
01649 sstring value;
01650
01651 cfapiParty_get_property(&type, party, CFAPI_PARTY_PROP_PASSWORD, &value);
01652 assert(type == CFAPI_SSTRING);
01653 return value;
01654 }
01655
01663 player *cf_party_get_first_player(partylist *party) {
01664 int type;
01665 player *value;
01666
01667 cfapiParty_get_property(&type, party, CFAPI_PARTY_PROP_PLAYER, NULL, &value);
01668 assert(type == CFAPI_PPLAYER);
01669 return value;
01670 }
01671
01681 player *cf_party_get_next_player(partylist *party, player *op) {
01682 int type;
01683 player *value;
01684
01685 cfapiParty_get_property(&type, party, CFAPI_PARTY_PROP_PLAYER, op, &value);
01686 assert(type == CFAPI_PPLAYER);
01687 return value;
01688 }
01689
01695 region *cf_region_get_first(void) {
01696 int type;
01697 region *value;
01698
01699 cfapiRegion_get_property(&type, NULL, CFAPI_REGION_PROP_NEXT, &value);
01700 assert(type == CFAPI_PREGION);
01701 return value;
01702 }
01703
01711 const char *cf_region_get_name(region *reg) {
01712 int type;
01713 sstring value;
01714
01715 cfapiRegion_get_property(&type, reg, CFAPI_REGION_PROP_NAME, &value);
01716 assert(type == CFAPI_SSTRING);
01717 return value;
01718 }
01719
01727 region *cf_region_get_next(region *reg) {
01728 int type;
01729 region *value;
01730
01731 cfapiRegion_get_property(&type, reg, CFAPI_REGION_PROP_NEXT, &value);
01732 assert(type == CFAPI_PREGION);
01733 return value;
01734 }
01735
01743 region *cf_region_get_parent(region *reg) {
01744 int type;
01745 region *value;
01746
01747 cfapiRegion_get_property(&type, reg, CFAPI_REGION_PROP_PARENT, &value);
01748 assert(type == CFAPI_PREGION);
01749 return value;
01750 }
01751
01759 const char *cf_region_get_longname(region *reg) {
01760 int type;
01761 sstring value;
01762
01763 cfapiRegion_get_property(&type, reg, CFAPI_REGION_PROP_LONGNAME, &value);
01764 assert(type == CFAPI_SSTRING);
01765 return value;
01766 }
01767
01775 const char *cf_region_get_message(region *reg) {
01776 int type;
01777 sstring value;
01778
01779 cfapiRegion_get_property(&type, reg, CFAPI_REGION_PROP_MESSAGE, &value);
01780 assert(type == CFAPI_SSTRING);
01781 return value;
01782 }
01783
01784
01785
01791 object *cf_friendlylist_get_first(void) {
01792 int type;
01793 object *value;
01794
01795 cfapiFriendlylist_get_next(&type, NULL, &value);
01796 assert(type == CFAPI_POBJECT);
01797 return value;
01798 }
01799
01807 object *cf_friendlylist_get_next(object *ob) {
01808 int type;
01809 object *value;
01810
01811 cfapiFriendlylist_get_next(&type, ob, &value);
01812 assert(type == CFAPI_POBJECT);
01813 return value;
01814 }
01815
01816 #ifdef WIN32
01817 int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info) {
01818
01819 if (time_Info != NULL) {
01820 time_Info->tv_sec = time(NULL);
01821 time_Info->tv_usec = timeGetTime()*1000;
01822 }
01823
01824 if (timezone_Info != NULL) {
01825 _tzset();
01826 timezone_Info->tz_minuteswest = _timezone;
01827 timezone_Info->tz_dsttime = _daylight;
01828 }
01829
01830 return 0;
01831 }
01832 #endif