bool SocTransport::SpecifyAddress(NetAddress *pnad) { #if 0 static char *s_apszChars[] = { "ABCDEFGHIJKLM", "NOPQRSTUVWXYZ", "0123456789.-", }; #else static char *s_apszChars[] = { "123", "456", "789", ".0" }; #endif char szIpAddress[32]; if (!DoInputPanelForm(s_apszChars, ARRAYSIZE(s_apszChars), "Address:", "", szIpAddress, sizeof(szIpAddress), ValidateIpAddress)) return false; dword nlIpAddress = inet_addr(szIpAddress); sockaddr_in *psoca = (sockaddr_in *)pnad; psoca->sin_family = AF_INET; psoca->sin_port = htons(SERVER_LISTEN_PORT); #ifdef IPHONE psoca->sin_addr.s_addr = nlIpAddress; #else psoca->sin_addr.S_un.S_addr = nlIpAddress; #endif return true; }
void CreateGameForm::OnControlSelected(word idc) { switch (idc) { case kidcPasswordPanel: DoInputPanelForm(this, kidcPasswordLabel, kidcPassword); break; case kidcGameSpeed: { SliderControl *psldr = (SliderControl *)GetControlPtr( kidcGameSpeed); m_tGameSpeed = gatGameSpeeds[psldr->GetValue()]; UpdateLabels(); } break; case kidcChat: chatter_.ShowChat(); break; case kidcCancel: EndForm(idc); break; case kidcOk: // Fill in GameParams ListControl *plstc = m_aplstc[IndexFromMissionType(m_mt)]; int nLevel = (int)plstc->GetSelectedItemData(); MissionIdentifier miid; if (!m_pml->GetMissionIdentifier(nLevel, &miid)) { HtMessageBox(kfMbWhiteBorder, "Error!", "First you must select a map to play on."); return; } // Mount the pdb if (!gppackm->Mount(gpakr, &miid.packid)) { HtMessageBox(kfMbWhiteBorder, "Error!", "Cannot load mission pack."); return; } // Remember for later selecting from the list m_miidFind = miid; // Read the level info Level *plvl = new Level(); if (plvl != NULL) { if (plvl->LoadLevelInfo(miid.szLvlFilename)) { m_prams->packid = miid.packid; m_prams->dwVersionSimulation = knVersionSimulation; m_prams->tGameSpeed = m_tGameSpeed; strncpyz(m_prams->szLvlFilename, miid.szLvlFilename, sizeof(m_prams->szLvlFilename)); } delete plvl; } else { HtMessageBox(kfMbWhiteBorder, "Error", "Out of memory!"); idc = kidcCancel; } gppackm->Unmount(gpakr, &miid.packid); // Keep this game speed around for next time gtGameSpeed = m_tGameSpeed; ggame.SavePreferences(); EndForm(idc); break; } }