Example #1
0
char *proobraz(char* input)
{
input = registr(input);

input=  ficha(input);
for (int i=0;i<strlen(input);i++)
    {
       ssin(i,input);
       ccos(i,input);
       aasin(i,input);
       aacos(i,input);
       aatan(i,input);
       cceil(i,input);
       cch(i,input);
       eexp(i,input);
       aabs(i,input);
       ffloor(i,input);
       lln(i,input);
       llog(i,input);
       ssh(i,input);
       ssqrt(i,input);
       ttan(i,input);
       tth(i,input);
       cctg(i,input);
	aactg(i,input);
	ccth(i,input);
    }
    return input;
}
Example #2
0
int QoreValueList::getAsString(QoreString &str, int foff, ExceptionSink* xsink) const {
   QoreContainerHelper cch(this);
   if (!cch) {
      str.sprintf("[ERROR: recursive reference to list %p]", this);
      return 0;
   }

   if (foff == FMT_YAML_SHORT) {
      str.concat('[');
      ConstValueListIterator li(this);
      while (li.next()) {
	 QoreValue n = li.getValue();
	 if (n.getAsString(str, foff, xsink))
	    return -1;
	 if (!li.last())
	    str.concat(", ");
      }
      str.concat(']');
      return 0;
   }

   if (!size()) {
      str.concat(&EmptyListString);
      return 0;
   }
   str.concat("list: (");

   if (foff != FMT_NONE)
      str.sprintf("%d element%s)\n", priv->length, priv->length == 1 ? "" : "s");

   for (size_t i = 0; i < priv->length; ++i) {
      if (foff != FMT_NONE) {
	 str.addch(' ', foff + 2);
	 str.sprintf("[%d]=", i);
      }

      QoreValue n = priv->entry[i];
      if (n.getAsString(str, foff != FMT_NONE ? foff + 2 : foff, xsink))
	 return -1;

      if (i != (priv->length - 1)) {
	 if (foff != FMT_NONE)
	    str.concat('\n');
	 else
	    str.concat(", ");
      }
   }
   if (foff == FMT_NONE)
      str.concat(')');

   return 0;
}
Example #3
0
size_t LookUpTheMessage(PMSG wParam, LPWSTR szBuf)
{
  size_t cch(0);
  auto hResult = StringCchPrintf((STRSAFE_LPWSTR)szBuf, 128/sizeof(WCHAR),
                            L"%d",
                            wParam);
  if (FAILED(hResult))
  {
  // TODO: write error handler
  }

  hResult = StringCchLength((STRSAFE_LPWSTR)szBuf, 128/sizeof(WCHAR), &cch);

  return cch;
}
Example #4
0
void mech_c3i_network(dbref player, MECH * mech, char *buffer)
{
    cch(MECH_USUALO);

    DOCHECK(!HasC3i(mech), "This unit is not equipped with C3i!");
    DOCHECK(C3iDestroyed(mech), "Your C3i system is destroyed!");
    DOCHECK(AnyECMDisturbed(mech),
	"Your C3i system is not currently operational!");

    validateC3iNetwork(mech);

    DOCHECK(MechC3iNetworkSize(mech) <= 0,
	"There are no other units in your C3i network!");

    showNetworkData(player, mech, 0);
}
Example #5
0
void mech_c3i_message(dbref player, MECH * mech, char *buffer)
{
    cch(MECH_USUALO);

    DOCHECK(!HasC3i(mech), "This unit is not equipped with C3i!");
    DOCHECK(C3iDestroyed(mech), "Your C3i system is destroyed!");
    DOCHECK(AnyECMDisturbed(mech),
	"Your C3i system is not currently operational!");

    validateC3iNetwork(mech);

    DOCHECK(MechC3iNetworkSize(mech) <= 0,
	"There are no other units in your C3i network!");

    skipws(buffer);
    DOCHECK(!*buffer, "What do you want to send on the C3i Network?");

    sendNetworkMessage(player, mech, buffer, 0);
}
Example #6
0
void chat_handler::do_speak(const std::string& message, bool allies_only)
{
	if (message == "" || message == "/") {
		return;
	}
	bool is_command = (message[0] == '/');
	bool quoted_command = (is_command && message[1] == ' ');

	if (!is_command) {
		send_chat_message(message, allies_only);
		return;
	}
	else if (quoted_command) {
		send_chat_message(std::string(message.begin() + 2, message.end()), allies_only);
		return;
	}
	std::string cmd(message.begin() + 1, message.end());
	chat_command_handler cch(*this, allies_only);
	cch.dispatch(cmd);
}
Example #7
0
void mech_enterbay(dbref player, void *data, char *buffer)
{
	char *args[3];
	int argc;
	dbref ref = -1, bayn = -1;
	MECH *mech = data, *ds;
	MAP *map;

	cch(MECH_USUAL);
	DOCHECK(MechType(mech) == CLASS_VTOL &&
			AeroFuel(mech) <= 0, "You lack fuel to maneuver in!");
	DOCHECK(Jumping(mech), "While in mid-jump? No way.");
	DOCHECK(MechType(mech) == CLASS_MECH && (Fallen(mech) ||
											 Standing(mech)),
			"Crawl inside? I think not. Stand first.");
	DOCHECK(OODing(mech), "While in mid-flight? No way.");
	DOCHECK((argc =
			 mech_parseattributes(buffer, args, 2)) == 2,
			"Hmm, invalid number of arguments?");
	if(argc > 0)
		DOCHECK((ref =
				 FindTargetDBREFFromMapNumber(mech, args[0])) <= 0,
				"Invalid target!");
	if(ref < 0) {
		DOCHECK(!Find_Single_DS_In_MechHex(mech, &ref, &bayn),
				"No DS bay found in your hex!");
		DOCHECK(ref < 0,
				"Multiple enterable things found ; use the id for specifying which you want.");
		DOCHECK(!(ds =
				  getMech(ref)), "You sense wrongness in fabric of space.");
	} else {
		DOCHECK(!(ds =
				  getMech(ref)), "You sense wrongness in fabric of space.");
		DOCHECK(!Find_DS_Bay_In_MechHex(mech, ds, &bayn),
				"You see no bays in your hex.");
	}
	DOCHECK(IsDS(mech)
			&& !(MechSpecials2(mech) & CARRIER_TECH),
			"Your craft can't enter bays.");
	DOCHECK(!DS_Bay_Is_Open(mech, ds, AeroBay(ds, bayn)),
			"The door has been jammed!");
	DOCHECK(IsDS(mech), "Your unit is a bit too large to fit in there.");
	DOCHECK((fabs((float) (MechSpeed(mech) - MechSpeed(ds)))) > MP1,
			"Speed difference's too large to enter!");
	DOCHECK(MechZ(ds) != MechZ(mech),
			"Get to same elevation before thinking about entering!");
	DOCHECK(abs(MechVerticalSpeed(mech) - MechVerticalSpeed(ds)) > 10,
			"Vertical speed difference is too great to enter safely!");
	DOCHECK(MechType(mech) == CLASS_MECH && !MechIsQuad(mech) &&
			(IsMechLegLess(mech)), "Without legs? Are you kidding?");
	ref = AeroBay(ds, bayn);
	map = getMap(ref);

	DOCHECK(!map, "You sense wrongness in fabric of space.");

	DOCHECK(EnteringHangar(mech), "You are already entering the hangar!");
	if(!can_pass_lock(mech->mynum, ref, A_LENTER)) {
		char *msg = silly_atr_get(ref, A_FAIL);
		if(!msg || !*msg)
			msg = "You are unable to enter the bay!";
		notify(player, msg);
		return;
	}
	DOCHECK(!DS_Bay_Is_EnterOK(mech, ds, AeroBay(ds, bayn)),
			"Someone else is using the door at the moment.");
	DOCHECK(!(map =
			  getMap(mech->mapindex)),
			"You sense a wrongness in fabric of space.");
	HexLOSBroadcast(map, MechX(mech), MechY(mech),
					"The bay doors at $h start to open..");
	MECHEVENT(mech, EVENT_ENTER_HANGAR, mech_enterbay_event, 12, ref);
}
Example #8
0
void mech_c3i_join_leave(dbref player, void *data, char *buffer)
{
    MECH *mech = (MECH *) data, *target;
    MAP *objMap;
    char *args[2];
    dbref refTarget;
    int LOS = 1;
    float range = 0.0;

    cch(MECH_USUALO);

    DOCHECK(mech_parseattributes(buffer, args, 2) != 1,
	"Invalid number of arguments to function!");

    DOCHECK(!HasC3i(mech), "This unit is not equipped with C3i!");
    DOCHECK(C3iDestroyed(mech), "Your C3i system is destroyed!");
    DOCHECK(AnyECMDisturbed(mech),
	"Your C3i system is not currently operational!");

    validateC3iNetwork(mech);

    /* Clear our C3i Network */
    if (!strcmp(args[0], "-")) {
	if (MechC3iNetworkSize(mech) <= 0) {
	    mech_notify(mech, MECHALL,
		"You are not connected to a C3i network!");

	    return;
	}

	clearC3iNetwork(mech, 1);

	mech_notify(mech, MECHALL, "You disconnect from the C3i network.");

	return;
    }

    /* Well, if we're here then we wanna connect to a network */
    /* Let's check to see if we're already in one... can't be in two at the same time */
    DOCHECK(MechC3iNetworkSize(mech) > 0,
	"You are already in a C3i network!");

    objMap = getMap(mech->mapindex);

    /* Find who we're trying to connect to */
    refTarget = FindTargetDBREFFromMapNumber(mech, args[0]);
    target = getMech(refTarget);

    if (target) {
	LOS =
	    InLineOfSight(mech, target, MechX(target), MechY(target),
	    range);
    } else
	refTarget = 0;

    DOCHECK((refTarget < 1) ||
	!LOS, "That is not a valid targetID. Try again.");
    DOCHECK(MechTeam(mech) != MechTeam(target),
	"You can't use the C3i network of unfriendly units!");
    DOCHECK(mech == target, "You can't connect to yourself!");
    DOCHECK(Destroyed(target), "That unit is destroyed!");
    DOCHECK(!Started(target), "That unit is not started!");
    DOCHECK(!HasC3i(target),
	"That unit does not appear to be equipped with C3i!");

    /* validate the network of our target */
    validateC3iNetwork(target);
    DOCHECK(MechC3iNetworkSize(target) >= C3I_NETWORK_SIZE,
	"That unit's C3i network is operating at maximum capacity!");

    /* Connect us up */
    mech_notify(mech, MECHALL, tprintf("You connect to %s's C3i network.",
	    GetMechToMechID(mech, target)));

    addMechToC3iNetwork(target, mech);
}