示例#1
0
void MainExitState(void)
{
	debug(("Old main state = %d\n", state));
	switch (state)
	{
	case STATE_OFFLINE:
		MenuDisconnect();
		OfflineExit();
		break;
		
	case STATE_CONNECTING:
		ConnectingExit();
		break;
	case STATE_LOGIN:
		// Free any modules that are sitting around (need to be unloaded so that
		// they can be overwritten during download).						   
		ModulesClose();
		LoginExit();
		break;
	case STATE_STARTUP:
		AbortStartupTimer();
		break;
	case STATE_TERM:
		TermExit();
		break;
	case STATE_GAME:
		GameExit();
		break;
	case STATE_DOWNLOAD:
		DownloadExit();
		break;
	}
}
示例#2
0
/*
 * AddCharsStartup:  We got some stuff from the server; see what it is.
 */
void AddCharsStartup(char *message, int len)
{
   int i;
   Bool done = False;

   for (i=0; i < len; i++)
   {
      /* If character doesn't match code, start over */
      if (server_string[pos] != (unsigned char) message[i])
      {
	 pos = 0;
	 continue;
      }
      pos++;

      /* If we reach end of server string, win */
      if (pos == INITSTR_LENGTH)
      {
	 done = True;
	 break;
      }
   }

   if (!done)
      return;

   debug(("Got response from server\n"));

   /* We found server's code string.  Send response and go into correct mode. */
   AbortStartupTimer();
   WriteServer((char *) client_string2, INITSTR_LENGTH);
   
   switch (dest_state)
   {
   case STATE_LOGIN:
      MainSetState(STATE_LOGIN);
      break;

   case STATE_GAME:
      /* We're already in game state, so don't do MainSetState--just get new game data */
      ResetUserData();
      break;
   }
}