当前位置: 首页>>代码示例>>C++>>正文


C++ Location函数代码示例

本文整理汇总了C++中Location函数的典型用法代码示例。如果您正苦于以下问题:C++ Location函数的具体用法?C++ Location怎么用?C++ Location使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Location函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: do_chown

/** Change an object's owner.
 * \verbatim
 * This implements @chown.
 * \endverbatim
 * \param player the enactor.
 * \param name name of object to change owner of.
 * \param newobj name of new owner for object.
 * \param preserve if 1, preserve privileges and don't halt the object.
 * \param pe_info the pe_info for lock checks
 */
void
do_chown(dbref player, const char *name, const char *newobj, int preserve,
         NEW_PE_INFO *pe_info)
{
  dbref thing;
  dbref newowner = NOTHING;
  long match_flags = MAT_POSSESSION | MAT_HERE | MAT_EXIT | MAT_ABSOLUTE;


  /* check for '@chown <object>/<atr>=<player>'  */
  if (strchr(name, '/')) {
    do_atrchown(player, name, newobj);
    return;
  }
  if (Wizard(player))
    match_flags |= MAT_PLAYER;

  if ((thing = noisy_match_result(player, name, TYPE_THING, match_flags))
      == NOTHING)
    return;

  if (!*newobj || !strcasecmp(newobj, "me")) {
    newowner = player;
  } else {
    if ((newowner = lookup_player(newobj)) == NOTHING) {
      notify(player, T("I couldn't find that player."));
      return;
    }
  }

  if (IsPlayer(thing) && !God(player)) {
    notify(player, T("Players always own themselves."));
    return;
  }
  /* Permissions checking */
  if (!chown_ok(player, thing, newowner, pe_info)) {
    notify(player, T("Permission denied."));
    return;
  }
  if (IsThing(thing) && !Hasprivs(player) &&
      !(GoodObject(Location(thing)) && (Location(thing) == player))) {
    notify(player, T("You must carry the object to @chown it."));
    return;
  }
  if (preserve && !Wizard(player)) {
    notify(player, T("You cannot @CHOWN/PRESERVE. Use normal @CHOWN."));
    return;
  }
  /* chowns to the zone master don't count towards fees */
  if (!ZMaster(newowner)) {
    /* Debit the owner-to-be */
    if (!can_pay_fees(newowner, Pennies(thing))) {
      /* not enough money or quota */
      if (newowner != player)
        notify(player,
               T
               ("That player doesn't have enough money or quota to receive that object."));
      return;
    }
    /* Credit the current owner */
    giveto(Owner(thing), Pennies(thing));
    change_quota(Owner(thing), QUOTA_COST);
  }
  chown_object(player, thing, newowner, preserve);
  notify(player, T("Owner changed."));
}
开发者ID:FranticFanatic,项目名称:pennmush,代码行数:76,代码来源:set.c

示例2: Align

extern void Align( WPARAM wparam )
/********************************/
{
    /* Perform the requested alignment of current objects relative to the primary
     * object
     */
    OBJPTR   currobj;
    OBJPTR   primary;
    RECT     primrect;
    RECT     rect;
    BOOL     atleasttwo;
    POINT    offset;
    LIST     *objlist;

    primary = GetPrimaryObject();
    if( primary == NULL ) {
        return;
    }
    atleasttwo = FALSE;
    currobj = GetECurrObject();
    while( currobj != NULL && !atleasttwo ) {
        if( currobj != primary ) {
            atleasttwo = TRUE;
        } else {
            currobj = GetNextECurrObject( currobj );
        }
    }
    if( !atleasttwo ) {
        return;
    }
    if( !CheckMoveOperation( &objlist ) ) {
        return;
    }
    BeginMoveOperation( objlist );
    ListFree( objlist );
    currobj = GetECurrObject();
    primary = GetPrimaryObject();
    Location( primary, &primrect );
    while( currobj != NULL ) {
        if( currobj != primary ) {
            Location( currobj, &rect );
            switch( LOWORD( wparam ) ) {
            case IDM_FMLEFT:
                offset.x = primrect.left - rect.left;
                offset.y = 0;
                break;
            case IDM_FMHCENTRE:
                offset.x = ((primrect.right + primrect.left) / 2) -
                           ((rect.right + rect.left) / 2);
                offset.y = 0;
                break;
            case IDM_FMRIGHT:
                offset.x = primrect.right - rect.right;
                offset.y = 0;
                break;
            case IDM_FMTOP:
                offset.x = 0;
                offset.y = primrect.top - rect.top;
                break;
            case IDM_FMVCENTRE:
                offset.x = 0;
                offset.y = ((primrect.bottom + primrect.top) / 2) -
                           ((rect.bottom + rect.top) / 2);
                break;
            case IDM_FMBOTTOM:
                offset.x = 0;
                offset.y = primrect.bottom - rect.bottom;
                break;
            }
            Move( currobj, &offset, TRUE );
        }
        currobj = GetNextECurrObject( currobj );
    }
    FinishMoveOperation( TRUE );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:75,代码来源:align.c

示例3: Location

		static inline Location	bindingArrayElement	(deUint32 binding_, deUint32 arrayElement)
		{
			return Location(binding_, arrayElement);
		}
开发者ID:eth0047,项目名称:VK-GL-CTS,代码行数:4,代码来源:vkBuilderUtil.hpp

示例4: main

int main()
{
	{
		Location p1(0,0,0);
		Location p2(10,0,0);
		Location p3(0,0,10);

		Location p(10,0,0);

		interpolate(p1, p2, p3, p);

		assertEqual(p, Location(10,0,0));
	}
	{
		Location p1(0,0,0);
		Location p2(10,0,0);
		Location p3(0,0,10);

		Location p(1,0,1);

		interpolate(p1, p2, p3, p);

		assertEqual(p, Location(1,0,1));
	}
	{
		Location p1(0,2,0);
		Location p2(2,0,0);
		Location p3(0,0,2);

		Location p(1,0,0);

		interpolate(p1, p2, p3, p);

		assertEqual(p, Location(1,1,0));
	}
	{
		Location p1(0,2,0);
		Location p2(2,0,0);
		Location p3(0,0,2);

		Location p(0,0,1);

		interpolate(p1, p2, p3, p);

		assertEqual(p, Location(0,1,1));
	}
	{
		Location p1(0,2,0);
		Location p2(2,0,0);
		Location p3(0,0,2);

		Location p(0,0,1);

		interpolate(p1, p2, p3, p);

		assertEqual(p, Location(0,1,1));
	}
	{
		Location p1(0,2,0);
		Location p2(2,0,0);
		Location p3(0,0,2);

		Location p(FixedPoint(1,2),0,FixedPoint(1,2));

		interpolate(p1, p2, p3, p);

		assertEqual(p, Location(FixedPoint(1,2),1,FixedPoint(1,2)));
	}
}
开发者ID:soulaim,项目名称:worldofapo,代码行数:69,代码来源:interpolationtest.cpp

示例5: Location

Area Location::get_world_area_offset(int offset, int radius) {
  Area area;
  area.p1 = Location(this->x + offset, this->y + offset);
  area.p2 = Location((this->x  + offset) + radius, (this->y + offset) + radius);
  return area;
}
开发者ID:rlt3,项目名称:rogue,代码行数:6,代码来源:Location.cpp

示例6: MoveVal

MoveVal::MoveVal() : MoveVal(0, Location()) { }
开发者ID:Jasonkatz,项目名称:AI-Project-1,代码行数:1,代码来源:Utils.cpp

示例7: Y

 int Y() { int nY; return Location(nullptr, &nY) ? nY : -1; }
开发者ID:etorth,项目名称:mir2x,代码行数:1,代码来源:creature.hpp

示例8: give_thing

static void give_thing (dbref giver, dbref recipient, int key, char *what)
{
dbref	thing, loc;
char	*str, *sp;

	init_match(giver, what, TYPE_THING);
	match_possession();
	match_me();
	thing = match_result();

	switch (thing) {
	case NOTHING:
		notify(giver, "You don't have that!");
		return;
	case AMBIGUOUS:
		notify(giver, "I don't know which you mean!");
		return;
	}

	if (thing == giver) {
		notify(giver, "You can't give yourself away!");
		return;
	}

	if (((Typeof(thing) != TYPE_THING) &&
	     (Typeof(thing) != TYPE_PLAYER)) ||
	    !(Enter_ok(recipient) || controls(giver, recipient))) {
		notify(giver, "Permission denied.");
		return;
	}
	if ((Flags3(thing) & NOMOVE) && !Wizard(giver)) {
		notify(giver, "Permission denied.");
		return;
	}

	if (!could_doit(giver, thing, A_LGIVE,1)) {
		sp = str = alloc_lbuf("do_give.gfail");
		safe_str((char *)"You can't give ", str, &sp);
		safe_str(Name(thing), str, &sp);
		safe_str((char *)" away.", str, &sp);
		*sp = '\0';

		did_it(giver, thing, A_GFAIL, str, A_OGFAIL, NULL,
			A_AGFAIL, (char **)NULL, 0);
		free_lbuf(str);
		return;
	}
	if (!could_doit(thing, recipient, A_LRECEIVE,1)) {
		sp = str = alloc_lbuf("do_give.rfail");
		safe_str(Name(recipient), str, &sp);
		safe_str((char *)" doesn't want ", str, &sp);
		safe_str(Name(thing), str, &sp);
		safe_chr('.', str, &sp);
		*sp = '\0';

		did_it(giver, recipient, A_RFAIL, str, A_ORFAIL, NULL,
			A_ARFAIL, (char **)NULL, 0);
		free_lbuf(str);
		return;
	}
	loc = Location(giver);
	if ( !Good_obj(loc) || loc == NOTHING || loc == AMBIGUOUS || Recover(loc) || Going(loc) )
           loc = giver;
	if (!could_doit(giver, loc, A_LGIVETO, 1)) {
		sp = str = alloc_lbuf("do_giveto.rfail");
		safe_str((char *)"You can not give ", str, &sp);
		safe_str(Name(thing), str, &sp);
		safe_str((char *)" away at this location.", str, &sp);
		*sp = '\0';
		notify(giver, str);
		free_lbuf(str);
		return;
	}

	move_via_generic(thing, recipient, giver, 0);
	divest_object(thing);
	
	if (!(key & GIVE_QUIET)) {
		str = alloc_lbuf("do_give.thing.ok");
		strcpy(str, Name(giver));
		notify_with_cause(recipient, giver,
			unsafe_tprintf("%s gave you %s.", str, Name(thing)));
		notify(giver, "Given.");
		notify_with_cause(thing, giver,
			unsafe_tprintf("%s gave you to %s.", str, Name(recipient)));
		free_lbuf(str);
	}
	else {
		notify(giver, "Given. (quiet)");
	}
	did_it(giver, thing, A_DROP, NULL, A_ODROP, NULL, A_ADROP,
		(char **)NULL, 0);
	did_it(recipient, thing, A_SUCC, NULL, A_OSUCC, NULL, A_ASUCC,
		(char **)NULL, 0);
}
开发者ID:Haunted-Memories,项目名称:rhost,代码行数:95,代码来源:rob.c

示例9: Move

Move Board::RandomLegalMove (const Player& player) const {
	return Move(player,
			Location(_fast_field_map[Rand::next_rand(_moves_left)]));
}
开发者ID:lukaszlew,项目名称:MiMHex,代码行数:4,代码来源:board.cpp

示例10: emergency_eject

/* leave a flying ship through the escape pod */
void emergency_eject(dbref player)
{
  dbref nav, pad;
  hship *ship;
  hcelestial *cel, *min_cel;
  ATTR *a;
  char *r, *s;
  char buff[512];
  double dist, min_dist;
  dbref min_pad;
  hship *sptr, *min_ship;
  
  /* check for a BAY */
  a = atr_get(Location(player), "BAY");
  if (!a)
  {
    /* no BAY, see if we're next to the nav console */
    ship = find_ship(player);
    if (ship)
    {
      if (Location(ship->objnum) != Location(player))
      {
        notify(player, "You can't eject from here.");
        return;
      }
    }
  }
  else
  {
    /* there's a BAY, see if the ship is valid */
    nav = parse_dbref(atr_value(a));
    if (!IsShip(nav))
    {
      notify(player, "You can't eject from here.");
      return;
    }

    ship = find_ship_by_nav(nav);
  }
  
  if (!ship)
  {
    notify(player, "You can't eject from here.");
    return;
  }

  /* only eject when flying, not when landing or docking */
  if (!ship->uid || ship->landed || ship->docked)
  {
    notify(player, "You may only eject while flying.");
    return;
  }
  
  /* find a planet with a drop pad */
  min_pad = NOTHING;
  min_dist = 1000000.0;
  min_cel = NULL;
  for (cel = ship->uid->head_celestial; cel; cel = cel->next)
  {
    if (!HasFlag(cel->type, HS_PLANET))
      continue;
    
    pad = atr_parse_dbref(cel->objnum, "DROPPADS");
    if (!RealGoodObject(pad))
      continue;

    dist = ship_celestial_distance(ship, cel);

    if (dist < min_dist)
    {
      min_dist = dist;
      min_pad = pad;
      min_cel = cel;
    }
  }
  
  min_ship = NULL;
  for (sptr = ship->uid->head_ship; sptr; sptr = sptr->next)
  {
    if (min_cel)
      break;
    
    if (!HasFlag(sptr->type, HS_STATION | HS_CAPITAL))
      continue;
    
    pad = atr_parse_dbref(sptr->objnum, "BAY");
    if (!RealGoodObject(pad))
      continue;
    
    dist = ship_distance(ship, sptr);

    if (dist < min_dist)
    {
      min_cel = NULL;
      min_ship = sptr;
      min_dist = dist;
      min_pad = pad;
    }
  }
//.........这里部分代码省略.........
开发者ID:jrsteensen,项目名称:hspace3g,代码行数:101,代码来源:hscmds.c

示例11: do_kill

void do_kill (dbref player, dbref cause, int key, char *what, char *costchar)
{
dbref	victim;
char	*buf1, *buf2;
int	cost;

	init_match(player, what, TYPE_PLAYER);
	match_neighbor();
	match_me();
	match_here();
	if (Wizard(player)) {
		match_player();
		match_absolute();
	}
	victim = match_result();

	switch (victim) {
	case NOTHING:
		notify(player, "I don't see that player here.");
		break;
	case AMBIGUOUS:
		notify(player, "I don't know who you mean!");
		break;
	default:
		if ((Typeof(victim) != TYPE_PLAYER) &&
		    (Typeof(victim) != TYPE_THING)) {
			notify(player,
				"Sorry, you can only kill players and things.");
			break;
		}
		if ((Haven(Location(victim)) && !Wizard(player)) ||
		    (controls(victim, Location(victim)) &&
		     !controls(player, Location(victim))) ||
		    Immortal(victim)) {
			notify(player, "Sorry.");
			break;
		}
		if (key == KILL_SLAY) {
		  if (Builder(player) && Builder(victim)) {
			notify(player, "Sorry.");
			break;
		  }
		}

		/* go for it */

		cost = atoi(costchar);
		if (key == KILL_KILL) {
			if (HasPriv(victim,player,POWER_NOKILL,POWER4,NOTHING)) {
			  notify(player, "Sorry.");
			  break;
			}
			if (cost < mudconf.killmin)
				cost = mudconf.killmin;
			if (cost > mudconf.killmax)
				cost = mudconf.killmax;

			/* see if it works */

			if (!payfor(player, cost)) {
				notify(player,
					unsafe_tprintf("You don't have enough %s.",
						mudconf.many_coins));
				return;
			}
		} else {
			cost = 0;
		}

		if (!(((random() % mudconf.killguarantee) < cost) ||
		      (key == KILL_SLAY)) ||
		    Wizard(victim)) {

			/* Failure: notify player and victim only */

			notify(player, "Your murder attempt failed.");
			buf1 = alloc_lbuf("do_kill.failed");
			sprintf(buf1, "%s tried to kill you!", Name(player));
			notify_with_cause(victim, player, buf1);
			if (Suspect(player)) {
				strcpy(buf1, Name(player));
				if (player == Owner(player)) {
					raw_broadcast(0, WIZARD,
						"[Suspect] %s tried to kill %s(#%d).",
						buf1, Name(victim), victim);
				} else {
					buf2 = alloc_lbuf("do_kill.SUSP.failed");
					strcpy(buf2, Name(Owner(player)));
					raw_broadcast(0, WIZARD,
						"[Suspect] %s <via %s(#%d)> tried to kill %s(#%d).",
						buf2, buf1, player,
						Name(victim), victim);
					free_lbuf(buf2);
				}
			}
			free_lbuf(buf1);
			break;
		}

		/* Success!  You killed him */
//.........这里部分代码省略.........
开发者ID:Haunted-Memories,项目名称:rhost,代码行数:101,代码来源:rob.c

示例12: disembark

/* leave a landed/docked ship through the hatch */
void disembark(dbref player)
{
  dbref nav, obj, newobj;
  hship *ship;
  ATTR *a;
  int security;
  
  /* check if we can disembark from here */
  a = atr_get(Location(player), "BAY");
  if (!a)
  {
    /* no BAY, check if we're near the nav console */
    ship = find_ship(player);
    if (ship)
    {
      if (Location(ship->objnum) != Location(player))
      {
        notify(player, "You can't disembark from here.");
        return;
      }
    }
  }
  else
  {
    /* there's a BAY here, make sure it's a good one */
    nav = parse_dbref(atr_value(a));
    if (!IsShip(nav))
    {
      notify(player, "You can't disembark from here.");
      return;
    }
  
    ship = find_ship_by_nav(nav);
  }
  
  if (!ship)
  {
    notify(player, "You can't disembark from here.");
    return;
  }
  
  /* no ditching in space, or early after launching, or prematurely when landing */
  if ((ship->uid || ship->landing || ship->launching) && !ship->linked)
  {
    notify(player, "You can't disembark while in space.");
    return;
  }
  
  obj = atr_parse_dbref(ship->objnum, "SHIPOBJ");
  if (!RealGoodObject(obj))
  {
    notify(player, "This ship can not be disembarked.");
    return;
  }
  
  /* check whether we're docking or landing, save the new space object */
  if (ship->landed)
  {
    newobj = ship->landed->objnum;
  }
  else if (ship->docked)
  {
    newobj = ship->docked->objnum;
  }
  else if (ship->linked)
  {
    newobj = ship->linked->objnum;
  } else {
    notify(player, "You can't disembark while in space.");
    return;
  }
  
  if (ship->linked)
  {
    /* check the boarding code, if necessary */
    security = atr_parse_integer(ship->linked->objnum, "SECURITY", 0);
    if (security)
    {
      notify(player, "Unable to use boarding link while the other ship has security enabled.");
      return;
    }
    
    security = atr_parse_integer(ship->objnum, "SECURITY", 0);
    if (security)
    {
      notify(player, "Unable to use boarding link while security is enabled.");
      return;
    }
    
    obj = atr_parse_dbref(ship->linked->objnum, "BAY");
    if (!RealGoodObject(obj))
      obj = Location(ship->linked->objnum);
      
    moveto(player, obj, hs_options.space_wiz, NULL);
  } else {
    moveto(player, Location(obj), hs_options.space_wiz, NULL);
  }
  
  /* finish up by setting HSPACE attribute and notifying everybody about the move */
//.........这里部分代码省略.........
开发者ID:jrsteensen,项目名称:hspace3g,代码行数:101,代码来源:hscmds.c

示例13: man_console


//.........这里部分代码省略.........
  {
    notify(player, "Can't reload weapons in combat!");
    stype = sec->type;
    ptype = pri->type;
  } else {
    ptype = load_weapon(player, pri, HS_PRIMARY);
    stype = load_weapon(player, sec, HS_SECONDARY);
  }
  
  type = HasFlag(ptype | stype, HS_ANY_WEAPON);

  if (con)
  {
    /* this is an auxiliary console */
    /* no missiles on the aux consoles */
    if (HasFlag(type, HS_MISSILE))
    {
      clear_weapon(pri);
      clear_weapon(sec);
      
      notify(player, "You may not man an auxiliary console with missiles equipped.");
      return;
    }
    
    if (HasFlag(type, HS_WIRETAP))
      con->type = HS_OPS;
    else if (HasFlag(type, HS_CAPACITOR))
      con->type = HS_ENG;
    else if (HasFlag(type, HS_CANNON | HS_EMITTER | HS_WEAPON))
      con->type = HS_GUN;
    else
      con->type = HS_CIV;
    
  } else {
    /* this is a nav console */
    /* no cans, caps or taps */
    
    if (HasFlag(type, HS_CANNON))
    {
      clear_weapon(pri);
      clear_weapon(sec);
      
      notify(player, "You may not man a navigation console with a cannon equipped.");
      return;
    }
  }
  
  /* the equipment slots check out, and the console
     has been set to the appropriate type, if needed */

  if (prompt)
  {
    *prompt = HasFlag(atr_parse_integer(player, "HSPROMPT_FREQUENCY", 1), HS_PROMPT_FREQUENCY);
    FlagOn(*prompt, atr_parse_flags(player, hs_prompt_flags, "HSPROMPT_FLAGS"));
  }
  
  manning = get_console(player);
  if (manning != NOTHING)
  {
    manner = get_user(manning);
    if (manner == player)
    {
      con = find_console(manning);
      if (con)
      {
        load_weapon(manning, &(con->primary), HS_PRIMARY);
        load_weapon(manning, &(con->secondary), HS_SECONDARY);
      }
      
      set_user(manning, NOTHING);
      
      notify(player, tprintf("You unman the %s.", Name(manning)));
      notify_except(manning, Location(manning), player,
              tprintf("%s unmans the %s.", Name(player), Name(manning)), 0);
    }
  }
  
  /* set the HSPACE attribute in case something was fishy */
  if (!IsSim(ship->objnum))
  {
    atr_add(player, "HSPACE", unparse_dbref(ship->objnum), hs_options.space_wiz, 0);
  }

  set_user(console, player);

  execute_trigger(console, "AMAN", ship);

  if (con)
  {
    notify(player, tprintf("You man the %s (%s%s%s).", Name(console),
          ANSI_HILITE, STR(hs_console_types, con->type), ANSI_NORMAL));
    notify_except(console, Location(console), player,
    	  tprintf("%s mans the %s (%s%s%s).", Name(player), Name(console),
    	  ANSI_HILITE, STR(hs_console_types, con->type), ANSI_NORMAL), 0);
  } else {
    notify(player, tprintf("You man the %s.", Name(console)));
    notify_except(console, Location(console), player,
    	  tprintf("%s mans the %s.", Name(player), Name(console)), 0);
  }
}
开发者ID:jrsteensen,项目名称:hspace3g,代码行数:101,代码来源:hscmds.c

示例14: Location

Location Location::GetLocation(const Direction& direction) {
  if (i == -1 or j == -1) {
    return Location(-1, -1);
  }

  switch (direction) {
  case EAST:
    return Location(i + 1, j);
  case SOUTH_EAST:
    if (j % 2 == 0) {
      return Location(i + 1, j + 1);
    }
    return Location(i, j + 1);
  case SOUTH_WEST:
    if (j % 2 == 0) {
      return Location(i, j + 1);
    }
    return Location(i - 1, j + 1);
  case WEST:
    return Location(i - 1, j);
  case NORTH_WEST:
    if (j % 2 == 0) {
      return Location(i, j - 1);
    }
    return Location(i - 1, j - 1);
  case NORTH_EAST:
    if (j % 2 == 0) {
      return Location(i + 1, j - 1);
    }
    return Location(i, j - 1);
  default:
    return Location(-1, -1);
  }
}
开发者ID:Li2012,项目名称:SlowBall,代码行数:34,代码来源:map.cpp

示例15: ct_exit

static void
ct_exit(dbref player, dbref i, warn_type flags)
{
    dbref j, src, dst;
    int count = 0;
    int lt;

    /* i must be an exit, must be in a valid room, and must lead to a
     * different room
     * Remember, for exit i, Exits(i) = source room
     * and Location(i) = destination room
     */

    dst = Destination(i);
    if ((flags & W_EXIT_UNLINKED) && (dst == NOTHING))
        complain(player, i, "exit-unlinked",
                 T("exit is unlinked; anyone can steal it"));

    if ((flags & W_EXIT_UNLINKED) && dst == AMBIGUOUS) {
        ATTR *a;
        const char *var = "DESTINATION";
        a = atr_get(i, "DESTINATION");
        if (!a)
            a = atr_get(i, "EXITTO");
        if (a)
            var = "EXITTO";
        if (!a)
            complain(player, i, "exit-unlinked",
                     T("Variable exit has no %s attribute"), var);
        else {
            const char *x = atr_value(a);
            if (!x || !*x)
                complain(player, i, "exit-unlinked",
                         T("Variable exit has empty %s attribute"), var);
        }
    }

    if (!Dark(i)) {
        if (flags & W_EXIT_MSGS) {
            lt = warning_lock_type(getlock(i, Basic_Lock));
            if ((lt & W_UNLOCKED) &&
                    (!atr_get(i, "OSUCCESS") || !atr_get(i, "ODROP") ||
                     !atr_get(i, "SUCCESS")))
                complain(player, i, "exit-msgs",
                         T("possibly unlocked exit missing succ/osucc/odrop"));
            if ((lt & W_LOCKED) && !atr_get(i, "FAILURE"))
                complain(player, i, "exit-msgs",
                         T("possibly locked exit missing fail"));
        }
        if (flags & W_EXIT_DESC) {
            if (!atr_get(i, "DESCRIBE"))
                complain(player, i, "exit-desc", T("exit is missing description"));
        }
    }
    src = Source(i);
    if (!GoodObject(src) || !IsRoom(src))
        return;
    if (src == dst)
        return;
    /* Don't complain about exits linked to HOME or variable exits. */
    if (!GoodObject(dst))
        return;

    for (j = Exits(dst); GoodObject(j); j = Next(j))
        if (Location(j) == src) {
            if (!(flags & W_EXIT_MULTIPLE))
                return;
            else
                count++;
        }
    if ((count == 0) && (flags & W_EXIT_ONEWAY))
        complain(player, i, "exit-oneway", T("exit has no return exit"));
    else if ((count > 1) && (flags & W_EXIT_MULTIPLE))
        complain(player, i, "exit-multiple",
                 T("exit has multiple (%d) return exits"), count);
}
开发者ID:nveid,项目名称:cobramush,代码行数:76,代码来源:warnings.c


注:本文中的Location函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。