void CPlayerGameStats::OnSystemEntered (CSystem *pSystem, int *retiLastVisit)

//	OnSystemEntered
//
//	Player just entered the system

	{
	CTopologyNode *pNode = pSystem->GetTopology();
	if (pNode == NULL)
		{
		if (retiLastVisit)
			*retiLastVisit = -1;
		return;
		}

	SSystemStats *pStats = GetSystemStats(pNode->GetID());
	pStats->dwLastEntered = g_pUniverse->GetTicks();
	if (pStats->dwFirstEntered == INVALID_TIME)
		{
		pStats->dwFirstEntered = pStats->dwLastEntered;
		if (retiLastVisit)
			*retiLastVisit = -1;
		}
	else
		{
		if (retiLastVisit)
			*retiLastVisit = (pStats->dwLastLeft != INVALID_TIME ? pStats->dwLastLeft : -1);
		}

	pStats->dwLastLeft = INVALID_TIME;
	}
Exemple #2
0
/*
 * DownloadNewClient:  Spawn external program to get new client executable.
 *   Arguments are passed as command line paramenters to external program.
 */
void DownloadNewClient(char *hostname, char *filename)
{
  SHELLEXECUTEINFO shExecInfo;
  char command_line[MAX_CMDLINE];
  char exe_name[MAX_PATH];
  char client_directory[MAX_PATH];
  char update_program_path[MAX_PATH];
  char *ptr;
  SystemInfo sysinfo;
  
  if (AreYouSure(hInst, hMain, YES_BUTTON, IDS_NEEDNEWVERSION))
  {
    // Make download dir if not already there
    DownloadCheckDirs(hMain);
    
    // Destination directory is wherever client executable is running.
    // Because of UAC, this is likely not the current working directory.
    GetModuleFileName(NULL, exe_name, MAX_PATH);
    strcpy(client_directory, exe_name);
    ptr = strrchr(client_directory, '\\');
    if (ptr != NULL)
      *ptr = 0;

    sprintf(update_program_path, "%s\\%s", client_directory, update_program);
    
    sprintf(command_line, "\"%s\" UPDATE \"%s\" \"%s\" \"%s\\%s\" \"%s\"", 
            exe_name, hostname, filename, download_dir, update_filename,
            client_directory);
    
    // Using full pathname of client can overrun 128 character DOS command line limit
    GetSystemStats(&sysinfo);
    if (strlen(command_line) >= 127 && 
        (sysinfo.platform == VER_PLATFORM_WIN32_WINDOWS))
    {
      ClientError(hInst, hMain, IDS_LONGCMDLINE, command_line);	 
    }
    

    shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
    shExecInfo.fMask = 0;
    shExecInfo.hwnd = NULL;
    shExecInfo.lpVerb = "runas";
    shExecInfo.lpFile = update_program_path;
    shExecInfo.lpParameters = command_line;
    // Run in parent of resource directory; club will take care of copying
    // exes to Program Files if necessary.
    shExecInfo.lpDirectory = NULL;
    shExecInfo.nShow = SW_NORMAL;
    shExecInfo.hInstApp = NULL;
    
    if (!ShellExecuteEx(&shExecInfo))
      ClientError(hInst, hMain, IDS_CANTUPDATE, update_program);
  }
  
  // Quit client
  PostMessage(hMain, WM_DESTROY, 0, 0);
}
void CPlayerGameStats::OnSystemLeft (CSystem *pSystem)

//	OnSystemLeft
//
//	Player just left the system

	{
	CTopologyNode *pNode = pSystem->GetTopology();
	if (pNode == NULL)
		return;

	SSystemStats *pStats = GetSystemStats(pNode->GetID());
	ASSERT(pStats->dwLastEntered != INVALID_TIME);
	pStats->dwLastLeft = g_pUniverse->GetTicks();
	pStats->dwTotalTime += pStats->dwLastLeft - pStats->dwLastEntered;
	}
Exemple #4
0
/*  
 * LoginSendInfo:  Send login information (username, password, etc.) to server.
 */
void LoginSendInfo(void)
{
   unsigned char buf[ENCRYPT_LEN + 1];

   GetSystemStats(&sysinfo);

   // Encrypt password
   MDString(config.password, buf);
   buf[ENCRYPT_LEN] = 0;

   debug(("Got partner code of %d.\n", (sysinfo.reserved & 0xFF00) >> 8));

   // Load the RSB hash from LoginSendInfo to ensure we have an up-to-date hash.
   LoadRSBHash();

   RequestLogin(MAJOR_REV, MINOR_REV, 
      sysinfo.platform, sysinfo.platform_major, sysinfo.platform_minor,
      sysinfo.memory, sysinfo.chip, 
      sysinfo.screen_width, sysinfo.screen_height, 
      sysinfo.color_depth, sysinfo.bandwidth, sysinfo.reserved,
      config.username, buf, GetRSBHash());
}