/*
* This file is part of Crossfire TRT, the Roguelike Realtime MORPG.
*
* Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team
* Copyright (©) 2001-2005,2007 Chachkoff Yann (Feel free to deliver your complaints)
* Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
*
* Crossfire TRT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* The authors can be reached via e-mail to
*/
/*****************************************************************************/
/* The CPICP are the various functions of the server that can be used by all */
/* plugins. It is recommended that plugins do not call the server-provided */
/* functions directly, but instead use the wrappers provided here by the */
/* CPICP interface. By doing so, various validity checks can be performed */
/* by CPICP, protecting the server from potential nasty effects of passing */
/* it wrong parameter values. */
/*****************************************************************************/
#include
static f_plug_api cfapiSystem_register_global_event = NULL;
static f_plug_api cfapiSystem_unregister_global_event = NULL;
static f_plug_api cfapiSystem_find_animation = NULL;
static f_plug_api cfapiMap_create_path = NULL;
static f_plug_api cfapiObject_get_property = NULL;
static f_plug_api cfapiObject_set_property = NULL;
static f_plug_api cfapiObject_apply = NULL;
static f_plug_api cfapiObject_identify = NULL;
static f_plug_api cfapiObject_describe = NULL;
static f_plug_api cfapiObject_drain = NULL;
static f_plug_api cfapiObject_fix = NULL;
static f_plug_api cfapiObject_give_skill = NULL;
static f_plug_api cfapiObject_transmute = NULL;
static f_plug_api cfapiObject_remove = NULL;
static f_plug_api cfapiObject_delete = NULL;
static f_plug_api cfapiObject_clone = NULL;
static f_plug_api cfapiObject_find = NULL;
static f_plug_api cfapiObject_create = NULL;
static f_plug_api cfapiObject_insert = NULL;
static f_plug_api cfapiObject_split = NULL;
static f_plug_api cfapiObject_merge = NULL;
static f_plug_api cfapiObject_distance = NULL;
static f_plug_api cfapiObject_update = NULL;
static f_plug_api cfapiObject_clear = NULL;
static f_plug_api cfapiObject_reset = NULL;
/* static f_plug_api cfapiCheck_inventory = NULL; */
static f_plug_api cfapiObject_activate_rune = NULL;
static f_plug_api cfapiObject_check_trigger = NULL;
static f_plug_api cfapiObject_query_money = NULL;
static f_plug_api cfapiObject_query_cost = NULL;
static f_plug_api cfapiObject_cast = NULL;
static f_plug_api cfapiObject_learn_spell = NULL;
static f_plug_api cfapiObject_forget_spell = NULL;
static f_plug_api cfapiObject_check_spell = NULL;
static f_plug_api cfapiObject_pay_amount = NULL;
static f_plug_api cfapiObject_pay_item = NULL;
static f_plug_api cfapiObject_transfer = NULL;
static f_plug_api cfapiObject_find_archetype_inside = NULL;
static f_plug_api cfapiObject_out_of_map = NULL;
static f_plug_api cfapiObject_drop = NULL;
static f_plug_api cfapiObject_take = NULL;
static f_plug_api cfapiObject_say = NULL;
static f_plug_api cfapiObject_speak = NULL;
static f_plug_api cfapiMap_get_property = NULL;
static f_plug_api cfapiMap_set_property = NULL;
static f_plug_api cfapiMap_get_map = NULL;
static f_plug_api cfapiMap_message = NULL;
static f_plug_api cfapiMap_get_object_at = NULL;
static f_plug_api cfapiMap_present_arch_by_name = NULL;
static f_plug_api cfapiMap_get_flags = NULL;
static f_plug_api cfapiPlayer_find = NULL;
static f_plug_api cfapiPlayer_message = NULL;
static f_plug_api cfapiPlayer_send_inventory = NULL;
static f_plug_api cfapiObject_teleport = NULL;
static f_plug_api cfapiObject_pickup = NULL;
static f_plug_api cfapiObject_get_key = NULL;
static f_plug_api cfapiObject_set_key = NULL;
static f_plug_api cfapiObject_move = NULL;
static f_plug_api cfapiObject_apply_below = NULL;
static f_plug_api cfapiArchetype_get_first = NULL;
static f_plug_api cfapiArchetype_get_property = NULL;
static f_plug_api cfapiParty_get_property = NULL;
static f_plug_api cfapiRegion_get_property = NULL;
#define GET_HOOK( x, y, z ) \
{ \
x = ( f_plug_api )getHooks( &z, 1, y ); \
if ( z != CFAPI_FUNC ) {\
printf( "unable to find hook %s!\n", y ); return 0; \
} }
int cf_init_plugin( f_plug_api getHooks )
{
int z;
GET_HOOK( cfapiSystem_register_global_event, "cfapi_system_register_global_event", z );
GET_HOOK( cfapiSystem_unregister_global_event, "cfapi_system_unregister_global_event", z );
GET_HOOK( cfapiSystem_find_animation, "cfapi_system_find_animation", z );
GET_HOOK( cfapiObject_get_property, "cfapi_object_get_property", z );
GET_HOOK( cfapiObject_set_property, "cfapi_object_set_property", z );
GET_HOOK( cfapiObject_apply, "cfapi_object_apply", z );
GET_HOOK( cfapiObject_identify, "cfapi_object_identify", z );
GET_HOOK( cfapiObject_describe, "cfapi_object_describe", z );
GET_HOOK( cfapiObject_drain, "cfapi_object_drain", z );
GET_HOOK( cfapiObject_fix, "cfapi_object_fix", z );
GET_HOOK( cfapiObject_give_skill, "cfapi_object_give_skill", z );
GET_HOOK( cfapiObject_transmute, "cfapi_object_transmute", z );
GET_HOOK( cfapiObject_remove, "cfapi_object_remove", z );
GET_HOOK( cfapiObject_delete, "cfapi_object_delete", z );
GET_HOOK( cfapiObject_clone, "cfapi_object_clone", z );
GET_HOOK( cfapiObject_find, "cfapi_object_find", z );
GET_HOOK( cfapiObject_create, "cfapi_object_create", z );
GET_HOOK( cfapiObject_insert, "cfapi_object_insert", z );
GET_HOOK( cfapiObject_split, "cfapi_object_split", z );
GET_HOOK( cfapiObject_merge, "cfapi_object_merge", z );
GET_HOOK( cfapiObject_distance, "cfapi_object_distance", z );
GET_HOOK( cfapiObject_update, "cfapi_object_update", z );
GET_HOOK( cfapiObject_clear, "cfapi_object_clear", z );
GET_HOOK( cfapiObject_reset, "cfapi_object_reset", z );
GET_HOOK( cfapiObject_activate_rune, "cfapi_object_spring_trap", z );
GET_HOOK( cfapiObject_check_trigger, "cfapi_object_check_trigger", z );
GET_HOOK( cfapiObject_query_money,"cfapi_object_query_money", z );
GET_HOOK( cfapiObject_query_cost,"cfapi_object_query_cost", z );
GET_HOOK( cfapiObject_cast,"cfapi_object_cast", z );
GET_HOOK( cfapiObject_learn_spell,"cfapi_object_learn_spell", z );
GET_HOOK( cfapiObject_forget_spell,"cfapi_object_forget_spell", z );
GET_HOOK( cfapiObject_check_spell,"cfapi_object_check_spell", z );
GET_HOOK( cfapiObject_pay_amount,"cfapi_object_pay_amount", z );
GET_HOOK( cfapiObject_pay_item,"cfapi_object_pay_item", z );
GET_HOOK( cfapiObject_transfer, "cfapi_object_transfer", z );
GET_HOOK( cfapiObject_find_archetype_inside, "cfapi_object_find_archetype_inside", z );
GET_HOOK( cfapiObject_remove, "cfapi_object_remove", z );
GET_HOOK( cfapiObject_delete, "cfapi_object_delete", z );
GET_HOOK( cfapiObject_out_of_map, "cfapi_map_out_of_map", z );
GET_HOOK( cfapiObject_drop, "cfapi_object_drop", z );
GET_HOOK( cfapiObject_take, "cfapi_object_take", z );
GET_HOOK( cfapiObject_say, "cfapi_object_say", z );
GET_HOOK( cfapiObject_speak, "cfapi_object_speak", z );
/*GET_HOOK( cfapiCheck_inventory, "cfapi_check_inventory", z );*/
GET_HOOK( cfapiMap_create_path, "cfapi_map_create_path", z );
GET_HOOK( cfapiMap_get_property,"cfapi_map_get_property", z );
GET_HOOK( cfapiMap_set_property,"cfapi_map_set_property", z );
GET_HOOK( cfapiMap_get_map, "cfapi_map_get_map", z );
GET_HOOK( cfapiMap_message, "cfapi_map_message", z );
GET_HOOK( cfapiMap_get_object_at, "cfapi_map_get_object_at", z );
GET_HOOK( cfapiMap_present_arch_by_name, "cfapi_map_present_arch_by_name", z );
GET_HOOK( cfapiMap_get_flags, "cfapi_map_get_flags", z );
GET_HOOK( cfapiPlayer_find, "cfapi_player_find", z );
GET_HOOK( cfapiPlayer_message, "cfapi_player_message", z );
GET_HOOK( cfapiPlayer_send_inventory, "cfapi_player_send_inventory", z );
GET_HOOK( cfapiObject_teleport, "cfapi_object_teleport", z );
GET_HOOK( cfapiObject_pickup, "cfapi_object_pickup", z );
GET_HOOK( cfapiObject_get_key, "cfapi_object_get_key", z );
GET_HOOK( cfapiObject_set_key, "cfapi_object_set_key", z );
GET_HOOK( cfapiObject_move, "cfapi_object_move", z );
GET_HOOK( cfapiObject_apply_below, "cfapi_object_apply_below", z );
GET_HOOK( cfapiArchetype_get_first, "cfapi_archetype_get_first", z );
GET_HOOK( cfapiArchetype_get_property, "cfapi_archetype_get_property", z );
GET_HOOK( cfapiParty_get_property, "cfapi_party_get_property", z );
GET_HOOK( cfapiRegion_get_property, "cfapi_region_get_property", z );
return 1;
}
/* Should get replaced by tons of more explicit wrappers */
void* cf_map_get_property(maptile* map, int propcode)
{
int val;
return cfapiMap_get_property(&val, propcode, map);
}
/* Should get replaced by tons of more explicit wrappers */
void* cf_map_set_int_property(maptile* map, int propcode, int value)
{
int val;
return cfapiMap_set_property(&val, map, propcode,value);
}
/* Should get replaced by tons of more explicit wrappers */
void* cf_object_get_property(object* op, int propcode)
{
int val;
return cfapiObject_get_property(&val, op, propcode);
}
sint16 cf_object_get_resistance(object* op, int rtype)
{
int val;
return *(int*)cfapiObject_get_property(&val, op, CFAPI_OBJECT_PROP_RESIST, rtype);
}
/* Should get replaced by tons of more explicit wrappers */
void* cf_object_set_int_property(object* op, int propcode, int value)
{
int val;
return cfapiObject_set_property(&val, op, propcode,value);
}
/* Should get replaced by tons of more explicit wrappers */
void* cf_object_set_long_property(object* op, int propcode, long value)
{
int val;
return cfapiObject_set_property(&val, op, propcode,value);
}
/* Should get replaced by tons of more explicit wrappers */
void* cf_object_set_string_property(object* op, int propcode, char* value)
{
int val;
return cfapiObject_set_property(&val, op, propcode,value);
}
void cf_player_move(player* pl, int dir)
{
int val;
cfapiObject_move(&val,1,pl,dir);
}
void cf_object_move(object* op, int dir, object*originator)
{
int val;
cfapiObject_move(&val,0,op,dir,originator);
}
object* cf_player_send_inventory(object* op)
{
int val;
return (object*) cfapiPlayer_send_inventory(&val, op);
}
void cf_object_apply(object* op, object* author, int flags)
{
int val;
cfapiObject_apply(&val,op,author,flags);
}
void cf_object_apply_below(object* op)
{
int val;
cfapiObject_apply_below(&val,op);
}
void cf_object_remove(object* op)
{
int val;
cfapiObject_remove(&val, op);
}
void cf_object_free(object* op)
{
int val;
cfapiObject_delete(&val, op);
}
object* cf_object_present_archname_inside(object* op, char* whatstr)
{
int val;
return (object*) cfapiObject_find_archetype_inside(&val, op, 0, whatstr);
}
int cf_object_transfer(object* op,int x,int y,int r,object* orig)
{
int val;
/* return *(int*)cfapiObject_transfer(&val,op,1,x,y,op->map);*/
return *(int*)cfapiObject_transfer(&val,op,0,x,y,r,orig);
}
int cf_object_change_map(object* op, int x, int y, maptile* map)
{
int val;
return *(int*)cfapiObject_transfer(&val,op,1,x,y,map);
/*cfapiObject_transfer(&val,op,1,x,y,map);
return 0;*/
}
object* cf_map_get_object_at(maptile* m, int x, int y)
{
int val;
return (object*) cfapiMap_get_object_at(&val, m, x, y);
}
void cf_map_message(maptile* m, char* msg, int color)
{
int val;
cfapiMap_message(&val, m, msg, color);
}
object* cf_object_clone(object* op, int clonetype)
{
int val;
return (object*)cfapiObject_clone(&val, op, clonetype);
}
int cf_object_pay_item(object* op, object* buyer)
{
int val;
return *(int*)cfapiObject_pay_item(&val, op, buyer);
}
int cf_object_pay_amount(object* op, uint64 amount)
{
int val;
return *(int*)cfapiObject_pay_amount(&val, op, amount);
}
int cf_object_cast_spell(object* caster, object* ctoo, int dir, object* sp, char* flags)
{
int val;
return *(int*)cfapiObject_cast(&val, caster, ctoo, dir, sp, flags);
}
/* Should there be a difference nowadays between that and cast_spell ? */
int cf_object_cast_ability(object* caster, object* ctoo, int dir, object* sp, char* flags)
{
int val;
return *(int*)cfapiObject_cast(&val, caster, ctoo, dir, sp, flags);
}
void cf_object_learn_spell(object* op, object* sp)
{
int val;
cfapiObject_learn_spell(&val, op, sp, 0);
}
void cf_object_forget_spell(object* op, object* sp)
{
int val;
cfapiObject_forget_spell(&val, op, sp);
}
object* cf_object_check_for_spell(object* op, char* spellname)
{
int val;
return (object*) cfapiObject_check_spell(&val, op, spellname);
}
void cf_player_message(object* op, char* txt, int flags)
{
int val;
cfapiPlayer_message(&val, flags, 0, op, txt);
}
player* cf_player_find(char* txt)
{
int val;
return (player*) cfapiPlayer_find(&val, txt);
}
char* cf_player_get_ip(object* op)
{
int val;
return (char*) cfapiObject_get_property(&val, op, CFAPI_PLAYER_PROP_IP);
}
object* cf_player_get_marked_item(object* op)
{
int val;
return (object*) cfapiObject_get_property(&val, op, CFAPI_PLAYER_PROP_MARKED_ITEM);
}
void cf_player_set_marked_item(object* op, object* ob)
{
int val;
cfapiObject_set_property(&val, op, CFAPI_PLAYER_PROP_MARKED_ITEM, ob);
}
partylist* cf_player_get_party(object* op)
{
int val;
return (partylist*) cfapiObject_get_property(&val, op, CFAPI_PLAYER_PROP_PARTY);
}
void cf_player_set_party(object* op, partylist* party)
{
int val;
cfapiObject_set_property(&val, op, CFAPI_PLAYER_PROP_PARTY, party);
}
maptile* cf_map_get_map( char* name )
{
int val;
return (maptile*) cfapiMap_get_map( &val, 1, name, 0);
}
maptile* cf_map_get_first(void)
{
int val;
return (maptile*) cfapiMap_get_map( &val, 3);
}
int cf_object_query_money( object* op)
{
int val;
return *(int*)cfapiObject_query_money( &val, op);
}
int cf_object_query_cost( object* op, object* who, int flags)
{
int val;
return *(int*)cfapiObject_query_cost(&val,op,who,flags);
}
void cf_object_activate_rune( object* op , object* victim)
{
int val;
if ( op )
cfapiObject_activate_rune( &val, op, victim );
}
int cf_object_check_trigger( object* op, object* cause )
{
int val;
return *(int*)cfapiObject_check_trigger( &val, op, cause );
}
int cf_object_out_of_map( object* op, int x, int y)
{
abort ();
}
void cf_object_drop( object* op, object* author)
{
int val;
cfapiObject_drop( &val, op, author );
}
void cf_object_take( object* op, object* author)
{
int val;
cfapiObject_take( &val, op, author );
}
void cf_object_say( object* op, char* msg)
{
int val;
cfapiObject_say( &val, op, msg );
}
void cf_object_speak( object* op, char* msg)
{
int val;
cfapiObject_speak( &val, op, msg );
}
object* cf_object_insert_object(object* op, object* container)
{
int val;
return (object*) cfapiObject_insert(&val, op, 3, container);
}
char* cf_get_maps_directory(char* str)
{
int val;
/*printf("Calling with %s, type 0\n",str);
printf("Value of the pointer: %p\n", cfapiMap_create_path);*/
return (char*) cfapiMap_create_path(&val, 0, str);
}
object* cf_create_object()
{
int val;
return (object*) cfapiObject_create(&val, 0);
}
object* cf_create_object_by_name( const char* name )
{
int val;
return (object*) cfapiObject_create(&val, 1, name);
}
void cf_free_object( object* ob )
{
int val;
if ( ob )
cfapiObject_delete( &val, ob );
}
void cf_system_register_global_event( int event, const char* name, f_plug_api hook )
{
int val;
cfapiSystem_register_global_event( &val, event, name, hook );
}
void cf_fix_object( object* pl )
{
int val;
if ( pl )
cfapiObject_fix( &val, pl );
}
char* cf_query_name( object* ob )
{
int val;
return (char*) cfapiObject_get_property( &val, ob, CFAPI_OBJECT_PROP_NAME );
}
char* cf_query_name_pl( object* ob )
{
int val;
return (char*) cfapiObject_get_property( &val, ob, CFAPI_OBJECT_PROP_NAME_PLURAL );
}
char* cf_query_base_name( object* ob, int plural )
{
int val;
return (char*) cfapiObject_get_property( &val, ob, CFAPI_OBJECT_PROP_BASE_NAME, plural );
}
object* cf_insert_ob_in_ob( object* ob, object* where )
{
int val;
return (object*) cfapiObject_insert( &val, ob, 3, where );
}
const char* cf_object_get_msg( object* ob )
{
int val;
return (const char*) cfapiObject_get_property( &val, ob, CFAPI_OBJECT_PROP_MESSAGE );
}
void cf_object_set_weight( object* ob, int weight )
{
int val;
cfapiObject_set_property( &val, ob, CFAPI_OBJECT_PROP_WEIGHT, weight );
}
void cf_object_set_weight_limit( object* ob, int weight_limit )
{
int val;
cfapiObject_set_property( &val, ob, CFAPI_OBJECT_PROP_WEIGHT_LIMIT, weight_limit );
}
int cf_object_get_weight( object* ob )
{
int val;
return *( int* )cfapiObject_get_property( &val, ob, CFAPI_OBJECT_PROP_WEIGHT );
}
int cf_object_get_weight_limit( object* ob )
{
int val;
int *dummy;
dummy = (int*) cfapiObject_get_property( &val, ob, CFAPI_OBJECT_PROP_WEIGHT_LIMIT );
return *dummy;
}
/**
* @return -1=nrof is invalid, 0=nrof is ok#
*/
int cf_object_set_nrof( object* ob, int nrof )
{
int val;
if (nrof < 0)
return -1;
cfapiObject_set_property( &val, ob, CFAPI_OBJECT_PROP_NROF, nrof );
return 0;
}
int cf_object_get_nrof( object* ob )
{
int val;
return *( int* )cfapiObject_get_property( &val, ob, CFAPI_OBJECT_PROP_NROF );
}
int cf_object_get_flag( object* ob, int flag )
{
int type;
int rv;
rv = *(int*)cfapiObject_get_property( &type, ob, CFAPI_OBJECT_PROP_FLAGS, flag );
if (rv != 0)
return 1;
else
return 0;
}
void cf_object_set_flag( object* ob, int flag, int value )
{
int type;
cfapiObject_set_property( &type, ob, CFAPI_OBJECT_PROP_FLAGS, flag, value ? 1 : 0 );
}
object* cf_object_insert_in_ob( object* ob, object* where )
{
int type;
if (!cf_object_get_flag(ob,FLAG_REMOVED))
{
cfapiObject_remove( &type, ob );
}
return (object*) cfapiObject_insert( &type, ob, 3, where );
}
object* cf_map_insert_object_there(maptile* where, object* op, object* originator, int flags)
{
int val;
return (object*)cfapiObject_insert(&val, op, 1, where, originator, flags);
}
object* cf_map_insert_object(maptile* where , object* op, int x, int y)
{
int type;
return (object*) cfapiObject_insert( &type, op, 0, where, NULL, 0 , x, y);
}
int cf_object_teleport( object* op, maptile* map, int x, int y )
{
int val;
return *( int* )cfapiObject_teleport( &val, op, map, x, y );
}
object* cf_map_present_arch_by_name(const char* str, maptile* map, int nx, int ny)
{
int val;
return (object*)cfapiMap_present_arch_by_name(&val, str,map,nx,ny);
}
static int cf_get_map_int_property(maptile* map, int property)
{
int type;
void* rv;
rv = cfapiMap_get_property(&type, property, map);
if ( !rv || type != CFAPI_INT )
return PLUGIN_ERROR_INT;
return *(int*)rv;
}
int cf_map_get_difficulty(maptile* map)
{
return cf_get_map_int_property(map,CFAPI_MAP_PROP_DIFFICULTY);
}
int cf_map_get_reset_time(maptile* map)
{
return cf_get_map_int_property(map,CFAPI_MAP_PROP_RESET_TIME);
}
int cf_map_get_reset_timeout(maptile* map)
{
return cf_get_map_int_property(map,CFAPI_MAP_PROP_RESET_TIMEOUT);
}
int cf_map_get_players(maptile* map)
{
return cf_get_map_int_property(map,CFAPI_MAP_PROP_PLAYERS);
}
int cf_map_get_darkness(maptile* map)
{
return cf_get_map_int_property(map,CFAPI_MAP_PROP_DARKNESS);
}
int cf_map_get_width(maptile* map)
{
return cf_get_map_int_property(map,CFAPI_MAP_PROP_WIDTH);
}
int cf_map_get_height(maptile* map)
{
return cf_get_map_int_property(map,CFAPI_MAP_PROP_HEIGHT);
}
int cf_map_get_enter_x(maptile* map)
{
return cf_get_map_int_property(map,CFAPI_MAP_PROP_ENTER_X);
}
int cf_map_get_enter_y(maptile* map)
{
return cf_get_map_int_property(map,CFAPI_MAP_PROP_ENTER_Y);
}
int cf_map_get_temperature(maptile* map)
{
return cf_get_map_int_property(map,CFAPI_MAP_PROP_TEMPERATURE);
}
int cf_map_get_pressure(maptile* map)
{
return cf_get_map_int_property(map,CFAPI_MAP_PROP_PRESSURE);
}
int cf_map_get_humidity(maptile* map)
{
return cf_get_map_int_property(map,CFAPI_MAP_PROP_HUMIDITY);
}
int cf_map_get_windspeed(maptile* map)
{
return cf_get_map_int_property(map,CFAPI_MAP_PROP_WINDSPEED);
}
int cf_map_get_winddir(maptile* map)
{
return cf_get_map_int_property(map,CFAPI_MAP_PROP_WINDDIR);
}
int cf_map_get_sky(maptile* map)
{
return cf_get_map_int_property(map,CFAPI_MAP_PROP_SKY);
}
int cf_map_get_wpartx(maptile* map)
{
return cf_get_map_int_property(map,CFAPI_MAP_PROP_WPARTX);
}
int cf_map_get_wparty(maptile* map)
{
return cf_get_map_int_property(map,CFAPI_MAP_PROP_WPARTY);
}
void cf_object_update( object* op, int flags)
{
int val;
cfapiObject_update(&val, op, flags);
}
void cf_object_pickup( object* op, object* what)
{
int val;
cfapiObject_pickup(&val, op, what);
}
char* cf_strdup(char* txt)
{
return (char*)strdup(txt);
}
int cf_map_get_flags( maptile* map, maptile** nmap, sint16 x, sint16 y, sint16* nx, sint16* ny )
{
int val;
return *( int* )cfapiMap_get_flags(&val, map, nmap, x, y, nx, ny);
}
int cf_find_animation(char* txt)
{
int val;
return *(int*)cfapiSystem_find_animation(&val, txt);
}
char* cf_object_get_key(object* op, char* keyname)
{
int val;
return (char*)cfapiObject_get_key(&val, op, keyname);
}
void cf_object_set_key(object* op, char* keyname, char* value)
{
int val;
cfapiObject_set_key(&val, op, keyname, value);
}
/* Archetype-related functions */
archetype* cf_archetype_get_first()
{
int val;
return (archetype*) cfapiArchetype_get_first(&val);
}
const char* cf_archetype_get_name(archetype* arch)
{
int val;
return (const char*) cfapiArchetype_get_property(&val, arch, CFAPI_ARCH_PROP_NAME);
}
archetype* cf_archetype_get_next(archetype* arch)
{
int val;
return (archetype*) cfapiArchetype_get_property(&val, arch, CFAPI_ARCH_PROP_NEXT);
}
archetype* cf_archetype_get_more(archetype* arch)
{
int val;
return (archetype*) cfapiArchetype_get_property(&val, arch, CFAPI_ARCH_PROP_MORE);
}
archetype* cf_archetype_get_head(archetype* arch)
{
int val;
return (archetype*) cfapiArchetype_get_property(&val, arch, CFAPI_ARCH_PROP_HEAD);
}
object* cf_archetype_get_clone(archetype* arch)
{
int val;
return (object*) cfapiArchetype_get_property(&val, arch, CFAPI_ARCH_PROP_CLONE);
}
/* Party-related functions */
partylist* cf_party_get_first(void)
{
int val;
return (partylist*) cfapiParty_get_property(&val, NULL, CFAPI_PARTY_PROP_NEXT);
}
const char* cf_party_get_name(partylist* party)
{
int val;
return (const char*) cfapiParty_get_property(&val, party, CFAPI_PARTY_PROP_NAME);
}
partylist* cf_party_get_next(partylist* party)
{
int val;
return (partylist*) cfapiParty_get_property(&val, party, CFAPI_PARTY_PROP_NEXT);
}
const char* cf_party_get_password(partylist* party)
{
int val;
return (const char*) cfapiParty_get_property(&val, party, CFAPI_PARTY_PROP_PASSWORD);
}
player* cf_party_get_first_player(partylist* party)
{
int val;
return (player*) cfapiParty_get_property(&val, party, CFAPI_PARTY_PROP_PLAYER, NULL);
}
player* cf_party_get_next_player(partylist* party, player* op)
{
int val;
return (player*) cfapiParty_get_property(&val, party, CFAPI_PARTY_PROP_PLAYER, op);
}
region* cf_region_get_first(void)
{
int val;
return (region*) cfapiRegion_get_property(&val, NULL, CFAPI_REGION_PROP_NEXT);
}
const char* cf_region_get_name(region* reg)
{
int val;
return (const char*) cfapiRegion_get_property(&val, reg, CFAPI_REGION_PROP_NAME);
}
region* cf_region_get_next(region* reg)
{
int val;
return (region*) cfapiRegion_get_property(&val, reg, CFAPI_REGION_PROP_NEXT);
}
region* cf_region_get_parent(region* reg)
{
int val;
return (region*) cfapiRegion_get_property(&val, reg, CFAPI_REGION_PROP_PARENT);
}
const char* cf_region_get_longname(region* reg)
{
int val;
return (const char*) cfapiRegion_get_property(&val, reg, CFAPI_REGION_PROP_LONGNAME);
}
const char* cf_region_get_message(region* reg)
{
int val;
return (const char*) cfapiRegion_get_property(&val, reg, CFAPI_REGION_PROP_MESSAGE);
}