gcblue-commits Mailing List for Global Conflict Blue (Page 28)
Status: Alpha
Brought to you by:
ddcforge
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(112) |
Feb
(106) |
Mar
(88) |
Apr
(111) |
May
(53) |
Jun
(60) |
Jul
(58) |
Aug
(61) |
Sep
(45) |
Oct
(31) |
Nov
(71) |
Dec
(70) |
| 2005 |
Jan
(33) |
Feb
(57) |
Mar
(98) |
Apr
(47) |
May
(53) |
Jun
(79) |
Jul
(79) |
Aug
|
Sep
(33) |
Oct
(1) |
Nov
(20) |
Dec
(64) |
| 2006 |
Jan
(20) |
Feb
(1) |
Mar
(43) |
Apr
(11) |
May
(8) |
Jun
(23) |
Jul
|
Aug
(28) |
Sep
(58) |
Oct
(25) |
Nov
(47) |
Dec
(70) |
|
From: Dewitt C. <ddc...@us...> - 2005-04-17 22:35:40
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14954/src/network Modified Files: tcConnectionData.cpp tcMultiplayerInterface.cpp tcNetworkInterface.cpp tcUpdateMessageHandler.cpp Log Message: fixed problem writing to account database, added command state update as part of create update for new objects at client, removed application-level command ack Index: tcUpdateMessageHandler.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcUpdateMessageHandler.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcUpdateMessageHandler.cpp 2 Nov 2004 04:23:56 -0000 1.12 --- tcUpdateMessageHandler.cpp 17 Apr 2005 22:35:31 -0000 1.13 *************** *** 46,53 **** void tcUpdateMessageHandler::AddCommandAck(tcGameObject* obj, tcCommandStream& stream) { ! wxASSERT(stream.GetAck()); ! ! stream << obj->mnID; // write id ! *obj >> stream; } --- 46,50 ---- void tcUpdateMessageHandler::AddCommandAck(tcGameObject* obj, tcCommandStream& stream) { ! wxASSERT(false); } *************** *** 58,63 **** void tcUpdateMessageHandler::AddCommandUpdate(tcGameObject* obj, tcCommandStream& stream) { - wxASSERT(!stream.GetAck()); - stream << obj->mnID; // write id --- 55,58 ---- *************** *** 89,92 **** --- 84,92 ---- stream << obj->mnDBKey; *obj >> stream; + + tcCommandStream& commandStream = stream.AsCommandStream(); + commandStream.SetDetailLevel(tcStream::WRITE_ALL); + *obj >> commandStream; + } *************** *** 279,283 **** void tcUpdateMessageHandler::HandleCommandAck(tcCommandStream& stream) { ! stream.SetAck(true); tcSimState* simState = tcSimState::Get(); --- 279,283 ---- void tcUpdateMessageHandler::HandleCommandAck(tcCommandStream& stream) { ! wxASSERT(false); tcSimState* simState = tcSimState::Get(); *************** *** 319,328 **** - // Init ack message - tcCommandStream commandStream; - tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::COMMAND_ACK, commandStream); - commandStream.SetAck(true); - - unsigned nAcks = 0; unsigned nUnknowns = 0; --- 319,322 ---- *************** *** 339,350 **** tcGameObject* obj = simState->GetObject(id); ! // update obj and add ack if it exists, otherwise skip if (obj) { *obj << stream; - tcUpdateMessageHandler::AddCommandAck(obj, commandStream); - nAcks++; - fprintf(stdout, "%d ", id); } --- 333,341 ---- tcGameObject* obj = simState->GetObject(id); ! // update obj if it exists, otherwise skip if (obj) { *obj << stream; fprintf(stdout, "%d ", id); } *************** *** 357,368 **** } fprintf(stdout, "\n"); - - if (nAcks) - { - tcMultiplayerInterface::Get()->SendUpdateMessage(connectionId, commandStream); - #ifdef _DEBUG - fprintf(stdout, ">> Sent obj command update ack, time: %.1f\n", simState->GetTime()); - #endif - } } --- 348,351 ---- *************** *** 376,379 **** --- 359,365 ---- tcDatabase* database = simState->mpDatabase; // convert database to singleton eventually + // command stream update is located after each create update to initialize command params + tcCommandStream& commandStream = stream.AsCommandStream(); + fprintf(stdout, "<< Received obj create msg, time %.1f: ", simState->GetTime()); *************** *** 403,406 **** --- 389,394 ---- simState->AddPlatformWithKey(obj, id); fprintf(stdout, "%d (%d)", id, obj->mnAlliance); + + *obj << commandStream; } else Index: tcConnectionData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcConnectionData.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcConnectionData.cpp 16 Apr 2005 20:44:43 -0000 1.11 --- tcConnectionData.cpp 17 Apr 2005 22:35:31 -0000 1.12 *************** *** 154,157 **** --- 154,162 ---- } + const char* tcConnectionData::GetIdString() const + { + return idString.c_str(); + } + const wxIPV4address& tcConnectionData::GetPeerAddress() const { *************** *** 412,416 **** UDPaddress.Service(tcNetworkInterface::UDP_PORT); ! peerName = UDPaddress.Hostname(); } --- 417,421 ---- UDPaddress.Service(tcNetworkInterface::UDP_PORT); ! peerName = UDPaddress.IPAddress().c_str(); } Index: tcMultiplayerInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMultiplayerInterface.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcMultiplayerInterface.cpp 16 Apr 2005 20:44:43 -0000 1.22 --- tcMultiplayerInterface.cpp 17 Apr 2005 22:35:31 -0000 1.23 *************** *** 191,196 **** { playerStatus.name = username; ! playerStatus.isAuthenticated = true; ! msg = wxString::Format("Welcome %s\n", username.c_str()); } else if (status == tcAccountDatabase::USER_NOT_FOUND) --- 191,209 ---- { playerStatus.name = username; ! ! const tcConnectionData* const connection = networkInterface->GetConnection(connectionId); ! std::string ipAddress = connection->GetIdString(); ! ! int loginStatus = LogInPlayer(username, connectionId, msg); ! ! if (loginStatus == tcAccountDatabase::SUCCESS) ! { ! playerStatus.isAuthenticated = true; ! } ! else if (loginStatus == tcAccountDatabase::DUPLICATE_LOGIN) ! { ! playerStatus.name += "_DUP"; ! } ! } else if (status == tcAccountDatabase::USER_NOT_FOUND) *************** *** 212,215 **** --- 225,275 ---- /** + * Logs player in after username/password has been authenticated. Checks for duplicate + * logins, etc. + * @return tcAccountDatabase::SUCCESS if successful + */ + int tcMultiplayerInterface::LogInPlayer(const std::string& username, int connectionId, wxString& msg) + { + tcConnectionData* connection = networkInterface->GetConnection(connectionId); + std::string ipAddress = connection->GetIdString(); + + int loginStatus = tcAccountDatabase::Get()->LogIn(username, ipAddress); + + if (loginStatus == tcAccountDatabase::SUCCESS) + { + msg = wxString::Format("Welcome %s\n", username.c_str()); + } + else if (loginStatus == tcAccountDatabase::DUPLICATE_LOGIN) + { + msg = wxString::Format("Username, %s, is already logged in\n", username.c_str()); + } + else + { + msg = wxString::Format("Unknown login error for username, %s\n", username.c_str()); + } + + return loginStatus; + } + + /** + * Log out all players that are logged in. Call before shutting down server. + */ + void tcMultiplayerInterface::LogOutAllPlayers() + { + if (!IsServer()) return; + + for (std::map<int,tcPlayerStatus>::iterator iter = playerInfo.begin(); + iter != playerInfo.end(); ++iter) + { + if (iter->second.isAuthenticated) + { + tcAccountDatabase::Get()->LogOut(iter->second.name); + iter->second.isAuthenticated = false; + } + } + + } + + /** * Broadcast chat text to all connected clients */ *************** *** 416,419 **** --- 476,481 ---- void tcMultiplayerInterface::MakeClient() { + if (IsServer()) LogOutAllPlayers(); + networkInterface->MakeClient(); tcMessageHandler::SetAsClient(); *************** *** 436,442 **** void tcMultiplayerInterface::Reset() { ! networkInterface->MakeClient(); ! tcMessageHandler::SetAsClient(); ! InitMessageHandlers(); } --- 498,502 ---- void tcMultiplayerInterface::Reset() { ! MakeClient(); } *************** *** 878,882 **** } ! void tcMultiplayerInterface::UpdateEntityCommands(int connectionId, bool updateUnack, bool clearNewCmdFlag) { int connId = connectionId; --- 938,942 ---- } ! void tcMultiplayerInterface::UpdateEntityCommands(int connectionId, bool clearNewCmdFlag) { int connId = connectionId; *************** *** 899,903 **** if ((pstatus.alliance == obj->mnAlliance) || !IsServer()) { ! if (obj->HasNewCommand() || (updateUnack && obj->HasUnacknowledgedCommand())) { tcUpdateMessageHandler::AddCommandUpdate(obj, commandStream); --- 959,963 ---- if ((pstatus.alliance == obj->mnAlliance) || !IsServer()) { ! if (obj->HasNewCommand()) { tcUpdateMessageHandler::AddCommandUpdate(obj, commandStream); *************** *** 995,998 **** --- 1055,1071 ---- fprintf(stdout, "C%d ", obj->mnID); #endif + + if (createCount >= 8) + { + SendUpdateMessage(connId, createStream); + #ifdef _DEBUG + fprintf(stdout, "Sent obj create msg, time: %d\n", t); + #endif + createStream.clear(); + tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::CREATE, + createStream); + createCount = 0; + } + } *************** *** 1020,1024 **** /** ! * Server only for now, send state updates on objects to clients */ void tcMultiplayerInterface::UpdateEntities() --- 1093,1097 ---- /** ! * Send state updates on objects to clients (command info in both directions) */ void tcMultiplayerInterface::UpdateEntities() *************** *** 1034,1058 **** { int id = *iter; ! /* always do new cmd update, clear flag on last only (likely need ! ** to track acks for each connection, or move ack to network level */ bool clearNewCmdFlag = (n++ == nConnections - 1); ! UpdateEntityCommands(id, false, clearNewCmdFlag); tcPlayerStatus& player = GetPlayerStatus(id); unsigned int dt = t - player.entityUpdateTime; ! if ((dt > entityUpdateInterval) && (player.isAuthenticated)) ! { ! player.entityUpdateTime = t; ! if (IsServer()) ! { ! UpdateDestroyedEntities(id); ! UpdateNewAndExistingEntities(id); ! } ! UpdateEntityCommands(id, true, true); // clear new cmd flag (broken) fprintf(stdout, "Performed entity state update, conn %d, t: %d\n", id, t); ! ! } --- 1107,1130 ---- { int id = *iter; ! ! /* always do new cmd update, clear flag on last only. ! ** New commands need to be send to all clients at once with ! ** this system */ bool clearNewCmdFlag = (n++ == nConnections - 1); ! UpdateEntityCommands(id, clearNewCmdFlag); tcPlayerStatus& player = GetPlayerStatus(id); unsigned int dt = t - player.entityUpdateTime; ! ! if ((dt > entityUpdateInterval) && (player.isAuthenticated) && IsServer()) ! { ! player.entityUpdateTime = t; ! ! UpdateDestroyedEntities(id); ! UpdateNewAndExistingEntities(id); fprintf(stdout, "Performed entity state update, conn %d, t: %d\n", id, t); ! } *************** *** 1145,1148 **** --- 1217,1222 ---- eraseKeys.push(iter->first); tcSound::Get()->PlayEffect("fslide"); + + tcAccountDatabase::Get()->LogOut(iter->second.name); } *************** *** 1163,1200 **** void tcMultiplayerInterface::UpdateSensorMap(int connectionId) { - tcUpdateStream stream; - tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::SENSOR_UPDATE, stream); - int connId = connectionId; tcPlayerStatus& pstatus = GetPlayerStatus(connId); int alliance = pstatus.alliance; - tcUpdateMessageHandler::AddSensorUpdateHeader(alliance, stream); - size_t initialStreamSize = stream.size(); - tcSimState* simState = tcSimState::Get(); wxASSERT(simState); tcSensorMap* sensorMap = simState->GetSensorMap(); - wxASSERT(sensorMap); - tcAllianceSensorMap* allianceSensorMap = sensorMap->GetMap(alliance); ! if (allianceSensorMap) ! { ! *allianceSensorMap >> stream; ! if (stream.size() > initialStreamSize) ! { ! SendUpdateMessage(connId, stream); ! fprintf(stdout, ">> sensormap update msg sent, connId (%d) size (%d)\n", ! connId, stream.size()); ! } ! } ! else ! { ! fprintf(stderr, "Error - tcMultiplayerInterface::UpdateSensorMap - " ! "NULL allianceSensorMap\n"); ! } ! } --- 1237,1265 ---- void tcMultiplayerInterface::UpdateSensorMap(int connectionId) { int connId = connectionId; tcPlayerStatus& pstatus = GetPlayerStatus(connId); int alliance = pstatus.alliance; tcSimState* simState = tcSimState::Get(); wxASSERT(simState); tcSensorMap* sensorMap = simState->GetSensorMap(); tcAllianceSensorMap* allianceSensorMap = sensorMap->GetMap(alliance); + if (allianceSensorMap == 0) return; + ! tcUpdateStream stream; ! tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::SENSOR_UPDATE, stream); ! ! tcUpdateMessageHandler::AddSensorUpdateHeader(alliance, stream); ! size_t initialStreamSize = stream.size(); ! ! *allianceSensorMap >> stream; ! if (stream.size() > initialStreamSize) ! { ! SendUpdateMessage(connId, stream); ! fprintf(stdout, ">> sensormap update msg sent, connId (%d) size (%d)\n", ! connId, stream.size()); ! } } *************** *** 1269,1272 **** --- 1334,1338 ---- tcMultiplayerInterface::~tcMultiplayerInterface() { + if (IsServer()) LogOutAllPlayers(); ClearMessageMap(); if (networkInterface) delete networkInterface; Index: tcNetworkInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcNetworkInterface.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcNetworkInterface.cpp 16 Apr 2005 20:44:43 -0000 1.16 --- tcNetworkInterface.cpp 17 Apr 2005 22:35:31 -0000 1.17 *************** *** 66,70 **** cdata->id = connectionIndex++; - socket->SetEventHandler(*this, cdata->id); socket->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_CONNECTION_FLAG); --- 66,69 ---- *************** *** 288,291 **** --- 287,291 ---- + /** * Lookup connection by peerName and return pointer to connection data |
|
From: Dewitt C. <ddc...@us...> - 2005-04-17 22:35:40
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14954/src/scriptinterface Modified Files: tcPlatformInterface.cpp Log Message: fixed problem writing to account database, added command state update as part of create update for new objects at client, removed application-level command ack Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** tcPlatformInterface.cpp 29 Mar 2005 00:12:27 -0000 1.41 --- tcPlatformInterface.cpp 17 Apr 2005 22:35:31 -0000 1.42 *************** *** 177,180 **** --- 177,185 ---- } + void tcPlatformInterface::SetAltitude(float alt_m) + { + mpPlatformObj->SetAltitude(alt_m); + } + /** * Set state to 1 to land object if near appropriate flightport. *************** *** 201,204 **** --- 206,214 ---- } + void tcPlatformInterface::SetSpeed(float speed_kts) + { + mpPlatformObj->SetSpeed(speed_kts); + } + /** * Sets speed to max speed or max military power for aero modeled aircraft. |
|
From: Dewitt C. <ddc...@us...> - 2005-04-17 22:35:40
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14954/src/graphics Modified Files: tc3DWindow.cpp tcAltitudeBarControl.cpp tcEditBox.cpp tcNetworkView.cpp tcRadioButton.cpp Log Message: fixed problem writing to account database, added command state update as part of create update for new objects at client, removed application-level command ack Index: tcRadioButton.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcRadioButton.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcRadioButton.cpp 2 Nov 2004 04:23:56 -0000 1.8 --- tcRadioButton.cpp 17 Apr 2005 22:35:31 -0000 1.9 *************** *** 67,71 **** */ backgroundColor.set(0.5f, 0.5f, 0.5f, 0.5f); ! textColor.set(0, 0, 0, 1); float width = float(mnWidth); --- 67,71 ---- */ backgroundColor.set(0.5f, 0.5f, 0.5f, 0.5f); ! textColor.set(1, 1, 1, 1); float width = float(mnWidth); Index: tcNetworkView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcNetworkView.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcNetworkView.cpp 16 Apr 2005 20:44:42 -0000 1.7 --- tcNetworkView.cpp 17 Apr 2005 22:35:31 -0000 1.8 *************** *** 311,314 **** --- 311,319 ---- usernameEdit->SetCommand(3); usernameEdit->SetClearOnReturn(false); + if (!tcOptions::Get()->OptionStringExists("UserName")) + { + tcOptions::Get()->SetOptionString("UserName", "observer"); + } + usernameEdit->SetBuffer(tcOptions::Get()->GetOptionString("UserName")); // add password edit box *************** *** 317,320 **** --- 322,326 ---- passwordEdit->SetCommand(4); passwordEdit->SetClearOnReturn(false); + usernameEdit->SetBuffer(""); if (!tcOptions::Get()->OptionStringExists("HostAddress")) *************** *** 356,360 **** chatEntry->SetCommand(2); chatEntry->SetClearOnReturn(true); ! chatEntry->SetBuffer("Enter chat text here"); } --- 362,366 ---- chatEntry->SetCommand(2); chatEntry->SetClearOnReturn(true); ! chatEntry->SetBuffer(""); } Index: tcAltitudeBarControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcAltitudeBarControl.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcAltitudeBarControl.cpp 23 Nov 2004 23:30:57 -0000 1.1 --- tcAltitudeBarControl.cpp 17 Apr 2005 22:35:31 -0000 1.2 *************** *** 153,162 **** { if (commandValue < 3) commandValue = 3; ! air->mcGS.SetAltitude(commandValue); } else if (tcSubObject* sub = dynamic_cast<tcSubObject*>(obj)) { if (commandValue > 0) commandValue = 0; ! sub->mcGS.SetAltitude(commandValue); } } --- 153,162 ---- { if (commandValue < 3) commandValue = 3; ! air->SetAltitude(commandValue); } else if (tcSubObject* sub = dynamic_cast<tcSubObject*>(obj)) { if (commandValue > 0) commandValue = 0; ! sub->SetAltitude(commandValue); } } Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tc3DWindow.cpp 16 Apr 2005 20:44:42 -0000 1.19 --- tc3DWindow.cpp 17 Apr 2005 22:35:31 -0000 1.20 *************** *** 2050,2057 **** --- 2050,2059 ---- { #ifdef _DEBUG + /* fprintf(stdout, "Destroying 3D window %s, %d text obj, %d image quad obj" ", line obj %d, rect obj %d, transform %d\n", wxWindow::GetName().c_str(), textPool.size(), imageQuadPool.size(), linePool.size(), rectPool.size(), transformPool.size()); + */ #endif if (hostParent) Index: tcEditBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcEditBox.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcEditBox.cpp 16 Apr 2005 20:44:42 -0000 1.10 --- tcEditBox.cpp 17 Apr 2005 22:35:31 -0000 1.11 *************** *** 72,77 **** // draw text ! DrawTextInRect(mzBuffer, mrectTextBar, defaultFont.get(), osg::Vec4(0, 0, 0, 1), fontSize, LEFT_BASE_LINE); // draw caption --- 72,81 ---- // draw text ! char* drawText = (starText == true) ? mzBufferHide : mzBuffer; ! ! ! DrawTextInRect(drawText, mrectTextBar, defaultFont.get(), osg::Vec4(0, 0, 0, 1), fontSize, LEFT_BASE_LINE); + // draw caption *************** *** 81,85 **** // draw cursor wxSize size; ! MeasureText(defaultFont.get(), fontSize, mzBuffer, size); osg::Vec4 cursorColor(0, 0, 0, 1); --- 85,89 ---- // draw cursor wxSize size; ! MeasureText(defaultFont.get(), fontSize, drawText, size); osg::Vec4 cursorColor(0, 0, 0, 1); *************** *** 113,117 **** int nLength = (int)strlen(mzBuffer); ! if (keycode == WXK_RETURN) { if (textChanged) --- 117,121 ---- int nLength = (int)strlen(mzBuffer); ! if ((keycode == WXK_RETURN) || (keycode == WXK_TAB)) { if (textChanged) *************** *** 125,129 **** if (clearOnReturn) { ! strcpy(mzBuffer,""); } } --- 129,134 ---- if (clearOnReturn) { ! strcpy(mzBuffer, ""); ! strcpy(mzBufferHide, ""); } } *************** *** 133,136 **** --- 138,142 ---- if (nLength == 0) return; mzBuffer[--nLength] = 0; + mzBufferHide[nLength] = 0; textChanged = true; } *************** *** 153,157 **** --- 159,165 ---- mzBuffer[nLength] = (char)keycode; + mzBufferHide[nLength] = '*'; mzBuffer[++nLength] = 0; + mzBufferHide[nLength] = 0; textChanged = true; } *************** *** 201,205 **** --- 209,220 ---- { strncpy(mzBuffer,azBuffer,MAX_EDITBOX_CHAR-1); + + for (size_t n=0; (n<strlen(azBuffer)) && (n<MAX_EDITBOX_CHAR-1); n++) + { + mzBufferHide[n] = '*'; + } + mzBuffer[MAX_EDITBOX_CHAR-1] = 0; + mzBufferHide[MAX_EDITBOX_CHAR-1] = 0; textChanged = true; } *************** *** 218,227 **** drawBackground(true), clearOnReturn(false), ! command(0) { ref_count++; ! strcpy(mzBuffer,"Default string"); strcpy(mzCaption,"Default caption"); mrectTextBar.left = 5.0f; --- 233,244 ---- drawBackground(true), clearOnReturn(false), ! command(0), ! starText(false) { ref_count++; ! strcpy(mzBuffer, ""); ! strcpy(mzBufferHide, ""); strcpy(mzCaption,"Default caption"); mrectTextBar.left = 5.0f; *************** *** 282,285 **** --- 299,306 ---- current->Attribute("FontSize", &xmlFontSize); if (xmlFontSize > 0) fontSize = xmlFontSize; + + int passwordMode = 0; + current->Attribute("PasswordMode", &passwordMode); + if (passwordMode != 0) starText = true; } |
|
From: Dewitt C. <ddc...@us...> - 2005-04-17 22:35:39
|
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14954/src/database Modified Files: tcDatabase.cpp Log Message: fixed problem writing to account database, added command state update as part of create update for new objects at client, removed application-level command ack Index: tcDatabase.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabase.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** tcDatabase.cpp 29 Mar 2005 00:12:26 -0000 1.25 --- tcDatabase.cpp 17 Apr 2005 22:35:31 -0000 1.26 *************** *** 326,329 **** --- 326,330 ---- } + BuildDictionaries(); } |
|
From: Dewitt C. <ddc...@us...> - 2005-04-17 22:35:39
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14954/src/common Modified Files: tcObjStream.cpp Log Message: fixed problem writing to account database, added command state update as part of create update for new objects at client, removed application-level command ack Index: tcObjStream.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcObjStream.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcObjStream.cpp 1 May 2004 21:50:27 -0000 1.1 --- tcObjStream.cpp 17 Apr 2005 22:35:30 -0000 1.2 *************** *** 27,30 **** --- 27,39 ---- // ------------------------- tcCreateStream ------------------------- + + /** + * Added crosscast as workaround to support mixtures of streams + */ + tcCommandStream& tcCreateStream::AsCommandStream() + { + return (tcCommandStream&)(*this); + } + /** * *************** *** 53,70 **** // ------------------------- tcCommandStream ------------------------- - /** - * - */ - bool tcCommandStream::GetAck() const - { - return isAck; - } /** ! * Sets ack state of this command stream */ ! void tcCommandStream::SetAck(bool state) { ! isAck = state; } --- 62,72 ---- // ------------------------- tcCommandStream ------------------------- /** ! * Added crosscast as workaround to support mixtures of streams */ ! tcCreateStream& tcCommandStream::AsCreateStream() { ! return (tcCreateStream&)(*this); } *************** *** 73,77 **** */ tcCommandStream::tcCommandStream(const char* data, std::streamsize count) ! : tcStream(data, count), isAck(false) { } --- 75,79 ---- */ tcCommandStream::tcCommandStream(const char* data, std::streamsize count) ! : tcStream(data, count) { } *************** *** 90,94 **** */ tcCommandStream::tcCommandStream() - : isAck(false) { } --- 92,95 ---- |
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14250/include/sim Modified Files: tcAeroAirObject.h tcAirObject.h tcCommandObject.h tcGameObject.h tcLauncherState.h tcPlatformObject.h tcSensorPlatform.h tcSubObject.h Log Message: fixed problem writing to account database, added command state update as part of create update for new objects at client, removed application-level command ack Index: tcGameObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGameObject.h,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** tcGameObject.h 29 Mar 2005 00:12:24 -0000 1.35 --- tcGameObject.h 17 Apr 2005 22:35:00 -0000 1.36 *************** *** 138,142 **** virtual void ClearNewCommand(); virtual bool HasNewCommand() const; ! virtual bool HasUnacknowledgedCommand() const; virtual bool IsDestroyed(); --- 138,142 ---- virtual void ClearNewCommand(); virtual bool HasNewCommand() const; ! virtual bool IsDestroyed(); Index: tcSubObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSubObject.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcSubObject.h 8 Mar 2005 00:41:47 -0000 1.3 --- tcSubObject.h 17 Apr 2005 22:35:00 -0000 1.4 *************** *** 70,74 **** virtual void ClearNewCommand(); virtual bool HasNewCommand() const; - virtual bool HasUnacknowledgedCommand() const; tcSubObject(); --- 70,73 ---- Index: tcAeroAirObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcAeroAirObject.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcAeroAirObject.h 11 Mar 2005 02:46:46 -0000 1.9 --- tcAeroAirObject.h 17 Apr 2005 22:35:00 -0000 1.10 *************** *** 32,35 **** --- 32,37 ---- } + class tcCommandStream; + /** * Aerodynamic air object model. *************** *** 48,56 **** void PrintToFile(tcFile& file); void SaveToFile(tcFile& file); float GetThrottleFraction() {return throttleFraction;} ! void SetThrottleFraction(float fract) {throttleFraction = fract;} void LoadFromFile(tcFile& file); virtual void Serialize(tcFile& file, bool mbLoad); tcAeroAirObject(); tcAeroAirObject(tcAeroAirObject&); --- 50,66 ---- void PrintToFile(tcFile& file); void SaveToFile(tcFile& file); + float GetThrottleFraction() {return throttleFraction;} ! void SetThrottleFraction(float fract); ! void LoadFromFile(tcFile& file); virtual void Serialize(tcFile& file, bool mbLoad); + virtual tcCommandStream& operator<<(tcCommandStream& stream); + virtual tcCommandStream& operator>>(tcCommandStream& stream); + + virtual void ClearNewCommand(); + virtual bool HasNewCommand() const; + tcAeroAirObject(); tcAeroAirObject(tcAeroAirObject&); *************** *** 64,70 **** --- 74,87 ---- virtual void UpdateSpeed(float dt_s); private: + enum + { + THROTTLE_CMD = 0x0001 + }; + tcCommandObject commandObj; float throttleFraction; ///< throttle setting from 0 to 1 military, greater than 1 to use afterburners float angleOfAttack; ///< angle of attack in radians, solved assuming level flight const float liftCoeffToAoa; ///< factor to convert Cl to AOA + + float GetParasiticDragCoefficient(float vmach); float UpdateThrust(float dt_s); Index: tcAirObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcAirObject.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcAirObject.h 8 Mar 2005 00:41:47 -0000 1.13 --- tcAirObject.h 17 Apr 2005 22:35:00 -0000 1.14 *************** *** 72,76 **** virtual void ClearNewCommand(); virtual bool HasNewCommand() const; - virtual bool HasUnacknowledgedCommand() const; tcAirObject(); --- 72,75 ---- Index: tcCommandObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcCommandObject.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcCommandObject.h 24 May 2004 00:14:46 -0000 1.1 --- tcCommandObject.h 17 Apr 2005 22:35:00 -0000 1.2 *************** *** 38,42 **** void ClearNewCommand(); bool HasNewCommand() const; ! bool HasUnacknowledgedCommand() const; /// implements rules for updating command params over multiplayer connection void LoadCommandParam(tcCommandStream& stream, float& param, int flag); --- 38,42 ---- void ClearNewCommand(); bool HasNewCommand() const; ! /// implements rules for updating command params over multiplayer connection void LoadCommandParam(tcCommandStream& stream, float& param, int flag); *************** *** 52,58 **** private: - /// flag to indicate new obj command since last update - bool newCommand; - /** * bitfield to manage acknowledgement for command updates. --- 52,55 ---- Index: tcLauncherState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcLauncherState.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcLauncherState.h 29 Mar 2005 00:12:24 -0000 1.14 --- tcLauncherState.h 17 Apr 2005 22:35:00 -0000 1.15 *************** *** 88,92 **** void ClearNewCommand(); bool HasNewCommand() const; - bool HasUnacknowledgedCommand() const; void Serialize(tcFile& file, bool abLoad); --- 88,91 ---- Index: tcPlatformObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPlatformObject.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** tcPlatformObject.h 29 Mar 2005 00:12:24 -0000 1.25 --- tcPlatformObject.h 17 Apr 2005 22:35:00 -0000 1.26 *************** *** 138,142 **** virtual void ClearNewCommand(); virtual bool HasNewCommand() const; - virtual bool HasUnacknowledgedCommand() const; tcPlatformObject(); --- 138,141 ---- Index: tcSensorPlatform.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorPlatform.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcSensorPlatform.h 4 Mar 2005 00:46:15 -0000 1.1 --- tcSensorPlatform.h 17 Apr 2005 22:35:00 -0000 1.2 *************** *** 88,92 **** void ClearNewCommand(); bool HasNewCommand() const; - bool HasUnacknowledgedCommand() const; tcSensorPlatform(); --- 88,91 ---- |
|
From: Dewitt C. <ddc...@us...> - 2005-04-17 22:35:09
|
Update of /cvsroot/gcblue/gcb_wx/include/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14250/include/network Modified Files: tcConnectionData.h tcMultiplayerInterface.h tcNetworkInterface.h Log Message: fixed problem writing to account database, added command state update as part of create update for new objects at client, removed application-level command ack Index: tcMultiplayerInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcMultiplayerInterface.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tcMultiplayerInterface.h 16 Apr 2005 20:43:55 -0000 1.20 --- tcMultiplayerInterface.h 17 Apr 2005 22:34:59 -0000 1.21 *************** *** 27,30 **** --- 27,32 ---- #endif + #include "wx/wx.h" + #include <list> #include <map> *************** *** 111,114 **** --- 113,118 ---- bool IsCommand(const std::string& text); bool IsServer(); + int LogInPlayer(const std::string& username, int connectionId, wxString& msg); + void LogOutAllPlayers(); void MakeClient(); void MakeServer(); *************** *** 159,163 **** void UpdateDestroyedEntities(int connectionId); void UpdateNewAndExistingEntities(int connectionId); ! void UpdateEntityCommands(int connectionId, bool updateUnack, bool clearNewCmdFlag); void UpdateEntities(); void UpdatePing(); --- 163,167 ---- void UpdateDestroyedEntities(int connectionId); void UpdateNewAndExistingEntities(int connectionId); ! void UpdateEntityCommands(int connectionId, bool clearNewCmdFlag); void UpdateEntities(); void UpdatePing(); Index: tcNetworkInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcNetworkInterface.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcNetworkInterface.h 16 Apr 2005 20:43:55 -0000 1.10 --- tcNetworkInterface.h 17 Apr 2005 22:34:59 -0000 1.11 *************** *** 67,70 **** --- 67,72 ---- tcMessage* GetMessage(int id); unsigned int GetNumConnections(); + tcConnectionData* GetConnection(int id); + bool IsServer() const; void MakeClient(); *************** *** 119,123 **** int CheckoutMessage(); ! tcConnectionData* GetConnection(int id); tcConnectionData* GetConnection(const std::string& peerName); wxDatagramSocket* GetDatagramSocket() {return datagramSock;} --- 121,125 ---- int CheckoutMessage(); ! tcConnectionData* GetConnection(const std::string& peerName); wxDatagramSocket* GetDatagramSocket() {return datagramSock;} Index: tcConnectionData.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcConnectionData.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcConnectionData.h 16 Apr 2005 20:43:55 -0000 1.8 --- tcConnectionData.h 17 Apr 2005 22:34:59 -0000 1.9 *************** *** 65,68 **** --- 65,69 ---- // free all queued messages void ClearAllMessages(); + const char* GetIdString() const; const wxIPV4address& GetPeerAddress() const; unsigned long GetReadCount() const; |
|
From: Dewitt C. <ddc...@us...> - 2005-04-17 22:35:09
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14250/include/scriptinterface Modified Files: tcPlatformInterface.h Log Message: fixed problem writing to account database, added command state update as part of create update for new objects at client, removed application-level command ack Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** tcPlatformInterface.h 29 Mar 2005 00:12:23 -0000 1.37 --- tcPlatformInterface.h 17 Apr 2005 22:34:59 -0000 1.38 *************** *** 134,142 **** * @param alt_m goal altitude of platform in meters */ ! void SetAltitude(float alt_m) {mpPlatformObj->mcGS.mfGoalAltitude_m = alt_m;} /// sets maximum +/- pitch for air objects in degrees, workaround to slow descent for cv landing void SetPitchLimitDeg(float lim_deg); /// sets speed of platform ! void SetSpeed(float speed_kts) {mpPlatformObj->SetSpeed(speed_kts);} /// set speed of platform to maximum speed (use SetThrottle for aero air objects) void SetSpeedToMax(); --- 134,142 ---- * @param alt_m goal altitude of platform in meters */ ! void SetAltitude(float alt_m); /// sets maximum +/- pitch for air objects in degrees, workaround to slow descent for cv landing void SetPitchLimitDeg(float lim_deg); /// sets speed of platform ! void SetSpeed(float speed_kts); /// set speed of platform to maximum speed (use SetThrottle for aero air objects) void SetSpeedToMax(); |
|
From: Dewitt C. <ddc...@us...> - 2005-04-17 22:35:08
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14250/include/graphics Modified Files: tcEditBox.h Log Message: fixed problem writing to account database, added command state update as part of create update for new objects at client, removed application-level command ack Index: tcEditBox.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcEditBox.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcEditBox.h 2 Oct 2004 22:41:32 -0000 1.6 --- tcEditBox.h 17 Apr 2005 22:34:59 -0000 1.7 *************** *** 59,63 **** --- 59,65 ---- char mzCaption[MAX_EDITBOX_CHAR]; char mzBuffer[MAX_EDITBOX_CHAR]; + char mzBufferHide[MAX_EDITBOX_CHAR]; ///< buffer with * chars for password entry mode long command; + bool starText; ///< true to use * for text for password entry |
|
From: Dewitt C. <ddc...@us...> - 2005-04-17 22:35:08
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14250/include/common Modified Files: tcObjStream.h Log Message: fixed problem writing to account database, added command state update as part of create update for new objects at client, removed application-level command ack Index: tcObjStream.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcObjStream.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcObjStream.h 1 May 2004 21:50:23 -0000 1.1 --- tcObjStream.h 17 Apr 2005 22:34:59 -0000 1.2 *************** *** 29,32 **** --- 29,36 ---- #include "common/tcStream.h" + class tcCommandStream; + class tcCreateStream; + class tcUpdateStream; + /** * This file holds the classes derived from tcStream that are used for obj *************** *** 41,44 **** --- 45,49 ---- { public: + tcCommandStream& AsCommandStream(); tcCreateStream(); tcCreateStream(const char* data, std::streamsize count); *************** *** 64,71 **** { public: ! bool isAck; ///< set true to indicate acknowledgement command update ! ! bool GetAck() const; ! void SetAck(bool state); tcCommandStream(); --- 69,73 ---- { public: ! tcCreateStream& AsCreateStream(); tcCommandStream(); |
|
From: Dewitt C. <ddc...@us...> - 2005-04-16 20:44:52
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11335/src/sim Modified Files: Game.cpp tcFlightOpsObject.cpp tcLauncher.cpp tcLauncherState.cpp tcSensorPlatform.cpp tcSimState.cpp Log Message: housekeeping, networking upgrades, fixed wrapping problems with world map Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** tcSimState.cpp 8 Apr 2005 01:54:12 -0000 1.76 --- tcSimState.cpp 16 Apr 2005 20:44:43 -0000 1.77 *************** *** 2535,2538 **** --- 2535,2546 ---- tcGameObject::SetClientMode(false); tcCommandObject::SetClientMode(false); + + if (tcOptions::Get()->OptionStringExists("UsePositionRegistry")) + { + if (positionRegistry == 0) + { + positionRegistry = new tcPositionRegistry; + } + } } *************** *** 2553,2556 **** --- 2561,2570 ---- tcGameObject::SetClientMode(true); tcCommandObject::SetClientMode(true); + + if (positionRegistry) + { + delete positionRegistry; + positionRegistry = 0; + } } *************** *** 2565,2568 **** --- 2579,2590 ---- tcGameObject::SetClientMode(false); tcCommandObject::SetClientMode(false); + + if (tcOptions::Get()->OptionStringExists("UsePositionRegistry")) + { + if (positionRegistry == 0) + { + positionRegistry = new tcPositionRegistry; + } + } } Index: tcFlightOpsObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcFlightOpsObject.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcFlightOpsObject.cpp 6 Apr 2005 02:19:50 -0000 1.7 --- tcFlightOpsObject.cpp 16 Apr 2005 20:44:43 -0000 1.8 *************** *** 67,71 **** tcCreateStream& tcFlightOpsObject::operator<<(tcCreateStream& stream) { ! return stream; --- 67,90 ---- tcCreateStream& tcFlightOpsObject::operator<<(tcCreateStream& stream) { ! unsigned short nChildren; ! stream >> nChildren; ! ! wxASSERT(flight_deck.GetCount() == 0); ! ! for (unsigned short k=0; k < nChildren; k++) ! { ! long key; ! stream >> key; ! ! tcDatabaseObject* databaseObj = database->GetObject(key); ! ! std::string unitName; ! stream >> unitName; ! ! unsigned char loc; ! stream >> loc; ! ! AddChildToFlightDeck(databaseObj, unitName, teLocation(loc)); ! } return stream; *************** *** 107,131 **** tcUpdateStream& tcFlightOpsObject::operator<<(tcUpdateStream& stream) { - unsigned short nChildren; - stream >> nChildren; - - wxASSERT(flight_deck.GetCount() == 0); - - for (unsigned short k=0; k < nChildren; k++) - { - long key; - stream >> key; - - tcDatabaseObject* databaseObj = database->GetObject(key); - - std::string unitName; - stream >> unitName; - - unsigned char loc; - stream >> loc; - - AddChildToFlightDeck(databaseObj, unitName, teLocation(loc)); - } - return stream; } --- 126,129 ---- Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** tcLauncherState.cpp 29 Mar 2005 00:12:29 -0000 1.27 --- tcLauncherState.cpp 16 Apr 2005 20:44:43 -0000 1.28 *************** *** 427,430 **** --- 427,447 ---- } + // update damage + unsigned short launcherDamage; + stream >> launcherDamage; + + unsigned short damageFlag = 0x0001; + + size_t nLaunchers = launchers.size(); + wxASSERT(nLaunchers <= 8*sizeof(launcherDamage)); + for (size_t k=0; k<nLaunchers; k++) + { + bool damageState = (launcherDamage & damageFlag) != 0; + launchers[k]->SetDamaged(damageState); + + damageFlag = damageFlag << 1; + } + + return stream; } *************** *** 436,444 **** --- 453,476 ---- tcUpdateStream& tcLauncherState::operator>>(tcUpdateStream& stream) { + unsigned short launcherDamage = 0; + + unsigned short damageFlag = 0x0001; + + wxASSERT(mnCount <= 8*sizeof(launcherDamage)); + for(int n = 0; n < mnCount; n++) { tcLauncher& ldata = *launchers[n]; ldata >> stream; + + // update damage flag + if (launchers[n]->IsDamaged()) + { + launcherDamage |= damageFlag; + } + damageFlag = damageFlag << 1; } + + stream << launcherDamage; return stream; Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -d -r1.126 -r1.127 *** Game.cpp 31 Mar 2005 03:51:13 -0000 1.126 --- Game.cpp 16 Apr 2005 20:44:43 -0000 1.127 *************** *** 237,240 **** --- 237,250 ---- UninitGame(); + // if in multiplayer client mode, switch to multiplayer off mode + if (networkView->GetNetworkMode() == tcNetworkView::MULTIPLAYER_CLIENT) + { + /* TODO: should have one object for network state vs. current system + ** with state in tcGame, tcSimState, tcNetworkView */ + wxASSERT(multiplayerMode == 1); + networkView->SetNetworkMode(tcNetworkView::MULTIPLAYER_OFF); + multiplayerMode = 0; + } + simState->RandInit(); // generate new random scenario HookRandomFriendly(); Index: tcLauncher.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncher.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcLauncher.cpp 31 Mar 2005 03:51:13 -0000 1.16 --- tcLauncher.cpp 16 Apr 2005 20:44:43 -0000 1.17 *************** *** 781,785 **** tcLauncher::tcLauncher() { ! wxASSERT(false); } --- 781,785 ---- tcLauncher::tcLauncher() { ! } Index: tcSensorPlatform.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorPlatform.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcSensorPlatform.cpp 4 Mar 2005 00:46:18 -0000 1.1 --- tcSensorPlatform.cpp 16 Apr 2005 20:44:43 -0000 1.2 *************** *** 265,268 **** --- 265,284 ---- tcUpdateStream& tcSensorPlatform::operator<<(tcUpdateStream& stream) { + unsigned short sensorDamage; + stream >> sensorDamage; + + + unsigned short damageFlag = 0x0001; + + size_t nSensors = sensorState.size(); + wxASSERT(nSensors <= 8*sizeof(sensorDamage)); + + for(size_t n=0; n < nSensors; n++) + { + bool damageState = (sensorDamage & damageFlag) != 0; + sensorState[n]->SetDamaged(damageState); + + damageFlag = damageFlag << 1; + } return stream; *************** *** 274,277 **** --- 290,311 ---- tcUpdateStream& tcSensorPlatform::operator>>(tcUpdateStream& stream) { + unsigned short sensorDamage = 0; + + unsigned short damageFlag = 0x0001; + + size_t nSensors = sensorState.size(); + wxASSERT(nSensors <= 8*sizeof(sensorDamage)); + + for(size_t n=0; n < nSensors; n++) + { + if (sensorState[n]->IsDamaged()) + { + sensorDamage |= damageFlag; + } + damageFlag = damageFlag << 1; + } + + stream << sensorDamage; + return stream; } |
|
From: Dewitt C. <ddc...@us...> - 2005-04-16 20:44:52
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11335/src/graphics Modified Files: tc3DWindow.cpp tcChatBox.cpp tcConsoleBox.cpp tcEditBox.cpp tcMapView.cpp tcNetworkView.cpp tcTerrainView.cpp Log Message: housekeeping, networking upgrades, fixed wrapping problems with world map Index: tcNetworkView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcNetworkView.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcNetworkView.cpp 8 Apr 2005 01:54:11 -0000 1.6 --- tcNetworkView.cpp 16 Apr 2005 20:44:42 -0000 1.7 *************** *** 45,48 **** --- 45,50 ---- EVT_COMMAND(1, wxEVT_COMMAND_TEXT_UPDATED, tcNetworkView::SetIPText) EVT_COMMAND(2, wxEVT_COMMAND_TEXT_UPDATED, tcNetworkView::SendChatText) + EVT_COMMAND(3, wxEVT_COMMAND_TEXT_UPDATED, tcNetworkView::SetUsername) + EVT_COMMAND(4, wxEVT_COMMAND_TEXT_UPDATED, tcNetworkView::SetPassword) END_EVENT_TABLE() *************** *** 77,86 **** CENTER_CENTER); - unsigned nConnections = tcMultiplayerInterface::Get()->GetNumConnections(); x = (float)statusBoxBounds.x + 10.0f; ! for (unsigned n=0;n<nConnections;n++) ! { y += 14.0f; ! std::string connectionStatus = tcMultiplayerInterface::Get()->GetConnectionStatus(n); DrawTextR(connectionStatus.c_str(), x, y, defaultFont.get(), color, 12.0f, --- 79,90 ---- CENTER_CENTER); x = (float)statusBoxBounds.x + 10.0f; ! ! const std::list<int>& connectionList = tcMultiplayerInterface::Get()->GetConnectionList(); ! std::list<int>::const_iterator iter = connectionList.begin(); ! for ( ; iter != connectionList.end(); ++iter) ! { y += 14.0f; ! std::string connectionStatus = tcMultiplayerInterface::Get()->GetConnectionStatus(*iter); DrawTextR(connectionStatus.c_str(), x, y, defaultFont.get(), color, 12.0f, *************** *** 92,99 **** LEFT_CENTER); ! } /** * Only applies in client mode when already connected --- 96,107 ---- LEFT_CENTER); + } ! int tcNetworkView::GetNetworkMode() const ! { ! return networkMode; } + /** * Only applies in client mode when already connected *************** *** 160,171 **** } ! unsigned nConnections = multiplayerInterface->GetNumConnections(); ! ! for (unsigned n=0;n<nConnections;n++) ! { ! int connId = tcMultiplayerInterface::Get()->GetConnectionId(n); ! tcMultiplayerInterface::Get()->SendChatText(connId, chatText); ! } ! // if server, print chat text locally since no echo comes back --- 168,172 ---- } ! tcMultiplayerInterface::Get()->BroadcastChatText(chatText); // if server, print chat text locally since no echo comes back *************** *** 195,204 **** int mode = event.m_extraLong; if (networkMode == mode) return; - // switching to client mode also terminates all connections if (mode == MULTIPLAYER_OFF) { ! tcMultiplayerInterface::Get()->MakeClient(); tcSimState::Get()->SetMultiplayerOff(); } --- 196,212 ---- int mode = event.m_extraLong; + SetNetworkMode(mode); + + event.Skip(); // send event on to application + } + + void tcNetworkView::SetNetworkMode(int mode) + { if (networkMode == mode) return; if (mode == MULTIPLAYER_OFF) { ! // terminate all connections ! tcMultiplayerInterface::Get()->Reset(); tcSimState::Get()->SetMultiplayerOff(); } *************** *** 224,236 **** } - //tcMultiplayerInterface::Get().OpenConnection("192.168.0.101"); - networkMode = mode; ! event.Skip(); // send event on to application } void tcNetworkView::SendTest(wxCommandEvent& event) { std::string testText = "Test text for UDP"; --- 232,255 ---- } networkMode = mode; + } ! void tcNetworkView::SetUsername(wxCommandEvent& event) ! { ! std::string s = event.GetString().c_str(); ! ! tcMultiplayerInterface::Get()->SetName(s); ! } ! ! void tcNetworkView::SetPassword(wxCommandEvent& event) ! { ! std::string s = event.GetString().c_str(); ! ! tcMultiplayerInterface::Get()->SetPassword(s); } void tcNetworkView::SendTest(wxCommandEvent& event) { + /* std::string testText = "Test text for UDP"; *************** *** 250,253 **** --- 269,273 ---- chatBox->Print(localText.c_str()); } + */ } *************** *** 286,289 **** --- 306,321 ---- ipEdit->SetClearOnReturn(false); + // add username edit box + current = root->FirstChild("EditName"); + usernameEdit = new tcEditBox(this, current); + usernameEdit->SetCommand(3); + usernameEdit->SetClearOnReturn(false); + + // add password edit box + current = root->FirstChild("EditPassword"); + passwordEdit = new tcEditBox(this, current); + passwordEdit->SetCommand(4); + passwordEdit->SetClearOnReturn(false); + if (!tcOptions::Get()->OptionStringExists("HostAddress")) { Index: tcConsoleBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcConsoleBox.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcConsoleBox.cpp 2 Mar 2005 22:28:43 -0000 1.12 --- tcConsoleBox.cpp 16 Apr 2005 20:44:42 -0000 1.13 *************** *** 151,155 **** y = nyzero-(int)i*nlinespace; ! if (y<0) break; --- 151,155 ---- y = nyzero-(int)i*nlinespace; ! if (y<15) break; Index: tcChatBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcChatBox.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcChatBox.cpp 21 Oct 2004 04:10:59 -0000 1.2 --- tcChatBox.cpp 16 Apr 2005 20:44:42 -0000 1.3 *************** *** 86,97 **** } ! unsigned nConnections = multiplayerInterface->GetNumConnections(); ! ! for (unsigned n=0;n<nConnections;n++) ! { ! int connId = tcMultiplayerInterface::Get()->GetConnectionId(n); ! tcMultiplayerInterface::Get()->SendChatText(connId, chatText); ! } ! // if server, print chat text locally since no echo comes back --- 86,90 ---- } ! tcMultiplayerInterface::Get()->BroadcastChatText(chatText); // if server, print chat text locally since no echo comes back Index: tcTerrainView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcTerrainView.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcTerrainView.cpp 19 Mar 2005 15:31:09 -0000 1.5 --- tcTerrainView.cpp 16 Apr 2005 20:44:42 -0000 1.6 *************** *** 44,49 **** if (!redraw) return; ! DrawZoomedImage(mapImage.get(), 0, 0, (float)mnWidth, (float)mnHeight, ! displayRegion, ALIGN_BOTTOM_LEFT); FinishDraw(); --- 44,61 ---- if (!redraw) return; ! // if displayRegion is wrapped, draw two images ! ! if (!isWrapped) ! { ! DrawZoomedImage(mapImage.get(), 0, 0, (float)mnWidth, (float)mnHeight, ! displayRegion, ALIGN_BOTTOM_LEFT); ! } ! else ! { ! DrawZoomedImage(mapImage.get(), 0, 0, wrapWidth*(float)mnWidth, (float)mnHeight, ! displayRegion, ALIGN_BOTTOM_LEFT); ! DrawZoomedImage(mapImage.get(), wrapWidth*(float)mnWidth, 0, (1.0f-wrapWidth)*(float)mnWidth, (float)mnHeight, ! displayRegionWrapped, ALIGN_BOTTOM_LEFT); ! } FinishDraw(); *************** *** 88,107 **** mrectCurrentView = r; ! /* ! float surfaceWidth, surfaceHeight; // surface coordinate dimensions ! osg::Image* image = mapImage->getImage(); ! wxASSERT(image); ! ! surfaceWidth = (float)image->s(); ! surfaceHeight = (float)image->t(); ! */ ! // assumes longitude is within [-pi,pi) and lat within [-pi/2,pi/2] ! displayRegion.left = (r.left - mrectMap.left)/mrectMap.Width(); ! displayRegion.right = (r.right - mrectMap.left)/mrectMap.Width(); ! displayRegion.bottom = (r.bottom - mrectMap.bottom)/mrectMap.Height(); ! displayRegion.top = (r.top - mrectMap.bottom)/mrectMap.Height(); ! redraw = true; } --- 100,131 ---- mrectCurrentView = r; ! isWrapped = r.left > r.right; ! if (!isWrapped) ! { ! // assumes longitude is within [-pi,pi) and lat within [-pi/2,pi/2] ! displayRegion.left = (r.left - mrectMap.left)/mrectMap.Width(); ! displayRegion.right = (r.right - mrectMap.left)/mrectMap.Width(); ! displayRegion.bottom = (r.bottom - mrectMap.bottom)/mrectMap.Height(); ! displayRegion.top = (r.top - mrectMap.bottom)/mrectMap.Height(); ! wrapWidth = 1.0f; ! } ! else ! { ! displayRegion.left = (r.left - mrectMap.left)/mrectMap.Width(); ! displayRegion.right = 1.0f; ! displayRegion.bottom = (r.bottom - mrectMap.bottom)/mrectMap.Height(); ! displayRegion.top = (r.top - mrectMap.bottom)/mrectMap.Height(); ! ! displayRegionWrapped.left = 0; ! displayRegionWrapped.right = (r.right - mrectMap.left)/mrectMap.Width(); ! displayRegionWrapped.bottom = (r.bottom - mrectMap.bottom)/mrectMap.Height(); ! displayRegionWrapped.top = (r.top - mrectMap.bottom)/mrectMap.Height(); ! ! wrapWidth = (1.0f - displayRegion.left) / (1.0f - displayRegion.left + displayRegionWrapped.right); ! ! } ! redraw = true; } Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tc3DWindow.cpp 31 Mar 2005 03:51:12 -0000 1.18 --- tc3DWindow.cpp 16 Apr 2005 20:44:42 -0000 1.19 *************** *** 2018,2022 **** } ! defaultFont = osgText::readFontFile("fonts/arial.ttf"); InitGraphicsObjects(); --- 2018,2022 ---- } ! defaultFont = osgText::readFontFile("fonts/times.ttf"); InitGraphicsObjects(); Index: tcEditBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcEditBox.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcEditBox.cpp 2 Nov 2004 04:23:56 -0000 1.9 --- tcEditBox.cpp 16 Apr 2005 20:44:42 -0000 1.10 *************** *** 73,85 **** // draw text DrawTextInRect(mzBuffer, mrectTextBar, defaultFont.get(), ! osg::Vec4(0, 0, 0, 1), 12.0f, LEFT_BASE_LINE); // draw caption DrawTextInRectR(mzCaption, mrectTextBar, defaultFont.get(), ! osg::Vec4(1, 1, 1, 1), 12.0f, CENTER_CENTER); // draw cursor wxSize size; ! MeasureText(defaultFont.get(), 12.0f, mzBuffer, size); osg::Vec4 cursorColor(0, 0, 0, 1); --- 73,85 ---- // draw text DrawTextInRect(mzBuffer, mrectTextBar, defaultFont.get(), ! osg::Vec4(0, 0, 0, 1), fontSize, LEFT_BASE_LINE); // draw caption DrawTextInRectR(mzCaption, mrectTextBar, defaultFont.get(), ! osg::Vec4(1, 1, 1, 1), fontSize, CENTER_CENTER); // draw cursor wxSize size; ! MeasureText(defaultFont.get(), fontSize, mzBuffer, size); osg::Vec4 cursorColor(0, 0, 0, 1); *************** *** 91,95 **** if (isFocused) { ! float xcursor = mrectTextBar.left + size.GetWidth() + 1.0f; float xcursorMax = mrectTextBar.right - 2.0f; --- 91,95 ---- if (isFocused) { ! float xcursor = mrectTextBar.left + size.GetWidth() + 2.0f; float xcursorMax = mrectTextBar.right - 2.0f; *************** *** 115,119 **** if (keycode == WXK_RETURN) { ! if ((textChanged)&&(clearOnReturn)) { wxCommandEvent command(wxEVT_COMMAND_TEXT_UPDATED, command) ; --- 115,119 ---- if (keycode == WXK_RETURN) { ! if (textChanged) { wxCommandEvent command(wxEVT_COMMAND_TEXT_UPDATED, command) ; *************** *** 121,126 **** command.SetString(mzBuffer); AddPendingEvent(command); // TODO add handler added in tcGame for this event ! strcpy(mzBuffer,""); ! textChanged = false; } } --- 121,130 ---- command.SetString(mzBuffer); AddPendingEvent(command); // TODO add handler added in tcGame for this event ! ! textChanged = false; ! if (clearOnReturn) ! { ! strcpy(mzBuffer,""); ! } } } *************** *** 274,277 **** --- 278,285 ---- drawBackground = (mrectTextBar.Width() < (float)width); + + double xmlFontSize = 0; + current->Attribute("FontSize", &xmlFontSize); + if (xmlFontSize > 0) fontSize = xmlFontSize; } Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcMapView.cpp 31 Mar 2005 03:51:12 -0000 1.22 --- tcMapView.cpp 16 Apr 2005 20:44:42 -0000 1.23 *************** *** 2698,2709 **** p1 = GeoToScreen(p1); p2 = GeoToScreen(p2); width = p2.x - p1.x; height = p1.y - p2.y; - //Pen* pen = (width > 16.0f) ? mpPen : mpPenThin; - osg::Vec4 color(1, 1, 1, 1); ! DrawRectangleR(p1.x, p2.y, width, height, color); } /** --- 2698,2725 ---- p1 = GeoToScreen(p1); p2 = GeoToScreen(p2); + + float fWidth = (float)mnWidth; + float fHeight = (float)mnHeight; + + if ((p1.x > fWidth) || (p2.x < 0) || + (p2.y > fHeight) || (p1.y < 0)) + { + return; + } + + + if (p1.x < 0) p1.x = 0; + if (p2.y < 0) p2.y = 0; + if (p2.x > fWidth) p2.x = fWidth; + if (p1.y > fHeight) p1.y = fHeight; + + width = p2.x - p1.x; height = p1.y - p2.y; osg::Vec4 color(1, 1, 1, 1); ! DrawRectangleR(p1.x, p2.y, width, height, color); ! } /** *************** *** 2780,2784 **** { wxPoint point = event.GetPosition(); ! if (event.ShiftDown()) { tcSound::Get()->PlayEffect("Beep2"); --- 2796,2800 ---- { wxPoint point = event.GetPosition(); ! if (event.AltDown()) { tcSound::Get()->PlayEffect("Beep2"); |
|
From: Dewitt C. <ddc...@us...> - 2005-04-16 20:44:52
|
Update of /cvsroot/gcblue/gcb_wx/src/sqlite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11335/src/sqlite Modified Files: sqlite_reader.cpp Log Message: housekeeping, networking upgrades, fixed wrapping problems with world map Index: sqlite_reader.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sqlite/sqlite_reader.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sqlite_reader.cpp 8 Aug 2004 00:31:35 -0000 1.1 --- sqlite_reader.cpp 16 Apr 2005 20:44:43 -0000 1.2 *************** *** 67,70 **** --- 67,76 ---- } + long reader::getlong(int index) + { + string s = this->getstring(index); + return atol(s.c_str()); + } + std::string reader::getstring(int index) { if(index>(argc-1)) throw out_of_range("index is out of range"); |
|
From: Dewitt C. <ddc...@us...> - 2005-04-16 20:44:51
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11335/src/common Modified Files: simmath.cpp tcStream.cpp Log Message: housekeeping, networking upgrades, fixed wrapping problems with world map Index: simmath.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/simmath.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** simmath.cpp 10 Mar 2005 03:28:28 -0000 1.23 --- simmath.cpp 16 Apr 2005 20:44:42 -0000 1.24 *************** *** 188,193 **** bool bLeftIn, bRightIn; bool bAdjustLeft; ! bool bWrapped = left > right; ! if (r.top > top) { r.Offset(0, top - r.top); --- 188,194 ---- bool bLeftIn, bRightIn; bool bAdjustLeft; ! // bool bWrapped = left > right; ! bool bWrapped = r.left > r.right; ! if (r.top > top) { r.Offset(0, top - r.top); *************** *** 197,200 **** --- 198,203 ---- } + if (bWrapped) return; + if (r.left > r.right) { r.left -= C_TWOPI; Index: tcStream.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcStream.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcStream.cpp 17 May 2004 00:38:53 -0000 1.7 --- tcStream.cpp 16 Apr 2005 20:44:42 -0000 1.8 *************** *** 174,178 **** } ! tcStream& tcStream::operator<<(std::string& val) { size_t len = val.size(); --- 174,178 ---- } ! tcStream& tcStream::operator<<(const std::string& val) { size_t len = val.size(); |
|
From: Dewitt C. <ddc...@us...> - 2005-04-16 20:44:04
|
Update of /cvsroot/gcblue/gcb_wx/include/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11092/include/network Modified Files: tcConnectionData.h tcControlMessageHandler.h tcMessage.h tcMultiplayerInterface.h tcNetworkInterface.h Log Message: housekeeping, networking upgrades, fixed wrapping problems with world map Index: tcControlMessageHandler.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcControlMessageHandler.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcControlMessageHandler.h 8 Apr 2005 01:54:11 -0000 1.6 --- tcControlMessageHandler.h 16 Apr 2005 20:43:55 -0000 1.7 *************** *** 55,58 **** --- 55,59 ---- }; + static void CreateControlMessage(int messageCode, unsigned& messageSize, unsigned char *data, int param = 0); Index: tcMultiplayerInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcMultiplayerInterface.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcMultiplayerInterface.h 8 Apr 2005 01:54:11 -0000 1.19 --- tcMultiplayerInterface.h 16 Apr 2005 20:43:55 -0000 1.20 *************** *** 1,6 **** ! /** @file tcMultiplayerInterface.h*/ ! /* ! ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcMultiplayerInterface.h ! */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 27,32 **** #endif ! #include <queue> #include <map> #include <string> #include <vector> --- 27,33 ---- #endif ! #include <list> #include <map> + #include <queue> #include <string> #include <vector> *************** *** 56,67 **** public: std::string name; ///< handle for player int alliance; ///< player's alliance ! unsigned timestamp; ///< time of last update float ping_s; ///< value of last ping ! std::map<long, double> lastUpdate; ///< map of (obj id, update time) pairs void EraseEntry(long id); ! bool GetLastUpdate(long id, double& updateTime); ! void SetUpdate(long id, double updateTime); }; --- 57,72 ---- public: std::string name; ///< handle for player + bool isAuthenticated; ///< true if password has been verified int alliance; ///< player's alliance ! unsigned int timestamp; ///< time of last network update (30 Hz tics) ! unsigned int startTime; ///< time connection started (30 Hz tics) ! unsigned int entityUpdateTime; ///< time of last entity update (30 Hz tics) ! unsigned int sensorUpdateTime; ///< time of last sensor update (30 Hz tics) float ping_s; ///< value of last ping ! std::map<long, unsigned int> lastUpdate; ///< map of (obj id, update time (30Hz tics)) void EraseEntry(long id); ! bool GetLastUpdate(long id, unsigned int& updateTime); ! void SetUpdate(long id, unsigned int updateTime); }; *************** *** 82,86 **** MSG_CHATTEXT = 1, MSG_CONTROL = 2, ! MSG_USERNAME = 3, MSG_UPDATE = 4 }; --- 87,91 ---- MSG_CHATTEXT = 1, MSG_CONTROL = 2, ! MSG_AUTHENTICATION = 3, MSG_UPDATE = 4 }; *************** *** 89,99 **** void AddChatSubscriber(tcConsoleBox* subscriber); void AddMessageHandler(int messageId, tcMessageHandler* handler); void BroadcastControlMessage(int messageCode); //std::string GetChatText(); ! int GetConnectionId(unsigned connectionIdx); ! std::string GetConnectionStatus(unsigned connectionIdx); wxEvtHandler* GetEvtHandler() const; ! std::string GetName() const; ! unsigned GetNumConnections(); tcPlayerStatus& GetPlayerStatus(int connectionId); ///< redundant with GetConnectionStatus? void InitMessageHandlers(); --- 94,109 ---- void AddChatSubscriber(tcConsoleBox* subscriber); void AddMessageHandler(int messageId, tcMessageHandler* handler); + void AuthenticatePlayer(int connectionId, const std::string& username, + const std::string& passwordHash); + void BroadcastChatText(const std::string& message); void BroadcastControlMessage(int messageCode); //std::string GetChatText(); ! ! const std::list<int>& GetConnectionList() const; ! std::string GetConnectionStatus(int connectionId); wxEvtHandler* GetEvtHandler() const; ! const std::string& GetName() const; ! unsigned int GetNumConnections(); ! const std::string& GetPassword() const; tcPlayerStatus& GetPlayerStatus(int connectionId); ///< redundant with GetConnectionStatus? void InitMessageHandlers(); *************** *** 107,113 **** --- 117,127 ---- void ProcessCommandServer(const std::string& text); void RemoveChatSubscriber(tcConsoleBox* subscriber); + void Reset(); + void SendAuthRequest(int destination); + void SendAuthResponse(int destination); void SendChatText(int destination, const std::string& message); void SendControlMessage(int destination, int messageCode, int param = 0); void SendControlMessageUDP(int destination, int messageCode, int param = 0); + void SendControlMessageUDPAck(int destination, int messageCode, int param = 0); void SendTestUDP(int destination, const std::string& message); void SendUpdateMessage(int destination, tcStream& stream); *************** *** 115,119 **** void SetEvtHandler(wxEvtHandler *eh); void SetName(const std::string& name); ! void SetPingTime(int connectionId, float ping_s); void Update(); --- 129,135 ---- void SetEvtHandler(wxEvtHandler *eh); void SetName(const std::string& name); ! void SetPassword(const std::string& plainText); ! void SetPingTime(int connectionId, float ping_s); ! void Update(); *************** *** 124,128 **** std::queue<std::string> chatText; ///< chat text to display std::vector<tcConsoleBox*> chatSubscribers; ! std::string myName; ///< name to identify player std::map<int, tcPlayerStatus> playerInfo; ///< map of (connection id, tcPlayerStatus) pairs std::map<int, std::vector<tcMessageHandler*> > messageMap; ///< map of (message id, message handler vector) pairs --- 140,145 ---- std::queue<std::string> chatText; ///< chat text to display std::vector<tcConsoleBox*> chatSubscribers; ! std::string myName; ///< name to identify player (username) ! std::string passwordHash; ///< hashed password std::map<int, tcPlayerStatus> playerInfo; ///< map of (connection id, tcPlayerStatus) pairs std::map<int, std::vector<tcMessageHandler*> > messageMap; ///< map of (message id, message handler vector) pairs *************** *** 130,134 **** tcPlayerStatus errorPlayerStatus; ///< status to return if player not found wxEvtHandler* evtHandler; ///< wxWidgets event handler for posting messages to application ! void ClearMessageMap(); --- 147,152 ---- tcPlayerStatus errorPlayerStatus; ///< status to return if player not found wxEvtHandler* evtHandler; ///< wxWidgets event handler for posting messages to application ! const unsigned int entityUpdateInterval; ///< 30 Hz tics ! const unsigned int sensorUpdateInterval; ///< 30 Hz tics void ClearMessageMap(); *************** *** 139,151 **** void ProcessReceiveMessages(); ! void UpdateDestroyedObjects(unsigned connIdx); ! void UpdateExistingObjects(unsigned connIdx); ! void UpdateNewObjects(unsigned connIdx); ! void UpdateObjectCommands(unsigned connIdx, bool updateUnack, bool clearNewCmdFlag); ! void UpdateObjects(); void UpdatePing(); void UpdatePlayerInfo(); void UpdateSensorMaps(); ! void UpdateSensorMap(unsigned connIdx); void UpdateTime(); --- 157,168 ---- void ProcessReceiveMessages(); ! void UpdateDestroyedEntities(int connectionId); ! void UpdateNewAndExistingEntities(int connectionId); ! void UpdateEntityCommands(int connectionId, bool updateUnack, bool clearNewCmdFlag); ! void UpdateEntities(); void UpdatePing(); void UpdatePlayerInfo(); void UpdateSensorMaps(); ! void UpdateSensorMap(int connectionId); void UpdateTime(); Index: tcMessage.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcMessage.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcMessage.h 8 Aug 2004 00:31:32 -0000 1.6 --- tcMessage.h 16 Apr 2005 20:43:55 -0000 1.7 *************** *** 42,47 **** MESSAGE_SIZE = BUFFER_SIZE - HEADER_SIZE }; ! unsigned int timestamp; unsigned short bufferIdx; union DATA_UNION { --- 42,48 ---- MESSAGE_SIZE = BUFFER_SIZE - HEADER_SIZE }; ! unsigned int timestamp; ///< time in 30 Hz tics when message was created (not sent) unsigned short bufferIdx; + unsigned short resendCount; ///< number of times message has been resent union DATA_UNION { *************** *** 50,64 **** unsigned int messageSize : 16; ///< size of message in bytes (including all header fields) int sourceId : 16; ///< connection id of source of message ! unsigned int : 0; ! int id : 32; ///< id of message } header; unsigned char buffer[BUFFER_SIZE]; } data; ! const unsigned char* GetMessageData(); ! int GetMessageId(); ! unsigned int GetMessageSize(); ! unsigned int GetMessageTimestamp(); ! void PopulateMessage(int sourceId, int messageId, unsigned messageSize, const unsigned char *messageData); void Reset(); --- 51,72 ---- unsigned int messageSize : 16; ///< size of message in bytes (including all header fields) int sourceId : 16; ///< connection id of source of message ! unsigned int ackFlag : 1; ///< ack msg if 1 (UDP only) ! unsigned int msgId : 15; ///< id of message for ack ! unsigned int riderSize : 10; ///< size in bytes of "rider" message at end ! int id : 6; ///< functional id of message, message type } header; unsigned char buffer[BUFFER_SIZE]; } data; ! void ClearRider(); ! bool GetAck() const; ! unsigned int GetAckId() const; ! ! unsigned char* GetMessageData(); ! int GetId() const; ! unsigned int GetMessageSize() const; ! unsigned int GetMessageTimestamp() const; ! void PopulateMessage(int sourceId, int messageType, unsigned messageId, ! unsigned int ack, unsigned int messageSize, const unsigned char *messageData); void Reset(); Index: tcNetworkInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcNetworkInterface.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcNetworkInterface.h 8 Apr 2005 01:54:11 -0000 1.9 --- tcNetworkInterface.h 16 Apr 2005 20:43:55 -0000 1.10 *************** *** 30,33 **** --- 30,34 ---- #include "wx/socket.h" #include "wx/event.h" + #include <list> #include <vector> #include <queue> *************** *** 59,73 **** }; ! void CloseConnection(); ! int GetConnectionId(unsigned connectionIdx); ! std::string GetConnectionStatus(unsigned connectionIdx); tcMessage* GetMessage(int id); ! unsigned GetNumConnections(); ! bool IsServer(); void MakeClient(); void MakeServer(); void OpenConnection(wxString hostName); ! ! const unsigned char* ReceiveMessage(int connectionId, int& messageId, unsigned& messageSize, int protocol = TCP); --- 60,78 ---- }; ! ! const std::list<int>& GetConnectionList() const; ! const std::map<int, tcConnectionData*>& GetConnectionMap(); ! ! std::string GetConnectionStatus(int id); tcMessage* GetMessage(int id); ! unsigned int GetNumConnections(); ! bool IsServer() const; void MakeClient(); void MakeServer(); + void OpenConnection(wxString hostName); ! void CloseConnection(); ! void RemoveConnection(int id); ! const unsigned char* ReceiveMessage(int connectionId, int& messageId, unsigned& messageSize, int protocol = TCP); *************** *** 99,117 **** wxDatagramSocket *datagramSock; ///< UDP socket ! std::vector<tcConnectionData> connectionData; ///< vector of connection data std::vector<tcMessage> messageBuffer; std::queue<unsigned int> available; ///< fifo of free slot indices ! std::map<int, int> connectionLookup; ///< (connection id key, connectionData idx (-1 invalid)) std::map<std::string, int> peerMap; ///< another lookup (peername, connectionData idx) ! void AddConnection(wxSocketBase *socket); // adds socket to connectionData void Clear(); ! void ClearConnectionMessages(unsigned int idx); int CheckoutMessage(); ! tcConnectionData* GetConnection(int idx); ! tcConnectionData* GetConnection(std::string peerName); wxDatagramSocket* GetDatagramSocket() {return datagramSock;} void InitializeUDP(); ! int LookupConnectionIndex(int id); void OnSocketEvent(wxSocketEvent& event); void RemoveDeadConnections(); --- 104,127 ---- wxDatagramSocket *datagramSock; ///< UDP socket ! /// map of (connection id, connection data), access (and delete) in log time ! std::map<int, tcConnectionData*> connectionData; ! std::list<int> connectionList; ///< list of connections ! std::vector<tcMessage> messageBuffer; std::queue<unsigned int> available; ///< fifo of free slot indices ! std::map<std::string, int> peerMap; ///< another lookup (peername, connectionData idx) ! void AddConnection(wxSocketBase *socket); // adds new connection using socket ! void Clear(); ! void ClearConnectionMessages(int id); int CheckoutMessage(); ! ! tcConnectionData* GetConnection(int id); ! tcConnectionData* GetConnection(const std::string& peerName); wxDatagramSocket* GetDatagramSocket() {return datagramSock;} void InitializeUDP(); ! void OnSocketEvent(wxSocketEvent& event); void RemoveDeadConnections(); *************** *** 123,127 **** void UpdateClientConnection(); void UpdateConnections(); ! void UpdateConnectionLookup(); void UpdateServer(); --- 133,137 ---- void UpdateClientConnection(); void UpdateConnections(); ! void UpdateServer(); Index: tcConnectionData.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcConnectionData.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcConnectionData.h 8 Apr 2005 01:54:11 -0000 1.7 --- tcConnectionData.h 16 Apr 2005 20:43:55 -0000 1.8 *************** *** 29,34 **** #include "wx/wx.h" #include "wx/socket.h" ! #include <vector> #include <queue> #include "network/tcMessage.h" --- 29,38 ---- #include "wx/wx.h" #include "wx/socket.h" ! ! #include <deque> ! #include <list> #include <queue> + #include <vector> + #include "network/tcMessage.h" *************** *** 53,60 **** std::queue<unsigned int> writeQueueTCP; ///< fifo of message indices waiting for TCP transmit std::queue<unsigned int> writeQueueUDP; ///< fifo of message indices waiting for UDP transmit ! std::vector<unsigned int> ack; ///< vector of transmitted messages waiting for ack unsigned long readCount; ///< number of bytes read from this connection unsigned long writeCount; ///< number of bytes written to this connection const wxIPV4address& GetPeerAddress() const; unsigned long GetReadCount() const; --- 57,68 ---- std::queue<unsigned int> writeQueueTCP; ///< fifo of message indices waiting for TCP transmit std::queue<unsigned int> writeQueueUDP; ///< fifo of message indices waiting for UDP transmit ! std::list<unsigned int> waitForAck; ///< vector of transmitted messages waiting for ack ! std::deque<unsigned int> sendAck; ///< dequeue of received messages to send acks for ! unsigned long readCount; ///< number of bytes read from this connection unsigned long writeCount; ///< number of bytes written to this connection + // free all queued messages + void ClearAllMessages(); const wxIPV4address& GetPeerAddress() const; unsigned long GetReadCount() const; *************** *** 67,73 **** void ReadNextMessageTCP(); void ReadNextMessageUDP(unsigned int messageSize, unsigned char *buffer); - void SendTCP(unsigned int idx); ! void SendUDP(unsigned int idx, bool useAck = false); void SetPingTime(float ping_s); void SetSocket(wxSocketBase* sock); --- 75,80 ---- void ReadNextMessageTCP(); void ReadNextMessageUDP(unsigned int messageSize, unsigned char *buffer); void SendTCP(unsigned int idx); ! void SendUDP(unsigned int idx); void SetPingTime(float ping_s); void SetSocket(wxSocketBase* sock); *************** *** 77,80 **** --- 84,89 ---- tcConnectionData(); + ~tcConnectionData(); + private: wxSocketBase *socket; ///< socket associated with this connection *************** *** 87,91 **** --- 96,105 ---- wxIPV4address UDPaddress; wxString peerName; + unsigned int lastCountUpdate; + unsigned int lastResendUpdate; + void AttachAckRider(tcMessage* message); + void ProcessAckRider(tcMessage* message); + void ResendFailedAcks(); void WriteTCP(); void WriteUDP(); |
|
From: Dewitt C. <ddc...@us...> - 2005-04-16 20:44:04
|
Update of /cvsroot/gcblue/gcb_wx/include/sqlite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11092/include/sqlite Modified Files: sqlite_plus.h Log Message: housekeeping, networking upgrades, fixed wrapping problems with world map Index: sqlite_plus.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sqlite/sqlite_plus.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sqlite_plus.h 8 Aug 2004 00:31:35 -0000 1.1 --- sqlite_plus.h 16 Apr 2005 20:43:56 -0000 1.2 *************** *** 65,68 **** --- 65,69 ---- int GetFieldCount() {return argc;} int getint(int index); + long getlong(int index); double getdouble(int index); std::string getstring(int index); |
|
From: Dewitt C. <ddc...@us...> - 2005-04-16 20:44:04
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11092/include/sim Modified Files: tcTime.h Log Message: housekeeping, networking upgrades, fixed wrapping problems with world map Index: tcTime.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcTime.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcTime.h 8 Apr 2005 01:54:11 -0000 1.8 --- tcTime.h 16 Apr 2005 20:43:56 -0000 1.9 *************** *** 33,43 **** static tcTime* Get(); ///< accessor for singleton instance ! unsigned snCount_30Hz; ///< 30 Hz counter value unsigned long snFrequency; unsigned int snDeltaCount; unsigned int snLastCount; ! unsigned Get30HzCount(); ! unsigned GetUpdated30HzCount(); void Update(); --- 33,43 ---- static tcTime* Get(); ///< accessor for singleton instance ! unsigned int snCount_30Hz; ///< 30 Hz counter value unsigned long snFrequency; unsigned int snDeltaCount; unsigned int snLastCount; ! unsigned int Get30HzCount(); ! unsigned int GetUpdated30HzCount(); void Update(); |
|
From: Dewitt C. <ddc...@us...> - 2005-04-16 20:44:03
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11092/include/graphics Modified Files: tcNetworkView.h tcTerrainView.h Log Message: housekeeping, networking upgrades, fixed wrapping problems with world map Index: tcTerrainView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcTerrainView.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcTerrainView.h 19 Mar 2005 15:31:08 -0000 1.3 --- tcTerrainView.h 16 Apr 2005 20:43:55 -0000 1.4 *************** *** 89,92 **** --- 89,95 ---- tcGeoRect mrectMap; ///< current borders of loaded map tcRect displayRegion; ///< normalized coords [0, 1] to display on textured quad + tcRect displayRegionWrapped; ///< wrapped section for wrapped view + float wrapWidth; ///< 0-1.0 fraction of view for wrapped portion of map + bool isWrapped; ///< true if wrapped osg::ref_ptr<osg::Texture2D> mapImage; bool redraw; ///< true to redraw Index: tcNetworkView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcNetworkView.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcNetworkView.h 6 Apr 2005 02:19:48 -0000 1.3 --- tcNetworkView.h 16 Apr 2005 20:43:55 -0000 1.4 *************** *** 52,55 **** --- 52,56 ---- void Draw(); void DrawStatusBox(); + int GetNetworkMode() const; void JoinGame(wxCommandEvent& event); void OnConnect(wxCommandEvent& event); *************** *** 60,63 **** --- 61,67 ---- void SetIPText(wxCommandEvent& event); void SetNetworkMode(wxCommandEvent& event); + void SetNetworkMode(int mode); + void SetUsername(wxCommandEvent& event); + void SetPassword(wxCommandEvent& event); tcNetworkView(wxWindow *parent, *************** *** 68,72 **** std::string ipText; int networkMode; ! tcEditBox *ipEdit; tcConsoleBox *chatBox; tcEditBox *chatEntry; --- 72,78 ---- std::string ipText; int networkMode; ! tcEditBox* ipEdit; ! tcEditBox* usernameEdit; ! tcEditBox* passwordEdit; tcConsoleBox *chatBox; tcEditBox *chatEntry; |
|
From: Dewitt C. <ddc...@us...> - 2005-04-16 20:44:03
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11092/include/common Modified Files: tcStream.h Log Message: housekeeping, networking upgrades, fixed wrapping problems with world map Index: tcStream.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcStream.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcStream.h 17 May 2004 00:38:53 -0000 1.7 --- tcStream.h 16 Apr 2005 20:43:55 -0000 1.8 *************** *** 59,63 **** tcStream& operator<<(float& val); tcStream& operator<<(double& val); ! tcStream& operator<<(std::string& val); tcStream& operator<<(tcStream& stream); --- 59,63 ---- tcStream& operator<<(float& val); tcStream& operator<<(double& val); ! tcStream& operator<<(const std::string& val); tcStream& operator<<(tcStream& stream); |
|
From: Dewitt C. <ddc...@us...> - 2005-04-08 22:44:37
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21965/docs Modified Files: BUILDING.txt Log Message: Index: BUILDING.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/BUILDING.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BUILDING.txt 14 Jun 2004 15:23:37 -0000 1.2 --- BUILDING.txt 8 Apr 2005 22:44:28 -0000 1.3 *************** *** 1,11 **** --- Download information --- ! * OpenSceneGraph 0.9.6-2 and OpenThreads-v1.2dev3 http://openscenegraph.sourceforge.net/downloads/index.html Follow links to Sourceforge download page. ! Download bundled OSG_OT_OP 0.9.6-2 package, and extract OSG and OT directories ! to top level. ! Also download OSG_Win32_Dependencies-0.9.6-2.zip to get 3rdParty_2003-10-01 package. * Demeter 3.21 --- 1,15 ---- + Updated April 2005 + --- Download information --- ! * OpenSceneGraph 0.9.8-2 (including OpenThreads) http://openscenegraph.sourceforge.net/downloads/index.html Follow links to Sourceforge download page. ! Download bundled OSG_OT_OP 0.9.8-2 package ! ! Also download latest OSG Win32 Dependencies package + Link: (as of April 2005) + http://prdownloads.sourceforge.net/openscenegraph/3rdParty_Win32binaries_2004-07-25a.zip?download * Demeter 3.21 *************** *** 33,39 **** ------------------ ----------------------- wxWidgets-2.4.2 C:\wxWindows-2.4.2 ! OpenSceneGraph-0.9.6-2 C:\OpenSceneGraph-0.9.6-2 OpenThreads-v1.2dev3-osg0.9.6 C:\OpenThreads-v1.2dev3-osg0.9.6 ! libxml and related C:\3rdParty_2003-10-01 Demeter 3.21 C:\demeter-3.21 OpenAL Beta C:\openal --- 37,43 ---- ------------------ ----------------------- wxWidgets-2.4.2 C:\wxWindows-2.4.2 ! OpenSceneGraph-0.9.8-2 C:\OpenSceneGraph-0.9.8-2 OpenThreads-v1.2dev3-osg0.9.6 C:\OpenThreads-v1.2dev3-osg0.9.6 ! libxml, etc. (osg dependencies) C:\3rdParty Demeter 3.21 C:\demeter-3.21 OpenAL Beta C:\openal *************** *** 47,55 **** * Include files ! C:\3rdParty_2003-10-01\include C:\wxWindows-2.4.2\include C:\wxWindows-2.4.2\lib\msw ! C:\OpenSceneGraph-0.9.6-2\include ! C:\OpenThreads-v1.2dev3-osg0.9.6\include C:\openal\include C:\Python-2.3.3\include --- 51,59 ---- * Include files ! C:\3rdParty\include C:\wxWindows-2.4.2\include C:\wxWindows-2.4.2\lib\msw ! C:\OSG_OP_OT-0.9.8-2\OpenSceneGraph\include ! C:\OSG_OP_OT-0.9.8-2\OpenThreads\include C:\openal\include C:\Python-2.3.3\include *************** *** 61,68 **** * Library files ! C:\3rdParty_2003-10-01\lib ! C:\OpenThreads-v1.2dev3-osg0.9.6\lib\win32 C:\wxWindows-2.4.1\lib ! C:\OpenSceneGraph-0.9.6-2\lib C:\openal\lib C:\Python-2.3.3\libs --- 65,72 ---- * Library files ! C:\3rdParty\lib ! C:\OSG_OP_OT-0.9.8-2\OpenThreads\lib\win32 C:\wxWindows-2.4.1\lib ! C:\OSG_OP_OT-0.9.8-2\OpenSceneGraph\lib C:\openal\lib C:\Python-2.3.3\libs *************** *** 72,82 **** C:\libvorbis-1.0.1\libs - * Source files (optional for debugging libraries) - C:\wxWindows-2.4.1\src\msw - C:\wxWindows-2.4.1\src - C:\OpenSceneGraph-0.9.6-2\src - C:\OpenThreads-v1.2dev3-osg0.9.6\win32_src - C:\demeter-3.21\src * Project file conversion --- 76,80 ---- *************** *** 91,95 **** ! * Build OpenThreads v1.2dev3-osg0.9.6 - Project file is at win32_src/OpenThreads.dsw directory --- 89,93 ---- ! * Build OpenThreads - Project file is at win32_src/OpenThreads.dsw directory |
|
From: Dewitt C. <ddc...@us...> - 2005-04-08 01:54:22
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7286/src/network Modified Files: tcConnectionData.cpp tcControlMessageHandler.cpp tcMultiplayerInterface.cpp tcNetworkInterface.cpp Log Message: multiplayer work Index: tcConnectionData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcConnectionData.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcConnectionData.cpp 2 Nov 2004 04:23:56 -0000 1.9 --- tcConnectionData.cpp 8 Apr 2005 01:54:12 -0000 1.10 *************** *** 39,42 **** --- 39,52 ---- tcNetworkInterface* tcConnectionData::networkInterface = NULL; + const wxIPV4address& tcConnectionData::GetPeerAddress() const + { + return UDPaddress; + } + + float tcConnectionData::GetPingTime() const + { + return pingTime_s; + } + /** * @return total number of bytes read from this connection *************** *** 48,51 **** --- 58,74 ---- /** + * @return number of bytes read from this connection during last sec + */ + unsigned int tcConnectionData::GetReadCountSec() const + { + return readCount_sec; + } + + wxSocketBase* tcConnectionData::GetSocket() + { + return socket; + } + + /** * @return total number of bytes written to this connection */ *************** *** 56,59 **** --- 79,90 ---- /** + * @return number of bytes written to this connection during last sec + */ + unsigned int tcConnectionData::GetWriteCountSec() const + { + return writeCount_sec; + } + + /** * Attempts to read next whole message. If message is incomplete, the partial * message is returned to the socket read buffer. This method does not block. *************** *** 79,82 **** --- 110,115 ---- } + unsigned t0 = tcTime::Get()->GetUpdated30HzCount(); + // Read message socket->Read(tempMessage.data.buffer + tempMessage.bufferIdx, *************** *** 84,87 **** --- 117,123 ---- tempMessage.bufferIdx += socket->LastCount(); + unsigned t1 = tcTime::Get()->GetUpdated30HzCount(); + fprintf(stdout, "***** TCP READ time %d\n", t1-t0); + if (tempMessage.bufferIdx >= tempMessage.data.header.messageSize) { *************** *** 192,195 **** --- 228,248 ---- } + void tcConnectionData::SetPingTime(float ping_s) + { + pingTime_s = ping_s; + } + + void tcConnectionData::SetSocket(wxSocketBase* sock) + { + socket = sock; + wxASSERT(socket); + + + socket->GetPeer(UDPaddress); + UDPaddress.Service(tcNetworkInterface::UDP_PORT); + + peerName = UDPaddress.Hostname(); + } + /** * *************** *** 201,204 **** --- 254,265 ---- //ReadNextMessage(); WriteQueuedMessages(); + + if (tcTime::Get()->Get30HzCount() % 30 == 0) + { + readCount_sec = readCount - lastReadCount; + writeCount_sec = writeCount - lastWriteCount; + lastReadCount = readCount; + lastWriteCount = writeCount; + } } *************** *** 214,219 **** WriteUDP(); - - } --- 275,278 ---- *************** *** 223,227 **** void tcConnectionData::WriteTCP() { ! if (writeQueueTCP.empty()) return; int bufferId = writeQueueTCP.front(); --- 282,286 ---- void tcConnectionData::WriteTCP() { ! if (writeQueueTCP.empty()) return; int bufferId = writeQueueTCP.front(); *************** *** 235,238 **** --- 294,300 ---- return; } + + unsigned t0 = tcTime::Get()->GetUpdated30HzCount(); + //socket->SetFlags(wxSOCKET_WAITALL); *************** *** 264,267 **** --- 326,332 ---- } + unsigned t1 = tcTime::Get()->GetUpdated30HzCount(); + + fprintf(stdout, "***** TCP send time %d\n", t1-t0); //socket->SetFlags(wxSOCKET_NOWAIT); *************** *** 285,294 **** } ! wxIPV4address addr; ! socket->GetPeer(addr); ! addr.Service(tcNetworkInterface::UDP_PORT); ! ! wxString peerName = addr.Hostname(); ! wxDatagramSocket *datagramSock = networkInterface->GetDatagramSocket(); if (datagramSock == NULL) --- 350,354 ---- } ! wxDatagramSocket *datagramSock = networkInterface->GetDatagramSocket(); if (datagramSock == NULL) *************** *** 297,301 **** return; } ! datagramSock->SendTo(addr, message->data.buffer, message->data.header.messageSize); if (datagramSock->Error()) { --- 357,361 ---- return; } ! datagramSock->SendTo(UDPaddress, message->data.buffer, message->data.header.messageSize); if (datagramSock->Error()) { *************** *** 318,327 **** */ tcConnectionData::tcConnectionData() { ! socket = NULL; ! idString = "Err"; ! id = -1; ! readCount = 0; ! writeCount = 0; } --- 378,394 ---- */ tcConnectionData::tcConnectionData() + : + socket(0), + idString("Err"), + id(-1), + readCount(0), + writeCount(0), + lastReadCount(0), + lastWriteCount(0), + readCount_sec(0), + writeCount_sec(0), + pingTime_s(0) { ! } Index: tcControlMessageHandler.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcControlMessageHandler.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcControlMessageHandler.cpp 2 Nov 2004 04:23:56 -0000 1.7 --- tcControlMessageHandler.cpp 8 Apr 2005 01:54:12 -0000 1.8 *************** *** 32,35 **** --- 32,36 ---- #include "common/tcStream.h" #include "tcSimState.h" + #include "tcTime.h" #include "wxcommands.h" *************** *** 70,73 **** --- 71,75 ---- return; } + break; case CM_ALLIANCE: { *************** *** 80,83 **** --- 82,109 ---- } break; + case CM_PING: + { + tcStream stream; + stream << messageCode; + + unsigned int t = tcTime::Get()->GetUpdated30HzCount(); + stream << t; + + messageSize = stream.size(); + stream.read((char*)data, messageSize); + } + break; + case CM_PONG: + { + tcStream stream; + stream << messageCode; + + unsigned int t = (unsigned int)param; + stream << t; + + messageSize = stream.size(); + stream.read((char*)data, messageSize); + } + break; default: { *************** *** 92,101 **** void tcControlMessageHandler::Handle(int connectionId, unsigned messageSize, const unsigned char *data) { - // server ignores control messages - if (isServer) - { - fprintf(stderr, "Warning - control message received by server\n"); - return; - } int messageCode; --- 118,121 ---- *************** *** 112,116 **** stream >> messageCode; ! //memcpy(&messageCode, data, sizeof(messageCode)); switch (messageCode) --- 132,147 ---- stream >> messageCode; ! ! // if server, check to ensure control message is valid ! if (isServer) ! { ! if (!((messageCode == CM_PING) || (messageCode == CM_PONG))) ! { ! fprintf(stderr, "Warning - illegal control message received by server (%d)\n", ! messageCode); ! return; ! } ! } ! switch (messageCode) *************** *** 146,149 **** --- 177,202 ---- } break; + case CM_PING: + { + unsigned int t0; + stream >> t0; + + tcMultiplayerInterface::Get()-> + SendControlMessageUDP(connectionId, CM_PONG, int(t0)); + } + break; + case CM_PONG: + { + unsigned int t0; + stream >> t0; + + + unsigned int t = tcTime::Get()->GetUpdated30HzCount(); + unsigned int pingTime = t - t0; + float ping_s = (1.0f/30.0f) * float(pingTime); + tcMultiplayerInterface::Get()-> + SetPingTime(connectionId, ping_s); + } + break; default: { Index: tcMultiplayerInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMultiplayerInterface.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tcMultiplayerInterface.cpp 6 Apr 2005 02:19:49 -0000 1.20 --- tcMultiplayerInterface.cpp 8 Apr 2005 01:54:12 -0000 1.21 *************** *** 88,91 **** --- 88,92 ---- } + /** * Updates lastUpdate time. *************** *** 541,545 **** /** ! * Send control message to destination */ void tcMultiplayerInterface::SendControlMessage(int destination, int messageCode, int param) --- 542,546 ---- /** ! * Send control message to destination using TCP */ void tcMultiplayerInterface::SendControlMessage(int destination, int messageCode, int param) *************** *** 554,557 **** --- 555,571 ---- } + /** + * Send control message to destination using UDP + */ + void tcMultiplayerInterface::SendControlMessageUDP(int destination, int messageCode, int param) + { + unsigned char data[64]; + unsigned messageSize; + + tcControlMessageHandler::CreateControlMessage(messageCode, messageSize, data, param); + networkInterface->SendMessage(destination, MSG_CONTROL, + messageSize , data, + tcNetworkInterface::UDP); + } void tcMultiplayerInterface::SendTestUDP(int destination, const std::string& message) *************** *** 604,611 **** * Sets identification name string for player using this interface */ ! void tcMultiplayerInterface::SetName(const std::string& name) ! { ! myName = name; ! } /** --- 618,633 ---- * Sets identification name string for player using this interface */ ! void tcMultiplayerInterface::SetName(const std::string& name) ! { ! myName = name; ! } ! ! /** ! * Sets ping time associated with connection ! */ ! void tcMultiplayerInterface::SetPingTime(int connectionId, float ping_s) ! { ! networkInterface->SetPingTime(connectionId, ping_s); ! } /** *************** *** 616,621 **** --- 638,653 ---- void tcMultiplayerInterface::Update() { + unsigned startCount = tcTime::Get()->GetUpdated30HzCount(); + networkInterface->Update(); + unsigned endCount = tcTime::Get()->GetUpdated30HzCount(); + + unsigned elapsed = endCount - startCount; + if ((elapsed > updateCount) || ((endCount >> 3) % 5 == 0)) + { + updateCount = elapsed; + } + // process receive messages ProcessReceiveMessages(); *************** *** 643,646 **** --- 675,681 ---- UpdateTime(); } + + UpdatePing(); + } *************** *** 901,904 **** --- 936,960 ---- } + + /** + * + */ + void tcMultiplayerInterface::UpdatePing() + { + static unsigned lastUpdate = 0; + unsigned currentTime = tcTime::Get()->Get30HzCount(); + if (currentTime - lastUpdate < 150) return; + + lastUpdate = currentTime; + + unsigned nConn = networkInterface->GetNumConnections(); + for (unsigned n=0;n<nConn;n++) + { + int connId = networkInterface->GetConnectionId(n); + + SendControlMessageUDP(connId, tcControlMessageHandler::CM_PING, 0); + } + } + /** * *************** *** 920,923 **** --- 976,980 ---- { tcPlayerStatus stat; + stat.ping_s = 0; stat.timestamp = tcTime::Get()->Get30HzCount(); stat.name = "anonymous"; *************** *** 1044,1047 **** --- 1101,1106 ---- errorPlayerStatus.name = "error"; errorPlayerStatus.timestamp = 0; + + updateCount = 0; } Index: tcNetworkInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcNetworkInterface.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcNetworkInterface.cpp 2 Nov 2004 04:23:56 -0000 1.14 --- tcNetworkInterface.cpp 8 Apr 2005 01:54:12 -0000 1.15 *************** *** 45,49 **** tcConnectionData cdata; ! cdata.socket = socket; wxIPV4address addr; --- 45,49 ---- tcConnectionData cdata; ! cdata.SetSocket(socket); wxIPV4address addr; *************** *** 91,97 **** for(size_t n=0;n<nClients;n++) { ! if(connectionData[n].socket) { ! connectionData[n].socket->Destroy(); } else --- 91,97 ---- for(size_t n=0;n<nClients;n++) { ! if (connectionData[n].GetSocket()) { ! connectionData[n].GetSocket()->Destroy(); } else *************** *** 177,185 **** float dt_sec = (1.0f/30.0f)*(float)(timeCount - connData.timestamp); ! unsigned long bytesIn = connData.GetReadCount(); ! unsigned long bytesOut = connData.GetWriteCount(); ! wxString status = wxString::Format("%s (%.0f) %07d %07d", ! connData.idString.c_str(), dt_sec, bytesIn, bytesOut); return status.c_str(); } --- 177,187 ---- float dt_sec = (1.0f/30.0f)*(float)(timeCount - connData.timestamp); ! ! unsigned int bytesIn = connData.GetReadCountSec(); ! unsigned int bytesOut = connData.GetWriteCountSec(); ! float ping_ms = 1000.0f * connData.GetPingTime(); ! wxString status = wxString::Format("%s (%.0f) %04d %04d %.0f", ! connData.idString.c_str(), dt_sec, bytesIn, bytesOut, ping_ms); return status.c_str(); } *************** *** 482,487 **** for(int n=nConnections-1;n>=0;n--) { ! wxASSERT(connectionData[n].socket); ! if (!connectionData[n].socket->IsConnected()) { connectionData.erase(connectionData.begin()+n); --- 484,489 ---- for(int n=nConnections-1;n>=0;n--) { ! wxASSERT(connectionData[n].GetSocket()); ! if (!connectionData[n].GetSocket()->IsConnected()) { connectionData.erase(connectionData.begin()+n); *************** *** 650,653 **** --- 652,668 ---- } + /** + * Sets ping time associated with connection + */ + void tcNetworkInterface::SetPingTime(int connectionId, float ping_s) + { + int connectionIdx = LookupConnectionIndex(connectionId); + + if (tcConnectionData* conn = GetConnection(connectionIdx)) + { + conn->SetPingTime(ping_s); + } + } + /** *************** *** 742,750 **** for(size_t n=0;n<nConnections;n++) { - wxIPV4address peerAddr; - connectionLookup[connectionData[n].id] = (int)n; ! ! connectionData[n].socket->GetPeer(peerAddr); std::string hostName = peerAddr.IPAddress().c_str(); peerMap[hostName] = (int)n; --- 757,763 ---- for(size_t n=0;n<nConnections;n++) { connectionLookup[connectionData[n].id] = (int)n; ! ! wxIPV4address peerAddr = connectionData[n].GetPeerAddress(); std::string hostName = peerAddr.IPAddress().c_str(); peerMap[hostName] = (int)n; *************** *** 754,762 **** --- 767,781 ---- void tcNetworkInterface::UpdateServer() { + //unsigned t0 = tcTime::Get()->GetUpdated30HzCount(); + RemoveDeadConnections(); + //unsigned t1 = tcTime::Get()->GetUpdated30HzCount(); + // check for new connections wxSocketBase *socket = serverSock->Accept(FALSE); + //unsigned t2 = tcTime::Get()->GetUpdated30HzCount(); + if (socket) { *************** *** 764,768 **** --- 783,793 ---- } + //unsigned t3 = tcTime::Get()->GetUpdated30HzCount(); + UpdateConnections(); + + //unsigned t4 = tcTime::Get()->GetUpdated30HzCount(); + + } |
|
From: Dewitt C. <ddc...@us...> - 2005-04-08 01:54:22
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7286/src/sim Modified Files: tcSimState.cpp tcTime.cpp Log Message: multiplayer work Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** tcSimState.cpp 6 Apr 2005 02:19:50 -0000 1.75 --- tcSimState.cpp 8 Apr 2005 01:54:12 -0000 1.76 *************** *** 2532,2536 **** { multiplayerMode = MM_OFF; ! RandInit(); tcGameObject::SetClientMode(false); tcCommandObject::SetClientMode(false); --- 2532,2536 ---- { multiplayerMode = MM_OFF; ! tcGameObject::SetClientMode(false); tcCommandObject::SetClientMode(false); *************** *** 2562,2566 **** { multiplayerMode = MM_SERVER; ! RandInit(); tcGameObject::SetClientMode(false); tcCommandObject::SetClientMode(false); --- 2562,2566 ---- { multiplayerMode = MM_SERVER; ! tcGameObject::SetClientMode(false); tcCommandObject::SetClientMode(false); Index: tcTime.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcTime.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcTime.cpp 2 Nov 2004 04:23:57 -0000 1.8 --- tcTime.cpp 8 Apr 2005 01:54:12 -0000 1.9 *************** *** 1,20 **** /* ! * Copyright (C) 2003 Dewitt Colclough (de...@tw...) ! * All rights reserved. ! * ! * This file is part of the Global Conflict Blue (GCB) program. ! * GCB is free software; you can redistribute it and/or modify ! * it under the terms of version 2 of the GNU General Public License as ! * published by the Free Software Foundation. ! * ! * GCB is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with GCB; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ #ifdef WX_PRECOMP --- 1,20 ---- /* ! * Copyright (C) 2003 Dewitt Colclough (de...@tw...) ! * All rights reserved. ! * ! * This file is part of the Global Conflict Blue (GCB) program. ! * GCB is free software; you can redistribute it and/or modify ! * it under the terms of version 2 of the GNU General Public License as ! * published by the Free Software Foundation. ! * ! * GCB is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with GCB; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ #ifdef WX_PRECOMP *************** *** 36,42 **** tcTime* tcTime::Get() { ! static tcTime instance; ! return &instance; } --- 36,42 ---- tcTime* tcTime::Get() { ! static tcTime instance; ! return &instance; } *************** *** 49,53 **** unsigned tcTime::Get30HzCount() { ! return snCount_30Hz; } --- 49,53 ---- unsigned tcTime::Get30HzCount() { ! return snCount_30Hz; } *************** *** 58,110 **** unsigned tcTime::GetUpdated30HzCount() { ! Update(); ! return snCount_30Hz; } /** ! * Initializes the tcTime object. ! */ void tcTime::Init() { ! if (QueryPerformanceFrequency(&snFrequency) == false) ! { ! MessageBox(NULL, "Error - high performance counter", "Error", MB_OK); ! return; ! } ! snDeltaCount = (DWORD)snFrequency.QuadPart/30; // 30 updates per second } /** ! * Updates the tcTime object. ! */ void tcTime::Update() { ! LARGE_INTEGER nCurrentCount; ! QueryPerformanceCounter(&nCurrentCount); ! if ((nCurrentCount.QuadPart - snLastCount) >= snDeltaCount) ! { ! snCount_30Hz++; ! snLastCount = (DWORD)nCurrentCount.QuadPart; ! } } /** ! * tcTime constructor. ! */ tcTime::tcTime() : ! snDeltaCount(0), ! snLastCount(0), ! snCount_30Hz(0) { ! Init(); } /** ! * tcTime destructor. ! */ tcTime::~tcTime() { --- 58,114 ---- unsigned tcTime::GetUpdated30HzCount() { ! Update(); ! return snCount_30Hz; } /** ! * Initializes the tcTime object. ! */ void tcTime::Init() { ! LARGE_INTEGER frequency; ! if (QueryPerformanceFrequency(&frequency) == false) ! { ! MessageBox(NULL, "Error - high performance counter", "Error", MB_OK); ! return; ! } ! snFrequency = (unsigned long)frequency.QuadPart; ! snDeltaCount = (unsigned int)(snFrequency/30); // 30 updates per second } /** ! * Updates the tcTime object. ! */ void tcTime::Update() { ! LARGE_INTEGER nCurrentCount; ! QueryPerformanceCounter(&nCurrentCount); ! unsigned long currentTime = (unsigned long)nCurrentCount.QuadPart; ! ! while ((currentTime - snLastCount) >= snDeltaCount) ! { ! snCount_30Hz++; ! snLastCount += snDeltaCount; ! } } /** ! * tcTime constructor. ! */ tcTime::tcTime() : ! snDeltaCount(0), ! snLastCount(0), ! snCount_30Hz(0) { ! Init(); } /** ! * tcTime destructor. ! */ tcTime::~tcTime() { |
|
From: Dewitt C. <ddc...@us...> - 2005-04-08 01:54:22
|
Update of /cvsroot/gcblue/gcb_wx/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7286/xml Modified Files: network_view.xml Log Message: multiplayer work Index: network_view.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/network_view.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** network_view.xml 6 Apr 2005 02:19:50 -0000 1.8 --- network_view.xml 8 Apr 2005 01:54:12 -0000 1.9 *************** *** 15,19 **** <Button X="240" Y="305" Width="65" Height="15" Caption="Connect" Command="160"/> <Button X="340" Y="305" Width="65" Height="15" Caption="Join Game" Command="170"/> ! <StatusBox X="250" Y="130" Width="200" Height="100"/> <ChatBox X="30" Y="350" Width="400" Height="200" FontSize="11.0" DrawBorder="1"/> <ChatEntry X="30" Y="556" Width="400" Height="16" BarX="0.0" BarY="1.0" BarWidth="400.0" BarHeight="14.0" Caption=""/> --- 15,19 ---- <Button X="240" Y="305" Width="65" Height="15" Caption="Connect" Command="160"/> <Button X="340" Y="305" Width="65" Height="15" Caption="Join Game" Command="170"/> ! <StatusBox X="250" Y="130" Width="220" Height="120"/> <ChatBox X="30" Y="350" Width="400" Height="200" FontSize="11.0" DrawBorder="1"/> <ChatEntry X="30" Y="556" Width="400" Height="16" BarX="0.0" BarY="1.0" BarWidth="400.0" BarHeight="14.0" Caption=""/> |
|
From: Dewitt C. <ddc...@us...> - 2005-04-08 01:54:20
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7286/src/graphics Modified Files: tcNetworkView.cpp Log Message: multiplayer work Index: tcNetworkView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcNetworkView.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcNetworkView.cpp 6 Apr 2005 02:19:49 -0000 1.5 --- tcNetworkView.cpp 8 Apr 2005 01:54:11 -0000 1.6 *************** *** 3,7 **** */ /* ! ** Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 3,7 ---- */ /* ! ** Copyright (C) 2004-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 81,91 **** for (unsigned n=0;n<nConnections;n++) { ! y += 10.0f; std::string connectionStatus = tcMultiplayerInterface::Get()->GetConnectionStatus(n); ! DrawTextR(connectionStatus.c_str(), x, y, defaultFont.get(), color, 8.0f, LEFT_CENTER); } } --- 81,97 ---- for (unsigned n=0;n<nConnections;n++) { ! y += 14.0f; std::string connectionStatus = tcMultiplayerInterface::Get()->GetConnectionStatus(n); ! DrawTextR(connectionStatus.c_str(), x, y, defaultFont.get(), color, 12.0f, LEFT_CENTER); } + wxString s = wxString::Format("Max update: %d", tcMultiplayerInterface::Get()->updateCount); + DrawTextR(s.c_str(), x, (float)statusBoxBounds.y - 15.0f, defaultFont.get(), color, 12.0f, + LEFT_CENTER); + + + } *************** *** 197,200 **** --- 203,211 ---- tcSimState::Get()->SetMultiplayerOff(); } + else if (tcMultiplayerInterface::Get()->GetNumConnections() > 0) + { + chatBox->Print("Disconnect before switching multiplayer mode"); + return; + } else if (mode == MULTIPLAYER_CLIENT) { |
|
From: Dewitt C. <ddc...@us...> - 2005-04-08 01:54:20
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7286/include/sim Modified Files: tcTime.h Log Message: multiplayer work Index: tcTime.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcTime.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcTime.h 17 Aug 2004 02:22:56 -0000 1.7 --- tcTime.h 8 Apr 2005 01:54:11 -0000 1.8 *************** *** 34,40 **** unsigned snCount_30Hz; ///< 30 Hz counter value ! LARGE_INTEGER snFrequency; ! DWORD snDeltaCount; ! DWORD snLastCount; unsigned Get30HzCount(); --- 34,40 ---- unsigned snCount_30Hz; ///< 30 Hz counter value ! unsigned long snFrequency; ! unsigned int snDeltaCount; ! unsigned int snLastCount; unsigned Get30HzCount(); |