예제 #1
0
파일: glue.c 프로젝트: chazu/btmux
int HandledCommand_sub(dbref player, dbref location, char *command)
{
	XCODE *xcode_obj = NULL;

	struct SpecialObjectStruct *typeOfObject;
	int type;
	CommandsStruct *cmd;
	HASHTAB *damnedhash;
	char *tmpc, *tmpchar;
	int ishelp;

	type = WhichSpecial(location);
	if (type < 0 || (SpecialObjects[type].datasize > 0
	    && !(xcode_obj = rb_find(xcode_tree, (void *)location)))) {
		if(type >= 0 || !Hardcode(location) || Zombie(location))
			return 0;
		if((type = WhichSpecialS(location)) >= 0) {
			if(SpecialObjects[type].datasize > 0)
				return 0;
		} else
			return 0;
	}
#ifdef FAST_WHICHSPECIAL
	if(type > NUM_SPECIAL_OBJECTS)
		return 0;
#endif
	typeOfObject = &SpecialObjects[type];
	damnedhash = &SpecialCommandHash[type];
	tmpc = strstr(command, " ");
	if(tmpc)
		*tmpc = 0;
	ishelp = !strcmp(command, "HELP");
	for(tmpchar = command; *tmpchar; tmpchar++)
		*tmpchar = ToLower(*tmpchar);
	cmd = (CommandsStruct *) hashfind(command, &SpecialCommandHash[type]);
	if(tmpc)
		*tmpc = ' ';
	if(cmd && (type != GTYPE_MECH || (type == GTYPE_MECH &&
									  Can_Use_Command(((MECH *)
													   xcode_obj),
													  cmd->flag)))) {
#define SKIPSTUFF(a) while (*a && *a != ' ') a++;while (*a == ' ') a++
		if(cmd->helpmsg[0] != '@' ||
		   Have_MechPower(Owner(player), typeOfObject->power_needed)) {
			SKIPSTUFF(command);
			cmd->func(player, xcode_obj, command);
		} else
			notify(player, "Sorry, that command is restricted!");
		return 1;
	} else if(ishelp) {
		SKIPSTUFF(command);
		DoSpecialObjectHelp(player, typeOfObject->type, type, location,
							typeOfObject->power_needed, location, command);
		return 1;
	}
	return 0;
}
예제 #2
0
파일: main.cpp 프로젝트: tirrorex/Cpp
int		main(void)
{
	ZombieEvent event = ZombieEvent();
	Zombie* michael = event.newZombie("michael");
	michael->Announce();
	delete michael;
	event.randomChump();
	Zombie julie = Zombie("julie", "runner");
	julie.Announce();
	return (0);
}
예제 #3
0
파일: ds.bay.c 프로젝트: gtaylor/btmux
int Leave_DS(MAP * map, MECH * mech)
{
	MECH *car;

	DOCHECKMA0(!(car = getMech(map->onmap)), "Invalid : No parent object?");
	DOCHECKMA0(!DS_Bay_Is_Open(mech, car, map->mynum),
			   "The door has been jammed!");
	DOCHECKMA0(!Landed(car) &&
			   !FlyingT(mech), "The 'ship is still airborne!");
	DOCHECKMA0(Zombie(car->mynum),
			   "You don't feel leaving right now would be prudent..");
	return Leave_DS_Bay(map, car, mech, map->mynum);
}
예제 #4
0
bool BaseAI::startTurn()
{
  int count = 0;
  count = getWallCount();
  walls.clear();
  walls.resize(count);
  for(int i = 0; i < count; i++)
  {
    walls[i] = Wall(getWalls()+i);
  }
  count = getCrateCount();
  crates.clear();
  crates.resize(count);
  for(int i = 0; i < count; i++)
  {
    crates[i] = Crate(getCrates()+i);
  }
  count = getWeaponCount();
  weapons.clear();
  weapons.resize(count);
  for(int i = 0; i < count; i++)
  {
    weapons[i] = Weapon(getWeapons()+i);
  }
  count = getHumanCount();
  humans.clear();
  humans.resize(count);
  for(int i = 0; i < count; i++)
  {
    humans[i] = Human(getHumans()+i);
  }
  count = getZombieCount();
  zombies.clear();
  zombies.resize(count);
  for(int i = 0; i < count; i++)
  {
    zombies[i] = Zombie(getZombies()+i);
  }
  count = getAirstrikeCount();
  airstrikes.clear();
  airstrikes.resize(count);
  for(int i = 0; i < count; i++)
  {
    airstrikes[i] = Airstrike(getAirstrikes()+i);
  }
  count = getSpawnzoneCount();
  spawnzones.clear();
  spawnzones.resize(count);
  for(int i = 0; i < count; i++)
  {
    spawnzones[i] = Spawnzone(getSpawnzones()+i);
  }

  if(turnNum() == 1)
  {
    init();
    if(!isHuman())
    {
      return true;
     }
  }

  if(isHuman())
  {
    return runHuman();
  }
  else
  {
    return runZombie();
  }
}