[Gcblue-commits] gcb_wx/src/network tcConnectionData.cpp,1.12,1.13 tcControlMessageHandler.cpp,1.8,1
Status: Alpha
Brought to you by:
ddcforge
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27631/src/network Modified Files: tcConnectionData.cpp tcControlMessageHandler.cpp tcMultiplayerInterface.cpp tcNetworkInterface.cpp tcTextMessageHandler.cpp tcUpdateMessageHandler.cpp Log Message: Index: tcUpdateMessageHandler.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcUpdateMessageHandler.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcUpdateMessageHandler.cpp 17 Apr 2005 22:35:31 -0000 1.13 --- tcUpdateMessageHandler.cpp 29 Apr 2005 18:52:54 -0000 1.14 *************** *** 76,79 **** --- 76,84 ---- } + void tcUpdateMessageHandler::AddControlRequest(long id, tcStream& stream) + { + stream << id; + } + /** * Saves data to create obj to stream. *************** *** 169,172 **** --- 174,179 ---- case SENSOR_UPDATE: break; + case CONTROL_REQUEST: + break; default: fprintf(stderr, "tcUpdateMessageHandler::InitializeMessage - bad message type\n"); *************** *** 214,217 **** --- 221,234 ---- } break; + case CONTROL_REQUEST: + { + HandleControlRequest(stream, connectionId); + } + break; + case CREATE_REQUEST: + { + HandleCreateRequest(stream, connectionId); + } + break; default: fprintf(stderr, "tcUpdateMessageHandler::Handle - unknown msg type for server\n"); *************** *** 325,328 **** --- 342,348 ---- long id; + const bool isServer = tcMultiplayerInterface::Get()->IsServer(); + const std::string& playerName = tcMultiplayerInterface::Get()->GetPlayerName(connectionId); + while (((stream >> id).eof() == false) && (nUnknowns < 32)) { *************** *** 336,342 **** if (obj) { ! *obj << stream; ! fprintf(stdout, "%d ", id); } else --- 356,380 ---- if (obj) { ! // validate control rights at server ! if (isServer) ! { ! if (obj->IsControlledBy(playerName)) ! { ! *obj << stream; ! fprintf(stdout, "%d ", id); ! } ! else ! { ! stream.skip_read(updateSize); ! fprintf(stdout, "E%d ", id); ! } ! } ! else ! { ! *obj << stream; ! fprintf(stdout, "%d ", id); ! } ! } else *************** *** 350,353 **** --- 388,438 ---- } + void tcUpdateMessageHandler::HandleControlRequest(tcStream& stream, int connectionId) + { + tcMultiplayerInterface* multiplayerInterface = tcMultiplayerInterface::Get(); + + const tcPlayerStatus& playerInfo = multiplayerInterface->GetPlayerStatus(connectionId); + + const std::string& playerName = playerInfo.GetName(); + const unsigned char playerRank = playerInfo.GetRank(); + const unsigned char playerAlliance = playerInfo.GetAlliance(); + + if (!multiplayerInterface->IsServer()) + { + fprintf(stderr, "Control request received at client\n"); + return; + } + + tcSimState* simState = tcSimState::Get(); + wxASSERT(simState); + + fprintf(stdout, "<< Received obj control req msg, time %.1f: ", simState->GetTime()); + + long id; + + while ((stream >> id).eof() == false) + { + // lookup obj + if (tcGameObject* obj = simState->GetObject(id)) + { + if (obj->IsAvailable(playerAlliance, playerRank)) + { + obj->SetController(playerName); + fprintf(stdout, "%d ", obj->mnID); + } + else + { + fprintf(stdout, "E%d ", obj->mnID); + } + } + else + { + fprintf(stdout, "X%d ", obj->mnID); + } + } + + fprintf(stdout, "\n"); + } + /** * Handle CREATE update message *************** *** 374,401 **** tcGameObject* obj = simState->GetObject(id); ! // update obj if it exists, otherwise create object if (obj) { ! fprintf(stderr, "Error - HandleCreate - obj %d already exists\n", id); ! fprintf(stdout, "\n"); ! return; } ! tcDatabaseObject* dbObj = database->GetObject(databaseId); ! if (dbObj) ! { ! obj = simState->CreateGameObject(dbObj); ! *obj << stream; ! simState->AddPlatformWithKey(obj, id); ! fprintf(stdout, "%d (%d)", id, obj->mnAlliance); ! ! *obj << commandStream; ! } ! else ! { ! fprintf(stderr, "Bad update, database entry %d not found\n", databaseId); ! fprintf(stdout, "\n"); ! return; ! } } --- 459,498 ---- tcGameObject* obj = simState->GetObject(id); ! // update obj (re-create) if it exists, otherwise create object if (obj) { ! if (databaseId == obj->mpDBObject->mnKey) ! { ! *obj << stream; ! *obj << commandStream; ! fprintf(stdout, "%d(R) (%d)", id, obj->GetAlliance()); ! } ! else ! { ! fprintf(stderr, "Error - HandleCreate - obj %d already exists with different db class\n", id); ! fprintf(stdout, "\n"); ! return; ! } ! } + else + { + tcDatabaseObject* dbObj = database->GetObject(databaseId); + if (dbObj) + { + obj = simState->CreateGameObject(dbObj); + *obj << stream; + simState->AddPlatformWithKey(obj, id); + fprintf(stdout, "%d (%d)", id, obj->GetAlliance()); ! *obj << commandStream; ! } ! else ! { ! fprintf(stderr, "Bad update, database entry %d not found\n", databaseId); ! fprintf(stdout, "\n"); ! return; ! } ! } } *************** *** 526,530 **** { *obj << stream; ! fprintf(stdout, "%d ", id); } else --- 623,637 ---- { *obj << stream; ! ! if (!obj->GetRecreate()) ! { ! fprintf(stdout, "%d ", id); ! } ! else ! { ! missingIds.push(id); ! obj->SetRecreate(false); // clear flag ! fprintf(stdout, "%d(R) ", id); ! } } else *************** *** 548,552 **** tcUpdateMessageHandler::CREATE_REQUEST, createReqStream); fprintf(stdout, ">> Sending create request msg, time %.1f, ids: ", simState->GetTime()); ! while (missingIds.empty()) { long id = missingIds.front(); --- 655,659 ---- tcUpdateMessageHandler::CREATE_REQUEST, createReqStream); fprintf(stdout, ">> Sending create request msg, time %.1f, ids: ", simState->GetTime()); ! while (!missingIds.empty()) { long id = missingIds.front(); Index: tcMultiplayerInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMultiplayerInterface.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcMultiplayerInterface.cpp 17 Apr 2005 22:35:31 -0000 1.23 --- tcMultiplayerInterface.cpp 29 Apr 2005 18:52:54 -0000 1.24 *************** *** 44,47 **** --- 44,50 ---- #include "tcConsoleBox.h" #include "tcAccountDatabase.h" + #include "tcUserInfo.h" + #include "scriptinterface/tcSimPythonInterface.h" + #include "scriptinterface/tcScenarioInterface.h" #ifdef _DEBUG *************** *** 51,54 **** --- 54,58 ---- BEGIN_NAMESPACE(network) + using tcAccountDatabase::UserData; /** *************** *** 70,73 **** --- 74,87 ---- } + unsigned char tcPlayerStatus::GetAlliance() const + { + return alliance; + } + + int tcPlayerStatus::GetConnectionId() const + { + return connectionId; + } + /** * Gets time of last update to player for a game object *************** *** 93,96 **** --- 107,155 ---- + const std::string& tcPlayerStatus::GetName() const + { + return name; + } + + const std::string& tcPlayerStatus::GetNameWithRank() const + { + return nameWithRank; + } + + unsigned char tcPlayerStatus::GetRank() const + { + return rank; + } + + bool tcPlayerStatus::IsGM() const + { + return (GetRank() == tcUserInfo::RANK_GM); + } + + void tcPlayerStatus::SetAlliance(unsigned char val) + { + alliance = val; + } + + void tcPlayerStatus::SetConnectionId(int id) + { + connectionId = id; + } + + void tcPlayerStatus::SetName(const std::string& s) + { + name = s; + } + + void tcPlayerStatus::SetNameWithRank(const std::string& s) + { + nameWithRank = s; + } + + void tcPlayerStatus::SetRank(unsigned char val) + { + rank = val; + } + /** * Updates lastUpdate time. *************** *** 192,199 **** 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) --- 251,255 ---- playerStatus.name = username; ! int loginStatus = LogInPlayer(username, connectionId, playerStatus, msg); if (loginStatus == tcAccountDatabase::SUCCESS) *************** *** 229,233 **** * @return tcAccountDatabase::SUCCESS if successful */ ! int tcMultiplayerInterface::LogInPlayer(const std::string& username, int connectionId, wxString& msg) { tcConnectionData* connection = networkInterface->GetConnection(connectionId); --- 285,290 ---- * @return tcAccountDatabase::SUCCESS if successful */ ! int tcMultiplayerInterface::LogInPlayer(const std::string& username, int connectionId, ! tcPlayerStatus& playerStatus, wxString& msg) { tcConnectionData* connection = networkInterface->GetConnection(connectionId); *************** *** 238,242 **** if (loginStatus == tcAccountDatabase::SUCCESS) { ! msg = wxString::Format("Welcome %s\n", username.c_str()); } else if (loginStatus == tcAccountDatabase::DUPLICATE_LOGIN) --- 295,318 ---- if (loginStatus == tcAccountDatabase::SUCCESS) { ! UserData userData; ! tcAccountDatabase::Get()->GetUserData(username, userData); ! ! playerStatus.data = userData; ! ! playerStatus.SetAlliance(userData.alliance); ! ! SendControlMessage(connectionId, tcControlMessageHandler::CM_ALLIANCE, userData.alliance); ! ! unsigned char rank = tcUserInfo::Get()->ScoreToRank(userData.score); ! playerStatus.SetRank(rank); ! std::string rankString = tcUserInfo::Get()->RankToString(rank); ! rankString += " "; ! rankString += username; ! playerStatus.SetNameWithRank(rankString); ! ! playerStatus.SetConnectionId(connectionId); ! ! msg = wxString::Format("Welcome %s (Alliance %d)\n", playerStatus.GetNameWithRank().c_str(), ! playerStatus.GetAlliance()); } else if (loginStatus == tcAccountDatabase::DUPLICATE_LOGIN) *************** *** 391,394 **** --- 467,475 ---- } + const std::string& tcMultiplayerInterface::GetPlayerName(int connectionId) + { + return GetPlayerStatus(connectionId).GetName(); + } + /** * @return tcPlayerStatus object associated with connectionId *************** *** 529,532 **** --- 610,738 ---- } + /** + * Process command to change alliance of player + */ + void tcMultiplayerInterface::ProcessAllianceCommand(tcPlayerStatus& player, const wxString& args) + { + wxString msg; + + int connectionId = player.GetConnectionId(); + + if (player.data.CanSwitchAlliance()) + { + wxString allianceText = args; + long alliance; + if (allianceText.ToLong(&alliance)) + { + player.alliance = alliance; + tcAccountDatabase::Get()->SetUserAlliance(player.GetName(), player.alliance); + + SendControlMessage(connectionId, tcControlMessageHandler::CM_ALLIANCE, alliance); + msg = wxString::Format("*** Success - alliance set to %d", alliance); + } + else + { + msg = wxString::Format("*** Error - bad alliance change argument (%s)", + allianceText.c_str()); + } + } + else + { + msg = "*** Alliance already selected, cannot change"; + } + + SendChatText(connectionId, msg.c_str()); + } + + /** + * Process game master commands from player + */ + void tcMultiplayerInterface::ProcessGameMasterCommand(tcPlayerStatus& player, const wxString& args) + { + wxASSERT(IsServer()); + + using ScriptInterface::tcScenarioInterface; + tcScenarioInterface* scenarioInterface = tcSimPythonInterface::Get()->GetScenarioInterface(); + wxASSERT(scenarioInterface); + tcSimState* simState = tcSimState::Get(); + + int connectionId = player.GetConnectionId(); + + bool syntaxError = true; + wxString msg; + + if (player.IsGM()) + { + wxString command = args.BeforeFirst(' '); + wxString params = args.AfterFirst(' '); + + if ((command == "help") || (command == "")) + { + syntaxError = false; + SendChatText(connectionId, "*** /gm help ***"); + SendChatText(connectionId, " /gm help - print GM command list"); + SendChatText(connectionId, " /gm create '<class>' '<unitname>' <alliance>"); + SendChatText(connectionId, " /gm destroy <id>"); + SendChatText(connectionId, " /gm move <id> <lat_deg> <lon_deg> (<alt>)"); + SendChatText(connectionId, " /gm repair <id>"); + } + else if (command == "create") + { + syntaxError = false; + + const char delim = '\''; + wxString s1 = args.AfterFirst(delim); + wxString unitClass = s1.BeforeFirst(delim); + s1 = s1.AfterFirst(delim); + s1 = s1.AfterFirst(delim); + wxString unitName = s1.BeforeFirst(delim); + s1 = s1.AfterFirst(delim); + s1 = s1.AfterFirst(' '); + + msg = wxString::Format("*** Received create, class '%s', unit '%s'", + unitClass.c_str(), unitName.c_str()); + } + else if (command == "destroy") + { + long id; + if (params.ToLong(&id)) + { + syntaxError = false; + simState->DeleteObject(id); + msg = wxString::Format("*** Entity %d destroyed", id); + } + } + else if (command == "repair") + { + long id; + if (params.ToLong(&id)) + { + syntaxError = false; + if (tcGameObject* obj = simState->GetObject(id)) + { + obj->ApplyRepairs(2.0f); + obj->mfDamageLevel = 0; + msg = wxString::Format("*** Entity %d repaired", id); + } + else + { + msg = wxString::Format("*** Entity %d not found", id); + } + } + } + } + else + { + syntaxError = false; + msg = "*** Denied - insufficient permissions for /gm commands"; + } + + if (syntaxError) + { + msg = wxString::Format("*** Syntax error (%s)", args.c_str()); + } + + SendChatText(connectionId, msg.c_str()); + } *************** *** 555,591 **** wxString args = commandLine.AfterFirst(' '); ! /* replace this with a std::map<std::string, handle> registry system ! ** when it outgrows this switch */ ! if (command == "test") ! { ! chatText.push(std::string("*** test command from client ***")); ! SendChatText(connectionId, "*** test command acknowledged ***"); ! } ! else if (command == "help") { SendChatText(connectionId, "*** Help ***"); SendChatText(connectionId, " /help - print command list"); SendChatText(connectionId, " /alliance <int> - choose alliance"); - SendChatText(connectionId, " /test - dummy test command"); } else if (command == "alliance") { ! wxString allianceText = args; ! long alliance; ! if (allianceText.ToLong(&alliance)) ! { ! pstatus.alliance = alliance; ! SendControlMessage(connectionId, tcControlMessageHandler::CM_ALLIANCE, alliance); ! SendChatText(connectionId, ! (wxString::Format("*** success - alliance set to %d ***", alliance)).c_str()); ! } ! else ! { ! SendChatText(connectionId, "*** error - bad alliance change argument ***"); ! } } else { ! SendChatText(connectionId, "*** unrecognized command ***"); } } --- 761,783 ---- wxString args = commandLine.AfterFirst(' '); ! // replace this with map lookup if it grows too large ! if (command == "help") { SendChatText(connectionId, "*** Help ***"); SendChatText(connectionId, " /help - print command list"); SendChatText(connectionId, " /alliance <int> - choose alliance"); } else if (command == "alliance") + { + ProcessAllianceCommand(pstatus, args); + } + else if (command == "gm") { ! ProcessGameMasterCommand(pstatus, args); } else { ! wxString msg = wxString::Format("*** Unrecognized command (%s)", command.c_str()); ! SendChatText(connectionId, msg.c_str()); } } *************** *** 600,621 **** wxString candidate(text.c_str()); ! wxString command = candidate.AfterFirst('/'); /* replace this with a std::map<std::string, handle> registry system ** when it outgrows this switch */ ! if (command == "startgame") ! { ! chatText.push(std::string("*** sending STARTGAME ***")); ! BroadcastControlMessage(tcControlMessageHandler::CM_STARTGAME); ! } ! else if (command == "test") ! { ! chatText.push(std::string("*** test command ***")); ! } ! else if (command == "help") { chatText.push(std::string("*** Help ***")); chatText.push(std::string(" /help - print command list")); ! chatText.push(std::string(" /startgame - starts the game")); ! chatText.push(std::string(" /test - dummy test command")); } else --- 792,811 ---- wxString candidate(text.c_str()); ! wxString commandLine = candidate.AfterFirst('/'); ! wxString command = commandLine.BeforeFirst(' '); ! wxString args = commandLine.AfterFirst(' '); ! /* replace this with a std::map<std::string, handle> registry system ** when it outgrows this switch */ ! ! if (command == "help") { chatText.push(std::string("*** Help ***")); + chatText.push(std::string(" /gm <argument list> - GM commands")); chatText.push(std::string(" /help - print command list")); ! } ! else if (command == "gm") ! { ! ProcessGameMasterCommand(serverPlayerStatus, args); } else *************** *** 715,718 **** --- 905,915 ---- void tcMultiplayerInterface::SendChatText(int destination, const std::string& message) { + // first check for local message + if (destination == 0) + { + chatText.push(message); + return; + } + char buff[256]; unsigned messageLength; *************** *** 768,771 **** --- 965,1000 ---- } + /** + * Sends control request message to server requesting control of object id by player + */ + void tcMultiplayerInterface::SendControlRequest(long id) + { + if (IsServer()) + { + fprintf(stderr, "tcMultiplayerInterface::SendControlRequest - called by server\n"); + wxASSERT(false); + return; + } + + // server should be only connection + const std::list<int>& connectionList = networkInterface->GetConnectionList(); + if (connectionList.size() == 0) + { + fprintf(stderr, "tcMultiplayerInterface::SendControlRequest - no connections\n"); + wxASSERT(false); + return; + } + + std::list<int>::const_iterator iter = connectionList.begin(); + int destination = *iter; + + tcStream stream; + tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::CONTROL_REQUEST, stream); + + tcUpdateMessageHandler::AddControlRequest(id, stream); + + SendUpdateMessageAck(destination, stream); + } + void tcMultiplayerInterface::SendTestUDP(int destination, const std::string& message) { *************** *** 787,792 **** tcNetworkInterface::UDP); ! delete buffer; ! } --- 1016,1032 ---- tcNetworkInterface::UDP); ! delete buffer; ! } ! ! void tcMultiplayerInterface::SendUpdateMessageAck(int destination, tcStream& stream) ! { ! size_t streamSize = stream.size(); ! char* buffer = new char[streamSize]; ! stream.read(buffer, streamSize); ! ! networkInterface->SendMessage(destination, MSG_UPDATE, streamSize, (unsigned char*)buffer, ! tcNetworkInterface::UDP_ACK); ! ! delete buffer; } *************** *** 957,961 **** { tcGameObject* obj = iter.Get(); ! if ((pstatus.alliance == obj->mnAlliance) || !IsServer()) { if (obj->HasNewCommand()) --- 1197,1201 ---- { tcGameObject* obj = iter.Get(); ! if ((pstatus.alliance == obj->GetAlliance()) || !IsServer()) { if (obj->HasNewCommand()) *************** *** 973,977 **** if (updateCount >= 4) { ! SendUpdateMessage(connId, commandStream); #ifdef _DEBUG fprintf(stdout, "Sent obj command update, time: %.1f\n", t); --- 1213,1217 ---- if (updateCount >= 4) { ! SendUpdateMessageAck(connId, commandStream); #ifdef _DEBUG fprintf(stdout, "Sent obj command update, time: %.1f\n", t); *************** *** 985,989 **** if (updateCount) { ! SendUpdateMessage(connId, commandStream); #ifdef _DEBUG fprintf(stdout, "Sent obj command update, time: %.1f\n", t); --- 1225,1229 ---- if (updateCount) { ! SendUpdateMessageAck(connId, commandStream); #ifdef _DEBUG fprintf(stdout, "Sent obj command update, time: %.1f\n", t); *************** *** 1022,1026 **** { tcGameObject* obj = iter.Get(); ! if (pstatus.alliance == obj->mnAlliance) { unsigned int lastUpdate; --- 1262,1266 ---- { tcGameObject* obj = iter.Get(); ! if (pstatus.alliance == obj->GetAlliance()) { unsigned int lastUpdate; *************** *** 1111,1115 **** ** New commands need to be send to all clients at once with ** this system */ ! bool clearNewCmdFlag = (n++ == nConnections - 1); UpdateEntityCommands(id, clearNewCmdFlag); --- 1351,1355 ---- ** New commands need to be send to all clients at once with ** this system */ ! bool clearNewCmdFlag = (n++ == (nConnections - 1)); UpdateEntityCommands(id, clearNewCmdFlag); *************** *** 1309,1313 **** tcMultiplayerInterface::tcMultiplayerInterface() ! : tcpChat(true), myName("Server"), evtHandler(0), entityUpdateInterval(50), sensorUpdateInterval(50) --- 1549,1555 ---- tcMultiplayerInterface::tcMultiplayerInterface() ! : tcpChat(true), ! myName("Server"), ! evtHandler(0), entityUpdateInterval(50), sensorUpdateInterval(50) *************** *** 1318,1322 **** errorPlayerStatus.name = "error"; errorPlayerStatus.timestamp = 0; ! updateCount = 0; } --- 1560,1573 ---- errorPlayerStatus.name = "error"; errorPlayerStatus.timestamp = 0; ! ! serverPlayerStatus.SetName("Server"); ! serverPlayerStatus.SetNameWithRank("Server"); ! serverPlayerStatus.SetAlliance(0); ! serverPlayerStatus.SetRank(tcUserInfo::RANK_GM); ! serverPlayerStatus.timestamp = 0; ! serverPlayerStatus.isAuthenticated = true; ! serverPlayerStatus.data.flags = 0xFFFF; ! serverPlayerStatus.SetConnectionId(0); ! updateCount = 0; } *************** *** 1334,1338 **** tcMultiplayerInterface::~tcMultiplayerInterface() { - if (IsServer()) LogOutAllPlayers(); ClearMessageMap(); if (networkInterface) delete networkInterface; --- 1585,1588 ---- Index: tcConnectionData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcConnectionData.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcConnectionData.cpp 17 Apr 2005 22:35:31 -0000 1.12 --- tcConnectionData.cpp 29 Apr 2005 18:52:53 -0000 1.13 *************** *** 65,69 **** riderSize += sizeof(ackId); ! fprintf(stdout, "Attaching rider ack for %d\n", ackId); } --- 65,69 ---- riderSize += sizeof(ackId); ! //fprintf(stdout, "Attaching rider ack for %d\n", ackId); } *************** *** 73,77 **** if (sendAck.size()) { ! fprintf(stdout, "- sendAck size: %d\n", sendAck.size()); } --- 73,77 ---- if (sendAck.size()) { ! //fprintf(stdout, "- sendAck size: %d\n", sendAck.size()); } *************** *** 116,120 **** { networkInterface->ReturnMessage(ackId); ! fprintf(stdout, "Received ack rider for %d\n", ackId); } else --- 116,120 ---- { networkInterface->ReturnMessage(ackId); ! //fprintf(stdout, "Received ack rider for %d\n", ackId); } else *************** *** 132,136 **** if (waitForAck.size()) { ! fprintf(stdout, "- waitForAck size: %d\n", waitForAck.size()); } } --- 132,136 ---- if (waitForAck.size()) { ! //fprintf(stdout, "- waitForAck size: %d\n", waitForAck.size()); } } *************** *** 185,188 **** --- 185,193 ---- } + unsigned int tcConnectionData::GetResentCount() const + { + return resentCount; + } + wxSocketBase* tcConnectionData::GetSocket() { *************** *** 367,370 **** --- 372,376 ---- SendUDP(bufferId); + resentCount++; fprintf(stdout, "* Resending msg %d (%d)\n", bufferId, msg->resendCount); *************** *** 582,586 **** pingTime_s(0), lastCountUpdate(0), ! lastResendUpdate(0) { --- 588,593 ---- pingTime_s(0), lastCountUpdate(0), ! lastResendUpdate(0), ! resentCount(0) { Index: tcNetworkInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcNetworkInterface.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcNetworkInterface.cpp 17 Apr 2005 22:35:31 -0000 1.17 --- tcNetworkInterface.cpp 29 Apr 2005 18:52:54 -0000 1.18 *************** *** 248,255 **** 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 std::string(status.c_str()); } --- 248,256 ---- unsigned int bytesIn = connData->GetReadCountSec(); unsigned int bytesOut = connData->GetWriteCountSec(); + unsigned int resentCount = connData->GetResentCount(); // num packets resent due to failed acks float ping_ms = 1000.0f * connData->GetPingTime(); ! wxString status = wxString::Format("%s (%.0f) %04d %04d %03d %.0f", ! connData->idString.c_str(), dt_sec, bytesIn, bytesOut, resentCount, ping_ms); return std::string(status.c_str()); } Index: tcTextMessageHandler.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcTextMessageHandler.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcTextMessageHandler.cpp 16 Apr 2005 20:44:43 -0000 1.4 --- tcTextMessageHandler.cpp 29 Apr 2005 18:52:54 -0000 1.5 *************** *** 48,52 **** // create string with name prepended to text to identify source tcPlayerStatus pstatus = multiplayerInterface->GetPlayerStatus(connectionId); ! std::string namedText = std::string("<") + pstatus.name + std::string("> ") + text; // check if this is a text command --- 48,52 ---- // create string with name prepended to text to identify source tcPlayerStatus pstatus = multiplayerInterface->GetPlayerStatus(connectionId); ! std::string namedText = std::string("<") + pstatus.GetNameWithRank() + std::string("> ") + text; // check if this is a text command Index: tcControlMessageHandler.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcControlMessageHandler.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcControlMessageHandler.cpp 8 Apr 2005 01:54:12 -0000 1.8 --- tcControlMessageHandler.cpp 29 Apr 2005 18:52:54 -0000 1.9 *************** *** 54,58 **** { case CM_BEEP: - case CM_STARTGAME: { messageSize = sizeof(messageCode); --- 54,57 ---- *************** *** 109,113 **** { fprintf(stderr, ! "tcControlMessageHandler::CreateControlMessage - unrecognized message code\n"); break; } --- 108,113 ---- { fprintf(stderr, ! "tcControlMessageHandler::CreateControlMessage - unrecognized message code (%d)\n", ! messageCode); break; } *************** *** 151,162 **** } break; - case CM_STARTGAME: - { - wxEvtHandler* evtHandler = tcMultiplayerInterface::Get()->GetEvtHandler(); - wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, ID_STARTGAME); - // command.SetEventObject(evtHandler); - evtHandler->AddPendingEvent(command); - } - break; case CM_TIME: { --- 151,154 ---- |