Beispiel #1
0
static PyObject *
iobase_flush(PyObject *self, PyObject *args)
{
    /* XXX Should this return the number of bytes written??? */
    if (IS_CLOSED(self)) {
        PyErr_SetString(PyExc_ValueError, "I/O operation on closed file.");
        return NULL;
    }
    Py_RETURN_NONE;
}
Beispiel #2
0
int	VALID_EDGE(room_rnum x, int y)
{
	if (world[x].dir_option[y] == NULL || TOROOM(x, y) == NOWHERE)
		return 0;
	if (track_through_doors == FALSE && IS_CLOSED(x, y))
		return 0;
	if (ROOM_FLAGGED(TOROOM(x, y), ROOM_NOTRACK) || IS_MARKED(TOROOM(x, y)))
		return 0;

	return 1;
}
Beispiel #3
0
static PyObject *
_io__IOBase_flush_impl(PyObject *self)
/*[clinic end generated code: output=7cef4b4d54656a3b input=773be121abe270aa]*/
{
    /* XXX Should this return the number of bytes written??? */
    if (IS_CLOSED(self)) {
        PyErr_SetString(PyExc_ValueError, "I/O operation on closed file.");
        return NULL;
    }
    Py_RETURN_NONE;
}
Beispiel #4
0
static int VALID_EDGE(room_rnum x, int y)
{
  if (world[x].dir_option[y] == NULL || TOROOM(x, y) == NOWHERE)
    return 0;
  if (CONFIG_TRACK_T_DOORS == FALSE && IS_CLOSED(x, y))
    return 0;
  if (ROOM_FLAGGED(TOROOM(x, y), ROOM_NOTRACK) || IS_MARKED(TOROOM(x, y)))
    return 0;

  return 1;
}
Beispiel #5
0
static PyObject *
iobase_close(PyObject *self, PyObject *args)
{
    PyObject *res;

    if (IS_CLOSED(self))
        Py_RETURN_NONE;

    res = PyObject_CallMethodObjArgs(self, _PyIO_str_flush, NULL);
    PyObject_SetAttrString(self, "__IOBase_closed", Py_True);
    if (res == NULL) {
        return NULL;
    }
    Py_XDECREF(res);
    Py_RETURN_NONE;
}
Beispiel #6
0
int VALID_EDGE(room_rnum x, int y, int edge_range, int through_doors)
{
	if (world[x]->dir_option[y] == NULL || TOROOM(x, y) == NOWHERE)
		return 0;

	// Попытка уползти в другую зону
	if (edge_range == EDGE_ZONE && (world[x]->zone != world[TOROOM(x, y)]->zone))
		return 0;

	if (through_doors == FALSE && IS_CLOSED(x, y))
		return 0;

	if (ROOM_FLAGGED(TOROOM(x, y), ROOM_NOTRACK) || IS_MARKED(TOROOM(x, y)))
		return 0;

	return 1;
}
Beispiel #7
0
static PyObject *
iobase_close(PyObject *self, PyObject *args)
{
    PyObject *res;
    _Py_IDENTIFIER(__IOBase_closed);

    if (IS_CLOSED(self))
        Py_RETURN_NONE;

    res = PyObject_CallMethodObjArgs(self, _PyIO_str_flush, NULL);
    _PyObject_SetAttrId(self, &PyId___IOBase_closed, Py_True);
    if (res == NULL) {
        return NULL;
    }
    Py_XDECREF(res);
    Py_RETURN_NONE;
}
Beispiel #8
0
static PyObject *
_io__IOBase_close_impl(PyObject *self)
/*[clinic end generated code: output=63c6a6f57d783d6d input=f4494d5c31dbc6b7]*/
{
    PyObject *res;

    if (IS_CLOSED(self))
        Py_RETURN_NONE;

    res = PyObject_CallMethodObjArgs(self, _PyIO_str_flush, NULL);

    if (_PyObject_SetAttrId(self, &PyId___IOBase_closed, Py_True) < 0) {
        Py_XDECREF(res);
        return NULL;
    }

    if (res == NULL)
        return NULL;

    Py_DECREF(res);
    Py_RETURN_NONE;
}
Beispiel #9
0
static PyObject *
iobase_closed_get(PyObject *self, void *context)
{
    return PyBool_FromLong(IS_CLOSED(self));
}
Beispiel #10
0
void hunt_victim(struct char_data * ch)
{
  extern struct char_data *character_list;
  ACMD(do_open);

  int dir;
  byte found;
  struct char_data *tmp;
  struct char_data *hunted_ch;
  char abuf[80];
  char doorname[80];

  if (!ch || !HUNTING(ch) || AFF2_FLAGGED(ch, AFF2_MINOR_PARALIZED) || AFF_FLAGGED(ch, AFF_MAJOR_PARALIZED)) {
    return;
  }

  hunted_ch = find_hunted_char(HUNTING(ch));
  /* make sure the char still exists */
  for (found = 0, tmp = character_list; tmp && !found && hunted_ch; tmp = tmp->next) {
    if (HUNTING(ch) == GET_IDNUM(tmp)) {
      found = 1;
    }
  }

  if (!found) {
    act("$n says, 'Damn!  My prey is gone!!'", TRUE, ch, 0, 0, TO_ROOM);
    /* don't forget vict until they die or I am dead
     HUNTING(ch) = 0;
     */
    return;
  }

  /* dez 19980805
   if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_SENTINEL)) {
   dir = find_first_step(ch->in_room, hunted_ch->in_room, 2);
   } else if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_STAY_ZONE)) {
   */

  if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_STAY_ZONE)) {
    dir = find_first_step(ch->in_room, hunted_ch->in_room, 1);
  } else {
    dir = find_first_step(ch->in_room, hunted_ch->in_room, 0);
  }

  if (dir < 0) {
    sprintf(buf, "$n says 'Damn!  Lost %s!'", HMHR(hunted_ch));
    act(buf, TRUE, ch, 0, 0, TO_ROOM);
    /* don't forget vict until they die or I am dead
     HUNTING(ch) = 0;
     */
    return;
  } else {
    if (IS_CLOSED(ch->in_room, dir)) {
      one_argument(EXIT(ch, dir)->keyword, doorname);
      sprintf(abuf, "%s %s", doorname, dirs[dir]);
      do_open(ch, abuf, 0, 0);
    }
    perform_move(ch, dir, 1);
    if (ch->in_room == hunted_ch->in_room && !ROOM_FLAGGED(hunted_ch->in_room, ROOM_PEACEFUL)) {
      if (CAN_SEE(ch, hunted_ch)) {
        hit(ch, hunted_ch, TYPE_UNDEFINED);
      }
    }
    return;
  }
}