Example #1
0
void SetString(string_node *snod,char *buf,int len)
{
   if (snod == &temp_str)
   {
      SetTempString(buf,len);
      return;
   }
   FreeMemory(MALLOC_ID_STRING,snod->data,snod->len_data+1);
   snod->data = (char *)AllocateMemory(MALLOC_ID_STRING,len+1);
   memcpy(snod->data,buf,len);
   snod->len_data = len;
   snod->data[snod->len_data] = '\0';
}
Example #2
0
void GameWarnLowCredits(session_node *s)
{
   val_type str_val;
   parm_node blak_parm[1];
   char text[100];

   sprintf(text,"You have only %i credit%s remaining",s->account->credits/100,
	   (s->account->credits/100 == 1) ? "" : "s");

   SetTempString(text,strlen(text));
   str_val.v.tag = TAG_TEMP_STRING;
   str_val.v.data = 0;		/* the data field doesn't matter for TAG_TEMP_STRING */

   blak_parm[0].type = CONSTANT;
   blak_parm[0].value = str_val.int_val;
   blak_parm[0].name_id = STRING_PARM;   

   SendTopLevelBlakodMessage(s->game->object_id,SYSTEM_STRING_MSG,1,blak_parm);
}
Example #3
0
user_node * GetUserByName(char *username)
{
   val_type temp_str_val,ret_val;
   parm_node p[1];

   SetTempString(username,strlen(username));

   temp_str_val.v.tag = TAG_TEMP_STRING;
   temp_str_val.v.data = 0;

   p[0].type = CONSTANT;
   p[0].value = temp_str_val.int_val;
   p[0].name_id = STRING_PARM;

   ret_val.int_val = SendTopLevelBlakodMessage(GetSystemObjectID(),
					       FIND_USER_BY_STRING_MSG,1,p);
   if (ret_val.v.tag != TAG_OBJECT)
      return NULL;

   return GetUserByObjectID(ret_val.v.data);
}
Example #4
0
/* GetInternetMailObject
We return a valtype, the tag and data. */
int GetInternetMailObject(char *s)
{
#ifdef SMTP_TEST
	return NIL;
#else
	val_type temp_string_const,object_val;
	parm_node p[1];
	
	SetTempString(s,strlen(s));
	
	temp_string_const.v.tag = TAG_TEMP_STRING;
	temp_string_const.v.data = 0;
	
	p[0].type = CONSTANT;
	p[0].value = temp_string_const.int_val;
	p[0].name_id = NAME_PARM;
	
	object_val.int_val = SendTopLevelBlakodMessage(GetSystemObjectID(),
						  FIND_USER_BY_INTERNET_NAME_MSG,1,p);
	
	return object_val.int_val;
#endif   
	
}