Crossfire Server, Trunk  R20513
Functions | Variables
cfpython_map.c File Reference
#include <cfpython.h>
#include <hashtable.h>
Include dependency graph for cfpython_map.c:

Go to the source code of this file.

Functions

static void add_map_assoc (mapstruct *key, Crossfire_Map *value)
 
static void Crossfire_Map_dealloc (PyObject *obj)
 
static PyObject * Crossfire_Map_Int (PyObject *obj)
 
static PyObject * Crossfire_Map_Long (PyObject *obj)
 
static PyObject * Crossfire_Map_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
 Python initialized. More...
 
static PyObject * Crossfire_Map_RichCompare (Crossfire_Map *left, Crossfire_Map *right, int op)
 
PyObject * Crossfire_Map_wrap (mapstruct *what)
 
static void ensure_map_in_memory (Crossfire_Map *map)
 This makes sure the map is in memory and not swapped out. More...
 
static PyObject * find_assoc_pymap (mapstruct *key)
 
static void free_map_assoc (mapstruct *key)
 
void Handle_Map_Unload_Hook (Crossfire_Map *map)
 
void init_map_assoc_table (void)
 
static PyObject * Map_ChangeLight (Crossfire_Map *map, PyObject *args)
 
static PyObject * Map_Check (Crossfire_Map *map, PyObject *args)
 
static PyObject * Map_CreateObject (Crossfire_Map *map, PyObject *args)
 
static PyObject * Map_GetDarkness (Crossfire_Map *whoptr, void *closure)
 
static PyObject * Map_GetDifficulty (Crossfire_Map *whoptr, void *closure)
 
static PyObject * Map_GetEnterX (Crossfire_Map *whoptr, void *closure)
 
static PyObject * Map_GetEnterY (Crossfire_Map *whoptr, void *closure)
 
static PyObject * Map_GetFirstObjectAt (Crossfire_Map *map, PyObject *args)
 
static PyObject * Map_GetHeight (Crossfire_Map *whoptr, void *closure)
 
static PyObject * Map_GetMessage (Crossfire_Map *whoptr, void *closure)
 
static PyObject * Map_GetName (Crossfire_Map *whoptr, void *closure)
 
static PyObject * Map_GetPath (Crossfire_Map *whoptr, void *closure)
 
static PyObject * Map_GetPlayers (Crossfire_Map *whoptr, void *closure)
 
static PyObject * Map_GetRegion (Crossfire_Map *whoptr, void *closure)
 
static PyObject * Map_GetResetTime (Crossfire_Map *whoptr, void *closure)
 
static PyObject * Map_GetResetTimeout (Crossfire_Map *whoptr, void *closure)
 
static PyObject * Map_GetTempName (Crossfire_Map *whoptr, void *closure)
 
static PyObject * Map_GetUnique (Crossfire_Map *whoptr, void *closure)
 
static PyObject * Map_GetWidth (Crossfire_Map *whoptr, void *closure)
 
static PyObject * Map_Insert (Crossfire_Map *map, PyObject *args)
 
static PyObject * Map_InsertAround (Crossfire_Map *map, PyObject *args)
 
static int Map_InternalCompare (Crossfire_Map *left, Crossfire_Map *right)
 
static PyObject * Map_Message (Crossfire_Map *map, PyObject *args)
 
static PyObject * Map_Next (Crossfire_Map *map, PyObject *args)
 
static int Map_SetPath (Crossfire_Map *whoptr, PyObject *value, void *closure)
 
static PyObject * Map_TriggerConnected (Crossfire_Map *map, PyObject *args)
 Python backend method for Map.TriggerConnected(int connected, CfObject cause, int state) More...
 

Variables

PyTypeObject Crossfire_MapType
 
static ptr_assoc_table map_assoc_table
 
static PyGetSetDef Map_getseters []
 
static PyNumberMethods MapConvert
 
static PyMethodDef MapMethods []
 

Function Documentation

static void add_map_assoc ( mapstruct key,
Crossfire_Map value 
)
static

Definition at line 41 of file cfpython_map.c.

References add_ptr_assoc(), and map_assoc_table.

Referenced by Crossfire_Map_wrap().

Here is the call graph for this function:

Here is the caller graph for this function:

static void Crossfire_Map_dealloc ( PyObject *  obj)
static

Definition at line 410 of file cfpython_map.c.

References free_map_assoc(), and Py_TYPE.

Here is the call graph for this function:

static PyObject* Crossfire_Map_Int ( PyObject *  obj)
static

Definition at line 391 of file cfpython_map.c.

References MAPEXISTCHECK.

static PyObject* Crossfire_Map_Long ( PyObject *  obj)
static

Definition at line 385 of file cfpython_map.c.

References MAPEXISTCHECK.

static PyObject* Crossfire_Map_new ( PyTypeObject *  type,
PyObject *  args,
PyObject *  kwds 
)
static

Python initialized.

Definition at line 400 of file cfpython_map.c.

References Crossfire_Map::map.

static PyObject* Crossfire_Map_RichCompare ( Crossfire_Map left,
Crossfire_Map right,
int  op 
)
static

Definition at line 347 of file cfpython_map.c.

References Crossfire_MapType, and Map_InternalCompare().

Here is the call graph for this function:

PyObject* Crossfire_Map_wrap ( mapstruct what)

Definition at line 427 of file cfpython_map.c.

References add_map_assoc(), Crossfire_MapType, find_assoc_pymap(), Crossfire_Map::map, and Crossfire_Map::valid.

Referenced by cfpython_globalEventListener(), createMap(), getMapHasBeenLoaded(), getMaps(), Map_Next(), Object_GetMap(), and readyMap().

Here is the call graph for this function:

Here is the caller graph for this function:

static void ensure_map_in_memory ( Crossfire_Map map)
static

This makes sure the map is in memory and not swapped out.

Definition at line 55 of file cfpython_map.c.

References cf_log(), cf_map_get_int_property(), cf_map_get_map(), CFAPI_MAP_PROP_UNIQUE, mapdef::in_memory, llevDebug, llevError, Crossfire_Map::map, MAP_IN_MEMORY, MAP_PLAYER_UNIQUE, mapdef::path, and strdup().

Referenced by Map_Check(), Map_CreateObject(), Map_GetFirstObjectAt(), Map_Insert(), Map_InsertAround(), and Map_TriggerConnected().

Here is the call graph for this function:

Here is the caller graph for this function:

static PyObject* find_assoc_pymap ( mapstruct key)
static

Definition at line 45 of file cfpython_map.c.

References find_assoc_value(), and map_assoc_table.

Referenced by Crossfire_Map_wrap().

Here is the call graph for this function:

Here is the caller graph for this function:

static void free_map_assoc ( mapstruct key)
static

Definition at line 49 of file cfpython_map.c.

References free_ptr_assoc(), and map_assoc_table.

Referenced by Crossfire_Map_dealloc(), and Handle_Map_Unload_Hook().

Here is the call graph for this function:

Here is the caller graph for this function:

void Handle_Map_Unload_Hook ( Crossfire_Map map)

Definition at line 422 of file cfpython_map.c.

References free_map_assoc(), Crossfire_Map::map, and Crossfire_Map::valid.

Referenced by cfpython_globalEventListener().

Here is the call graph for this function:

Here is the caller graph for this function:

void init_map_assoc_table ( void  )

Definition at line 37 of file cfpython_map.c.

References init_ptr_assoc_table(), and map_assoc_table.

Referenced by initPlugin().

Here is the call graph for this function:

Here is the caller graph for this function:

static PyObject* Map_ChangeLight ( Crossfire_Map map,
PyObject *  args 
)
static

Definition at line 276 of file cfpython_map.c.

References cf_map_change_light(), Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_Check ( Crossfire_Map map,
PyObject *  args 
)
static
static PyObject* Map_CreateObject ( Crossfire_Map map,
PyObject *  args 
)
static

Definition at line 197 of file cfpython_map.c.

References cf_create_object_by_name(), cf_map_insert_object(), Crossfire_Object_wrap(), ensure_map_in_memory(), Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_GetDarkness ( Crossfire_Map whoptr,
void *  closure 
)
static

Definition at line 114 of file cfpython_map.c.

References cf_map_get_darkness(), Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_GetDifficulty ( Crossfire_Map whoptr,
void *  closure 
)
static

Definition at line 79 of file cfpython_map.c.

References cf_map_get_difficulty(), Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_GetEnterX ( Crossfire_Map whoptr,
void *  closure 
)
static

Definition at line 129 of file cfpython_map.c.

References cf_map_get_int_property(), CFAPI_MAP_PROP_ENTER_X, Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_GetEnterY ( Crossfire_Map whoptr,
void *  closure 
)
static

Definition at line 134 of file cfpython_map.c.

References cf_map_get_enter_x(), Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_GetFirstObjectAt ( Crossfire_Map map,
PyObject *  args 
)
static

Definition at line 181 of file cfpython_map.c.

References cf_map_get_object_at(), Crossfire_Object_wrap(), ensure_map_in_memory(), Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_GetHeight ( Crossfire_Map whoptr,
void *  closure 
)
static

Definition at line 124 of file cfpython_map.c.

References cf_map_get_height(), Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_GetMessage ( Crossfire_Map whoptr,
void *  closure 
)
static

Definition at line 139 of file cfpython_map.c.

References cf_map_get_sstring_property(), CFAPI_MAP_PROP_MESSAGE, Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_GetName ( Crossfire_Map whoptr,
void *  closure 
)
static

Definition at line 94 of file cfpython_map.c.

References cf_map_get_sstring_property(), CFAPI_MAP_PROP_NAME, Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_GetPath ( Crossfire_Map whoptr,
void *  closure 
)
static

Definition at line 84 of file cfpython_map.c.

References cf_map_get_sstring_property(), CFAPI_MAP_PROP_PATH, Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_GetPlayers ( Crossfire_Map whoptr,
void *  closure 
)
static

Definition at line 109 of file cfpython_map.c.

References cf_map_get_players(), Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_GetRegion ( Crossfire_Map whoptr,
void *  closure 
)
static

Definition at line 144 of file cfpython_map.c.

References cf_map_get_region_property(), CFAPI_MAP_PROP_REGION, Crossfire_Region_wrap(), Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_GetResetTime ( Crossfire_Map whoptr,
void *  closure 
)
static

Definition at line 99 of file cfpython_map.c.

References cf_map_get_reset_time(), Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_GetResetTimeout ( Crossfire_Map whoptr,
void *  closure 
)
static

Definition at line 104 of file cfpython_map.c.

References cf_map_get_reset_timeout(), Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_GetTempName ( Crossfire_Map whoptr,
void *  closure 
)
static

Definition at line 89 of file cfpython_map.c.

References cf_map_get_sstring_property(), CFAPI_MAP_PROP_TMPNAME, Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_GetUnique ( Crossfire_Map whoptr,
void *  closure 
)
static

Definition at line 161 of file cfpython_map.c.

References cf_map_get_int_property(), CFAPI_MAP_PROP_UNIQUE, Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_GetWidth ( Crossfire_Map whoptr,
void *  closure 
)
static

Definition at line 119 of file cfpython_map.c.

References cf_map_get_width(), Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static PyObject* Map_Insert ( Crossfire_Map map,
PyObject *  args 
)
static
static PyObject* Map_InsertAround ( Crossfire_Map map,
PyObject *  args 
)
static
static int Map_InternalCompare ( Crossfire_Map left,
Crossfire_Map right 
)
static

Definition at line 341 of file cfpython_map.c.

References Crossfire_Map::map, and MAPEXISTCHECK_INT.

Referenced by Crossfire_Map_RichCompare().

Here is the caller graph for this function:

static PyObject* Map_Message ( Crossfire_Map map,
PyObject *  args 
)
static

Definition at line 166 of file cfpython_map.c.

References cf_map_message(), Crossfire_Map::map, MAPEXISTCHECK, NDI_BLUE, and NDI_UNIQUE.

Here is the call graph for this function:

static PyObject* Map_Next ( Crossfire_Map map,
PyObject *  args 
)
static

Definition at line 241 of file cfpython_map.c.

References cf_map_get_map_property(), CFAPI_MAP_PROP_NEXT, Crossfire_Map_wrap(), Crossfire_Map::map, and MAPEXISTCHECK.

Here is the call graph for this function:

static int Map_SetPath ( Crossfire_Map whoptr,
PyObject *  value,
void *  closure 
)
static

Definition at line 149 of file cfpython_map.c.

References cf_map_set_string_property(), CFAPI_MAP_PROP_PATH, Crossfire_Map::map, and MAPEXISTCHECK_INT.

Here is the call graph for this function:

static PyObject* Map_TriggerConnected ( Crossfire_Map map,
PyObject *  args 
)
static

Python backend method for Map.TriggerConnected(int connected, CfObject cause, int state)

Expected arguments:

  • connected will be used to locate Objectlink with given id on map
  • state: 0=trigger the "release", other is trigger the "push", default is push
  • cause, eventual CfObject causing this trigger
Parameters
mapmap we're on.
argsarguments as explained above.
Returns
NULL if error, Py_None else.

Definition at line 301 of file cfpython_map.c.

References mapdef::buttons, cf_log(), cf_map_get_sstring_property(), cf_map_trigger_connected(), CFAPI_MAP_PROP_PATH, Crossfire_ObjectType, ensure_map_in_memory(), oblinkpt::link, llevError, llevInfo, Crossfire_Map::map, MAPEXISTCHECK, oblinkpt::next, Crossfire_Object::obj, and oblinkpt::value.

Here is the call graph for this function:

Variable Documentation

PyTypeObject Crossfire_MapType
ptr_assoc_table map_assoc_table
static
PyGetSetDef Map_getseters[]
static
Initial value:
= {
{ "Difficulty", (getter)Map_GetDifficulty, NULL, NULL, NULL },
{ "Path", (getter)Map_GetPath, (setter)Map_SetPath, NULL, NULL },
{ "TempName", (getter)Map_GetTempName, NULL, NULL, NULL },
{ "Name", (getter)Map_GetName, NULL, NULL, NULL },
{ "ResetTime", (getter)Map_GetResetTime, NULL, NULL, NULL },
{ "ResetTimeout", (getter)Map_GetResetTimeout, NULL, NULL, NULL },
{ "Players", (getter)Map_GetPlayers, NULL, NULL, NULL },
{ "Light", (getter)Map_GetDarkness, NULL, NULL, NULL },
{ "Darkness", (getter)Map_GetDarkness, NULL, NULL, NULL },
{ "Width", (getter)Map_GetWidth, NULL, NULL, NULL },
{ "Height", (getter)Map_GetHeight, NULL, NULL, NULL },
{ "EnterX", (getter)Map_GetEnterX, NULL, NULL, NULL },
{ "EnterY", (getter)Map_GetEnterY, NULL, NULL, NULL },
{ "Message", (getter)Map_GetMessage, NULL, NULL, NULL },
{ "Region", (getter)Map_GetRegion, NULL, NULL, NULL },
{ "Unique", (getter)Map_GetUnique, NULL, NULL, NULL },
{ NULL, NULL, NULL, NULL, NULL }
}
static int Map_SetPath(Crossfire_Map *whoptr, PyObject *value, void *closure)
Definition: cfpython_map.c:149
static PyObject * Map_GetTempName(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:89
static PyObject * Map_GetUnique(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:161
static PyObject * Map_GetName(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:94
static PyObject * Map_GetResetTime(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:99
static PyObject * Map_GetWidth(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:119
static PyObject * Map_GetDifficulty(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:79
static PyObject * Map_GetPlayers(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:109
static PyObject * Map_GetEnterY(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:134
static PyObject * Map_GetHeight(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:124
static PyObject * Map_GetDarkness(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:114
static PyObject * Map_GetPath(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:84
static PyObject * Map_GetRegion(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:144
static PyObject * Map_GetMessage(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:139
static PyObject * Map_GetEnterX(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:129
static PyObject * Map_GetResetTimeout(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:104

Definition at line 452 of file cfpython_map.c.

PyNumberMethods MapConvert
static

Definition at line 485 of file cfpython_map.c.

PyMethodDef MapMethods[]
static
Initial value:
= {
{ "Print", (PyCFunction)Map_Message, METH_VARARGS, NULL },
{ "ObjectAt", (PyCFunction)Map_GetFirstObjectAt, METH_VARARGS, NULL },
{ "CreateObject", (PyCFunction)Map_CreateObject, METH_VARARGS, NULL },
{ "Check", (PyCFunction)Map_Check, METH_VARARGS, NULL },
{ "Next", (PyCFunction)Map_Next, METH_NOARGS, NULL },
{ "Insert", (PyCFunction)Map_Insert, METH_VARARGS, NULL },
{ "InsertAround", (PyCFunction)Map_InsertAround, METH_VARARGS, NULL },
{ "ChangeLight", (PyCFunction)Map_ChangeLight, METH_VARARGS, NULL },
{ "TriggerConnected", (PyCFunction)Map_TriggerConnected, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
}
static PyObject * Map_Message(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.c:166
static PyObject * Map_InsertAround(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.c:261
static PyObject * Map_CreateObject(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.c:197
static PyObject * Map_Insert(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.c:246
static PyObject * Map_GetFirstObjectAt(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.c:181
static PyObject * Map_TriggerConnected(Crossfire_Map *map, PyObject *args)
Python backend method for Map.TriggerConnected(int connected, CfObject cause, int state) ...
Definition: cfpython_map.c:301
static PyObject * Map_ChangeLight(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.c:276
static PyObject * Map_Check(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.c:217
static PyObject * Map_Next(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.c:241

Definition at line 472 of file cfpython_map.c.