| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
#include <cfpython.h> |
| 31 |
#include <hashtable.h> |
| 32 |
|
| 33 |
|
| 34 |
static ptr_assoc_table map_assoc_table; |
| 35 |
|
| 36 |
|
| 37 |
void init_map_assoc_table(void) { |
| 38 |
init_ptr_assoc_table(map_assoc_table); |
| 39 |
} |
| 40 |
|
| 41 |
static void add_map_assoc(mapstruct *key, Crossfire_Map *value) { |
| 42 |
add_ptr_assoc(map_assoc_table, key, value); |
| 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) { |
| 50 |
free_ptr_assoc(map_assoc_table, key); |
| 51 |
} |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
static void ensure_map_in_memory(Crossfire_Map *map) { |
| 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 |
|
| 61 |
if (is_unique) { |
| 62 |
char* tmp = strdup(mapname); |
| 63 |
if (!tmp) { |
| 64 |
|
| 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 |
|
| 72 |
|
| 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 |
MAPEXISTCHECK(whoptr); |
| 81 |
return Py_BuildValue("i", cf_map_get_difficulty(whoptr->map)); |
| 82 |
} |
| 83 |
|
| 84 |
static PyObject *Map_GetPath(Crossfire_Map *whoptr, void *closure) { |
| 85 |
MAPEXISTCHECK(whoptr); |
| 86 |
return Py_BuildValue("s", cf_map_get_sstring_property(whoptr->map, CFAPI_MAP_PROP_PATH)); |
| 87 |
} |
| 88 |
|
| 89 |
static PyObject *Map_GetTempName(Crossfire_Map *whoptr, void *closure) { |
| 90 |
MAPEXISTCHECK(whoptr); |
| 91 |
return Py_BuildValue("s", cf_map_get_sstring_property(whoptr->map, CFAPI_MAP_PROP_TMPNAME)); |
| 92 |
} |
| 93 |
|
| 94 |
static PyObject *Map_GetName(Crossfire_Map *whoptr, void *closure) { |
| 95 |
MAPEXISTCHECK(whoptr); |
| 96 |
return Py_BuildValue("s", cf_map_get_sstring_property(whoptr->map, CFAPI_MAP_PROP_NAME)); |
| 97 |
} |
| 98 |
|
| 99 |
static PyObject *Map_GetResetTime(Crossfire_Map *whoptr, void *closure) { |
| 100 |
MAPEXISTCHECK(whoptr); |
| 101 |
return Py_BuildValue("i", cf_map_get_reset_time(whoptr->map)); |
| 102 |
} |
| 103 |
|
| 104 |
static PyObject *Map_GetResetTimeout(Crossfire_Map *whoptr, void *closure) { |
| 105 |
MAPEXISTCHECK(whoptr); |
| 106 |
return Py_BuildValue("i", cf_map_get_reset_timeout(whoptr->map)); |
| 107 |
} |
| 108 |
|
| 109 |
static PyObject *Map_GetPlayers(Crossfire_Map *whoptr, void *closure) { |
| 110 |
MAPEXISTCHECK(whoptr); |
| 111 |
return Py_BuildValue("i", cf_map_get_players(whoptr->map)); |
| 112 |
} |
| 113 |
|
| 114 |
static PyObject *Map_GetDarkness(Crossfire_Map *whoptr, void *closure) { |
| 115 |
MAPEXISTCHECK(whoptr); |
| 116 |
return Py_BuildValue("i", cf_map_get_darkness(whoptr->map)); |
| 117 |
} |
| 118 |
|
| 119 |
static PyObject *Map_GetWidth(Crossfire_Map *whoptr, void *closure) { |
| 120 |
MAPEXISTCHECK(whoptr); |
| 121 |
return Py_BuildValue("i", cf_map_get_width(whoptr->map)); |
| 122 |
} |
| 123 |
|
| 124 |
static PyObject *Map_GetHeight(Crossfire_Map *whoptr, void *closure) { |
| 125 |
MAPEXISTCHECK(whoptr); |
| 126 |
return Py_BuildValue("i", cf_map_get_height(whoptr->map)); |
| 127 |
} |
| 128 |
|
| 129 |
static PyObject *Map_GetEnterX(Crossfire_Map *whoptr, void *closure) { |
| 130 |
MAPEXISTCHECK(whoptr); |
| 131 |
return Py_BuildValue("i", cf_map_get_enter_x(whoptr->map)); |
| 132 |
} |
| 133 |
|
| 134 |
static PyObject *Map_GetEnterY(Crossfire_Map *whoptr, void *closure) { |
| 135 |
MAPEXISTCHECK(whoptr); |
| 136 |
return Py_BuildValue("i", cf_map_get_enter_y(whoptr->map)); |
| 137 |
} |
| 138 |
|
| 139 |
static PyObject *Map_GetMessage(Crossfire_Map *whoptr, void *closure) { |
| 140 |
MAPEXISTCHECK(whoptr); |
| 141 |
return Py_BuildValue("s", cf_map_get_sstring_property(whoptr->map, CFAPI_MAP_PROP_MESSAGE)); |
| 142 |
} |
| 143 |
|
| 144 |
static PyObject *Map_GetRegion(Crossfire_Map *whoptr, void *closure) { |
| 145 |
MAPEXISTCHECK(whoptr); |
| 146 |
return Crossfire_Region_wrap(cf_map_get_region_property(whoptr->map, CFAPI_MAP_PROP_REGION)); |
| 147 |
} |
| 148 |
|
| 149 |
static int Map_SetPath(Crossfire_Map *whoptr, PyObject *value, void *closure) { |
| 150 |
const char *val; |
| 151 |
|
| 152 |
MAPEXISTCHECK_INT(whoptr); |
| 153 |
if (!PyArg_Parse(value, "s", &val)) |
| 154 |
return -1; |
| 155 |
|
| 156 |
cf_map_set_string_property(whoptr->map, CFAPI_MAP_PROP_PATH, val); |
| 157 |
return 0; |
| 158 |
|
| 159 |
} |
| 160 |
|
| 161 |
static PyObject *Map_GetUnique(Crossfire_Map *whoptr, void *closure) { |
| 162 |
MAPEXISTCHECK(whoptr); |
| 163 |
return Py_BuildValue("i", cf_map_get_int_property(whoptr->map, CFAPI_MAP_PROP_UNIQUE)); |
| 164 |
} |
| 165 |
|
| 166 |
static PyObject *Map_Message(Crossfire_Map *map, PyObject *args) { |
| 167 |
int color = NDI_BLUE|NDI_UNIQUE; |
| 168 |
char *message; |
| 169 |
|
| 170 |
if (!PyArg_ParseTuple(args, "s|i", &message, &color)) |
| 171 |
return NULL; |
| 172 |
|
| 173 |
MAPEXISTCHECK(map); |
| 174 |
|
| 175 |
cf_map_message(map->map, message, color); |
| 176 |
|
| 177 |
Py_INCREF(Py_None); |
| 178 |
return Py_None; |
| 179 |
} |
| 180 |
|
| 181 |
static PyObject *Map_GetFirstObjectAt(Crossfire_Map *map, PyObject *args) { |
| 182 |
int x, y; |
| 183 |
object *val; |
| 184 |
|
| 185 |
if (!PyArg_ParseTuple(args, "ii", &x, &y)) |
| 186 |
return NULL; |
| 187 |
|
| 188 |
MAPEXISTCHECK(map); |
| 189 |
|
| 190 |
|
| 191 |
ensure_map_in_memory(map); |
| 192 |
|
| 193 |
val = cf_map_get_object_at(map->map, x, y); |
| 194 |
return Crossfire_Object_wrap(val); |
| 195 |
} |
| 196 |
|
| 197 |
static PyObject *Map_CreateObject(Crossfire_Map *map, PyObject *args) { |
| 198 |
char *txt; |
| 199 |
int x, y; |
| 200 |
object *op; |
| 201 |
|
| 202 |
if (!PyArg_ParseTuple(args, "sii", &txt, &x, &y)) |
| 203 |
return NULL; |
| 204 |
|
| 205 |
MAPEXISTCHECK(map); |
| 206 |
|
| 207 |
|
| 208 |
ensure_map_in_memory(map); |
| 209 |
|
| 210 |
op = cf_create_object_by_name(txt); |
| 211 |
|
| 212 |
if (op) |
| 213 |
op = cf_map_insert_object(map->map, op, x, y); |
| 214 |
return Crossfire_Object_wrap(op); |
| 215 |
} |
| 216 |
|
| 217 |
static PyObject *Map_Check(Crossfire_Map *map, PyObject *args) { |
| 218 |
char *what; |
| 219 |
int x, y; |
| 220 |
object *foundob; |
| 221 |
int16_t nx, ny; |
| 222 |
int mflags; |
| 223 |
|
| 224 |
if (!PyArg_ParseTuple(args, "s(ii)", &what, &x, &y)) |
| 225 |
return NULL; |
| 226 |
|
| 227 |
MAPEXISTCHECK(map); |
| 228 |
|
| 229 |
|
| 230 |
ensure_map_in_memory(map); |
| 231 |
|
| 232 |
mflags = cf_map_get_flags(map->map, &(map->map), (int16_t)x, (int16_t)y, &nx, &ny); |
| 233 |
if (mflags&P_OUT_OF_MAP) { |
| 234 |
Py_INCREF(Py_None); |
| 235 |
return Py_None; |
| 236 |
} |
| 237 |
foundob = cf_map_find_by_archetype_name(what, map->map, nx, ny); |
| 238 |
return Crossfire_Object_wrap(foundob); |
| 239 |
} |
| 240 |
|
| 241 |
static PyObject *Map_Next(Crossfire_Map *map, PyObject *args) { |
| 242 |
MAPEXISTCHECK(map); |
| 243 |
return Crossfire_Map_wrap(cf_map_get_map_property(map->map, CFAPI_MAP_PROP_NEXT)); |
| 244 |
} |
| 245 |
|
| 246 |
static PyObject *Map_Insert(Crossfire_Map *map, PyObject *args) { |
| 247 |
int x, y; |
| 248 |
Crossfire_Object *what; |
| 249 |
|
| 250 |
if (!PyArg_ParseTuple(args, "O!ii", &Crossfire_ObjectType, &what, &x, &y)) |
| 251 |
return NULL; |
| 252 |
|
| 253 |
MAPEXISTCHECK(map); |
| 254 |
|
| 255 |
|
| 256 |
ensure_map_in_memory(map); |
| 257 |
|
| 258 |
return Crossfire_Object_wrap(cf_map_insert_object(map->map, what->obj, x, y)); |
| 259 |
} |
| 260 |
|
| 261 |
static PyObject *Map_InsertAround(Crossfire_Map *map, PyObject *args) { |
| 262 |
int x, y; |
| 263 |
Crossfire_Object *what; |
| 264 |
|
| 265 |
if (!PyArg_ParseTuple(args, "O!ii", &Crossfire_ObjectType, &what, &x, &y)) |
| 266 |
return NULL; |
| 267 |
|
| 268 |
MAPEXISTCHECK(map); |
| 269 |
|
| 270 |
|
| 271 |
ensure_map_in_memory(map); |
| 272 |
|
| 273 |
return Crossfire_Object_wrap(cf_map_insert_object_around(map->map, what->obj, x, y)); |
| 274 |
} |
| 275 |
|
| 276 |
static PyObject *Map_ChangeLight(Crossfire_Map *map, PyObject *args) { |
| 277 |
int change; |
| 278 |
|
| 279 |
if (!PyArg_ParseTuple(args, "i", &change)) |
| 280 |
return NULL; |
| 281 |
|
| 282 |
MAPEXISTCHECK(map); |
| 283 |
|
| 284 |
return Py_BuildValue("i", cf_map_change_light(map->map, change)); |
| 285 |
} |
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
static PyObject *Map_TriggerConnected(Crossfire_Map *map, PyObject *args) { |
| 302 |
objectlink *ol = NULL; |
| 303 |
int connected; |
| 304 |
int state; |
| 305 |
Crossfire_Object *cause = NULL; |
| 306 |
oblinkpt *olp; |
| 307 |
|
| 308 |
if (!PyArg_ParseTuple(args, "ii|O!", &connected, &state, &Crossfire_ObjectType, &cause)) |
| 309 |
return NULL; |
| 310 |
|
| 311 |
MAPEXISTCHECK(map); |
| 312 |
|
| 313 |
|
| 314 |
ensure_map_in_memory(map); |
| 315 |
|
| 316 |
|
| 317 |
if (!map->map->buttons) { |
| 318 |
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); |
| 319 |
PyErr_SetString(PyExc_ReferenceError, "No objects connected to that ID on this map."); |
| 320 |
return NULL; |
| 321 |
} |
| 322 |
for (olp = map->map->buttons; olp; olp = olp->next) { |
| 323 |
if (olp->value == connected) { |
| 324 |
ol = olp->link; |
| 325 |
break; |
| 326 |
} |
| 327 |
} |
| 328 |
if (ol == NULL) { |
| 329 |
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); |
| 330 |
|
| 331 |
PyErr_SetString(PyExc_ReferenceError, "No objects with that connection ID on this map."); |
| 332 |
return NULL; |
| 333 |
} |
| 334 |
|
| 335 |
cf_map_trigger_connected(ol, cause ? cause->obj : NULL, state); |
| 336 |
|
| 337 |
Py_INCREF(Py_None); |
| 338 |
return Py_None; |
| 339 |
} |
| 340 |
|
| 341 |
static int Map_InternalCompare(Crossfire_Map *left, Crossfire_Map *right) { |
| 342 |
MAPEXISTCHECK_INT(left); |
| 343 |
MAPEXISTCHECK_INT(right); |
| 344 |
return left->map < right->map ? -1 : (left->map == right->map ? 0 : 1); |
| 345 |
} |
| 346 |
|
| 347 |
static PyObject *Crossfire_Map_RichCompare(Crossfire_Map *left, Crossfire_Map *right, int op) { |
| 348 |
int result; |
| 349 |
if (!left |
| 350 |
|| !right |
| 351 |
|| !PyObject_TypeCheck((PyObject*)left, &Crossfire_MapType) |
| 352 |
|| !PyObject_TypeCheck((PyObject*)right, &Crossfire_MapType)) { |
| 353 |
Py_INCREF(Py_NotImplemented); |
| 354 |
return Py_NotImplemented; |
| 355 |
} |
| 356 |
result = Map_InternalCompare(left, right); |
| 357 |
|
| 358 |
if (result == -1 && PyErr_Occurred()) |
| 359 |
return NULL; |
| 360 |
|
| 361 |
switch (op) { |
| 362 |
case Py_EQ: |
| 363 |
result = (result == 0); |
| 364 |
break; |
| 365 |
case Py_NE: |
| 366 |
result = (result != 0); |
| 367 |
break; |
| 368 |
case Py_LE: |
| 369 |
result = (result <= 0); |
| 370 |
break; |
| 371 |
case Py_GE: |
| 372 |
result = (result >= 0); |
| 373 |
break; |
| 374 |
case Py_LT: |
| 375 |
result = (result == -1); |
| 376 |
break; |
| 377 |
case Py_GT: |
| 378 |
result = (result == 1); |
| 379 |
break; |
| 380 |
} |
| 381 |
return PyBool_FromLong(result); |
| 382 |
} |
| 383 |
|
| 384 |
|
| 385 |
static PyObject *Crossfire_Map_Long(PyObject *obj) { |
| 386 |
MAPEXISTCHECK((Crossfire_Map *)obj); |
| 387 |
return Py_BuildValue("l", ((Crossfire_Map *)obj)->map); |
| 388 |
} |
| 389 |
|
| 390 |
#ifndef IS_PY3K |
| 391 |
static PyObject *Crossfire_Map_Int(PyObject *obj) { |
| 392 |
MAPEXISTCHECK((Crossfire_Map *)obj); |
| 393 |
return Py_BuildValue("i", ((Crossfire_Map *)obj)->map); |
| 394 |
} |
| 395 |
#endif |
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
static PyObject *Crossfire_Map_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { |
| 401 |
Crossfire_Map *self; |
| 402 |
|
| 403 |
self = (Crossfire_Map *)type->tp_alloc(type, 0); |
| 404 |
if (self) |
| 405 |
self->map = NULL; |
| 406 |
|
| 407 |
return (PyObject *)self; |
| 408 |
} |
| 409 |
|
| 410 |
static void Crossfire_Map_dealloc(PyObject *obj) { |
| 411 |
Crossfire_Map *self; |
| 412 |
|
| 413 |
self = (Crossfire_Map *)obj; |
| 414 |
if (self) { |
| 415 |
if (self->map && self->valid) { |
| 416 |
free_map_assoc(self->map); |
| 417 |
} |
| 418 |
Py_TYPE(self)->tp_free(obj); |
| 419 |
} |
| 420 |
} |
| 421 |
|
| 422 |
void Handle_Map_Unload_Hook(Crossfire_Map *map) { |
| 423 |
map->valid = 0; |
| 424 |
free_map_assoc(map->map); |
| 425 |
} |
| 426 |
|
| 427 |
PyObject *Crossfire_Map_wrap(mapstruct *what) { |
| 428 |
Crossfire_Map *wrapper; |
| 429 |
|
| 430 |
|
| 431 |
if (what == NULL) { |
| 432 |
Py_INCREF(Py_None); |
| 433 |
return Py_None; |
| 434 |
} |
| 435 |
|
| 436 |
wrapper = (Crossfire_Map *)find_assoc_pymap(what); |
| 437 |
if (!wrapper) { |
| 438 |
wrapper = PyObject_NEW(Crossfire_Map, &Crossfire_MapType); |
| 439 |
if (wrapper != NULL) { |
| 440 |
wrapper->map = what; |
| 441 |
wrapper->valid = 1; |
| 442 |
add_map_assoc(what, wrapper); |
| 443 |
} |
| 444 |
} else { |
| 445 |
Py_INCREF(wrapper); |
| 446 |
} |
| 447 |
|
| 448 |
return (PyObject *)wrapper; |
| 449 |
} |
| 450 |
|
| 451 |
|
| 452 |
static PyGetSetDef Map_getseters[] = { |
| 453 |
{ "Difficulty", (getter)Map_GetDifficulty, NULL, NULL, NULL }, |
| 454 |
{ "Path", (getter)Map_GetPath, (setter)Map_SetPath, NULL, NULL }, |
| 455 |
{ "TempName", (getter)Map_GetTempName, NULL, NULL, NULL }, |
| 456 |
{ "Name", (getter)Map_GetName, NULL, NULL, NULL }, |
| 457 |
{ "ResetTime", (getter)Map_GetResetTime, NULL, NULL, NULL }, |
| 458 |
{ "ResetTimeout", (getter)Map_GetResetTimeout, NULL, NULL, NULL }, |
| 459 |
{ "Players", (getter)Map_GetPlayers, NULL, NULL, NULL }, |
| 460 |
{ "Light", (getter)Map_GetDarkness, NULL, NULL, NULL }, |
| 461 |
{ "Darkness", (getter)Map_GetDarkness, NULL, NULL, NULL }, |
| 462 |
{ "Width", (getter)Map_GetWidth, NULL, NULL, NULL }, |
| 463 |
{ "Height", (getter)Map_GetHeight, NULL, NULL, NULL }, |
| 464 |
{ "EnterX", (getter)Map_GetEnterX, NULL, NULL, NULL }, |
| 465 |
{ "EnterY", (getter)Map_GetEnterY, NULL, NULL, NULL }, |
| 466 |
{ "Message", (getter)Map_GetMessage, NULL, NULL, NULL }, |
| 467 |
{ "Region", (getter)Map_GetRegion, NULL, NULL, NULL }, |
| 468 |
{ "Unique", (getter)Map_GetUnique, NULL, NULL, NULL }, |
| 469 |
{ NULL, NULL, NULL, NULL, NULL } |
| 470 |
}; |
| 471 |
|
| 472 |
static PyMethodDef MapMethods[] = { |
| 473 |
{ "Print", (PyCFunction)Map_Message, METH_VARARGS, NULL }, |
| 474 |
{ "ObjectAt", (PyCFunction)Map_GetFirstObjectAt, METH_VARARGS, NULL }, |
| 475 |
{ "CreateObject", (PyCFunction)Map_CreateObject, METH_VARARGS, NULL }, |
| 476 |
{ "Check", (PyCFunction)Map_Check, METH_VARARGS, NULL }, |
| 477 |
{ "Next", (PyCFunction)Map_Next, METH_NOARGS, NULL }, |
| 478 |
{ "Insert", (PyCFunction)Map_Insert, METH_VARARGS, NULL }, |
| 479 |
{ "InsertAround", (PyCFunction)Map_InsertAround, METH_VARARGS, NULL }, |
| 480 |
{ "ChangeLight", (PyCFunction)Map_ChangeLight, METH_VARARGS, NULL }, |
| 481 |
{ "TriggerConnected", (PyCFunction)Map_TriggerConnected, METH_VARARGS, NULL }, |
| 482 |
{ NULL, NULL, 0, NULL } |
| 483 |
}; |
| 484 |
|
| 485 |
static PyNumberMethods MapConvert = { |
| 486 |
NULL, |
| 487 |
NULL, |
| 488 |
NULL, |
| 489 |
#ifndef IS_PY3K |
| 490 |
NULL, |
| 491 |
#endif |
| 492 |
NULL, |
| 493 |
NULL, |
| 494 |
NULL, |
| 495 |
NULL, |
| 496 |
NULL, |
| 497 |
NULL, |
| 498 |
#ifdef IS_PY3K |
| 499 |
NULL, |
| 500 |
#else |
| 501 |
NULL, |
| 502 |
#endif |
| 503 |
NULL, |
| 504 |
NULL, |
| 505 |
NULL, |
| 506 |
NULL, |
| 507 |
NULL, |
| 508 |
NULL, |
| 509 |
#ifndef IS_PY3K |
| 510 |
NULL, |
| 511 |
#endif |
| 512 |
#ifdef IS_PY3K |
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
Crossfire_Map_Long, |
| 517 |
NULL, |
| 518 |
#else |
| 519 |
Crossfire_Map_Int, |
| 520 |
Crossfire_Map_Long, |
| 521 |
#endif |
| 522 |
NULL, |
| 523 |
#ifndef IS_PY3K |
| 524 |
NULL, |
| 525 |
NULL, |
| 526 |
#endif |
| 527 |
NULL, |
| 528 |
NULL, |
| 529 |
NULL, |
| 530 |
#ifndef IS_PY3K |
| 531 |
NULL, |
| 532 |
#endif |
| 533 |
NULL, |
| 534 |
NULL, |
| 535 |
NULL, |
| 536 |
NULL, |
| 537 |
NULL, |
| 538 |
NULL, |
| 539 |
NULL, |
| 540 |
|
| 541 |
NULL, |
| 542 |
NULL, |
| 543 |
NULL, |
| 544 |
NULL, |
| 545 |
#if defined(IS_PY25) || defined(IS_PY3K) |
| 546 |
NULL |
| 547 |
#endif |
| 548 |
}; |
| 549 |
|
| 550 |
|
| 551 |
PyTypeObject Crossfire_MapType = { |
| 552 |
#ifdef IS_PY3K |
| 553 |
|
| 554 |
PyVarObject_HEAD_INIT(NULL, 0) |
| 555 |
#else |
| 556 |
PyObject_HEAD_INIT(NULL) |
| 557 |
0, |
| 558 |
#endif |
| 559 |
"Crossfire.Map", |
| 560 |
sizeof(Crossfire_Map), |
| 561 |
0, |
| 562 |
Crossfire_Map_dealloc, |
| •563 |
0, |
| 564 |
NULL, |
| 565 |
NULL, |
| 566 |
#ifdef IS_PY3K |
| 567 |
NULL, |
| 568 |
#else |
| 569 |
(cmpfunc)Map_InternalCompare, |
| 570 |
#endif |
| 571 |
NULL, |
| 572 |
&MapConvert, |
| 573 |
NULL, |
| 574 |
NULL, |
| 575 |
PyObject_HashNotImplemented, |
| 576 |
NULL, |
| 577 |
NULL, |
| 578 |
PyObject_GenericGetAttr, |
| 579 |
PyObject_GenericSetAttr, |
| 580 |
NULL, |
| 581 |
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, |
| 582 |
"Crossfire maps", |
| 583 |
NULL, |
| 584 |
NULL, |
| 585 |
(richcmpfunc)Crossfire_Map_RichCompare, |
| 586 |
0, |
| 587 |
NULL, |
| 588 |
NULL, |
| 589 |
MapMethods, |
| 590 |
NULL, |
| 591 |
Map_getseters, |
| 592 |
NULL, |
| 593 |
NULL, |
| 594 |
NULL, |
| 595 |
NULL, |
| 596 |
0, |
| 597 |
NULL, |
| 598 |
NULL, |
| 599 |
Crossfire_Map_new, |
| 600 |
NULL, |
| 601 |
NULL, |
| 602 |
NULL, |
| 603 |
NULL, |
| 604 |
NULL, |
| 605 |
NULL, |
| 606 |
NULL, |
| 607 |
NULL, |
| 608 |
}; |