Ejemplo n.º 1
0
int		my_getnbr(const char *str)
{
  char		sign;
  unsigned int	i;
  int		length;
  int		result;
  unsigned char	overflow;

  sign = '+';
  i = 0;
  length = my_strlen(str);
  result = 0;
  overflow = 0;
  while (i < length && check_valid(str[i]) && !overflow)
    {
      if (str[i] == '+' || str[i] == '-')
	{
	  add_sign(&sign, str[i]);
	}
      else
	{
	  overflow = update_result(&result, str[i], sign);
	}
      i = i + 1;
    }
  return (result);
}
void reset() {
  if(!sign) {
    sign=add_sign("This is a plaque that seems to describe how to have "
                  "your combat skills assessed.\n", "To assess your "
                  "skills, attack the dummy with the weapon you want to "
                  "test your proficiency in.  Each time you hit the "
                  "dummy, the instructor will comment on your "
                  "performance.  After a number of rounds, the "
                  "instructor will stop you and give you an overall "
                  "performance rating.\n\n"
                  "Don't forget to hold your weapon of choice before "
                  "attacking the training dummy!\n",
                  "small plaque", "plaque", "general");
    sign->add_property("there", "on the wall");
  }
  if(!dummy)
    dummy = clone_object(PATH + "dummy");
  dummy->move(this_object());
  
  call_out("get_trainer", 1);
}/*reset*/
Ejemplo n.º 3
0
void		my_abs(char **str, int sens, char *ops)
{
  char		*result;
  t_limits	limite;
  int		signe;
  
  result = *str;
  signe = 1;
  limite.left = limite.right = 0;
  while (result[limite.right] &&
	 (find_pos(ops, result[limite.right]) == 2 ||
	  find_pos(ops, result[limite.right]) == 3))
    {
      if (find_pos(ops, result[limite.right]) == 3)
	signe *= -1;
      limite.right = limite.right + 1;
    }
  result = my_remove(result, limite.right, my_strlen(result), ops);
  if ((signe == -1 && sens == 0) || sens < 0)
      add_sign(&result, ops[3]);
  *str = result;
}