Crossfire Server, Trunk
cfpython_map.c
Go to the documentation of this file.
1 /*****************************************************************************/
2 /* CFPython - A Python module for Crossfire RPG. */
3 /* Version: 2.0beta8 (also known as "Alexander") */
4 /* Contact: yann.chachkoff@myrealbox.com */
5 /*****************************************************************************/
6 /* That code is placed under the GNU General Public Licence (GPL) */
7 /* (C)2001-2005 by Chachkoff Yann (Feel free to deliver your complaints) */
8 /*****************************************************************************/
9 /* CrossFire, A Multiplayer game for X-windows */
10 /* */
11 /* Copyright (C) 2000 Mark Wedel */
12 /* Copyright (C) 1992 Frank Tore Johansen */
13 /* */
14 /* This program is free software; you can redistribute it and/or modify */
15 /* it under the terms of the GNU General Public License as published by */
16 /* the Free Software Foundation; either version 2 of the License, or */
17 /* (at your option) any later version. */
18 /* */
19 /* This program is distributed in the hope that it will be useful, */
20 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
21 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
22 /* GNU General Public License for more details. */
23 /* */
24 /* You should have received a copy of the GNU General Public License */
25 /* along with this program; if not, write to the Free Software */
26 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
27 /* */
28 /*****************************************************************************/
29 
30 #include <cfpython.h>
31 #include <hashtable.h>
32 
33 /* Table for keeping track of which PyObject goes with with Crossfire object */
35 
36 /* Helper functions for dealing with object_assoc_table */
39 }
40 
43 }
44 
45 static PyObject *find_assoc_pymap(mapstruct *key) {
46  return (PyObject *)find_assoc_value(map_assoc_table, key);
47 }
48 
49 static void free_map_assoc(mapstruct *key) {
51 }
52 
53 
56  assert(map->map != NULL);
57  if (map->map->in_memory != MAP_IN_MEMORY) {
58  char* mapname = map->map->path;
59  int is_unique = cf_map_get_int_property(map->map, CFAPI_MAP_PROP_UNIQUE);
60  /* If the map is unique the path name will be freed. We need to handle that. */
61  if (is_unique) {
62  char* tmp = strdup(mapname);
63  if (!tmp) {
64  /* FIXME: We should fatal() here, but that doesn't exist in plugins. */
65  cf_log(llevError, "Out of memory in ensure_map_in_memory()!\n");
66  abort();
67  }
68  mapname = tmp;
69  }
70  cf_log(llevDebug, "MAP %s AIN'T READY ! Loading it...\n", mapname);
71  /* Map pointer may change for player unique maps. */
72  /* Also, is the MAP_PLAYER_UNIQUE logic correct? */
73  map->map = cf_map_get_map(mapname, is_unique ? MAP_PLAYER_UNIQUE : 0);
74  if (is_unique)
75  free(mapname);
76  }
77 }
78 
79 static PyObject *Map_GetDifficulty(Crossfire_Map *whoptr, void *closure) {
80  (void)closure;
81  MAPEXISTCHECK(whoptr);
82  return Py_BuildValue("i", cf_map_get_difficulty(whoptr->map));
83 }
84 
85 static PyObject *Map_GetPath(Crossfire_Map *whoptr, void *closure) {
86  (void)closure;
87  MAPEXISTCHECK(whoptr);
88  return Py_BuildValue("s", cf_map_get_sstring_property(whoptr->map, CFAPI_MAP_PROP_PATH));
89 }
90 
91 static PyObject *Map_GetTempName(Crossfire_Map *whoptr, void *closure) {
92  (void)closure;
93  MAPEXISTCHECK(whoptr);
94  return Py_BuildValue("s", cf_map_get_sstring_property(whoptr->map, CFAPI_MAP_PROP_TMPNAME));
95 }
96 
97 static PyObject *Map_GetName(Crossfire_Map *whoptr, void *closure) {
98  (void)closure;
99  MAPEXISTCHECK(whoptr);
100  return Py_BuildValue("s", cf_map_get_sstring_property(whoptr->map, CFAPI_MAP_PROP_NAME));
101 }
102 
103 static PyObject *Map_GetResetTime(Crossfire_Map *whoptr, void *closure) {
104  (void)closure;
105  MAPEXISTCHECK(whoptr);
106  return Py_BuildValue("i", cf_map_get_reset_time(whoptr->map));
107 }
108 
109 static PyObject *Map_GetResetTimeout(Crossfire_Map *whoptr, void *closure) {
110  (void)closure;
111  MAPEXISTCHECK(whoptr);
112  return Py_BuildValue("i", cf_map_get_reset_timeout(whoptr->map));
113 }
114 
115 static PyObject *Map_GetPlayers(Crossfire_Map *whoptr, void *closure) {
116  (void)closure;
117  MAPEXISTCHECK(whoptr);
118  return Py_BuildValue("i", cf_map_get_players(whoptr->map));
119 }
120 
121 static PyObject *Map_GetDarkness(Crossfire_Map *whoptr, void *closure) {
122  (void)closure;
123  MAPEXISTCHECK(whoptr);
124  return Py_BuildValue("i", cf_map_get_darkness(whoptr->map));
125 }
126 
127 static PyObject *Map_GetWidth(Crossfire_Map *whoptr, void *closure) {
128  (void)closure;
129  MAPEXISTCHECK(whoptr);
130  return Py_BuildValue("i", cf_map_get_width(whoptr->map));
131 }
132 
133 static PyObject *Map_GetHeight(Crossfire_Map *whoptr, void *closure) {
134  (void)closure;
135  MAPEXISTCHECK(whoptr);
136  return Py_BuildValue("i", cf_map_get_height(whoptr->map));
137 }
138 
139 static PyObject *Map_GetEnterX(Crossfire_Map *whoptr, void *closure) {
140  (void)closure;
141  MAPEXISTCHECK(whoptr);
142  return Py_BuildValue("i", cf_map_get_enter_x(whoptr->map));
143 }
144 
145 static PyObject *Map_GetEnterY(Crossfire_Map *whoptr, void *closure) {
146  (void)closure;
147  MAPEXISTCHECK(whoptr);
148  return Py_BuildValue("i", cf_map_get_enter_y(whoptr->map));
149 }
150 
151 static PyObject *Map_GetMessage(Crossfire_Map *whoptr, void *closure) {
152  (void)closure;
153  MAPEXISTCHECK(whoptr);
154  return Py_BuildValue("s", cf_map_get_sstring_property(whoptr->map, CFAPI_MAP_PROP_MESSAGE));
155 }
156 
157 static PyObject *Map_GetRegion(Crossfire_Map *whoptr, void *closure) {
158  (void)closure;
159  MAPEXISTCHECK(whoptr);
161 }
162 
163 static int Map_SetPath(Crossfire_Map *whoptr, PyObject *value, void *closure) {
164  const char *val;
165  (void)closure;
166 
167  MAPEXISTCHECK_INT(whoptr);
168  if (!PyArg_Parse(value, "s", &val))
169  return -1;
170 
172  return 0;
173 
174 }
175 
176 static PyObject *Map_GetUnique(Crossfire_Map *whoptr, void *closure) {
177  (void)closure;
178  MAPEXISTCHECK(whoptr);
179  return Py_BuildValue("i", cf_map_get_int_property(whoptr->map, CFAPI_MAP_PROP_UNIQUE));
180 }
181 
182 static PyObject *Map_Message(Crossfire_Map *map, PyObject *args) {
183  int color = NDI_BLUE|NDI_UNIQUE;
184  char *message;
185 
186  if (!PyArg_ParseTuple(args, "s|i", &message, &color))
187  return NULL;
188 
190 
192 
193  Py_INCREF(Py_None);
194  return Py_None;
195 }
196 
197 static PyObject *Map_GetFirstObjectAt(Crossfire_Map *map, PyObject *args) {
198  int x, y;
199  object *val;
200 
201  if (!PyArg_ParseTuple(args, "ii", &x, &y))
202  return NULL;
203 
205 
206  /* make sure the map is swapped in */
208 
209  val = cf_map_get_object_at(map->map, x, y);
210  return Crossfire_Object_wrap(val);
211 }
212 
213 static PyObject *Map_CreateObject(Crossfire_Map *map, PyObject *args) {
214  char *txt;
215  int x, y;
216  object *op;
217 
218  if (!PyArg_ParseTuple(args, "sii", &txt, &x, &y))
219  return NULL;
220 
222 
223  /* make sure the map is swapped in */
225 
227 
228  if (op)
229  op = cf_map_insert_object(map->map, op, x, y);
230  return Crossfire_Object_wrap(op);
231 }
232 
233 static PyObject *Map_Check(Crossfire_Map *map, PyObject *args) {
234  char *what;
235  int x, y;
236  object *foundob;
237  int16_t nx, ny;
238  int mflags;
239 
240  if (!PyArg_ParseTuple(args, "s(ii)", &what, &x, &y))
241  return NULL;
242 
244 
245  /* make sure the map is swapped in */
247 
248  mflags = cf_map_get_flags(map->map, &(map->map), (int16_t)x, (int16_t)y, &nx, &ny);
249  if (mflags&P_OUT_OF_MAP) {
250  Py_INCREF(Py_None);
251  return Py_None;
252  }
253  foundob = cf_map_find_by_archetype_name(what, map->map, nx, ny);
254  return Crossfire_Object_wrap(foundob);
255 }
256 
257 static PyObject *Map_Next(Crossfire_Map *map, PyObject *args) {
258  (void)args;
261 }
262 
263 static PyObject *Map_Insert(Crossfire_Map *map, PyObject *args) {
264  int x, y;
265  Crossfire_Object *what;
266 
267  if (!PyArg_ParseTuple(args, "O!ii", &Crossfire_ObjectType, &what, &x, &y))
268  return NULL;
269 
271 
272  /* make sure the map is swapped in */
274 
275  return Crossfire_Object_wrap(cf_map_insert_object(map->map, what->obj, x, y));
276 }
277 
278 static PyObject *Map_InsertAround(Crossfire_Map *map, PyObject *args) {
279  int x, y;
280  Crossfire_Object *what;
281 
282  if (!PyArg_ParseTuple(args, "O!ii", &Crossfire_ObjectType, &what, &x, &y))
283  return NULL;
284 
286 
287  /* make sure the map is swapped in */
289 
291 }
292 
293 static PyObject *Map_ChangeLight(Crossfire_Map *map, PyObject *args) {
294  int change;
295 
296  if (!PyArg_ParseTuple(args, "i", &change))
297  return NULL;
298 
300 
301  return Py_BuildValue("i", cf_map_change_light(map->map, change));
302 }
318 static PyObject *Map_TriggerConnected(Crossfire_Map *map, PyObject *args) {
319  objectlink *ol = NULL;
320  int connected;
321  int state;
322  Crossfire_Object *cause = NULL;
323  oblinkpt *olp;
324 
325  if (!PyArg_ParseTuple(args, "ii|O!", &connected, &state, &Crossfire_ObjectType, &cause))
326  return NULL;
327 
329 
330  /* make sure the map is swapped in */
332 
333  /* locate objectlink for this connected value */
334  if (!map->map->buttons) {
335  cf_log(llevError, "Map %s called for trigger on connected %d but there ain't any button list for that map!\n", cf_map_get_sstring_property(map->map, CFAPI_MAP_PROP_PATH), connected);
336  PyErr_SetString(PyExc_ReferenceError, "No objects connected to that ID on this map.");
337  return NULL;
338  }
339  for (olp = map->map->buttons; olp; olp = olp->next) {
340  if (olp->value == connected) {
341  ol = olp->link;
342  break;
343  }
344  }
345  if (ol == NULL) {
346  cf_log(llevInfo, "Map %s called for trigger on connected %d but there ain't any button list for that map!\n", cf_map_get_sstring_property(map->map, CFAPI_MAP_PROP_PATH), connected);
347  /* FIXME: I'm not sure about this message... */
348  PyErr_SetString(PyExc_ReferenceError, "No objects with that connection ID on this map.");
349  return NULL;
350  }
351  /* run the object link */
352  cf_map_trigger_connected(ol, cause ? cause->obj : NULL, state);
353 
354  Py_INCREF(Py_None);
355  return Py_None;
356 }
357 
359  MAPEXISTCHECK_INT(left);
360  MAPEXISTCHECK_INT(right);
361  return left->map < right->map ? -1 : (left->map == right->map ? 0 : 1);
362 }
363 
364 static PyObject *Crossfire_Map_RichCompare(Crossfire_Map *left, Crossfire_Map *right, int op) {
365  int result;
366  if (!left
367  || !right
368  || !PyObject_TypeCheck((PyObject*)left, &Crossfire_MapType)
369  || !PyObject_TypeCheck((PyObject*)right, &Crossfire_MapType)) {
370  Py_INCREF(Py_NotImplemented);
371  return Py_NotImplemented;
372  }
373  result = Map_InternalCompare(left, right);
374  /* Handle removed maps. */
375  if (result == -1 && PyErr_Occurred())
376  return NULL;
377  /* Based on how Python 3.0 (GPL compatible) implements it for internal types: */
378  switch (op) {
379  case Py_EQ:
380  result = (result == 0);
381  break;
382  case Py_NE:
383  result = (result != 0);
384  break;
385  case Py_LE:
386  result = (result <= 0);
387  break;
388  case Py_GE:
389  result = (result >= 0);
390  break;
391  case Py_LT:
392  result = (result == -1);
393  break;
394  case Py_GT:
395  result = (result == 1);
396  break;
397  }
398  return PyBool_FromLong(result);
399 }
400 
401 /* Legacy code: convert to long so that non-object functions work correctly */
402 static PyObject *Crossfire_Map_Long(PyObject *obj) {
404  return Py_BuildValue("l", ((Crossfire_Map *)obj)->map);
405 }
406 
410 static PyObject *Crossfire_Map_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
411  Crossfire_Map *self;
412  (void)args;
413  (void)kwds;
414 
415  self = (Crossfire_Map *)type->tp_alloc(type, 0);
416  if (self)
417  self->map = NULL;
418 
419  return (PyObject *)self;
420 }
421 
422 static void Crossfire_Map_dealloc(PyObject *obj) {
423  Crossfire_Map *self;
424 
425  self = (Crossfire_Map *)obj;
426  if (self) {
427  if (self->map && self->valid) {
428  free_map_assoc(self->map);
429  }
430  Py_TYPE(self)->tp_free(obj);
431  }
432 }
433 
435  map->valid = 0;
436  free_map_assoc(map->map);
437 }
438 
439 PyObject *Crossfire_Map_wrap(mapstruct *what) {
440  Crossfire_Map *wrapper;
441 
442  /* return None if no object was to be wrapped */
443  if (what == NULL) {
444  Py_INCREF(Py_None);
445  return Py_None;
446  }
447 
448  wrapper = (Crossfire_Map *)find_assoc_pymap(what);
449  if (!wrapper) {
450  wrapper = PyObject_NEW(Crossfire_Map, &Crossfire_MapType);
451  if (wrapper != NULL) {
452  wrapper->map = what;
453  wrapper->valid = 1;
454  add_map_assoc(what, wrapper);
455  }
456  } else {
457  Py_INCREF(wrapper);
458  }
459 
460  return (PyObject *)wrapper;
461 }
462 
463 /* Python binding */
464 static PyGetSetDef Map_getseters[] = {
465  { "Difficulty", (getter)Map_GetDifficulty, NULL, NULL, NULL },
466  { "Path", (getter)Map_GetPath, (setter)Map_SetPath, NULL, NULL },
467  { "TempName", (getter)Map_GetTempName, NULL, NULL, NULL },
468  { "Name", (getter)Map_GetName, NULL, NULL, NULL },
469  { "ResetTime", (getter)Map_GetResetTime, NULL, NULL, NULL },
470  { "ResetTimeout", (getter)Map_GetResetTimeout, NULL, NULL, NULL },
471  { "Players", (getter)Map_GetPlayers, NULL, NULL, NULL },
472  { "Light", (getter)Map_GetDarkness, NULL, NULL, NULL },
473  { "Darkness", (getter)Map_GetDarkness, NULL, NULL, NULL },
474  { "Width", (getter)Map_GetWidth, NULL, NULL, NULL },
475  { "Height", (getter)Map_GetHeight, NULL, NULL, NULL },
476  { "EnterX", (getter)Map_GetEnterX, NULL, NULL, NULL },
477  { "EnterY", (getter)Map_GetEnterY, NULL, NULL, NULL },
478  { "Message", (getter)Map_GetMessage, NULL, NULL, NULL },
479  { "Region", (getter)Map_GetRegion, NULL, NULL, NULL },
480  { "Unique", (getter)Map_GetUnique, NULL, NULL, NULL },
481  { NULL, NULL, NULL, NULL, NULL }
482 };
483 
484 static PyMethodDef MapMethods[] = {
485  { "Print", (PyCFunction)Map_Message, METH_VARARGS, NULL },
486  { "ObjectAt", (PyCFunction)Map_GetFirstObjectAt, METH_VARARGS, NULL },
487  { "CreateObject", (PyCFunction)Map_CreateObject, METH_VARARGS, NULL },
488  { "Check", (PyCFunction)Map_Check, METH_VARARGS, NULL },
489  { "Next", (PyCFunction)Map_Next, METH_NOARGS, NULL },
490  { "Insert", (PyCFunction)Map_Insert, METH_VARARGS, NULL },
491  { "InsertAround", (PyCFunction)Map_InsertAround, METH_VARARGS, NULL },
492  { "ChangeLight", (PyCFunction)Map_ChangeLight, METH_VARARGS, NULL },
493  { "TriggerConnected", (PyCFunction)Map_TriggerConnected, METH_VARARGS, NULL },
494  { NULL, NULL, 0, NULL }
495 };
496 
498 
499 /* Our actual Python MapType */
502  &MapConvert,
503  PyObject_HashNotImplemented,
504  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
505  "Crossfire maps",
506  (richcmpfunc) Crossfire_Map_RichCompare,
507  MapMethods,
509  NULL,
511  );
cf_map_get_region_property
region * cf_map_get_region_property(mapstruct *map, int propcode)
Definition: plugin_common.c:278
MAPEXISTCHECK_INT
#define MAPEXISTCHECK_INT(map)
Definition: cfpython_map.h:47
Map_Message
static PyObject * Map_Message(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.c:182
cf_log
void cf_log(LogLevel logLevel, const char *format,...)
Definition: plugin_common.c:1512
cf_map_get_height
int cf_map_get_height(mapstruct *map)
Definition: plugin_common.c:1394
Crossfire_Object::obj
PyObject_HEAD object * obj
Definition: cfpython_object.h:34
Map_SetPath
static int Map_SetPath(Crossfire_Map *whoptr, PyObject *value, void *closure)
Definition: cfpython_map.c:163
cf_map_get_sstring_property
sstring cf_map_get_sstring_property(mapstruct *map, int propcode)
Definition: plugin_common.c:260
Crossfire_Map_wrap
PyObject * Crossfire_Map_wrap(mapstruct *what)
Definition: cfpython_map.c:439
CFAPI_MAP_PROP_TMPNAME
#define CFAPI_MAP_PROP_TMPNAME
Definition: plugin.h:252
Map_GetResetTime
static PyObject * Map_GetResetTime(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:103
Map_GetTempName
static PyObject * Map_GetTempName(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:91
cf_map_get_int_property
int cf_map_get_int_property(mapstruct *map, int property)
Definition: plugin_common.c:244
llevError
@ llevError
Definition: logger.h:11
cf_map_get_players
int cf_map_get_players(mapstruct *map)
Definition: plugin_common.c:1382
Map
Definition: newserver.h:48
diamondslots.x
x
Definition: diamondslots.py:15
Map_GetUnique
static PyObject * Map_GetUnique(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:176
Map_InternalCompare
static int Map_InternalCompare(Crossfire_Map *left, Crossfire_Map *right)
Definition: cfpython_map.c:358
Crossfire_Region_wrap
PyObject * Crossfire_Region_wrap(region *what)
Definition: cfpython_region.c:72
CFAPI_MAP_PROP_NEXT
#define CFAPI_MAP_PROP_NEXT
Definition: plugin.h:264
add_map_assoc
static void add_map_assoc(mapstruct *key, Crossfire_Map *value)
Definition: cfpython_map.c:41
Crossfire_Object
Definition: cfpython_object.h:32
Map_GetName
static PyObject * Map_GetName(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:97
free_ptr_assoc
void free_ptr_assoc(ptr_assoc **hash_table, void *key)
Definition: hashtable.c:221
cf_create_object_by_name
object * cf_create_object_by_name(const char *name)
Definition: plugin_common.c:1083
Crossfire_Map_new
static PyObject * Crossfire_Map_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
Definition: cfpython_map.c:410
cf_map_get_reset_time
int cf_map_get_reset_time(mapstruct *map)
Definition: plugin_common.c:1374
Crossfire_Object_wrap
PyObject * Crossfire_Object_wrap(object *what)
Definition: cfpython_object.c:1609
cf_map_insert_object_around
object * cf_map_insert_object_around(mapstruct *where, object *op, int x, int y)
Definition: plugin_common.c:1341
CF_PYTHON_NUMBER_METHODS
CF_PYTHON_NUMBER_METHODS(Map, Crossfire_Map_Long)
MAP_PLAYER_UNIQUE
#define MAP_PLAYER_UNIQUE
Definition: map.h:97
oblinkpt::link
struct oblnk * link
Definition: object.h:456
Ice.tmp
int tmp
Definition: Ice.py:207
Crossfire_Map_RichCompare
static PyObject * Crossfire_Map_RichCompare(Crossfire_Map *left, Crossfire_Map *right, int op)
Definition: cfpython_map.c:364
oblinkpt
Definition: object.h:455
cf_map_insert_object
object * cf_map_insert_object(mapstruct *where, object *op, int x, int y)
Definition: plugin_common.c:1319
CFAPI_MAP_PROP_UNIQUE
#define CFAPI_MAP_PROP_UNIQUE
Definition: plugin.h:266
Map_GetEnterY
static PyObject * Map_GetEnterY(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:145
Handle_Map_Unload_Hook
void Handle_Map_Unload_Hook(Crossfire_Map *map)
Definition: cfpython_map.c:434
smoking_pipe.color
color
Definition: smoking_pipe.py:5
NDI_BLUE
#define NDI_BLUE
Definition: newclient.h:247
push.connected
connected
Definition: push.py:59
Map_GetPlayers
static PyObject * Map_GetPlayers(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:115
MAPEXISTCHECK
#define MAPEXISTCHECK(map)
Definition: cfpython_map.h:40
obj
Definition: object.h:277
CFAPI_MAP_PROP_REGION
#define CFAPI_MAP_PROP_REGION
Definition: plugin.h:265
MAP_IN_MEMORY
#define MAP_IN_MEMORY
Definition: map.h:131
add_ptr_assoc
void add_ptr_assoc(ptr_assoc **hash_table, void *key, void *value)
Definition: hashtable.c:108
init_ptr_assoc_table
void init_ptr_assoc_table(ptr_assoc **hash_table)
Definition: hashtable.c:56
disinfect.map
map
Definition: disinfect.py:4
Crossfire_Map::map
PyObject_HEAD mapstruct * map
Definition: cfpython_map.h:34
oblinkpt::next
struct oblinkpt * next
Definition: object.h:458
Map_InsertAround
static PyObject * Map_InsertAround(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.c:278
make_face_from_files.args
args
Definition: make_face_from_files.py:31
cf_map_get_object_at
object * cf_map_get_object_at(mapstruct *m, int x, int y)
Definition: plugin_common.c:645
rotate-tower.result
bool result
Definition: rotate-tower.py:13
init_map_assoc_table
void init_map_assoc_table(void)
Definition: cfpython_map.c:37
Map_CreateObject
static PyObject * Map_CreateObject(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.c:213
CFAPI_MAP_PROP_MESSAGE
#define CFAPI_MAP_PROP_MESSAGE
Definition: plugin.h:263
cf_map_get_enter_y
int cf_map_get_enter_y(mapstruct *map)
Definition: plugin_common.c:1402
Map_GetWidth
static PyObject * Map_GetWidth(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:127
oblinkpt::value
long value
Definition: object.h:457
ensure_map_in_memory
static void ensure_map_in_memory(Crossfire_Map *map)
Definition: cfpython_map.c:55
Map_GetDarkness
static PyObject * Map_GetDarkness(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:121
cfpython.h
map_assoc_table
static ptr_assoc_table map_assoc_table
Definition: cfpython_map.c:34
guild_questpoints_apply.mapname
mapname
Definition: guild_questpoints_apply.py:8
Crossfire_Map_Long
static PyObject * Crossfire_Map_Long(PyObject *obj)
Definition: cfpython_map.c:402
Map_GetDifficulty
static PyObject * Map_GetDifficulty(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:79
Map_GetHeight
static PyObject * Map_GetHeight(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:133
CFAPI_MAP_PROP_PATH
#define CFAPI_MAP_PROP_PATH
Definition: plugin.h:251
cf_map_message
void cf_map_message(mapstruct *m, const char *msg, int color)
Definition: plugin_common.c:657
cf_map_get_reset_timeout
int cf_map_get_reset_timeout(mapstruct *map)
Definition: plugin_common.c:1378
mapdef
Definition: map.h:317
Map_GetEnterX
static PyObject * Map_GetEnterX(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:139
cf_map_get_enter_x
int cf_map_get_enter_x(mapstruct *map)
Definition: plugin_common.c:1398
nlohmann::detail::void
j template void())
Definition: json.hpp:4099
cf_map_get_map_property
mapstruct * cf_map_get_map_property(mapstruct *map, int propcode)
Definition: plugin_common.c:269
free_map_assoc
static void free_map_assoc(mapstruct *key)
Definition: cfpython_map.c:49
cf_map_get_flags
int cf_map_get_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
Definition: plugin_common.c:1451
find_assoc_pymap
static PyObject * find_assoc_pymap(mapstruct *key)
Definition: cfpython_map.c:45
P_OUT_OF_MAP
#define P_OUT_OF_MAP
Definition: map.h:250
CFAPI_MAP_PROP_NAME
#define CFAPI_MAP_PROP_NAME
Definition: plugin.h:253
hashtable.h
cf_map_set_string_property
void cf_map_set_string_property(mapstruct *map, int propcode, const char *value)
Definition: plugin_common.c:295
diamondslots.message
string message
Definition: diamondslots.py:57
llevInfo
@ llevInfo
Definition: logger.h:12
Map_GetMessage
static PyObject * Map_GetMessage(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:151
NDI_UNIQUE
#define NDI_UNIQUE
Definition: newclient.h:262
Crossfire_Map::valid
int valid
Definition: cfpython_map.h:35
Map_Insert
static PyObject * Map_Insert(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.c:263
ptr_assoc_table
ptr_assoc * ptr_assoc_table[PTR_ASSOC_TABLESIZE]
Definition: hashtable.h:15
Map_GetPath
static PyObject * Map_GetPath(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:85
cf_map_trigger_connected
void cf_map_trigger_connected(objectlink *ol, object *cause, int state)
Definition: plugin_common.c:1018
Map_TriggerConnected
static PyObject * Map_TriggerConnected(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.c:318
Map_GetRegion
static PyObject * Map_GetRegion(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:157
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)
give.op
op
Definition: give.py:33
autojail.value
value
Definition: autojail.py:6
Map_ChangeLight
static PyObject * Map_ChangeLight(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.c:293
diamondslots.y
y
Definition: diamondslots.py:16
Map_Check
static PyObject * Map_Check(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.c:233
castle_read.key
key
Definition: castle_read.py:64
Map_Next
static PyObject * Map_Next(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.c:257
MapMethods
static PyMethodDef MapMethods[]
Definition: cfpython_map.c:484
cf_map_get_difficulty
int cf_map_get_difficulty(mapstruct *map)
Definition: plugin_common.c:1370
quest.state
state
Definition: quest.py:13
cf_map_get_darkness
int cf_map_get_darkness(mapstruct *map)
Definition: plugin_common.c:1386
cf_map_get_map
mapstruct * cf_map_get_map(const char *name, int flags)
Definition: plugin_common.c:925
Map_GetResetTimeout
static PyObject * Map_GetResetTimeout(Crossfire_Map *whoptr, void *closure)
Definition: cfpython_map.c:109
oblnk
Definition: object.h:446
find_assoc_value
void * find_assoc_value(ptr_assoc **hash_table, void *key)
Definition: hashtable.c:204
Map_GetFirstObjectAt
static PyObject * Map_GetFirstObjectAt(Crossfire_Map *map, PyObject *args)
Definition: cfpython_map.c:197
Crossfire_Map
Definition: cfpython_map.h:32
Crossfire_ObjectType
PyTypeObject Crossfire_ObjectType
Map_getseters
static PyGetSetDef Map_getseters[]
Definition: cfpython_map.c:464
cf_map_find_by_archetype_name
object * cf_map_find_by_archetype_name(const char *str, mapstruct *map, int nx, int ny)
Definition: plugin_common.c:1361
cf_map_get_width
int cf_map_get_width(mapstruct *map)
Definition: plugin_common.c:1390
cf_map_change_light
int cf_map_change_light(mapstruct *m, int change)
Definition: plugin_common.c:1410
llevDebug
@ llevDebug
Definition: logger.h:13
is_valid_types_gen.type
list type
Definition: is_valid_types_gen.py:25
Crossfire_Map_dealloc
static void Crossfire_Map_dealloc(PyObject *obj)
Definition: cfpython_map.c:422
Crossfire_MapType
PyTypeObject Crossfire_MapType