Exemplo n.º 1
0
user_node * CreateNewUserByName(int account_id,int class_id,char*buf)
{   
   user_node *u;

   val_type system_id_const,name_val;
   parm_node p[2];
   
   u = (user_node *)AllocateMemory(MALLOC_ID_USER,sizeof(user_node));

   u->account_id = account_id;

   system_id_const.v.tag = TAG_OBJECT;
   system_id_const.v.data = GetSystemObjectID();

   p[0].type = CONSTANT;
   p[0].value = system_id_const.int_val;
   p[0].name_id = SYSTEM_PARM;

   
   name_val.v.tag = TAG_RESOURCE;
   name_val.v.data = AddDynamicResource(buf);
	 
   p[1].type = CONSTANT;
   p[1].value = name_val.int_val;
   p[1].name_id = NAME_PARM;
   
   u->object_id = CreateObject(class_id,2,p);

   u->next = users;
   users = u;

   return u;
}
Exemplo n.º 2
0
void SendBlakodBeginSystemEvent(int type)
{
   val_type int_val;
   parm_node p[1];

   int_val.v.tag = TAG_INT;
   int_val.v.data = type;

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

   SendTopLevelBlakodMessage(GetSystemObjectID(),GARBAGE_MSG,1,p);
}
Exemplo n.º 3
0
void GameSendSystemEnter(session_node *s)
{
   parm_node p;
   val_type session_id_const;

   session_id_const.v.tag = TAG_SESSION;
   session_id_const.v.data = s->session_id;
   
   p.type = CONSTANT;
   p.value = session_id_const.int_val;
   p.name_id = SESSION_ID_PARM;
   
   SendTopLevelBlakodMessage(GetSystemObjectID(),SYSTEM_ENTER_GAME_MSG,1,&p);

}
Exemplo n.º 4
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);
}
Exemplo n.º 5
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   
	
}
Exemplo n.º 6
0
void MainServer()
{
	InitInterfaceLocks(); 
	
	InitInterface(); /* starts a thread with the window */

   WrapInit();
	
	InitMemory(); /* memory needs channels in general, but need to start before config,
	so just be careful. */
	
	InitConfig();
	LoadConfig();		/* must be nearly first since channels use it */
	
	InitDebug();
	
	InitChannelBuffer();
	
	OpenDefaultChannels();
	
	lprintf("Starting %s\n",BlakServLongVersionString());
	
	InitClass();
	InitMessage();
	InitObject();
	InitList();
	InitTimer();
	InitSession();
	InitResource();
	InitRoomData();
	InitString();
	InitUser();
	InitAccount();
	InitNameID();
	InitDLlist();   
	InitSysTimer();
	InitMotd();
	InitLoadBof();
	InitTime();
	InitGameLock();
	InitBkodInterpret();
	InitBufferPool();
	InitTable();
	AddBuiltInDLlist();
	
	LoadMotd();
	LoadBof();
	LoadRsc();
	LoadKodbase();
	
	LoadAdminConstants();
	
	PauseTimers();
	
	if (LoadAll() == True)
	{
	/* this loaded_game_msg tells it to disconnect all blakod info about sessions,
		* that were logged on when we saved */
		
		SendTopLevelBlakodMessage(GetSystemObjectID(),LOADED_GAME_MSG,0,NULL);
		DoneLoadAccounts();
	}
	
	/* these must be after LoadAll and ClearList */
	InitCommCli(); 
	InitParseClient(); 
	InitProfiling();
	InitAsyncConnections();
	
	UpdateSecurityRedbook();
	
	UnpauseTimers();

	

	ServiceTimers();
	/* returns if server termiated */
	
	MainExitServer();
   WrapShutdown();
}
Exemplo n.º 7
0
void SaveSystem(void)
{
	SaveGameWriteByte(SAVE_GAME_SYSTEM);
	SaveGameWriteInt(GetSystemObjectID());
}