Crossfire Server, Trunk
cfpython_map.cpp File Reference
#include <cfpython.h>
#include <map>
+ Include dependency graph for cfpython_map.cpp:

Go to the source code of this file.

Functions

static void add_map_assoc (mapstruct *key, Crossfire_Map *value)
 
 CF_PYTHON_NUMBER_METHODS (Map, Crossfire_Map_Long)
 
 CF_PYTHON_OBJECT (Map, Crossfire_Map_dealloc, &MapConvert, PyObject_HashNotImplemented, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, "Crossfire maps",(richcmpfunc) Crossfire_Map_RichCompare, MapMethods, Map_getseters, NULL, Crossfire_Map_new)
 
static void Crossfire_Map_dealloc (PyObject *obj)
 
static PyObject * Crossfire_Map_Long (PyObject *obj)
 
static PyObject * Crossfire_Map_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
 
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)
 
static Crossfire_Mapfind_assoc_pymap (mapstruct *key)
 
static void free_map_assoc (mapstruct *key)
 
void Handle_Map_Unload_Hook (Crossfire_Map *map)
 
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)
 

Variables

static std::map< mapstruct *, Crossfire_Map * > map_assoc_table
 
static PyGetSetDef Map_getseters []
 
static PyMethodDef MapMethods []
 

Function Documentation

◆ add_map_assoc()

static void add_map_assoc ( mapstruct key,
Crossfire_Map value 
)
static

Definition at line 36 of file cfpython_map.cpp.

References castle_read::key, map_assoc_table, and autojail::value.

Referenced by Crossfire_Map_wrap().

+ Here is the caller graph for this function:

◆ CF_PYTHON_NUMBER_METHODS()

CF_PYTHON_NUMBER_METHODS ( Map  ,
Crossfire_Map_Long   
)

◆ CF_PYTHON_OBJECT()

CF_PYTHON_OBJECT ( Map  ,
Crossfire_Map_dealloc  ,
MapConvert,
PyObject_HashNotImplemented  ,
Py_TPFLAGS_DEFAULT|  Py_TPFLAGS_BASETYPE,
"Crossfire maps ,
(richcmpfunc)  Crossfire_Map_RichCompare,
MapMethods  ,
Map_getseters  ,
NULL  ,
Crossfire_Map_new   
)

◆ Crossfire_Map_dealloc()

static void Crossfire_Map_dealloc ( PyObject *  obj)
static

Definition at line 418 of file cfpython_map.cpp.

References free_map_assoc(), and altar_valkyrie::obj.

+ Here is the call graph for this function:

◆ Crossfire_Map_Long()

static PyObject* Crossfire_Map_Long ( PyObject *  obj)
static

Definition at line 398 of file cfpython_map.cpp.

References disinfect::map, MAPEXISTCHECK, and altar_valkyrie::obj.

◆ Crossfire_Map_new()

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

Python initialized.

Definition at line 406 of file cfpython_map.cpp.

References make_face_from_files::args, is_valid_types_gen::type, and nlohmann::detail::void().

+ Here is the call graph for this function:

◆ Crossfire_Map_RichCompare()

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

Definition at line 360 of file cfpython_map.cpp.

References Crossfire_MapType, Map_InternalCompare(), give::op, and rotate-tower::result.

+ Here is the call graph for this function:

◆ Crossfire_Map_wrap()

PyObject* Crossfire_Map_wrap ( mapstruct what)

Definition at line 435 of file cfpython_map.cpp.

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:

◆ ensure_map_in_memory()

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 51 of file cfpython_map.cpp.

References cf_log(), cf_map_get_int_property(), cf_map_get_map(), CFAPI_MAP_PROP_UNIQUE, llevDebug, llevError, disinfect::map, MAP_IN_MEMORY, MAP_PLAYER_UNIQUE, guild_questpoints_apply::mapname, and Ice::tmp.

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:

◆ find_assoc_pymap()

static Crossfire_Map* find_assoc_pymap ( mapstruct key)
static

Definition at line 40 of file cfpython_map.cpp.

References castle_read::key, and map_assoc_table.

Referenced by Crossfire_Map_wrap().

+ Here is the caller graph for this function:

◆ free_map_assoc()

static void free_map_assoc ( mapstruct key)
static

Definition at line 45 of file cfpython_map.cpp.

References castle_read::key, and map_assoc_table.

Referenced by Crossfire_Map_dealloc(), and Handle_Map_Unload_Hook().

+ Here is the caller graph for this function:

◆ Handle_Map_Unload_Hook()

void Handle_Map_Unload_Hook ( Crossfire_Map map)

Definition at line 430 of file cfpython_map.cpp.

References free_map_assoc(), and disinfect::map.

Referenced by cfpython_globalEventListener().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Map_ChangeLight()

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

Definition at line 289 of file cfpython_map.cpp.

References make_face_from_files::args, cf_map_change_light(), disinfect::map, and MAPEXISTCHECK.

+ Here is the call graph for this function:

◆ Map_Check()

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

◆ Map_CreateObject()

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

◆ Map_GetDarkness()

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

Definition at line 117 of file cfpython_map.cpp.

References cf_map_get_darkness(), Crossfire_Map::map, MAPEXISTCHECK, and nlohmann::detail::void().

+ Here is the call graph for this function:

◆ Map_GetDifficulty()

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

Definition at line 75 of file cfpython_map.cpp.

References cf_map_get_difficulty(), Crossfire_Map::map, MAPEXISTCHECK, and nlohmann::detail::void().

+ Here is the call graph for this function:

◆ Map_GetEnterX()

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

Definition at line 135 of file cfpython_map.cpp.

References cf_map_get_enter_x(), Crossfire_Map::map, MAPEXISTCHECK, and nlohmann::detail::void().

+ Here is the call graph for this function:

◆ Map_GetEnterY()

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

Definition at line 141 of file cfpython_map.cpp.

References cf_map_get_enter_y(), Crossfire_Map::map, MAPEXISTCHECK, and nlohmann::detail::void().

+ Here is the call graph for this function:

◆ Map_GetFirstObjectAt()

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

◆ Map_GetHeight()

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

Definition at line 129 of file cfpython_map.cpp.

References cf_map_get_height(), Crossfire_Map::map, MAPEXISTCHECK, and nlohmann::detail::void().

+ Here is the call graph for this function:

◆ Map_GetMessage()

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

Definition at line 147 of file cfpython_map.cpp.

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

+ Here is the call graph for this function:

◆ Map_GetName()

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

Definition at line 93 of file cfpython_map.cpp.

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

+ Here is the call graph for this function:

◆ Map_GetPath()

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

Definition at line 81 of file cfpython_map.cpp.

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

+ Here is the call graph for this function:

◆ Map_GetPlayers()

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

Definition at line 111 of file cfpython_map.cpp.

References cf_map_get_players(), Crossfire_Map::map, MAPEXISTCHECK, and nlohmann::detail::void().

+ Here is the call graph for this function:

◆ Map_GetRegion()

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

Definition at line 153 of file cfpython_map.cpp.

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

+ Here is the call graph for this function:

◆ Map_GetResetTime()

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

Definition at line 99 of file cfpython_map.cpp.

References cf_map_get_reset_time(), Crossfire_Map::map, MAPEXISTCHECK, and nlohmann::detail::void().

+ Here is the call graph for this function:

◆ Map_GetResetTimeout()

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

Definition at line 105 of file cfpython_map.cpp.

References cf_map_get_reset_timeout(), Crossfire_Map::map, MAPEXISTCHECK, and nlohmann::detail::void().

+ Here is the call graph for this function:

◆ Map_GetTempName()

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

Definition at line 87 of file cfpython_map.cpp.

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

+ Here is the call graph for this function:

◆ Map_GetUnique()

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

Definition at line 172 of file cfpython_map.cpp.

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

+ Here is the call graph for this function:

◆ Map_GetWidth()

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

Definition at line 123 of file cfpython_map.cpp.

References cf_map_get_width(), Crossfire_Map::map, MAPEXISTCHECK, and nlohmann::detail::void().

+ Here is the call graph for this function:

◆ Map_Insert()

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

◆ Map_InsertAround()

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

◆ Map_InternalCompare()

static int Map_InternalCompare ( Crossfire_Map left,
Crossfire_Map right 
)
static

Definition at line 354 of file cfpython_map.cpp.

References Crossfire_Map::map, and MAPEXISTCHECK_INT.

Referenced by Crossfire_Map_RichCompare().

+ Here is the caller graph for this function:

◆ Map_Message()

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

Definition at line 178 of file cfpython_map.cpp.

References make_face_from_files::args, cf_map_message(), smoking_pipe::color, disinfect::map, MAPEXISTCHECK, diamondslots::message, NDI_BLUE, and NDI_UNIQUE.

+ Here is the call graph for this function:

◆ Map_Next()

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

◆ Map_SetPath()

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

Definition at line 159 of file cfpython_map.cpp.

References cf_map_set_string_property(), CFAPI_MAP_PROP_PATH, Crossfire_Map::map, MAPEXISTCHECK_INT, autojail::value, and nlohmann::detail::void().

+ Here is the call graph for this function:

◆ Map_TriggerConnected()

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 314 of file cfpython_map.cpp.

References make_face_from_files::args, cf_log(), cf_map_get_sstring_property(), cf_map_trigger_connected(), CFAPI_MAP_PROP_PATH, push::connected, Crossfire_ObjectType, ensure_map_in_memory(), oblinkpt::link, llevError, llevInfo, disinfect::map, MAPEXISTCHECK, oblinkpt::next, Crossfire_Object::obj, dragon::state, and oblinkpt::value.

+ Here is the call graph for this function:

Variable Documentation

◆ map_assoc_table

std::map<mapstruct *, Crossfire_Map *> map_assoc_table
static

Definition at line 34 of file cfpython_map.cpp.

Referenced by add_map_assoc(), find_assoc_pymap(), and free_map_assoc().

◆ Map_getseters

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 }
}

Definition at line 460 of file cfpython_map.cpp.

◆ MapMethods

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 }
}

Definition at line 480 of file cfpython_map.cpp.

Map_GetDifficulty
static PyObject * Map_GetDifficulty(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.cpp:75
Map_SetPath
static int Map_SetPath(Crossfire_Map *whoptr, PyObject *value, void *closure)
Definition: cfpython_map.cpp:159
Map_Insert
static PyObject * Map_Insert(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.cpp:259
Map_GetHeight
static PyObject * Map_GetHeight(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.cpp:129
Map_ChangeLight
static PyObject * Map_ChangeLight(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.cpp:289
Map_GetEnterY
static PyObject * Map_GetEnterY(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.cpp:141
Map_GetTempName
static PyObject * Map_GetTempName(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.cpp:87
Map_GetPath
static PyObject * Map_GetPath(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.cpp:81
Map_Message
static PyObject * Map_Message(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.cpp:178
Map_GetUnique
static PyObject * Map_GetUnique(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.cpp:172
Map_GetResetTimeout
static PyObject * Map_GetResetTimeout(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.cpp:105
Map_TriggerConnected
static PyObject * Map_TriggerConnected(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.cpp:314
Map_GetPlayers
static PyObject * Map_GetPlayers(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.cpp:111
Map_GetFirstObjectAt
static PyObject * Map_GetFirstObjectAt(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.cpp:193
Map_GetResetTime
static PyObject * Map_GetResetTime(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.cpp:99
Map_GetRegion
static PyObject * Map_GetRegion(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.cpp:153
Map_GetDarkness
static PyObject * Map_GetDarkness(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.cpp:117
Map_Check
static PyObject * Map_Check(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.cpp:229
Map_GetName
static PyObject * Map_GetName(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.cpp:93
Map_GetMessage
static PyObject * Map_GetMessage(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.cpp:147
Map_GetWidth
static PyObject * Map_GetWidth(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.cpp:123
Map_GetEnterX
static PyObject * Map_GetEnterX(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.cpp:135
Map_Next
static PyObject * Map_Next(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.cpp:253
Map_CreateObject
static PyObject * Map_CreateObject(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.cpp:209
Map_InsertAround
static PyObject * Map_InsertAround(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.cpp:274