gcblue-commits Mailing List for Global Conflict Blue (Page 27)
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-05-06 23:57:25
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11073/include/sim Modified Files: Game.h Added Files: tcControllableObject.h Log Message: added player name to connection status, update rates are slower for non-controlled objects, non-controlled objects now display as green, added chat text popup Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** Game.h 29 Apr 2005 18:52:02 -0000 1.55 --- Game.h 6 May 2005 23:57:16 -0000 1.56 *************** *** 306,310 **** tcGame(const wxPoint& pos, const wxSize& size); ! virtual ~tcGame(); DECLARE_EVENT_TABLE() --- 306,310 ---- tcGame(const wxPoint& pos, const wxSize& size); ! ~tcGame(); DECLARE_EVENT_TABLE() --- NEW FILE: tcControllableObject.h --- /** ** @file tcControllableObject.h */ /* Copyright (C) 2005 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 **/ #ifndef _TCCONTROLLABLEOBJECT_H_ #define _TCCONTROLLABLEOBJECT_H_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include <string> class tcUserInfo; class tcStream; class tcCommandStream; class tcCreateStream; class tcUpdateStream; /** * Base class for multiplayer client control of game objects */ class tcControllableObject { public: enum { ACCESS_LEVEL_MASK = 0x00FF }; unsigned char GetAlliance() const; void SetAlliance(unsigned char val); unsigned char GetAccessLevel() const; void SetAccessLevel(unsigned char level); const std::string& GetController() const; void SetController(const std::string& username); bool IsAvailable() const; bool IsAvailable(unsigned char playerAlliance, unsigned char rank) const; /// @return true if controlled by player bool IsControlledBy(const std::string& playerName) const; /// @return true if controlled by client player (client only, uses local userInfo for playerName) bool IsControlled() const; tcCreateStream& operator<<(tcCreateStream& stream); tcUpdateStream& operator<<(tcUpdateStream& stream); tcCreateStream& operator>>(tcCreateStream& stream); tcUpdateStream& operator>>(tcUpdateStream& stream); static void AttachUserInfo(); tcControllableObject(); tcControllableObject(const tcControllableObject& src); ~tcControllableObject(); private: unsigned char alliance; unsigned short flags; ///< flags governing control permission std::string controller; ///< username of player controlling object static tcUserInfo* userInfo; }; #endif |
|
From: Dewitt C. <ddc...@us...> - 2005-05-06 23:57:25
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11073/include/scriptinterface Modified Files: tcSimPythonInterface.h Log Message: added player name to connection status, update rates are slower for non-controlled objects, non-controlled objects now display as green, added chat text popup Index: tcSimPythonInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcSimPythonInterface.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcSimPythonInterface.h 5 May 2005 02:14:19 -0000 1.23 --- tcSimPythonInterface.h 6 May 2005 23:57:16 -0000 1.24 *************** *** 128,131 **** --- 128,132 ---- void ProcessCommand(std::string command, const std::vector<long>& id, int param = -1, std::string textParam = ""); + void ProcessCallback(std::string command, const std::vector<long>& id); void ProcessCallback(std::string command, const std::vector<long>& id, float afData, int param); |
|
From: Dewitt C. <ddc...@us...> - 2005-05-05 02:15:34
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv777/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcPlatformInterfaceExtensionB.cpp tcScenarioInterface.cpp tcSimPythonInterface.cpp Log Message: Index: tcPlatformInterfaceExtensionB.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtensionB.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcPlatformInterfaceExtensionB.cpp 29 Apr 2005 18:52:54 -0000 1.23 --- tcPlatformInterfaceExtensionB.cpp 5 May 2005 02:14:53 -0000 1.24 *************** *** 146,149 **** --- 146,150 ---- .def("IsAvailable", &tcPlatformInterface::IsAvailable) .def("IsMultiplayerActive", &tcPlatformInterface::IsMultiplayerActive) + .def("ReleaseControl", &tcPlatformInterface::ReleaseControl) .def("TakeControl", &tcPlatformInterface::TakeControl) Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tcSimPythonInterface.cpp 29 Apr 2005 18:52:54 -0000 1.29 --- tcSimPythonInterface.cpp 5 May 2005 02:14:53 -0000 1.30 *************** *** 41,44 **** --- 41,46 ---- #include "ai/ScriptedTask.h" #include "ai/ScriptedTaskInterface.h" + #include "common/tcStream.h" + #include "common/tcObjStream.h" #ifdef _DEBUG *************** *** 120,124 **** * Begin a submenu in current menu */ ! void tcMenuInterface::BeginSubMenu(void) { if (mpMenu == NULL) {return;} mpMenu->BeginSubMenu(); --- 122,126 ---- * Begin a submenu in current menu */ ! void tcMenuInterface::BeginSubMenu() { if (mpMenu == NULL) {return;} mpMenu->BeginSubMenu(); *************** *** 128,132 **** * Clear menu */ ! void tcMenuInterface::Clear(void) { if (mpMenu == NULL) {return;} mpMenu->Clear(); --- 130,134 ---- * Clear menu */ ! void tcMenuInterface::Clear() { if (mpMenu == NULL) {return;} mpMenu->Clear(); *************** *** 136,140 **** * End submenu in current menu */ ! void tcMenuInterface::EndSubMenu(void) { if (mpMenu == NULL) {return;} mpMenu->EndSubMenu(); --- 138,142 ---- * End submenu in current menu */ ! void tcMenuInterface::EndSubMenu() { if (mpMenu == NULL) {return;} mpMenu->EndSubMenu(); *************** *** 155,158 **** --- 157,267 ---- } + + + /** + * Loads state from command stream + * MetaString of stream must be set to player name for control validation + */ + tcCommandStream& tcSimPythonInterface::operator<<(tcCommandStream& stream) + { + wxASSERT(!mpSimState->IsMultiplayerClient()); + + const std::string& playerName = stream.GetMetaString(); + + unsigned char nCommands; + stream >> nCommands; + + for (unsigned char n=0; n<nCommands; n++) + { + unsigned char nId; + stream >> nId; + + std::vector<long> idList; + for (unsigned char n=0; n<nId; n++) + { + long id; + stream >> id; + idList.push_back(id); + } + + std::string command; + stream >> command; + + if (command.size() < 128) + { + bool playerHasControl = true; + for (unsigned int n=0; (n<idList.size()) && playerHasControl; n++) + { + tcGameObject* obj = mpSimState->GetObject(idList[n]); + playerHasControl = obj->IsControlledBy(playerName); + } + if (playerHasControl) + { + #ifdef _DEBUG + long id0 = (idList.size() > 0) ? idList[0] : -1; + fprintf(stdout, "Script cmd (%d/%d): %s\n", id0, idList.size(), command.c_str()); + #endif + ProcessCallbackString(command, idList); + } + else + { + fprintf(stderr, "Script command issued for obj that player does not control, " + "player: %s\n", playerName.c_str()); + } + } + else + { + fprintf(stderr, "Overlength command string received from client\n"); + wxASSERT(false); + } + } + + return stream; + } + + + /** + * Saves state to command stream + */ + tcCommandStream& tcSimPythonInterface::operator>>(tcCommandStream& stream) + { + wxASSERT(mpSimState->IsMultiplayerClient()); + + wxASSERT(clientCommands.size() < 16); + + unsigned char nCommands = clientCommands.size(); + stream << nCommands; + + for (unsigned char n=0; n<nCommands; n++) + { + ClientCommand& cmd = clientCommands[n]; + + wxASSERT(cmd.idList.size() < 256); + unsigned char nId = cmd.idList.size(); + stream << nId; + + for (unsigned char n=0; n<nId; n++) + { + long id = cmd.idList[n]; + stream << id; + } + + stream << cmd.commandText; + } + + return stream; + } + + void tcSimPythonInterface::ClearNewCommand() + { + clientCommands.clear(); + } + + bool tcSimPythonInterface::HasNewCommand() const + { + return (clientCommands.size() > 0); + } + + // write apObj void tcSimPythonInterface::SetUnitInfo(tcPlatformObject *apObj) { *************** *** 521,529 **** if (param == -1) ! sprintf(zBuff,"Menu.%s(%s,%.3f)\n",command.c_str(),zObject,afData); else ! sprintf(zBuff,"Menu.%s(%s,%.3f,%d)\n",command.c_str(),zObject,afData,param); ! CallPython(zBuff,"Exception occured in ProcessCallback\n"); PopMode(); --- 630,649 ---- if (param == -1) ! sprintf(zBuff, "Menu.%s(%s,%.3f)\n",command.c_str(),zObject,afData); else ! sprintf(zBuff, "Menu.%s(%s,%.3f,%d)\n",command.c_str(),zObject,afData,param); ! if (!mpSimState->IsMultiplayerClient()) ! { ! CallPython(zBuff, "Exception occured in ProcessCallback\n"); ! } ! else ! { ! ClientCommand cmd; ! cmd.idList = id; ! cmd.commandText = std::string(zBuff); ! ! clientCommands.push_back(cmd); ! } PopMode(); *************** *** 555,559 **** command.c_str(),zObject,afData1,afData2,param); } ! CallPython(zBuff,"Exception occured in ProcessCallback\n"); PopMode(); --- 675,695 ---- command.c_str(),zObject,afData1,afData2,param); } ! ! ! ! if (!mpSimState->IsMultiplayerClient()) ! { ! CallPython(zBuff, "Exception occured in ProcessCallback\n"); ! } ! else ! { ! ClientCommand cmd; ! cmd.idList = id; ! unsigned nId = id.size(); ! ! cmd.commandText = std::string(zBuff); ! ! clientCommands.push_back(cmd); ! } PopMode(); *************** *** 584,588 **** sprintf(zBuff,"Menu.%s(%s,%d,%d)\n",command.c_str(),zObject,anData,param); ! CallPython(zBuff,"Exception occured in ProcessCallback\n"); PopMode(); --- 720,767 ---- sprintf(zBuff,"Menu.%s(%s,%d,%d)\n",command.c_str(),zObject,anData,param); ! ! if (!mpSimState->IsMultiplayerClient()) ! { ! CallPython(zBuff, "Exception occured in ProcessCallback\n"); ! } ! else ! { ! ClientCommand cmd; ! cmd.idList = id; ! cmd.commandText = std::string(zBuff); ! ! clientCommands.push_back(cmd); ! } ! ! PopMode(); ! } ! ! /** ! * Version with string that includes exact call syntax ! */ ! void tcSimPythonInterface::ProcessCallbackString(const std::string& command, const std::vector<long>& id) ! { ! PushMode(); ! SetMenuGroup(id); ! ! if (mpHookedObj == NULL) ! { ! PopMode(); ! return; ! } ! ! ! if (!mpSimState->IsMultiplayerClient()) ! { ! CallPython(command.c_str(), "Exception occured in ProcessCallbackString\n"); ! } ! else ! { ! ClientCommand cmd; ! cmd.idList = id; ! cmd.commandText = command; ! ! clientCommands.push_back(cmd); ! } PopMode(); *************** *** 603,608 **** if (!mpSimState->mpUserInfo->IsOwnAlliance(mpHookedObj->GetAlliance())) return; ! sprintf(zBuff,"Menu.ProcessHotKey(HookedUnitInfo,'%c')\n",key); ! CallPython(zBuff,"Exception occured in ProcessHotKey\n"); } --- 782,790 ---- if (!mpSimState->mpUserInfo->IsOwnAlliance(mpHookedObj->GetAlliance())) return; ! sprintf(zBuff, "Menu.ProcessHotKey(HookedUnitInfo,'%c')\n", key); ! ! ! CallPython(zBuff, "Exception occured in ProcessHotKey\n"); ! } Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** tcScenarioInterface.cpp 29 Apr 2005 18:52:54 -0000 1.24 --- tcScenarioInterface.cpp 5 May 2005 02:14:53 -0000 1.25 *************** *** 107,112 **** tcMapOverlay* tcScenarioInterface::overlay = 0; tcSimState* tcScenarioInterface::simState = 0; ! // Interface class management functions void tcScenarioInterface::AddGoalClasses(boost::python::dict *dictionary) --- 107,120 ---- tcMapOverlay* tcScenarioInterface::overlay = 0; tcSimState* tcScenarioInterface::simState = 0; + + // non-python methods + + tcGameObject* tcScenarioInterface::GetLastObjectAdded() const + { + return lastObjectAdded; + } ! ! // Interface class management methods void tcScenarioInterface::AddGoalClasses(boost::python::dict *dictionary) *************** *** 194,197 **** --- 202,207 ---- bool tcScenarioInterface::AddUnitToAlliance(tcScenarioUnit unit, int alliance) { + lastObjectAdded = 0; + if (!unit.Validate()) return false; *************** *** 205,209 **** fprintf(stderr, errorMessage.c_str()); ! wxMessageBox(errorMessage.c_str(), "Error", wxICON_ERROR); return false; } --- 215,223 ---- fprintf(stderr, errorMessage.c_str()); ! // don't popup errors if sim is running ! if (simState->GetTime() == 0) ! { ! wxMessageBox(errorMessage.c_str(), "Error", wxICON_ERROR); ! } return false; } *************** *** 229,232 **** --- 243,249 ---- gameObj->mfStatusTime = 0; // for lack of a better time gameObj->mzUnit = unit.unitName.c_str(); + + float terrainHeight = mapData->GetTerrainHeight(unit.lon, unit.lat, 0); + // class-specific initialization if (tcPlatformObject *platObj = dynamic_cast<tcPlatformObject*>(gameObj)) *************** *** 254,257 **** --- 271,279 ---- if (tcAirObject *airObj = dynamic_cast<tcAirObject*>(gameObj)) { + if (airObj->mcKin.mfAlt_m < terrainHeight + 10.0f) + { + airObj->mcKin.mfAlt_m = terrainHeight + 10.0f; + } + airObj->SetAltitude(airObj->mcKin.mfAlt_m); } *************** *** 274,277 **** --- 296,302 ---- simState->AddPlatform(gameObj); + + lastObjectAdded = gameObj; + return true; } Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** tcPlatformInterface.cpp 29 Apr 2005 18:52:54 -0000 1.43 --- tcPlatformInterface.cpp 5 May 2005 02:14:53 -0000 1.44 *************** *** 503,507 **** } ! const tcLauncher* const pLauncher = mpPlatformObj->mcLauncherState.GetLauncher(anLauncher); wxASSERT(pLauncher); --- 503,507 ---- } ! tcLauncher* pLauncher = mpPlatformObj->mcLauncherState.GetLauncher(anLauncher); wxASSERT(pLauncher); *************** *** 742,745 **** --- 742,747 ---- void tcPlatformInterface::AddTask(const std::string& taskName, double priority) { + if (mpPlatformObj->IsClientMode()) return; + ai::Brain* brain = mpPlatformObj->GetBrain(); wxASSERT(brain); *************** *** 750,753 **** --- 752,757 ---- void tcPlatformInterface::AddNavWaypoint(float afLon_rad, float afLat_rad) { + if (mpPlatformObj->IsClientMode()) return; + ai::Brain* brain = mpPlatformObj->GetBrain(); wxASSERT(brain); *************** *** 769,772 **** --- 773,778 ---- void tcPlatformInterface::ClearTasks() { + if (mpPlatformObj->IsClientMode()) return; + ai::Brain* brain = mpPlatformObj->GetBrain(); wxASSERT(brain); *************** *** 777,780 **** --- 783,788 ---- void tcPlatformInterface::DeleteTask(const std::string& taskName) { + if (mpPlatformObj->IsClientMode()) return; + ai::Brain* brain = mpPlatformObj->GetBrain(); wxASSERT(brain); *************** *** 818,822 **** // sensor map commands ! tcTrackIterator tcPlatformInterface::GetFirstTrack(void) { tcTrackIterator t; --- 826,830 ---- // sensor map commands ! tcTrackIterator tcPlatformInterface::GetFirstTrack() { tcTrackIterator t; *************** *** 833,837 **** } ! int tcPlatformInterface::GetTrackCount(void) { if (mpSensorMap == NULL) {return 0;} --- 841,845 ---- } ! int tcPlatformInterface::GetTrackCount() { if (mpSensorMap == NULL) {return 0;} *************** *** 1085,1088 **** --- 1093,1106 ---- } + void tcPlatformInterface::ReleaseControl() + { + using network::tcMultiplayerInterface; + if (mpPlatformObj->IsControlled()) + { + tcMultiplayerInterface::Get()->SendControlRelease(mpPlatformObj->mnID); + } + } + + void tcPlatformInterface::TakeControl() { |
|
From: Dewitt C. <ddc...@us...> - 2005-05-05 02:15:33
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv777/src/network Modified Files: tcMultiplayerInterface.cpp tcUpdateMessageHandler.cpp Log Message: Index: tcUpdateMessageHandler.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcUpdateMessageHandler.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcUpdateMessageHandler.cpp 29 Apr 2005 18:52:54 -0000 1.14 --- tcUpdateMessageHandler.cpp 5 May 2005 02:14:52 -0000 1.15 *************** *** 34,37 **** --- 34,38 ---- #include "common/tcStream.h" #include "common/tcObjStream.h" + #include "tcSimPythonInterface.h" #ifdef _DEBUG *************** *** 76,81 **** --- 77,93 ---- } + void tcUpdateMessageHandler::AddControlRelease(long id, tcStream& stream) + { + bool releaseControl = true; + + stream << releaseControl; + stream << id; + } + void tcUpdateMessageHandler::AddControlRequest(long id, tcStream& stream) { + bool releaseControl = false; + + stream << releaseControl; stream << id; } *************** *** 122,125 **** --- 134,147 ---- /** + * Adds sound effect info to stream + * @param id entity id that sound effect is associated with + */ + void tcUpdateMessageHandler::AddSoundEffect(long id, const std::string& effect, tcStream& stream) + { + stream << id; + stream << effect; + } + + /** * Saves update data for obj to stream. Obj must be * created first for this data to be applied. *************** *** 176,179 **** --- 198,205 ---- case CONTROL_REQUEST: break; + case SOUND_EFFECT: + break; + case SCRIPT_COMMANDS: + break; default: fprintf(stderr, "tcUpdateMessageHandler::InitializeMessage - bad message type\n"); *************** *** 231,234 **** --- 257,265 ---- } break; + case SCRIPT_COMMANDS: + { + HandleScriptCommands(stream, connectionId); + } + break; default: fprintf(stderr, "tcUpdateMessageHandler::Handle - unknown msg type for server\n"); *************** *** 282,285 **** --- 313,321 ---- } break; + case SOUND_EFFECT: + { + HandleSoundEffect(stream); + } + break; default: fprintf(stderr, "tcUpdateMessageHandler::Handle - " *************** *** 409,420 **** 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); --- 445,470 ---- fprintf(stdout, "<< Received obj control req msg, time %.1f: ", simState->GetTime()); + bool releaseControl; long id; ! while ((stream >> releaseControl).eof() == false) { + stream >> id; + // lookup obj if (tcGameObject* obj = simState->GetObject(id)) { ! if (releaseControl) ! { ! if (obj->GetController() == playerName) ! { ! obj->SetController(""); ! } ! else ! { ! fprintf(stdout, "N%d ", obj->mnID); ! } ! } ! else if (obj->IsAvailable(playerAlliance, playerRank)) { obj->SetController(playerName); *************** *** 556,559 **** --- 606,628 ---- } + /** + * Handle SCRIPT_COMMANDS message (server only) + */ + void tcUpdateMessageHandler::HandleScriptCommands(tcStream& stream, int connectionId) + { + wxASSERT(isServer); + + tcPlayerStatus& pstatus = + tcMultiplayerInterface::Get()->GetPlayerStatus(connectionId); + + fprintf(stdout, "<< Received script commands for connection %d\n", connectionId); + + stream.SetMetaString(pstatus.GetName()); + + tcCommandStream& commandStream = (tcCommandStream&)stream; + + tcSimPythonInterface::Get()->operator<<(commandStream); + + } /** *************** *** 590,593 **** --- 659,682 ---- /** + * Handle SOUND_EFFECT message (client only) + */ + void tcUpdateMessageHandler::HandleSoundEffect(tcStream& stream) + { + wxASSERT(!isServer); + + long id; + unsigned int nEffects = 0; + while (((stream >> id).eof() == false) && (nEffects++ < 8)) + { + std::string effect; + + stream >> effect; + + tcSound::Get()->PlayEffect(effect); + } + + } + + /** * Handle UPDATE update message (client only) */ Index: tcMultiplayerInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMultiplayerInterface.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** tcMultiplayerInterface.cpp 29 Apr 2005 18:52:54 -0000 1.24 --- tcMultiplayerInterface.cpp 5 May 2005 02:14:52 -0000 1.25 *************** *** 256,259 **** --- 256,260 ---- { playerStatus.isAuthenticated = true; + SendSoundEffect(connectionId, "Welcome"); } else if (loginStatus == tcAccountDatabase::DUPLICATE_LOGIN) *************** *** 312,315 **** --- 313,317 ---- playerStatus.SetConnectionId(connectionId); + playerToConnection[username] = connectionId; msg = wxString::Format("Welcome %s (Alliance %d)\n", playerStatus.GetNameWithRank().c_str(), *************** *** 340,344 **** if (iter->second.isAuthenticated) { ! tcAccountDatabase::Get()->LogOut(iter->second.name); iter->second.isAuthenticated = false; } --- 342,346 ---- if (iter->second.isAuthenticated) { ! LogOutPlayer(iter->second.name); iter->second.isAuthenticated = false; } *************** *** 347,350 **** --- 349,379 ---- } + void tcMultiplayerInterface::LogOutPlayer(const std::string& username) + { + std::map<std::string, int>::iterator iter = + playerToConnection.find(username); + + if (iter == playerToConnection.end()) + { + fprintf(stderr, "tcMultiplayerInterface::LogOutPlayer - not found in playerToConnection map\n"); + return; + } + + playerToConnection.erase(iter); + tcAccountDatabase::Get()->LogOut(username); + + // iterate through objects and release control of objects controller by player + tcGameObjIterator objIter; + unsigned updateCount = 0; + for (objIter.First(); objIter.NotDone(); objIter.Next()) + { + tcGameObject* obj = objIter.Get(); + if (obj->GetController() == username) + { + obj->SetController(""); + } + } + } + /** * Broadcast chat text to all connected clients *************** *** 467,470 **** --- 496,517 ---- } + /** + * @return -1 if not found + */ + int tcMultiplayerInterface::GetPlayerConnectionId(const std::string& playerName) + { + std::map<std::string, int>::const_iterator iter = + playerToConnection.find(playerName); + + if (iter != playerToConnection.end()) + { + return iter->second; + } + else + { + return -1; + } + } + const std::string& tcMultiplayerInterface::GetPlayerName(int connectionId) { *************** *** 672,695 **** 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") --- 719,744 ---- SendChatText(connectionId, "*** /gm help ***"); SendChatText(connectionId, " /gm help - print GM command list"); + SendChatText(connectionId, " /gm addaccount '<username>' '<email>'"); + // SendChatText(connectionId, " /gm getaccountdata '<username>' '<param>'"); + // SendChatText(connectionId, " /gm setaccountdata '<username>' '<param>' <value>"); 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 reload <id>"); SendChatText(connectionId, " /gm repair <id>"); + // SendChatText(connectionId, " /gm setalliance <id> <alliance>"); + // SendChatTest(connectionId, " /gm setcontroller <id> '<player>'"); } + else if (command == "addaccount") + { + syntaxError = false; + + ProcessGMAddAccount(args, msg); + } else if (command == "create") { syntaxError = false; ! ProcessGMCreate(args, msg); } else if (command == "destroy") *************** *** 703,706 **** --- 752,761 ---- } } + else if (command == "move") + { + syntaxError = false; + + ProcessGMMove(args, msg); + } else if (command == "repair") { *************** *** 738,741 **** --- 793,958 ---- /** + * Adds new player account to database + * /gm addaccount '<username>' '<email>' + * @param args argument string + * @param msg message text to be returned + */ + void tcMultiplayerInterface::ProcessGMAddAccount(const wxString& args, wxString& msg) + { + + const char delim = '\''; + wxString s1 = args.AfterFirst(delim); + std::string username = s1.BeforeFirst(delim).c_str(); + s1 = s1.AfterFirst(delim); + s1 = s1.AfterFirst(delim); + std::string email = s1.BeforeFirst(delim).c_str(); + + if (username.size() < 3) + { + msg.Printf("*** Username too short (%s)", username.c_str()); + return; + } + + int status = tcAccountDatabase::Get()->AddUser(username, "", email); + if (status == tcAccountDatabase::SUCCESS) + { + msg.Printf("*** Added account for %s", username.c_str()); + } + else + { + msg.Printf("*** Error adding account %s (%d)", username.c_str(), status); + } + } + + + /** + * Creates a new game entity + * /gm create '<class>' '<unitname>' <alliance> + * @param args argument string + * @param msg message text to be returned + */ + void tcMultiplayerInterface::ProcessGMCreate(const wxString& args, wxString& msg) + { + 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(' '); + long alliance = 0; + if ((!s1.ToLong(&alliance)) || (alliance < 0)) + { + msg = wxString::Format("*** Bad alliance value for create, class '%s', unit '%s'", + unitClass.c_str(), unitName.c_str()); + return; + } + + tcScenarioInterface* scenarioInterface = tcSimPythonInterface::Get()->GetScenarioInterface(); + wxASSERT(scenarioInterface); + + tcScenarioUnit unit; + + unit.className = unitClass.c_str(); + unit.unitName = unitName.c_str(); + unit.lat = 0; + unit.lon = 0; + unit.alt = 0; + unit.heading = 0; + unit.speed = 0; + unit.throttle = 1.0; + + if (scenarioInterface->AddUnitToAlliance(unit, alliance)) + { + tcGameObject* obj = scenarioInterface->GetLastObjectAdded(); + wxASSERT(obj); + long id = obj->mnID; + + msg = wxString::Format("*** Created %d, class '%s', unit '%s' alliance %d", + id, unitClass.c_str(), unitName.c_str(), alliance); + } + else + { + msg = wxString::Format("*** Create FAILED, class '%s', unit '%s' alliance %d", + unitClass.c_str(), unitName.c_str(), alliance); + } + + } + + /** + * Moves a game entity + * move <id> <lat_deg> <lon_deg> (<alt>) + * use "move <id> 0 0 <alt>" to only change altitude + * @param args argument string + * @param msg message text to be returned + */ + void tcMultiplayerInterface::ProcessGMMove(const wxString& args, wxString& msg) + { + wxString params = args.AfterFirst(' '); + wxString s1 = params.BeforeFirst(' '); + + long id = -1; + if (!s1.ToLong(&id)) + { + msg = wxString::Format("*** Syntax error for /gm move"); + return; + } + + double lat_deg = 0; + params = params.AfterFirst(' '); + s1 = params.BeforeFirst(' '); + if (!s1.ToDouble(&lat_deg)) + { + msg = wxString::Format("*** Syntax error for /gm move"); + return; + } + + double lon_deg = 0; + params = params.AfterFirst(' '); + s1 = params.BeforeFirst(' '); + if (!s1.ToDouble(&lon_deg)) + { + msg = wxString::Format("*** Syntax error for /gm move"); + return; + } + + bool changeLatLon = (lat_deg != 0) || (lon_deg != 0); + + double alt_m = 0; + bool changeAlt = true; + params = params.AfterFirst(' '); + s1 = params.BeforeFirst(' '); + if (!s1.ToDouble(&alt_m)) + { + changeAlt = false; + } + + tcSimState* simState = tcSimState::Get(); + + if (tcGameObject* obj = simState->GetObject(id)) + { + if (changeLatLon) + { + obj->mcKin.mfLat_rad = C_PIOVER180 * lat_deg; + obj->mcKin.mfLon_rad = C_PIOVER180 * lon_deg; + } + if (changeAlt) + { + obj->mcKin.mfAlt_m = (float)alt_m; + } + + msg = wxString::Format("*** Entity %d moved", id); + } + else + { + msg = wxString::Format("*** Entity %d not found", id); + } + + + + } + + /** * Process command from client (after command is received at server) * text commands start with a forward slash '/' *************** *** 966,969 **** --- 1183,1218 ---- /** + * Sends control request message to server requesting release of control of object id by player + */ + void tcMultiplayerInterface::SendControlRelease(long id) + { + if (IsServer()) + { + fprintf(stderr, "tcMultiplayerInterface::SendControlRelease - 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::SendControlRelease - 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::AddControlRelease(id, stream); + + SendUpdateMessageAck(destination, stream); + } + + /** * Sends control request message to server requesting control of object id by player */ *************** *** 997,1000 **** --- 1246,1270 ---- } + void tcMultiplayerInterface::SendSoundEffect(const std::string& player, const std::string& effect, long id) + { + int connectionId = GetPlayerConnectionId(player); + + if (connectionId != -1) + { + SendSoundEffect(connectionId, effect, id); + } + } + + void tcMultiplayerInterface::SendSoundEffect(int destination, const std::string& effect, long id) + { + tcStream stream; + tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::SOUND_EFFECT, stream); + + tcUpdateMessageHandler::AddSoundEffect(id, effect, stream); + + SendUpdateMessage(destination, stream); + + } + void tcMultiplayerInterface::SendTestUDP(int destination, const std::string& message) { *************** *** 1233,1236 **** --- 1503,1531 ---- + /** + * Send script command messages to server + */ + void tcMultiplayerInterface::UpdateScriptCommands(int connectionId) + { + wxASSERT(!IsServer()); + + tcSimPythonInterface* pythonInterface = tcSimPythonInterface::Get(); + + if (!pythonInterface->HasNewCommand()) return; + + tcCommandStream commandStream; + tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::SCRIPT_COMMANDS, commandStream); + + pythonInterface->operator>>(commandStream); + + pythonInterface->ClearNewCommand(); + + SendUpdateMessageAck(connectionId, commandStream); + #ifdef _DEBUG + fprintf(stdout, "Sent script commands\n"); + #endif + + } + *************** *** 1348,1351 **** --- 1643,1652 ---- int id = *iter; + // always do script command update at client + if (!IsServer()) + { + UpdateScriptCommands(id); + } + /* always do new cmd update, clear flag on last only. ** New commands need to be send to all clients at once with *************** *** 1458,1462 **** tcSound::Get()->PlayEffect("fslide"); ! tcAccountDatabase::Get()->LogOut(iter->second.name); } --- 1759,1763 ---- tcSound::Get()->PlayEffect("fslide"); ! LogOutPlayer(iter->second.name); } |
|
From: Dewitt C. <ddc...@us...> - 2005-05-05 02:15:32
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv777/src/graphics Modified Files: tc3DWindow.cpp tcEditBox.cpp tcLauncherPopup.cpp tcStartView.cpp Log Message: Index: tcStartView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcStartView.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcStartView.cpp 29 Mar 2005 00:12:27 -0000 1.9 --- tcStartView.cpp 5 May 2005 02:14:52 -0000 1.10 *************** *** 98,102 **** wxString s = wxString::Format("%s Test Build", __DATE__); ! DrawTextR(s.c_str(), 85.0, 150.0, GetDefaultFont(), color, 24.0, LEFT_BASE_LINE); --- 98,102 ---- wxString s = wxString::Format("%s Test Build", __DATE__); ! DrawTextR(s.c_str(), 85.0, 180.0, GetDefaultFont(), color, 24.0, LEFT_BASE_LINE); Index: tcLauncherPopup.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcLauncherPopup.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcLauncherPopup.cpp 4 Mar 2005 00:46:17 -0000 1.5 --- tcLauncherPopup.cpp 5 May 2005 02:14:52 -0000 1.6 *************** *** 255,258 **** --- 255,259 ---- tcLauncher* launcher = GetLauncher(); wxASSERT(launcher); + if (launcher == 0) return; launcher->runToEnable_m = runToEnable; *************** *** 302,311 **** void tcLauncherPopup::OnDatumCommand(wxCommandEvent& event) { redraw = true; if (tcLauncher* launcher = GetLauncher()) { tcCommandQueue::Get()->GetUserInputForID("SetDatum", "Datum", ! std::vector<long>(platformId), launcherIdx); } } --- 303,316 ---- void tcLauncherPopup::OnDatumCommand(wxCommandEvent& event) { + static std::vector<long> idVect; + redraw = true; if (tcLauncher* launcher = GetLauncher()) { + idVect.clear(); + idVect.push_back(platformId); tcCommandQueue::Get()->GetUserInputForID("SetDatum", "Datum", ! idVect, launcherIdx); } } *************** *** 319,332 **** if (launcher->GetLauncherStatus() == tcLauncher::LAUNCHER_READY) { ! launcher->mnUncommitted -= 1; ! if (launcher->mnUncommitted < 0) ! { ! launcher->mnUncommitted = 0; // don't set new cmd here since this is an error case ! std::cerr << "Error - tcLauncherState::SetLaunch - negative uncommitted\n"; ! } ! //else ! //{ ! // commandObj.SetNewCommand(GetLauncherFlag(nLauncher)); ! //} } } --- 324,328 ---- if (launcher->GetLauncherStatus() == tcLauncher::LAUNCHER_READY) { ! launcher->SetLaunch(1); } } Index: tcEditBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcEditBox.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcEditBox.cpp 29 Apr 2005 18:52:53 -0000 1.12 --- tcEditBox.cpp 5 May 2005 02:14:52 -0000 1.13 *************** *** 84,89 **** // draw cursor wxSize size; ! MeasureText(defaultFont.get(), fontSize, drawText, size); osg::Vec4 cursorColor(0, 0, 0, 1); --- 84,91 ---- // draw cursor + wxString textToCursor = wxString(drawText).Truncate(cursorPosition); wxSize size; ! //MeasureText(defaultFont.get(), fontSize, drawText, size); ! MeasureText(defaultFont.get(), fontSize, textToCursor.c_str(), size); osg::Vec4 cursorColor(0, 0, 0, 1); *************** *** 129,134 **** --- 131,138 ---- if (clearOnReturn) { + lastBuffer = mzBuffer; strcpy(mzBuffer, ""); strcpy(mzBufferHide, ""); + cursorPosition = 0; } } *************** *** 136,144 **** else if (keycode == WXK_BACK) { ! if (nLength == 0) return; ! mzBuffer[--nLength] = 0; mzBufferHide[nLength] = 0; textChanged = true; } else if (keycode == WXK_ESCAPE) { --- 140,167 ---- else if (keycode == WXK_BACK) { ! if (cursorPosition == 0) return; ! cursorPosition--; ! for (unsigned n=cursorPosition; n<(unsigned)nLength-1; n++) ! { ! mzBuffer[n] = mzBuffer[n+1]; ! mzBufferHide[n] = mzBufferHide[n+1]; ! } ! nLength--; ! mzBuffer[nLength] = 0; mzBufferHide[nLength] = 0; textChanged = true; } + else if (keycode == WXK_UP) + { + SetBuffer(lastBuffer.c_str()); + } + else if (keycode == WXK_LEFT) + { + if (cursorPosition > 0) cursorPosition--; + } + else if (keycode == WXK_RIGHT) + { + if (cursorPosition < (unsigned)nLength) cursorPosition++; + } else if (keycode == WXK_ESCAPE) { *************** *** 155,166 **** { long keycode = event.KeyCode(); ! int nLength = (int)strlen(mzBuffer); if (nLength >= MAX_EDITBOX_CHAR-1) {return;} ! mzBuffer[nLength] = (char)keycode; ! mzBufferHide[nLength] = '*'; ! mzBuffer[++nLength] = 0; mzBufferHide[nLength] = 0; textChanged = true; } --- 178,204 ---- { long keycode = event.KeyCode(); ! unsigned int nLength = strlen(mzBuffer); ! ! nLength++; ! if (nLength >= MAX_EDITBOX_CHAR-1) {return;} ! for (unsigned n=nLength-1; n>cursorPosition; n--) ! { ! mzBuffer[n] = mzBuffer[n-1]; ! mzBufferHide[n] = mzBuffer[n-1]; ! } ! ! mzBuffer[cursorPosition] = (char)keycode; ! mzBufferHide[cursorPosition] = '*'; ! ! ! mzBuffer[nLength] = 0; mzBufferHide[nLength] = 0; textChanged = true; + + cursorPosition++; + if (cursorPosition > (unsigned)nLength) cursorPosition = (unsigned)nLength; + } *************** *** 220,223 **** --- 258,263 ---- mzBufferHide[MAX_EDITBOX_CHAR-1] = 0; textChanged = true; + + cursorPosition = strlen(mzBuffer); } *************** *** 236,240 **** clearOnReturn(false), command(0), ! starText(false) { ref_count++; --- 276,281 ---- clearOnReturn(false), command(0), ! starText(false), ! cursorPosition(0) { ref_count++; Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tc3DWindow.cpp 17 Apr 2005 22:35:31 -0000 1.20 --- tc3DWindow.cpp 5 May 2005 02:14:51 -0000 1.21 *************** *** 1592,1595 **** --- 1592,1596 ---- text->setLayout(osgText::Text::LEFT_TO_RIGHT); text->setFontResolution(32, 32); + //text->setFontResolution(64, 64); text->setText("UNINTIALIZED"); *************** *** 2018,2022 **** } ! defaultFont = osgText::readFontFile("fonts/times.ttf"); InitGraphicsObjects(); --- 2019,2024 ---- } ! //defaultFont = osgText::readFontFile("fonts/times.ttf"); ! defaultFont = osgText::readFontFile("fonts/arial.ttf"); InitGraphicsObjects(); |
|
From: Dewitt C. <ddc...@us...> - 2005-05-05 02:15:32
|
Update of /cvsroot/gcblue/gcb_wx/src/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv777/src/ai Modified Files: Brain.cpp Log Message: Index: Brain.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Brain.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Brain.cpp 29 Apr 2005 18:52:51 -0000 1.7 --- Brain.cpp 5 May 2005 02:14:45 -0000 1.8 *************** *** 61,64 **** --- 61,81 ---- tcCommandStream& Brain::operator<<(tcCommandStream& stream) { + wxASSERT(platform->IsClientMode()); + + unsigned char nTasks; + stream >> nTasks; + + RemoveAllTasks(); + + for (unsigned char n=0; n<nTasks; n++) + { + std::string taskName; + stream >> taskName; + + float priority; + stream >> priority; + + AddTask(taskName, (double)priority); + } return stream; *************** *** 70,74 **** tcCommandStream& Brain::operator>>(tcCommandStream& stream) { ! wxASSERT(!parent->IsClientMode()); unsigned char nTasks = taskMap.size(); --- 87,91 ---- tcCommandStream& Brain::operator>>(tcCommandStream& stream) { ! wxASSERT(!platform->IsClientMode()); unsigned char nTasks = taskMap.size(); *************** *** 80,86 **** for (;iter != done; ++iter) { ! wxASSERT(iter->second); ! ! // iter->second->Update(t); } --- 97,107 ---- for (;iter != done; ++iter) { ! Task* task = iter->second; ! wxASSERT(task); ! ! stream << task->GetTaskName(); ! ! float priority = (float)task->GetPriority(); ! stream << priority; } *************** *** 192,195 **** --- 213,218 ---- } + hasNewCommand = true; + // check taskNameMap for C++ task, otherwise assume python script task std::map<std::string, int>::iterator iter = taskNameLookup.find(taskName); *************** *** 214,217 **** --- 237,241 ---- default: fprintf(stderr, "Unrecognized C++ taskname (%s)\n", taskName.c_str()); + hasNewCommand = false; break; } *************** *** 228,231 **** --- 252,257 ---- if (updating) return; + if (taskMap.size() > 0) hasNewCommand = true; + std::map<std::string, Task*>::iterator iter = taskMap.begin(); while (iter != taskMap.end()) *************** *** 271,274 **** --- 297,302 ---- delete iter->second; taskMap.erase(iter); + + hasNewCommand = true; } } |
|
From: Dewitt C. <ddc...@us...> - 2005-05-05 02:15:32
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv777/src/common Modified Files: tcSound.cpp tcStream.cpp Log Message: Index: tcSound.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcSound.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** tcSound.cpp 8 Apr 2005 01:54:11 -0000 1.31 --- tcSound.cpp 5 May 2005 02:14:51 -0000 1.32 *************** *** 105,109 **** effectMap["Thuck"] = LoadSample("Thuck.wav"); effectMap["Explosion2"] = LoadSample("Explosion2.wav"); ! effectMap["Welcome"] = LoadSample("Welcome.wav"); effectMap["jetlaunch"] = LoadSample("jetlaunch.wav"); effectMap["MutedBeep"] = LoadSample("MutedBeep.wav"); --- 105,109 ---- effectMap["Thuck"] = LoadSample("Thuck.wav"); effectMap["Explosion2"] = LoadSample("Explosion2.wav"); ! effectMap["Welcome"] = LoadSample("NavyWhistle.wav"); effectMap["jetlaunch"] = LoadSample("jetlaunch.wav"); effectMap["MutedBeep"] = LoadSample("MutedBeep.wav"); Index: tcStream.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcStream.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcStream.cpp 29 Apr 2005 18:52:53 -0000 1.9 --- tcStream.cpp 5 May 2005 02:14:51 -0000 1.10 *************** *** 45,49 **** */ tcStream::tcStream() ! : detailLevel(0) { } --- 45,50 ---- */ tcStream::tcStream() ! : detailLevel(0), ! metaString("") { } *************** *** 118,121 **** --- 119,132 ---- } + const std::string& tcStream::GetMetaString() const + { + return metaString; + } + + void tcStream::SetMetaString(const std::string& s) + { + metaString = s; + } + /*** write operators ***/ |
|
From: Dewitt C. <ddc...@us...> - 2005-05-05 02:15:06
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv777/src/sim Modified Files: Game.cpp tcBallisticWeapon.cpp tcCommandObject.cpp tcLauncher.cpp tcLauncherState.cpp tcObjectControl.cpp tcPlatformObject.cpp tcSensorMap.cpp tcSimState.cpp tcTorpedoObject.cpp Log Message: Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** tcSimState.cpp 29 Apr 2005 18:52:56 -0000 1.78 --- tcSimState.cpp 5 May 2005 02:14:55 -0000 1.79 *************** *** 58,61 **** --- 58,62 ---- #include "tcMessageInterface.h" #include "tcPositionRegistry.h" + #include "network/tcMultiplayerInterface.h" #ifdef _DEBUG *************** *** 872,875 **** --- 873,880 ---- } + bool tcSimState::IsMultiplayerServer() const + { + return (multiplayerMode == MM_SERVER); + } *************** *** 931,934 **** --- 936,968 ---- /** + * In single player mode, play sound effect if entity is owned by user. + * In multiplayer server mode, send sound effect message to player + */ + void tcSimState::PlayEntitySoundEffect(tcGameObject* obj, const std::string& effect) + { + using network::tcMultiplayerInterface; + + if (multiplayerMode == MM_OFF) + { + if (mpUserInfo->IsOwnAlliance(obj->GetAlliance())) + { + tcSound::Get()->PlayEffect(effect); + } + } + else if (multiplayerMode == MM_SERVER) + { + const std::string& controller = obj->GetController(); + if (controller.size()) + { + tcMultiplayerInterface::Get()->SendSoundEffect(controller, effect, obj->mnID); + } + } + else + { + wxASSERT(false); + } + } + + /** * */ *************** *** 1587,1594 **** missile->LaunchFrom(launchingPlatform, nLauncher); ! if (mpUserInfo->IsOwnAlliance(launchingPlatform->GetAlliance())) ! { ! tcSound::Get()->PlayEffect("MissileLaunch"); ! } } else if (tcTorpedoObject* torp = dynamic_cast<tcTorpedoObject*>(launched)) --- 1621,1625 ---- missile->LaunchFrom(launchingPlatform, nLauncher); ! PlayEntitySoundEffect(launchingPlatform, "MissileLaunch"); } else if (tcTorpedoObject* torp = dynamic_cast<tcTorpedoObject*>(launched)) *************** *** 1596,1603 **** torp->LaunchFrom(launchingPlatform, nLauncher); ! if (mpUserInfo->IsOwnAlliance(launchingPlatform->GetAlliance())) ! { ! tcSound::Get()->PlayEffect("torpedo_launch"); ! } } else if (tcBallisticWeapon* ballistic = dynamic_cast<tcBallisticWeapon*>(launched)) --- 1627,1631 ---- torp->LaunchFrom(launchingPlatform, nLauncher); ! PlayEntitySoundEffect(launchingPlatform, "torpedo_launch"); } else if (tcBallisticWeapon* ballistic = dynamic_cast<tcBallisticWeapon*>(launched)) *************** *** 1605,1618 **** ballistic->LaunchFrom(launchingPlatform, nLauncher); ! if (mpUserInfo->IsOwnAlliance(launchingPlatform->GetAlliance())) { ! if (ballistic->IsGunRound()) ! { ! tcSound::Get()->PlayEffect("NavalGun1"); ! } ! else if (ballistic->IsPointDefense()) ! { ! tcSound::Get()->PlayEffect("Gatling"); ! } } } --- 1633,1643 ---- ballistic->LaunchFrom(launchingPlatform, nLauncher); ! if (ballistic->IsGunRound()) { ! PlayEntitySoundEffect(launchingPlatform, "NavalGun1"); ! } ! else if (ballistic->IsPointDefense()) ! { ! PlayEntitySoundEffect(launchingPlatform, "Gatling"); } } Index: tcBallisticWeapon.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcBallisticWeapon.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcBallisticWeapon.cpp 29 Apr 2005 18:52:55 -0000 1.13 --- tcBallisticWeapon.cpp 5 May 2005 02:14:54 -0000 1.14 *************** *** 49,52 **** --- 49,55 ---- tcWeaponObject::operator<<(stream); + stream >> vxy_mps; + stream >> vz_mps; + return stream; } *************** *** 59,62 **** --- 62,68 ---- tcWeaponObject::operator>>(stream); + stream << vxy_mps; + stream << vz_mps; + return stream; } Index: tcTorpedoObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcTorpedoObject.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcTorpedoObject.cpp 29 Apr 2005 18:52:56 -0000 1.10 --- tcTorpedoObject.cpp 5 May 2005 02:14:55 -0000 1.11 *************** *** 54,59 **** seeker << stream; - wxASSERT(false); - return stream; } --- 54,57 ---- *************** *** 73,79 **** stream << guidanceUpdateInterval; waypoint >> stream; ! seeker << stream; ! ! wxASSERT(false); return stream; --- 71,75 ---- stream << guidanceUpdateInterval; waypoint >> stream; ! seeker >> stream; return stream; Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tcLauncherState.cpp 17 Apr 2005 22:35:32 -0000 1.29 --- tcLauncherState.cpp 5 May 2005 02:14:54 -0000 1.30 *************** *** 383,392 **** tcCommandStream& tcLauncherState::operator<<(tcCommandStream& stream) { ! for(int n = 0; n < mnCount; n++) { ! // const tcLauncher* launcher = &launchers[n]; ! ! int launcherFlag = GetLauncherFlag(n); ! commandObj.LoadCommandParam(stream, *launchers[n], launcherFlag); } --- 383,389 ---- tcCommandStream& tcLauncherState::operator<<(tcCommandStream& stream) { ! for (int n = 0; n < mnCount; n++) { ! *launchers[n] << stream; } *************** *** 590,593 **** --- 587,595 ---- for(int i=0; i<mnCount; i++) { + if (simState->IsMultiplayerServer()) + { + launchers[i]->UpdateStatus(); + } + if (launchers[i]->mbActive) { Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -d -r1.128 -r1.129 *** Game.cpp 29 Apr 2005 18:52:55 -0000 1.128 --- Game.cpp 5 May 2005 02:14:53 -0000 1.129 *************** *** 306,310 **** creditView->SetActive(false); scenarioSelectView->SetActive(false); ! viewer->SetTerrainActive(true); --- 306,310 ---- creditView->SetActive(false); scenarioSelectView->SetActive(false); ! networkView->SetActive(false); viewer->SetTerrainActive(true); *************** *** 2230,2234 **** if (multiplayerMode != 0) { ! meScreenMode = NETWORK; } return; --- 2230,2241 ---- if (multiplayerMode != 0) { ! if (meScreenMode == NETWORK) ! { ! meScreenMode = TACTICAL; ! } ! else ! { ! meScreenMode = NETWORK; ! } } return; Index: tcLauncher.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncher.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcLauncher.cpp 16 Apr 2005 20:44:43 -0000 1.17 --- tcLauncher.cpp 5 May 2005 02:14:54 -0000 1.18 *************** *** 74,77 **** --- 74,79 ---- } + stream >> status; + return stream; } *************** *** 86,90 **** stream << mnCurrent; stream << errorCode; ! return stream; } --- 88,92 ---- stream << mnCurrent; stream << errorCode; ! stream << status; return stream; } *************** *** 105,108 **** --- 107,123 ---- stream >> msDatum.mfLon_rad; + unsigned char useTorpedoParams; + stream >> useTorpedoParams; + if (useTorpedoParams != 0) + { + stream >> usePassive; + stream >> preEnableSpeed_kts; + stream >> runDepth_m; + stream >> ceiling_m; + stream >> floor_m; + stream >> runToEnable_m; + fprintf(stdout, "Updating launcher torpedo params (%d/%d)\n", this, parent); + } + return stream; } *************** *** 119,122 **** --- 134,149 ---- stream << msDatum.mfLon_rad; + unsigned char useTorpedoParams = (preEnableSpeed_kts > 0); + stream << useTorpedoParams; + if (useTorpedoParams != 0) + { + stream << usePassive; + stream << preEnableSpeed_kts; + stream << runDepth_m; + stream << ceiling_m; + stream << floor_m; + stream << runToEnable_m; + } + return stream; } *************** *** 231,511 **** int tcLauncher::GetLauncherStatus() { ! using namespace Database; ! ! if (mnCurrent <= 0) {return LAUNCHER_EMPTY;} // launcher empty ! if ((mfTimeToReady > 0) || (isLoading)) ! { ! return LAUNCHER_BUSY; ! } ! if (!mbActive) {return LAUNCHER_INACTIVE;} // launcher inactive ! ! if (isDamaged) {return DAMAGED;} ! ! wxASSERT(simState); ! wxASSERT(parent); ! ! // limit depth for launching sub-launched missiles ! if (tcMissileDBObject* missile = ! dynamic_cast<tcMissileDBObject*>(mpChildDBObj)) ! { ! if (parent->mcKin.mfAlt_m < -30.0) return TOO_DEEP; ! } ! else if (tcTorpedoDBObject* torpedo = ! dynamic_cast<tcTorpedoDBObject*>(mpChildDBObj)) ! { ! if (-parent->mcKin.mfAlt_m > torpedo->maxDepth_m) return TOO_DEEP; ! } ! ! bool hasTarget = (mnTargetID != NULL_INDEX); ! ! if (meLaunchMode == DATUM_ONLY) // needs a datum programmed to launch ! { ! if ((msDatum.mfLat_rad != 0) || (msDatum.mfLon_rad != 0)) ! { ! return LAUNCHER_READY; ! } ! else ! { ! return NO_DATUM; ! } ! } ! else if (meLaunchMode == TARGET_ONLY) ! { ! if (hasTarget) ! { ! return LAUNCHER_READY; ! } ! else ! { ! return NO_TARGET; ! } ! } ! ! ! ! // will launch and either proceed unguided or autonomously search out target ! if (meLaunchMode == AUTO) ! { ! bool hasDatum = (msDatum.mfLat_rad != 0) || (msDatum.mfLon_rad != 0); ! if ((!hasDatum) && (!hasTarget)) ! { ! return NO_TARGET; ! } ! else ! { ! return LAUNCHER_READY; ! } ! } ! ! // if running as multiplayer client, seeker track can't be checked so defer checking to server ! if (parent->IsClientMode()) ! { ! return LAUNCHER_READY; ! } ! ! tcGameObject *targetObj = simState->GetObject(mnTargetID); ! ! // TODO: called here as quick way to add autopoint feature, move to better location ! if (IsAutoPoint() && (targetObj != 0)) ! { ! pointingAngle = parent->BearingToRad(*targetObj) - parent->mcKin.mfHeading_rad; ! if (pointingAngle >= C_PI) pointingAngle -= C_TWOPI; ! else if (pointingAngle < -C_PI) pointingAngle += C_TWOPI; ! } ! ! // needs a fire control track (launching platform) to launch ! if ((meLaunchMode == FC_TRACK)||(meLaunchMode == SEEKER_TRACK)) ! { ! if (mnTargetID == NULL_INDEX) return NO_TARGET; // needs a target ! if (!fireControlSensor) return NO_FIRECONTROL; // database error ! ! if (!fireControlSensor->IsTrackAvailable()) return FC_BUSY; // no FC tracks available ! if (targetObj == NULL) return NOT_DETECTED_FC; // target doesn't exist ! ! float range; ! if (!fireControlSensor->CanDetectTarget(targetObj, range)) ! { ! return NOT_DETECTED_FC; ! } ! ! if (meLaunchMode == FC_TRACK) return LAUNCHER_READY; ! } ! ! // needs a seeker track to launch ! if (meLaunchMode == SEEKER_TRACK) ! { ! tcMissileDBObject *pMissileDBObj = dynamic_cast<tcMissileDBObject*>(mpChildDBObj); ! if (pMissileDBObj==NULL) ! { ! std::cerr << "GetLauncherStatus -- Error: SEEKER_TRACK guidance with non-missile" << std::endl; ! return LAUNCHER_ERROR; ! } ! tnPoolIndex nSensorKey = pMissileDBObj->GetPrimarySeekerKey(); ! ! long fcID = parent->mnID; ! unsigned fcIdx = fireControlSensorIdx; ! ! bool canDetect = simState->RadarCanDetect(nSensorKey, targetObj, ! parent, pointingAngle, fcID, fcIdx); ! ! if (canDetect) ! { ! return LAUNCHER_READY; ! } ! else ! { ! return NOT_DETECTED_SEEKER; ! } ! } ! ! ! return LAUNCHER_ERROR; // bad meLaunchMode } - /** - * @return LAUNCHER_READY if launcher is ready to launch. Launch readiness - * @return conditions depend on meLaunchMode for the launcher. - * @return Otherwise return error code - * @see teWeaponLaunchMode - * @see tcLauncherState::teLauncherStatus - * This method needs to be separated into smaller pieces. - */ - int tcLauncher::GetLauncherStatus() const - { - using namespace Database; - - if (mnCurrent <= 0) {return LAUNCHER_EMPTY;} // launcher empty - if ((mfTimeToReady > 0) || (isLoading)) - { - return LAUNCHER_BUSY; - } - if (!mbActive) {return LAUNCHER_INACTIVE;} // launcher inactive or damaged - - if (isDamaged) {return DAMAGED;} - - wxASSERT(simState); - wxASSERT(parent); - - // limit depth for launching sub-launched missiles - if (tcMissileDBObject* missile = - dynamic_cast<tcMissileDBObject*>(mpChildDBObj)) - { - if (parent->mcKin.mfAlt_m < -30.0) return TOO_DEEP; - } - else if (tcTorpedoDBObject* torpedo = - dynamic_cast<tcTorpedoDBObject*>(mpChildDBObj)) - { - if (-parent->mcKin.mfAlt_m > torpedo->maxDepth_m) return TOO_DEEP; - } - - bool hasTarget = (mnTargetID != NULL_INDEX); - - if (meLaunchMode == DATUM_ONLY) // needs a datum programmed to launch - { - if ((msDatum.mfLat_rad != 0) || (msDatum.mfLon_rad != 0)) - { - return LAUNCHER_READY; - } - else - { - return NO_DATUM; - } - } - else if (meLaunchMode == TARGET_ONLY) - { - if (hasTarget) - { - return LAUNCHER_READY; - } - else - { - return NO_TARGET; - } - } - - - - // will launch and either proceed unguided or autonomously search out target - if (meLaunchMode == AUTO) - { - bool hasDatum = (msDatum.mfLat_rad != 0) || (msDatum.mfLon_rad != 0); - - if ((!hasDatum) && (!hasTarget)) - { - return NO_TARGET; - } - else - { - return LAUNCHER_READY; - } - } - - // if running as multiplayer client, seeker track can't be checked so defer checking to server - if (parent->IsClientMode()) - { - return LAUNCHER_READY; - } - - tcGameObject *targetObj = simState->GetObject(mnTargetID); - - // TODO: called here as quick way to add autopoint feature, move to better location - /* - if (IsAutoPoint() && (targetObj != 0)) - { - pointingAngle = parent->BearingToRad(*targetObj) - parent->mcKin.mfHeading_rad; - if (pointingAngle >= C_PI) pointingAngle -= C_TWOPI; - else if (pointingAngle < -C_PI) pointingAngle += C_TWOPI; - } - */ - - // needs a fire control track (launching platform) to launch - if ((meLaunchMode == FC_TRACK)||(meLaunchMode == SEEKER_TRACK)) - { - if (mnTargetID == NULL_INDEX) return NO_TARGET; // needs a target - if (!fireControlSensor) return NO_FIRECONTROL; // database error - - if (!fireControlSensor->IsTrackAvailable()) return FC_BUSY; // no FC tracks available - if (targetObj == NULL) return NOT_DETECTED_FC; // target doesn't exist - - float range; - if (!fireControlSensor->CanDetectTarget(targetObj, range)) - { - return NOT_DETECTED_FC; - } - - if (meLaunchMode == FC_TRACK) return LAUNCHER_READY; - } - - // needs a seeker track to launch - if (meLaunchMode == SEEKER_TRACK) - { - tcMissileDBObject *pMissileDBObj = dynamic_cast<tcMissileDBObject*>(mpChildDBObj); - if (pMissileDBObj==NULL) - { - std::cerr << "GetLauncherStatus -- Error: SEEKER_TRACK guidance with non-missile" << std::endl; - return LAUNCHER_ERROR; - } - tnPoolIndex nSensorKey = pMissileDBObj->GetPrimarySeekerKey(); - - long fcID = parent->mnID; - unsigned fcIdx = fireControlSensorIdx; - - bool canDetect = simState->RadarCanDetect(nSensorKey, targetObj, - parent, pointingAngle, fcID, fcIdx); - - if (canDetect) - { - return LAUNCHER_READY; - } - else - { - return NOT_DETECTED_SEEKER; - } - } - - - return LAUNCHER_ERROR; // bad meLaunchMode - } /** --- 258,269 ---- int tcLauncher::GetLauncherStatus() { ! if (!parent->IsClientMode()) ! { ! UpdateStatus(); ! } ! return (int)status; } /** *************** *** 553,556 **** --- 311,319 ---- } + unsigned char tcLauncher::GetStatus() const + { + return status; + } + /** *************** *** 694,697 **** --- 457,489 ---- /** + * Added so that appropriate commandObj receives new command for multiplayer + */ + void tcLauncher::SetLaunch(unsigned int quantity) + { + if (tcPlatformObject* platform = dynamic_cast<tcPlatformObject*>(parent)) + { + // find launcher index + bool searching = true; + unsigned int nLaunchers = platform->GetLauncherCount(); + for (unsigned int n=0; (n<nLaunchers) && searching; n++) + { + if (platform->GetLauncher(n) == this) + { + platform->SetLaunch(n, quantity); + searching = false; + } + } + if (searching) + { + fprintf(stderr, "tcLauncher::SetLaunch - couldn't find launcher in parent\n"); + } + } + else + { + wxASSERT(false); + } + } + + /** * */ *************** *** 709,771 **** } /** * Converts launcher status code into string. */ ! std::string tcLauncher::TranslateStatus(int status) { ! if (status == LAUNCHER_READY) { return "Launcher ready"; } ! else if (status == LAUNCHER_EMPTY) { return "Launcher empty"; } ! else if (status == LAUNCHER_BUSY) { return "Launcher busy"; } ! else if (status == NO_DATUM) { return "No datum"; } ! else if (status == NO_TARGET) { return "No target"; } ! else if (status == NOT_DETECTED_FC) { return "Not detected by fire control"; } ! else if (status == NOT_DETECTED_SEEKER) { return "Not detected by seeker"; } ! else if (status == FC_BUSY) { return "Fire control busy"; } ! else if (status == LAUNCHER_ERROR) { return "Corrupt launcher error"; } ! else if (status == LAUNCHER_INACTIVE) { return "Launcher inactive or damaged"; } ! else if (status == NO_FIRECONTROL) { return "No fire control sensor (database error)"; } ! else if (status == TOO_DEEP) { return "Too deep for launch"; } ! else if (status == DAMAGED) { return "Launcher damaged"; } ! else if (status == BAD_LAUNCHER) { return "Invalid launcher"; --- 501,745 ---- } + void tcLauncher::UpdateStatus() + { + using namespace Database; + + if (mnCurrent <= 0) + { + status = LAUNCHER_EMPTY; + return; + } + + if ((mfTimeToReady > 0) || (isLoading)) + { + status = LAUNCHER_BUSY; + return; + } + if (!mbActive) + { + status = LAUNCHER_INACTIVE; + return; + } + + if (isDamaged) + { + status = DAMAGED; + return; + } + + wxASSERT(simState); + wxASSERT(parent); + + // limit depth for launching sub-launched missiles + if (tcMissileDBObject* missile = + dynamic_cast<tcMissileDBObject*>(mpChildDBObj)) + { + if (parent->mcKin.mfAlt_m < -30.0) + { + status = TOO_DEEP; + return; + } + } + else if (tcTorpedoDBObject* torpedo = + dynamic_cast<tcTorpedoDBObject*>(mpChildDBObj)) + { + if (-parent->mcKin.mfAlt_m > torpedo->maxDepth_m) + { + status = TOO_DEEP; + return; + } + } + + bool hasTarget = (mnTargetID != NULL_INDEX); + + if (meLaunchMode == DATUM_ONLY) // needs a datum programmed to launch + { + if ((msDatum.mfLat_rad != 0) || (msDatum.mfLon_rad != 0)) + { + status = LAUNCHER_READY; + } + else + { + status = NO_DATUM; + } + return; + } + else if (meLaunchMode == TARGET_ONLY) + { + if (hasTarget) + { + status = LAUNCHER_READY; + } + else + { + status = NO_TARGET; + } + return; + } + + + + // will launch and either proceed unguided or autonomously search out target + if (meLaunchMode == AUTO) + { + bool hasDatum = (msDatum.mfLat_rad != 0) || (msDatum.mfLon_rad != 0); + if ((!hasDatum) && (!hasTarget)) + { + status = NO_TARGET; + } + else + { + status = LAUNCHER_READY; + } + return; + } + + // if running as multiplayer client, seeker track can't be checked so defer checking to server + if (parent->IsClientMode()) + { + status = LAUNCHER_READY; + return; + } + + tcGameObject *targetObj = simState->GetObject(mnTargetID); + + // TODO: called here as quick way to add autopoint feature, move to better location + if (IsAutoPoint() && (targetObj != 0)) + { + pointingAngle = parent->BearingToRad(*targetObj) - parent->mcKin.mfHeading_rad; + if (pointingAngle >= C_PI) pointingAngle -= C_TWOPI; + else if (pointingAngle < -C_PI) pointingAngle += C_TWOPI; + } + + // needs a fire control track (launching platform) to launch + if ((meLaunchMode == FC_TRACK)||(meLaunchMode == SEEKER_TRACK)) + { + if (mnTargetID == NULL_INDEX) + { + status = NO_TARGET; // needs a target + return; + } + if (!fireControlSensor) + { + status = NO_FIRECONTROL; // database error + return; + } + + if (!fireControlSensor->IsTrackAvailable()) + { + status = FC_BUSY; // no FC tracks available + return; + } + if (targetObj == NULL) + { + status = NOT_DETECTED_FC; // target doesn't exist + return; + } + + float range; + if (!fireControlSensor->CanDetectTarget(targetObj, range)) + { + status = NOT_DETECTED_FC; + return; + } + + if (meLaunchMode == FC_TRACK) + { + status = LAUNCHER_READY; + return; + } + } + + // needs a seeker track to launch + if (meLaunchMode == SEEKER_TRACK) + { + tcMissileDBObject *pMissileDBObj = dynamic_cast<tcMissileDBObject*>(mpChildDBObj); + if (pMissileDBObj==NULL) + { + std::cerr << "GetLauncherStatus -- Error: SEEKER_TRACK guidance with non-missile" << std::endl; + status = LAUNCHER_ERROR; + return; + } + tnPoolIndex nSensorKey = pMissileDBObj->GetPrimarySeekerKey(); + + long fcID = parent->mnID; + unsigned fcIdx = fireControlSensorIdx; + + bool canDetect = simState->RadarCanDetect(nSensorKey, targetObj, + parent, pointingAngle, fcID, fcIdx); + + if (canDetect) + { + status = LAUNCHER_READY; + } + else + { + status = NOT_DETECTED_SEEKER; + } + return; + } + + + status = LAUNCHER_ERROR; // bad meLaunchMode + } /** * Converts launcher status code into string. */ ! std::string tcLauncher::TranslateStatus(int statusCode) { ! if (statusCode == LAUNCHER_READY) { return "Launcher ready"; } ! else if (statusCode == LAUNCHER_EMPTY) { return "Launcher empty"; } ! else if (statusCode == LAUNCHER_BUSY) { return "Launcher busy"; } ! else if (statusCode == NO_DATUM) { return "No datum"; } ! else if (statusCode == NO_TARGET) { return "No target"; } ! else if (statusCode == NOT_DETECTED_FC) { return "Not detected by fire control"; } ! else if (statusCode == NOT_DETECTED_SEEKER) { return "Not detected by seeker"; } ! else if (statusCode == FC_BUSY) { return "Fire control busy"; } ! else if (statusCode == LAUNCHER_ERROR) { return "Corrupt launcher error"; } ! else if (statusCode == LAUNCHER_INACTIVE) { return "Launcher inactive or damaged"; } ! else if (statusCode == NO_FIRECONTROL) { return "No fire control sensor (database error)"; } ! else if (statusCode == TOO_DEEP) { return "Too deep for launch"; } ! else if (statusCode == DAMAGED) { return "Launcher damaged"; } ! else if (statusCode == BAD_LAUNCHER) { return "Invalid launcher"; *************** *** 794,798 **** pointingElevation(0), isLoading(false), ! isDamaged(false) { wxASSERT(dbObj); --- 768,774 ---- pointingElevation(0), isLoading(false), ! isDamaged(false), ! preEnableSpeed_kts(0), ! status(LAUNCHER_INACTIVE) { wxASSERT(dbObj); Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** tcPlatformObject.cpp 29 Apr 2005 18:52:56 -0000 1.42 --- tcPlatformObject.cpp 5 May 2005 02:14:55 -0000 1.43 *************** *** 679,682 **** --- 679,687 ---- } + if (updateMask & UPDATE_AI) + { + brain->operator<<(stream); + } + return stream; } *************** *** 701,707 **** --- 706,718 ---- updateMask |= UPDATE_SENSORS; } + if (brain->HasNewCommand()) + { + updateMask |= UPDATE_AI; + } if (stream.GetDetailLevel() == tcStream::WRITE_ALL) updateMask = 0xFF; + if (IsClientMode()) updateMask &= (~UPDATE_AI); // don't do ai updates at client + stream << updateMask; *************** *** 730,733 **** --- 741,749 ---- } + if (updateMask & UPDATE_AI) + { + brain->operator>>(stream); + } + return stream; *************** *** 792,801 **** mcLauncherState.ClearNewCommand(); tcSensorPlatform::ClearNewCommand(); } bool tcPlatformObject::HasNewCommand() const { return commandObj.HasNewCommand() || mcLauncherState.HasNewCommand() || ! tcSensorPlatform::HasNewCommand(); } --- 808,820 ---- mcLauncherState.ClearNewCommand(); tcSensorPlatform::ClearNewCommand(); + brain->ClearNewCommand(); } bool tcPlatformObject::HasNewCommand() const { + bool newBrainCommand = !IsClientMode() && brain->HasNewCommand(); + return commandObj.HasNewCommand() || mcLauncherState.HasNewCommand() || ! tcSensorPlatform::HasNewCommand() || newBrainCommand; } Index: tcSensorMap.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorMap.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcSensorMap.cpp 29 Mar 2005 00:12:46 -0000 1.18 --- tcSensorMap.cpp 5 May 2005 02:14:55 -0000 1.19 *************** *** 68,71 **** --- 68,73 ---- } + stream >> sensorFlags; + return stream; } *************** *** 84,99 **** } ! /* ! tcSensorReport maSensorReport[MAX_SENSOR_REPORTS]; // most recent data from contributing sensors ! int mnContributors; ! tsEmitterInfo maEmitterInfo[MAX_EMITTERS]; ! int mnEmitters; ! tnPoolIndex mnDatabaseID; // database ID of track ! float matchupRating; ///< matchup rating for platforms that have targeted this track ! float expectedDamage; ///< rating of expected fractional damage of weapons launched at target, 0 - none, 1.0 - totally destroyed ! float assessedDamage; ///< fractional damage assessment ! std::vector<long> intercepts; ///< vector of platform ids that are intercepting this track ! std::vector<long> engaged; ///< vector of weapon ids that are tracking / engaging ! */ return stream; } --- 86,91 ---- } ! stream << sensorFlags; ! return stream; } Index: tcCommandObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCommandObject.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcCommandObject.cpp 17 Apr 2005 22:35:32 -0000 1.3 --- tcCommandObject.cpp 5 May 2005 02:14:54 -0000 1.4 *************** *** 126,163 **** } - /** - * version that takes tcLauncher param - */ - void tcCommandObject::LoadCommandParam(tcCommandStream& stream, tcLauncher& param, int flag) - { - tcLauncher temp; - temp << stream; // read into temporary obj - - param.CopyCommandInfoFrom(temp); // apply update - - /* - - if (stream.GetAck()) - { - if ((commandStatus & flag) && (temp.CommandInfoMatches(param))) - { - commandStatus &= (~flag); // clear flag, successful ack - } - } - else // not an ack - { - if (clientMode && (commandStatus & flag)) - { - // ignore update - } - else - { - param.CopyCommandInfoFrom(temp); // apply update - commandStatus &= (~flag); // clear flag - } - - } - */ - } --- 126,129 ---- Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** tcObjectControl.cpp 29 Apr 2005 18:52:55 -0000 1.35 --- tcObjectControl.cpp 5 May 2005 02:14:54 -0000 1.36 *************** *** 707,711 **** for(int i=0;i<mnLaunchers;i++) { ! const tcLauncher* pLauncher = pLauncherState->GetLauncher(i); int nLaunchCount = pLauncher->mnCurrent; --- 707,711 ---- for(int i=0;i<mnLaunchers;i++) { ! tcLauncher* pLauncher = pLauncherState->GetLauncher(i); int nLaunchCount = pLauncher->mnCurrent; |
|
From: Dewitt C. <ddc...@us...> - 2005-05-05 02:14:30
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv722/include/sim Modified Files: tcCommandObject.h tcLauncher.h tcPlatformObject.h tcSensorMap.h tcSimState.h Log Message: Index: tcLauncher.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcLauncher.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcLauncher.h 29 Mar 2005 00:12:24 -0000 1.13 --- tcLauncher.h 5 May 2005 02:14:19 -0000 1.14 *************** *** 121,125 **** int GetErrorCode() const {return errorCode;} int GetLauncherStatus(); - int GetLauncherStatus() const; float GetSectorCenter() const; ///< returns center of engagement sector in radians float GetSectorWidth() const; ///< returns width of engagement sector in radians --- 121,124 ---- *************** *** 131,134 **** --- 130,134 ---- void SetChildQuantity(unsigned int quantity); void SetDamaged(bool state); + void SetLaunch(unsigned int quantity); void SetLoadState(bool state); void SetParent(tcGameObject *obj); *************** *** 137,141 **** bool IsItemCompatible(const std::string& item) const; ! static std::string TranslateStatus(int status); tcLauncher(); --- 137,144 ---- bool IsItemCompatible(const std::string& item) const; ! unsigned char GetStatus() const; ! void UpdateStatus(); ! ! static std::string TranslateStatus(int statusCode); tcLauncher(); *************** *** 145,148 **** --- 148,152 ---- tcGameObject* parent; bool isDamaged; + unsigned char status; static tcSimState* simState; Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** tcSimState.h 29 Apr 2005 18:52:02 -0000 1.38 --- tcSimState.h 5 May 2005 02:14:20 -0000 1.39 *************** *** 2,6 **** ** @file tcSimState.h */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcSimState.h */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 179,182 **** --- 179,183 ---- bool IsMultiplayerActive() const; bool IsMultiplayerClient() const; + bool IsMultiplayerServer() const; void SetScenarioDescription(std::string s); *************** *** 214,217 **** --- 215,219 ---- bool IsDetectedESM(tcESMSensor* apESM, const tcRadar* apEmitterRadar, float& rfAz_rad); void PerformAutoEngage(tcGameObject* apGameObj, double afTime); + void PlayEntitySoundEffect(tcGameObject* obj, const std::string& effect); void ProcessRadarDetection(tcGameObject *apRadarPlat,tcGameObject *apTarget, tcRadar *apRadarSS); Index: tcSensorMap.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorMap.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcSensorMap.h 5 Mar 2005 22:37:51 -0000 1.12 --- tcSensorMap.h 5 May 2005 02:14:20 -0000 1.13 *************** *** 184,188 **** static bool autoKillAssess; ///< set to true to automatically mark destroyed tracks enum {TRACK_STALE = 1, TRACK_DESTROYED = 2}; ! unsigned int sensorFlags; ///< 1 - stale, 2 - destroyed void KillAssess(); --- 184,188 ---- static bool autoKillAssess; ///< set to true to automatically mark destroyed tracks enum {TRACK_STALE = 1, TRACK_DESTROYED = 2}; ! unsigned char sensorFlags; ///< 1 - stale, 2 - destroyed void KillAssess(); Index: tcCommandObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcCommandObject.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcCommandObject.h 17 Apr 2005 22:35:00 -0000 1.2 --- tcCommandObject.h 5 May 2005 02:14:19 -0000 1.3 *************** *** 42,46 **** void LoadCommandParam(tcCommandStream& stream, float& param, int flag); void LoadCommandParam(tcCommandStream& stream, int& param, int flag); - void LoadCommandParam(tcCommandStream& stream, tcLauncher& param, int flag); void SetNewCommand(int flag); --- 42,45 ---- Index: tcPlatformObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPlatformObject.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** tcPlatformObject.h 29 Apr 2005 18:52:02 -0000 1.27 --- tcPlatformObject.h 5 May 2005 02:14:20 -0000 1.28 *************** *** 77,81 **** UPDATE_LAUNCHERS = 0x02, UPDATE_SENSORS = 0x04, ! UPDATE_TASKS = 0x08 }; --- 77,81 ---- UPDATE_LAUNCHERS = 0x02, UPDATE_SENSORS = 0x04, ! UPDATE_AI = 0x08 }; |
|
From: Dewitt C. <ddc...@us...> - 2005-05-05 02:14:29
|
Update of /cvsroot/gcblue/gcb_wx/include/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv722/include/network Modified Files: tcMultiplayerInterface.h tcUpdateMessageHandler.h Log Message: Index: tcUpdateMessageHandler.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcUpdateMessageHandler.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcUpdateMessageHandler.h 29 Apr 2005 18:52:02 -0000 1.7 --- tcUpdateMessageHandler.h 5 May 2005 02:14:19 -0000 1.8 *************** *** 59,67 **** DESTROY = 5, ///< destroys game obj SENSOR_UPDATE = 6, ///< update of sensor map tracks ! CONTROL_REQUEST = 7 ///< request to take control of obj }; static void AddCommandAck(tcGameObject* obj, tcCommandStream& stream); static void AddCommandUpdate(tcGameObject* obj, tcCommandStream& stream); static void AddControlRequest(long id, tcStream& stream); static void AddCreate(tcGameObject* obj, tcCreateStream& stream); --- 59,70 ---- DESTROY = 5, ///< destroys game obj SENSOR_UPDATE = 6, ///< update of sensor map tracks ! CONTROL_REQUEST = 7, ///< request to take control of obj ! SOUND_EFFECT = 8, ///< play sound effect for object ! SCRIPT_COMMANDS = 9 ///< script commands to execute on server }; static void AddCommandAck(tcGameObject* obj, tcCommandStream& stream); static void AddCommandUpdate(tcGameObject* obj, tcCommandStream& stream); + static void AddControlRelease(long id, tcStream& stream); static void AddControlRequest(long id, tcStream& stream); static void AddCreate(tcGameObject* obj, tcCreateStream& stream); *************** *** 69,72 **** --- 72,76 ---- static void AddDestroy(long id, tcStream& stream); static void AddSensorUpdateHeader(long alliance, tcStream& stream); + static void AddSoundEffect(long id, const std::string& effect, tcStream& stream); static void AddUpdate(tcGameObject* obj, tcUpdateStream& stream); *************** *** 81,85 **** --- 85,91 ---- void HandleCreateRequest(tcStream& stream, int connectionId); void HandleDestroy(tcStream& stream); + void HandleScriptCommands(tcStream& stream, int connectionId); void HandleSensorUpdate(tcUpdateStream& stream); + void HandleSoundEffect(tcStream& stream); void HandleUpdate(tcUpdateStream& stream, int connectionId); Index: tcMultiplayerInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcMultiplayerInterface.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcMultiplayerInterface.h 29 Apr 2005 18:52:02 -0000 1.22 --- tcMultiplayerInterface.h 5 May 2005 02:14:19 -0000 1.23 *************** *** 131,134 **** --- 131,135 ---- int LogInPlayer(const std::string& username, int connectionId, tcPlayerStatus& playerStatus, wxString& msg); + void LogOutPlayer(const std::string& username); void LogOutAllPlayers(); void MakeClient(); *************** *** 145,149 **** --- 146,153 ---- void SendControlMessageUDP(int destination, int messageCode, int param = 0); void SendControlMessageUDPAck(int destination, int messageCode, int param = 0); + void SendControlRelease(long id); void SendControlRequest(long id); + void SendSoundEffect(const std::string& player, const std::string& effect, long id = -1); + void SendSoundEffect(int destination, const std::string& effect, long id = -1); void SendTestUDP(int destination, const std::string& message); void SendUpdateMessage(int destination, tcStream& stream); *************** *** 165,169 **** 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 bool tcpChat; ///< true to use TCP for chat protocol, otherwise UDP --- 169,174 ---- 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<std::string, int> playerToConnection; ///< map of (player name, connection id) std::map<int, std::vector<tcMessageHandler*> > messageMap; ///< map of (message id, message handler vector) pairs bool tcpChat; ///< true to use TCP for chat protocol, otherwise UDP *************** *** 176,183 **** --- 181,192 ---- void ClearMessageMap(); void DistributeChatText(); + int GetPlayerConnectionId(const std::string& playerName); bool IsNewPlayer(int id); void ProcessAllianceCommand(tcPlayerStatus& player, const wxString& args); void ProcessGameMasterCommand(tcPlayerStatus& player, const wxString& args); + void ProcessGMAddAccount(const wxString& args, wxString& msg); + void ProcessGMCreate(const wxString& args, wxString& msg); + void ProcessGMMove(const wxString& args, wxString& msg); void ProcessMessage(int messageId, int connectionId, unsigned messageSize, const unsigned char *data); *************** *** 190,193 **** --- 199,203 ---- void UpdatePing(); void UpdatePlayerInfo(); + void UpdateScriptCommands(int connectionId); void UpdateSensorMaps(); void UpdateSensorMap(int connectionId); |
|
From: Dewitt C. <ddc...@us...> - 2005-05-05 02:14:29
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv722/include/scriptinterface Modified Files: tcPlatformInterface.h tcScenarioInterface.h tcSimPythonInterface.h Log Message: Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** tcPlatformInterface.h 29 Apr 2005 18:52:02 -0000 1.39 --- tcPlatformInterface.h 5 May 2005 02:14:19 -0000 1.40 *************** *** 298,301 **** --- 298,302 ---- bool IsAvailable() const; bool IsMultiplayerActive() const; + void ReleaseControl(); void TakeControl(); Index: tcScenarioInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcScenarioInterface.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcScenarioInterface.h 31 Mar 2005 03:51:12 -0000 1.16 --- tcScenarioInterface.h 5 May 2005 02:14:19 -0000 1.17 *************** *** 150,155 **** tcDestroyGoal DestroyGoal(std::string target); ! // Interface class management functions static object GetInterface(); static void InitPythonClasses(void); --- 150,157 ---- tcDestroyGoal DestroyGoal(std::string target); + // non-python methods + tcGameObject* GetLastObjectAdded() const; ! // Interface class management methods static object GetInterface(); static void InitPythonClasses(void); *************** *** 160,165 **** static void AttachSimState(tcSimState *apSS) {simState = apSS;} ! protected: double eventTime; ///< start time for briefing event functions static tcDirector* director; static tcMapData* mapData; --- 162,169 ---- static void AttachSimState(tcSimState *apSS) {simState = apSS;} ! private: double eventTime; ///< start time for briefing event functions + tcGameObject* lastObjectAdded; ///< last object added to sim + static tcDirector* director; static tcMapData* mapData; Index: tcSimPythonInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcSimPythonInterface.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcSimPythonInterface.h 29 Apr 2005 18:52:02 -0000 1.22 --- tcSimPythonInterface.h 5 May 2005 02:14:19 -0000 1.23 *************** *** 50,53 **** --- 50,55 ---- class tcCommandQueue; class tcMapOverlay; + class tcStream; + class tcCommandStream; using namespace Sensor; *************** *** 61,64 **** --- 63,67 ---- using ai::ScriptedTaskInterface; + /** * Embedded python scripting interface code. *************** *** 131,134 **** --- 134,138 ---- void ProcessCallback(std::string command, const std::vector<long>& id, long anData, int param); + void ProcessCallbackString(const std::string& command, const std::vector<long>& id); void ProcessHotKey(unsigned int key, unsigned int flags); void ProcessSecondaryHook(long id); *************** *** 143,146 **** --- 147,156 ---- void SetMenuGroup(const std::vector<long>& unitIds); + tcCommandStream& operator<<(tcCommandStream& stream); + tcCommandStream& operator>>(tcCommandStream& stream); + + void ClearNewCommand(); + bool HasNewCommand() const; + static tcSimPythonInterface* Get(); ///< singleton accessor *************** *** 190,193 **** --- 200,210 ---- std::vector<long> pushedPlatformIds; + struct ClientCommand + { + std::vector<long> idList; + std::string commandText; + }; + std::vector<ClientCommand> clientCommands; ///< commands to send to server + tcFlightPort* GetHookedObjFlightPort(); }; |
|
From: Dewitt C. <ddc...@us...> - 2005-05-05 02:14:28
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv722/include/common Modified Files: tcStream.h Log Message: Index: tcStream.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcStream.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcStream.h 29 Apr 2005 18:52:01 -0000 1.9 --- tcStream.h 5 May 2005 02:14:17 -0000 1.10 *************** *** 49,52 **** --- 49,55 ---- void SetDetailLevel(int dl); + const std::string& GetMetaString() const; + void SetMetaString(const std::string& s); + /// write operators tcStream& operator<<(int& val); *************** *** 82,85 **** --- 85,89 ---- private: int detailLevel; + std::string metaString; ///< additional data }; |
|
From: Dewitt C. <ddc...@us...> - 2005-05-05 02:14:27
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv722/include/graphics Modified Files: tcEditBox.h Log Message: Index: tcEditBox.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcEditBox.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcEditBox.h 17 Apr 2005 22:34:59 -0000 1.7 --- tcEditBox.h 5 May 2005 02:14:18 -0000 1.8 *************** *** 47,51 **** tcEditBox(tc3DWindow *parent, TiXmlNode *config); ! virtual ~tcEditBox(void); protected: static unsigned ref_count; --- 47,51 ---- tcEditBox(tc3DWindow *parent, TiXmlNode *config); ! virtual ~tcEditBox(); protected: static unsigned ref_count; *************** *** 62,65 **** --- 62,67 ---- long command; bool starText; ///< true to use * for text for password entry + std::string lastBuffer; + unsigned int cursorPosition; |
|
From: Dewitt C. <ddc...@us...> - 2005-04-29 18:53:36
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27631/src/graphics Modified Files: ObjectUpdater.cpp tc3DViewer.cpp tcChatBox.cpp tcConsoleBox.cpp tcEditBox.cpp tcGameView.cpp tcHookInfo.cpp tcMapView.cpp tcNetworkView.cpp Log Message: Index: tcNetworkView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcNetworkView.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcNetworkView.cpp 17 Apr 2005 22:35:31 -0000 1.8 --- tcNetworkView.cpp 29 Apr 2005 18:52:53 -0000 1.9 *************** *** 36,39 **** --- 36,40 ---- #include "tcSimState.h" #include "common/tcOptions.h" + #include "tcUserInfo.h" *************** *** 76,80 **** float y = (float)statusBoxBounds.y + 10.0f; ! DrawTextR("Connection Status", x, y, defaultFont.get(), color, 12.0f, CENTER_CENTER); --- 77,81 ---- float y = (float)statusBoxBounds.y + 10.0f; ! DrawTextR("Connection Status", x, y, defaultFont.get(), color, 14.0f, CENTER_CENTER); *************** *** 88,92 **** std::string connectionStatus = tcMultiplayerInterface::Get()->GetConnectionStatus(*iter); ! DrawTextR(connectionStatus.c_str(), x, y, defaultFont.get(), color, 12.0f, LEFT_CENTER); } --- 89,93 ---- std::string connectionStatus = tcMultiplayerInterface::Get()->GetConnectionStatus(*iter); ! DrawTextR(connectionStatus.c_str(), x, y, defaultFont.get(), color, 14.0f, LEFT_CENTER); } *************** *** 109,121 **** void tcNetworkView::JoinGame(wxCommandEvent& event) { ! if (networkMode != MULTIPLAYER_CLIENT) { ! chatBox->Print("Must be in client mode and connected to join game"); return; } ! ! if (tcMultiplayerInterface::Get()->GetNumConnections() == 0) { ! chatBox->Print("Must be connected to join game"); return; } --- 110,129 ---- void tcNetworkView::JoinGame(wxCommandEvent& event) { ! if (networkMode == MULTIPLAYER_OFF) { ! chatBox->Print("Must be in multiplayer mode to join game"); return; } ! else if (networkMode == MULTIPLAYER_CLIENT) { ! if (tcMultiplayerInterface::Get()->GetNumConnections() == 0) ! { ! chatBox->Print("Must connect first to join game"); ! return; ! } ! } ! else if (!tcSimState::Get()->IsScenarioLoaded()) ! { ! chatBox->Print("Server must load scenario before starting game"); return; } *************** *** 240,243 **** --- 248,253 ---- tcMultiplayerInterface::Get()->SetName(s); + tcUserInfo::Get()->SetUsername(s); + tcOptions::Get()->SetOptionString("UserName", s.c_str()); } *************** *** 313,319 **** if (!tcOptions::Get()->OptionStringExists("UserName")) { ! tcOptions::Get()->SetOptionString("UserName", "observer"); } ! usernameEdit->SetBuffer(tcOptions::Get()->GetOptionString("UserName")); // add password edit box --- 323,333 ---- if (!tcOptions::Get()->OptionStringExists("UserName")) { ! tcOptions::Get()->SetOptionString("UserName", "Observer"); } ! const std::string& username = tcOptions::Get()->GetOptionString("UserName"); ! usernameEdit->SetBuffer(username.c_str()); ! tcMultiplayerInterface::Get()->SetName(username); ! tcUserInfo::Get()->SetUsername(username); ! // add password edit box *************** *** 322,326 **** passwordEdit->SetCommand(4); passwordEdit->SetClearOnReturn(false); ! usernameEdit->SetBuffer(""); if (!tcOptions::Get()->OptionStringExists("HostAddress")) --- 336,340 ---- passwordEdit->SetCommand(4); passwordEdit->SetClearOnReturn(false); ! passwordEdit->SetBuffer(""); if (!tcOptions::Get()->OptionStringExists("HostAddress")) Index: tcConsoleBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcConsoleBox.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcConsoleBox.cpp 16 Apr 2005 20:44:42 -0000 1.13 --- tcConsoleBox.cpp 29 Apr 2005 18:52:53 -0000 1.14 *************** *** 33,36 **** --- 33,63 ---- #endif + + + /** + * Catch key events to scroll buffer + */ + void tcConsoleBox::OnKeyDown(wxKeyEvent& event) + { + int nChar = event.GetKeyCode(); + + // WXK_PRIOR is Page up + // WXK_NEXT is Page down + + if (nChar == WXK_NEXT) + { + ScrollBuffer(-SCROLL_LINES); + } + else if (nChar == WXK_PRIOR) + { + ScrollBuffer(SCROLL_LINES); + } + else + { + event.Skip(); + } + } + + void tcConsoleBox::OnSize(wxSizeEvent& event) { *************** *** 145,148 **** --- 172,184 ---- nLines = (size_t)cursorLine; } + + if (lineOffset + MIN_LINES_DISPLAY > nLines) + { + nLines = min(nLines, MIN_LINES_DISPLAY); + } + else + { + nLines -= lineOffset; + } for(size_t i=0;i<nLines;i++) *************** *** 160,164 **** } ! DrawTextR(line.c_str(), fontSize, float(y), defaultFont.get(), fontColor, fontSize, LEFT_BASE_LINE); } --- 196,200 ---- } ! DrawTextR(line.c_str(), 8.0f, float(y), defaultFont.get(), fontColor, fontSize, LEFT_BASE_LINE); } *************** *** 175,178 **** --- 211,218 ---- } + unsigned int tcConsoleBox::GetLineOffset() const + { + return lineOffset; + } void tcConsoleBox::InitFromXml(TiXmlNode* config) *************** *** 183,187 **** fontSize = 10.0f; fontColor.set(0.392f, 1.0f, 0.392f, 1.0f); ! nyzero = mnHeight - 20; return; } --- 223,227 ---- fontSize = 10.0f; fontColor.set(0.392f, 1.0f, 0.392f, 1.0f); ! nyzero = mnHeight - 10; return; } *************** *** 243,246 **** --- 283,309 ---- /** + * Scroll displayed lines of buffer history + */ + void tcConsoleBox::ScrollBuffer(int delta) + { + int offset = (int)lineOffset + delta; + if (offset < 0) + { + offset = 0; + } + else if (offset > (int)textArray.GetCount()) + { + offset = textArray.GetCount(); + } + SetLineOffset((unsigned int)offset); + } + + void tcConsoleBox::SetLineOffset(unsigned int offset) + { + lineOffset = offset; + ForceRedraw(); + } + + /** * Updates position of most recent text to draw. This is * used for the delayed draw effect. If this effect is not *************** *** 259,262 **** --- 322,334 ---- else { + /* if viewing buffer history (lineOffset > 0), adjust + ** lineOffset so that view doesn't change as new lines + ** are added */ + int newLines = (int)textArray.GetCount() - cursorLine; + if (lineOffset != 0) + { + lineOffset += newLines; + } + if ((cursorLine = (int)textArray.GetCount()) > 0) { *************** *** 313,317 **** isMouseOver(false), isFocused(false), ! drawBorder(true) { InitFromXml(config); --- 385,390 ---- isMouseOver(false), isFocused(false), ! drawBorder(true), ! lineOffset(0) { InitFromXml(config); Index: tcHookInfo.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcHookInfo.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcHookInfo.cpp 29 Mar 2005 00:12:26 -0000 1.9 --- tcHookInfo.cpp 29 Apr 2005 18:52:53 -0000 1.10 *************** *** 405,408 **** --- 405,430 ---- color.set(0.4f, 1.0f, 0.4f, 1.0f); + + // multiplayer info + if (mpSS->IsMultiplayerActive()) + { + const std::string& controller = pHookedObj->GetController(); + + if (controller.size()) + { + s = "Controlled by "; + s += controller; + } + else + { + s = "No controller"; + } + + DrawTextR(s.c_str(), ftextx, ftexty, defaultFont.get(), color, fontSize, LEFT_BASE_LINE); + ftexty += 15; + color.set(0.4f, 1.0f, 0.4f, 1.0f); + } + + // AI action text for platform objects tcPlatformObject* pPlatformObj = dynamic_cast<tcPlatformObject*>(pHookedObj); *************** *** 446,450 **** mpSS->GetPlatformState(mnHookID, pHookedObj); ! if ((pHookedObj != NULL) && (mpUserInfo->IsOwnAlliance(pHookedObj->mnAlliance))) { DrawOwn(pHookedObj); --- 468,472 ---- mpSS->GetPlatformState(mnHookID, pHookedObj); ! if ((pHookedObj != NULL) && (mpUserInfo->IsOwnAlliance(pHookedObj->GetAlliance()))) { DrawOwn(pHookedObj); Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcMapView.cpp 16 Apr 2005 20:44:42 -0000 1.23 --- tcMapView.cpp 29 Apr 2005 18:52:53 -0000 1.24 *************** *** 1885,1889 **** { wxString s = wxString::Format("%04d", pMO->mnID); ! DrawTextR(s.c_str(), x-9.0f, y+15.0f, defaultFont.get(), symbolColor, 8.0, LEFT_BASE_LINE); } --- 1885,1889 ---- { wxString s = wxString::Format("%04d", pMO->mnID); ! DrawTextR(s.c_str(), x-9.0f, y+15.0f, defaultFont.get(), symbolColor, 10.0, LEFT_BASE_LINE); } Index: tcGameView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcGameView.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcGameView.cpp 11 Mar 2005 02:34:57 -0000 1.7 --- tcGameView.cpp 29 Apr 2005 18:52:53 -0000 1.8 *************** *** 279,283 **** pSOI->droll = 0; ! bool useTrue = ((mpUserInfo->IsOwnAlliance(apGameObj->mnAlliance))||(mpOptions->mnViewMode < 2)); if (useTrue) pSOI->mpObj = apGameObj->mpDBObject->mp3DObj; --- 279,283 ---- pSOI->droll = 0; ! bool useTrue = ((mpUserInfo->IsOwnAlliance(apGameObj->GetAlliance()))||(mpOptions->mnViewMode < 2)); if (useTrue) pSOI->mpObj = apGameObj->mpDBObject->mp3DObj; *************** *** 504,508 **** } } ! else if ((pMissileObj != NULL)&&(pMissileObj->mnAlliance == nOwnAlliance)) { bShowTarget = mpSS->GetSeekerTrack(mnHookID,track) != 0; --- 504,508 ---- } } ! else if ((pMissileObj != NULL)&&(pMissileObj->GetAlliance() == nOwnAlliance)) { bShowTarget = mpSS->GetSeekerTrack(mnHookID,track) != 0; *************** *** 611,615 **** point.x = (float)po->mcKin.mfLon_rad; point.y = (float)po->mcKin.mfLat_rad; ! int bAllianceMatch = (po->mnAlliance == anAlliance); if (bAllianceMatch&&(mpMapView->PointInView(point))&&(rnIndex < MAXMAPOBJ)) --- 611,615 ---- point.x = (float)po->mcKin.mfLon_rad; point.y = (float)po->mcKin.mfLat_rad; ! int bAllianceMatch = (po->GetAlliance() == anAlliance); if (bAllianceMatch&&(mpMapView->PointInView(point))&&(rnIndex < MAXMAPOBJ)) Index: ObjectUpdater.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/ObjectUpdater.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ObjectUpdater.cpp 10 Mar 2005 03:28:28 -0000 1.15 --- ObjectUpdater.cpp 29 Apr 2005 18:52:53 -0000 1.16 *************** *** 257,261 **** if (gameObject) { ! if ((displayMode == 3) || simState->mpUserInfo->IsOwnAlliance(gameObject->mnAlliance)) { UpdateTrue(node); --- 257,261 ---- if (gameObject) { ! if ((displayMode == 3) || simState->mpUserInfo->IsOwnAlliance(gameObject->GetAlliance())) { UpdateTrue(node); Index: tcChatBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcChatBox.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcChatBox.cpp 16 Apr 2005 20:44:42 -0000 1.3 --- tcChatBox.cpp 29 Apr 2005 18:52:53 -0000 1.4 *************** *** 49,58 **** --- 49,72 ---- void tcChatBox::Draw() { + if (!IsBackgroundEnabled()) + { + DrawRectangle(0, 0, float(mnWidth), float(mnHeight), + osg::Vec4(0, 0, 0, 0.3f), FILL_ON); + } + DrawChildren(); + + FinishDraw(); } + void tcChatBox::OnChar(wxKeyEvent& event) + { + } + void tcChatBox::OnKeyDown(wxKeyEvent& event) + { + } *************** *** 97,101 **** - /** * @param surfaceHost tcWindow to share surface of --- 111,114 ---- *************** *** 107,111 **** { ! LoadBackgroundImage("background.jpg"); if (config) --- 120,124 ---- { ! //LoadBackgroundImage("background.jpg"); if (config) Index: tcEditBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcEditBox.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcEditBox.cpp 17 Apr 2005 22:35:31 -0000 1.11 --- tcEditBox.cpp 29 Apr 2005 18:52:53 -0000 1.12 *************** *** 168,171 **** --- 168,173 ---- { isMouseOver = true; + + SetFocus(); } Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tc3DViewer.cpp 25 Mar 2005 03:48:07 -0000 1.14 --- tc3DViewer.cpp 29 Apr 2005 18:52:53 -0000 1.15 *************** *** 1194,1198 **** tcSensorMap* sensorMap = simState->GetSensorMap(); unsigned int ownAlliance = simState->mpUserInfo->GetOwnAlliance(); ! if (ownAlliance == obj->mnAlliance) { x = LonToX(obj->mcKin.mfLon_rad); --- 1194,1198 ---- tcSensorMap* sensorMap = simState->GetSensorMap(); unsigned int ownAlliance = simState->mpUserInfo->GetOwnAlliance(); ! if (ownAlliance == obj->GetAlliance()) { x = LonToX(obj->mcKin.mfLon_rad); |
|
From: Dewitt C. <ddc...@us...> - 2005-04-29 18:53:36
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27631/src/common Modified Files: tcStream.cpp Log Message: Index: tcStream.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcStream.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcStream.cpp 16 Apr 2005 20:44:42 -0000 1.8 --- tcStream.cpp 29 Apr 2005 18:52:53 -0000 1.9 *************** *** 138,141 **** --- 138,147 ---- } + tcStream& tcStream::operator<<(char& val) + { + write((char*)&val, sizeof(val)); + return *this; + } + tcStream& tcStream::operator<<(unsigned char& val) { *************** *** 211,214 **** --- 217,225 ---- } + tcStream& tcStream::operator>>(char& val) + { + read((char*)&val, sizeof(val)); + return *this; + } tcStream& tcStream::operator>>(unsigned char& val) |
|
From: Dewitt C. <ddc...@us...> - 2005-04-29 18:53:36
|
Update of /cvsroot/gcblue/gcb_wx/src/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27631/src/ai Modified Files: Brain.cpp Log Message: Index: Brain.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Brain.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Brain.cpp 2 Mar 2005 22:28:41 -0000 1.6 --- Brain.cpp 29 Apr 2005 18:52:51 -0000 1.7 *************** *** 32,35 **** --- 32,37 ---- #include "ai/ScriptedTask.h" #include "sim/tcPlatformObject.h" + #include "common/tcStream.h" + #include "common/tcObjStream.h" #ifdef _DEBUG *************** *** 52,55 **** --- 54,106 ---- } + + + /** + * Loads state from command stream + */ + tcCommandStream& Brain::operator<<(tcCommandStream& stream) + { + + return stream; + } + + /** + * Saves state to command stream + */ + tcCommandStream& Brain::operator>>(tcCommandStream& stream) + { + wxASSERT(!parent->IsClientMode()); + + unsigned char nTasks = taskMap.size(); + stream << nTasks; + + // iterate through task map and update tasks + std::map<std::string, Task*>::iterator iter = taskMap.begin(); + std::map<std::string, Task*>::iterator& done = taskMap.end(); + for (;iter != done; ++iter) + { + wxASSERT(iter->second); + + // iter->second->Update(t); + } + + return stream; + } + + void Brain::ClearNewCommand() + { + hasNewCommand = false; + + } + + bool Brain::HasNewCommand() const + { + return hasNewCommand; + } + + + + + /** * gets a low priority, anonymous interface to board *************** *** 235,238 **** --- 286,291 ---- } + if (platform->IsClientMode()) return; // server updates only in multiplayer mode + RemovePending(); *************** *** 259,263 **** nextId(1), target(-1), ! updating(false) { wxASSERT(platform); --- 312,317 ---- nextId(1), target(-1), ! updating(false), ! hasNewCommand(false) { wxASSERT(platform); |
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 ---- |
|
From: Dewitt C. <ddc...@us...> - 2005-04-29 18:53:11
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27631/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcPlatformInterfaceExtensionB.cpp tcScenarioInterface.cpp tcSimPythonInterface.cpp Log Message: Index: tcPlatformInterfaceExtensionB.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtensionB.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcPlatformInterfaceExtensionB.cpp 29 Mar 2005 00:12:27 -0000 1.22 --- tcPlatformInterfaceExtensionB.cpp 29 Apr 2005 18:52:54 -0000 1.23 *************** *** 142,145 **** --- 142,151 ---- .def("SendCommand",&tcPlatformInterface::SendCommand) + // multiplayer related + .def("GetController", &tcPlatformInterface::GetController) + .def("IsAvailable", &tcPlatformInterface::IsAvailable) + .def("IsMultiplayerActive", &tcPlatformInterface::IsMultiplayerActive) + .def("TakeControl", &tcPlatformInterface::TakeControl) + // miscellaneous .def("GetTime", &tcPlatformInterface::GetTime) Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tcSimPythonInterface.cpp 31 Mar 2005 03:51:13 -0000 1.28 --- tcSimPythonInterface.cpp 29 Apr 2005 18:52:54 -0000 1.29 *************** *** 353,357 **** if ((mpHookedObj != NULL) && ! (mpSimState->mpUserInfo->IsOwnAlliance(mpHookedObj->mnAlliance))) { strcpy(str,"HookedUnitInfo"); --- 353,357 ---- if ((mpHookedObj != NULL) && ! (mpSimState->mpUserInfo->IsOwnAlliance(mpHookedObj->GetAlliance()))) { strcpy(str,"HookedUnitInfo"); *************** *** 363,366 **** --- 363,373 ---- } + tcScenarioInterface* tcSimPythonInterface::GetScenarioInterface() const + { + wxASSERT(scenarioInterface); + + return scenarioInterface; + } + /** * Loads scenario from Python script file. File should have *************** *** 594,598 **** char zBuff[128]; if (mpHookedObj == NULL) return; ! if (!mpSimState->mpUserInfo->IsOwnAlliance(mpHookedObj->mnAlliance)) return; sprintf(zBuff,"Menu.ProcessHotKey(HookedUnitInfo,'%c')\n",key); --- 601,605 ---- char zBuff[128]; if (mpHookedObj == NULL) return; ! if (!mpSimState->mpUserInfo->IsOwnAlliance(mpHookedObj->GetAlliance())) return; sprintf(zBuff,"Menu.ProcessHotKey(HookedUnitInfo,'%c')\n",key); *************** *** 611,615 **** char zBuff[128]; if (mpHookedObj == NULL) return; ! if (!mpSimState->mpUserInfo->IsOwnAlliance(mpHookedObj->mnAlliance)) return; sprintf(zBuff,"Menu.ProcessSecondaryHook(HookedUnitInfo,%d)\n",id); --- 618,622 ---- char zBuff[128]; if (mpHookedObj == NULL) return; ! if (!mpSimState->mpUserInfo->IsOwnAlliance(mpHookedObj->GetAlliance())) return; sprintf(zBuff,"Menu.ProcessSecondaryHook(HookedUnitInfo,%d)\n",id); *************** *** 655,659 **** tcGameObject* gameObj = mpSimState->GetObject(unitIds[idx]); if ((!gameObj) || ! (!mpSimState->mpUserInfo->IsOwnAlliance(gameObj->mnAlliance))) { fprintf(stderr, "tcSimPythonInterface::SetMenuGroup - null or " --- 662,666 ---- tcGameObject* gameObj = mpSimState->GetObject(unitIds[idx]); if ((!gameObj) || ! (!mpSimState->mpUserInfo->IsOwnAlliance(gameObj->GetAlliance()))) { fprintf(stderr, "tcSimPythonInterface::SetMenuGroup - null or " *************** *** 696,700 **** if (!pGameObj) return; ! if (mpSimState->mpUserInfo->IsOwnAlliance(pGameObj->mnAlliance)) { meMenuMode = UNIT_MENU; --- 703,707 ---- if (!pGameObj) return; ! if (mpSimState->mpUserInfo->IsOwnAlliance(pGameObj->GetAlliance())) { meMenuMode = UNIT_MENU; *************** *** 815,818 **** --- 822,826 ---- tcScenarioInterface::AddGoalClasses(mpDictionary); ScenarioInterface = scenarioInterfaceType(); + scenarioInterface = extract<tcScenarioInterface*>(ScenarioInterface); ScriptedTaskInterface tempInterface; Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcScenarioInterface.cpp 31 Mar 2005 03:51:13 -0000 1.23 --- tcScenarioInterface.cpp 29 Apr 2005 18:52:54 -0000 1.24 *************** *** 226,230 **** gameObj->mcKin.mfSpeed_kts = unit.speed; gameObj->mfDamageLevel = 0; ! gameObj->mnAlliance = alliance; gameObj->mfStatusTime = 0; // for lack of a better time gameObj->mzUnit = unit.unitName.c_str(); --- 226,230 ---- gameObj->mcKin.mfSpeed_kts = unit.speed; gameObj->mfDamageLevel = 0; ! gameObj->SetAlliance(alliance); gameObj->mfStatusTime = 0; // for lack of a better time gameObj->mzUnit = unit.unitName.c_str(); *************** *** 301,305 **** return false; } ! return flightOps->AddChildToFlightDeck(className, unitName, loc); } else --- 301,305 ---- return false; } ! return flightOps->AddChildToFlightDeck(className, unitName, loc, 0); } else Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** tcPlatformInterface.cpp 17 Apr 2005 22:35:31 -0000 1.42 --- tcPlatformInterface.cpp 29 Apr 2005 18:52:54 -0000 1.43 *************** *** 48,51 **** --- 48,52 ---- #include "tcLauncher.h" #include "tcMessageInterface.h" + #include "network/tcMultiplayerInterface.h" #include "tcStores.h" #include "ai/Brain.h" *************** *** 272,276 **** ** On client machine, only own-alliance objects exist in sim state */ ! if (pGameObj && (mpSimState->mpUserInfo->IsOwnAlliance(pGameObj->mnAlliance))) { tcKinematics *pTargetKin = &pGameObj->mcKin; --- 273,277 ---- ** On client machine, only own-alliance objects exist in sim state */ ! if (pGameObj && (mpSimState->mpUserInfo->IsOwnAlliance(pGameObj->GetAlliance()))) { tcKinematics *pTargetKin = &pGameObj->mcKin; *************** *** 296,300 **** { tcSensorMapTrack *smtrack = ! mpSimState->mcSensorMap.GetSensorMapTrack(GetTarget(), mpPlatformObj->mnAlliance); if (smtrack) { --- 297,301 ---- { tcSensorMapTrack *smtrack = ! mpSimState->mcSensorMap.GetSensorMapTrack(GetTarget(), mpPlatformObj->GetAlliance()); if (smtrack) { *************** *** 806,810 **** if (mpPlatformObj) { ! unsigned int nAlliance = mpPlatformObj->mnAlliance; mpSensorMap = mpSimState->mcSensorMap.GetMap(nAlliance); wxASSERT(mpSensorMap); --- 807,811 ---- if (mpPlatformObj) { ! unsigned int nAlliance = mpPlatformObj->GetAlliance(); mpSensorMap = mpSimState->mcSensorMap.GetMap(nAlliance); wxASSERT(mpSensorMap); *************** *** 998,1002 **** tcSensorMapTrack track; ! bool found = mpSimState->GetTrack(id, mpPlatformObj->mnAlliance, track); return track; --- 999,1003 ---- tcSensorMapTrack track; ! bool found = mpSimState->GetTrack(id, mpPlatformObj->GetAlliance(), track); return track; *************** *** 1069,1072 **** --- 1070,1099 ---- + std::string tcPlatformInterface::GetController() const + { + return std::string(mpPlatformObj->GetController()); + } + + bool tcPlatformInterface::IsAvailable() const + { + return mpPlatformObj->IsAvailable(); + } + + bool tcPlatformInterface::IsMultiplayerActive() const + { + return mpSimState->IsMultiplayerActive(); + } + + void tcPlatformInterface::TakeControl() + { + using network::tcMultiplayerInterface; + if (mpPlatformObj->IsAvailable()) + { + tcMultiplayerInterface::Get()->SendControlRequest(mpPlatformObj->mnID); + } + } + + + double tcPlatformInterface::GetTime() const { *************** *** 1088,1092 **** bool tcPlatformInterface::IsPlayerControlled() const { ! return mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->mnAlliance); } --- 1115,1127 ---- bool tcPlatformInterface::IsPlayerControlled() const { ! // single player or server, check for alliance match only ! if (!mpPlatformObj->IsClientMode()) ! { ! return mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->GetAlliance()); ! } ! else ! { ! return mpPlatformObj->IsControlled(); ! } } *************** *** 1094,1098 **** { tcGameObject* obj = mpSimState->GetObjectByName(unitName); ! bool isOwnAlliance = mpPlatformObj->mnAlliance == obj->mnAlliance; if ((obj == 0) || !isOwnAlliance) --- 1129,1133 ---- { tcGameObject* obj = mpSimState->GetObjectByName(unitName); ! bool isOwnAlliance = mpPlatformObj->GetAlliance() == obj->GetAlliance(); if ((obj == 0) || !isOwnAlliance) *************** *** 1109,1113 **** { tcGameObject* obj = mpSimState->GetObject(id); ! if ((obj == 0) || !mpSimState->mpUserInfo->IsOwnAlliance(obj->mnAlliance)) { return std::string(""); --- 1144,1148 ---- { tcGameObject* obj = mpSimState->GetObject(id); ! if ((obj == 0) || !mpSimState->mpUserInfo->IsOwnAlliance(obj->GetAlliance())) { return std::string(""); *************** *** 1213,1217 **** { tcGameObject* obj = mpSimState->GetObject(id); ! if ((obj == 0) || !mpSimState->mpUserInfo->IsOwnAlliance(obj->mnAlliance)) { tcTrack data; --- 1248,1252 ---- { tcGameObject* obj = mpSimState->GetObject(id); ! if ((obj == 0) || !mpSimState->mpUserInfo->IsOwnAlliance(obj->GetAlliance())) { tcTrack data; *************** *** 1251,1255 **** GetSensorMap(); isPlatformOwnAlliance = (mpPlatformObj) ? ! (mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->mnAlliance) != 0) : false; } --- 1286,1290 ---- GetSensorMap(); isPlatformOwnAlliance = (mpPlatformObj) ? ! (mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->GetAlliance()) != 0) : false; } *************** *** 1264,1268 **** GetSensorMap(); isPlatformOwnAlliance = (mpPlatformObj) ? ! (mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->mnAlliance) != 0) : false; } --- 1299,1303 ---- GetSensorMap(); isPlatformOwnAlliance = (mpPlatformObj) ? ! (mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->GetAlliance()) != 0) : false; } *************** *** 1287,1293 **** isPlatformOwnAlliance = (mpPlatformObj) ? ! (mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->mnAlliance) != 0) : false; ! mpSensorMap = mpSimState->mcSensorMap.GetMap(mpPlatformObj->mnAlliance); wxASSERT(mpSensorMap); } --- 1322,1328 ---- isPlatformOwnAlliance = (mpPlatformObj) ? ! (mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->GetAlliance()) != 0) : false; ! mpSensorMap = mpSimState->mcSensorMap.GetMap(mpPlatformObj->GetAlliance()); wxASSERT(mpSensorMap); } |
|
From: Dewitt C. <ddc...@us...> - 2005-04-29 18:52:13
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27186/include/scriptinterface Modified Files: tcPlatformInterface.h tcSimPythonInterface.h Log Message: Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** tcPlatformInterface.h 17 Apr 2005 22:34:59 -0000 1.38 --- tcPlatformInterface.h 29 Apr 2005 18:52:02 -0000 1.39 *************** *** 294,297 **** --- 294,304 ---- void SetLandingState(int state); + // multiplayer related + std::string GetController() const; + bool IsAvailable() const; + bool IsMultiplayerActive() const; + void TakeControl(); + + // miscellaneous Index: tcSimPythonInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcSimPythonInterface.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tcSimPythonInterface.h 31 Mar 2005 03:51:12 -0000 1.21 --- tcSimPythonInterface.h 29 Apr 2005 18:52:02 -0000 1.22 *************** *** 67,70 **** --- 67,72 ---- namespace ScriptInterface { + class tcScenarioInterface; + /** * Interface class for creating popup mouse menus. *************** *** 119,122 **** --- 121,125 ---- void CallTaskScript(ScriptedTask* task, const char* azCommand); void GetObjectStringByMode(char *str); // gets name of python object to pass to python function + tcScenarioInterface* GetScenarioInterface() const; void LoadScenario(const char *filePath, const char *fileName); ///< loads scenario from Python script file void ProcessCommand(std::string command, const std::vector<long>& id, *************** *** 165,168 **** --- 168,172 ---- tcFlightPortInterface *flightPortInterface; ///< C++ handle to flightport interface object ScenarioInterface; + tcScenarioInterface* scenarioInterface; ///< C++ handle to scenario interface tcDirector *director; tcSimState *mpSimState; |
|
From: Dewitt C. <ddc...@us...> - 2005-04-29 18:52:12
|
Update of /cvsroot/gcblue/gcb_wx/include/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27186/include/network Modified Files: tcConnectionData.h tcControlMessageHandler.h tcMultiplayerInterface.h tcUpdateMessageHandler.h Log Message: Index: tcUpdateMessageHandler.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcUpdateMessageHandler.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcUpdateMessageHandler.h 8 May 2004 21:25:25 -0000 1.6 --- tcUpdateMessageHandler.h 29 Apr 2005 18:52:02 -0000 1.7 *************** *** 58,66 **** COMMAND_ACK = 4, ///< ack of command-related update DESTROY = 5, ///< destroys game obj ! SENSOR_UPDATE = 6 ///< update of sensor map tracks }; static void AddCommandAck(tcGameObject* obj, tcCommandStream& stream); static void AddCommandUpdate(tcGameObject* obj, tcCommandStream& stream); static void AddCreate(tcGameObject* obj, tcCreateStream& stream); static void AddCreateRequest(long id, tcStream& stream); --- 58,68 ---- COMMAND_ACK = 4, ///< ack of command-related update DESTROY = 5, ///< destroys game obj ! SENSOR_UPDATE = 6, ///< update of sensor map tracks ! CONTROL_REQUEST = 7 ///< request to take control of obj }; static void AddCommandAck(tcGameObject* obj, tcCommandStream& stream); static void AddCommandUpdate(tcGameObject* obj, tcCommandStream& stream); + static void AddControlRequest(long id, tcStream& stream); static void AddCreate(tcGameObject* obj, tcCreateStream& stream); static void AddCreateRequest(long id, tcStream& stream); *************** *** 75,78 **** --- 77,81 ---- void HandleCommandAck(tcCommandStream& stream); ///< command ack void HandleCommandUpdate(tcCommandStream& stream, int connectionId); ///< command update + void HandleControlRequest(tcStream& stream, int connectionId); void HandleCreate(tcCreateStream& stream); void HandleCreateRequest(tcStream& stream, int connectionId); Index: tcMultiplayerInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcMultiplayerInterface.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tcMultiplayerInterface.h 17 Apr 2005 22:34:59 -0000 1.21 --- tcMultiplayerInterface.h 29 Apr 2005 18:52:02 -0000 1.22 *************** *** 34,38 **** #include <string> #include <vector> ! #define BEGIN_NAMESPACE(x) namespace x { --- 34,38 ---- #include <string> #include <vector> ! #include "tcAccountDatabase.h" #define BEGIN_NAMESPACE(x) namespace x { *************** *** 58,64 **** { 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) --- 58,66 ---- { public: ! std::string name; ///< username of player ! std::string nameWithRank; ///< name with rank title bool isAuthenticated; ///< true if password has been verified ! unsigned char alliance; ///< player's alliance ! unsigned char rank; ///< player's rank unsigned int timestamp; ///< time of last network update (30 Hz tics) unsigned int startTime; ///< time connection started (30 Hz tics) *************** *** 67,73 **** --- 69,88 ---- float ping_s; ///< value of last ping std::map<long, unsigned int> lastUpdate; ///< map of (obj id, update time (30Hz tics)) + tcAccountDatabase::UserData data; ///< local copy of account database entry (messy, merge or otherwise fix this) + int connectionId; void EraseEntry(long id); + unsigned char GetAlliance() const; + int GetConnectionId() const; bool GetLastUpdate(long id, unsigned int& updateTime); + const std::string& GetName() const; + const std::string& GetNameWithRank() const; + unsigned char GetRank() const; + bool IsGM() const; + void SetAlliance(unsigned char val); + void SetConnectionId(int id); + void SetName(const std::string& s); + void SetNameWithRank(const std::string& s); + void SetRank(unsigned char val); void SetUpdate(long id, unsigned int updateTime); }; *************** *** 109,117 **** const std::string& GetPassword() const; tcPlayerStatus& GetPlayerStatus(int connectionId); ///< redundant with GetConnectionStatus? void InitMessageHandlers(); bool IsChatTextAvail(); bool IsCommand(const std::string& text); bool IsServer(); ! int LogInPlayer(const std::string& username, int connectionId, wxString& msg); void LogOutAllPlayers(); void MakeClient(); --- 124,134 ---- const std::string& GetPassword() const; tcPlayerStatus& GetPlayerStatus(int connectionId); ///< redundant with GetConnectionStatus? + const std::string& GetPlayerName(int connectionId); void InitMessageHandlers(); bool IsChatTextAvail(); bool IsCommand(const std::string& text); bool IsServer(); ! int LogInPlayer(const std::string& username, int connectionId, ! tcPlayerStatus& playerStatus, wxString& msg); void LogOutAllPlayers(); void MakeClient(); *************** *** 128,133 **** --- 145,152 ---- void SendControlMessageUDP(int destination, int messageCode, int param = 0); void SendControlMessageUDPAck(int destination, int messageCode, int param = 0); + void SendControlRequest(long id); void SendTestUDP(int destination, const std::string& message); void SendUpdateMessage(int destination, tcStream& stream); + void SendUpdateMessageAck(int destination, tcStream& stream); void SetChatProtocol(int code); void SetEvtHandler(wxEvtHandler *eh); *************** *** 150,153 **** --- 169,173 ---- bool tcpChat; ///< true to use TCP for chat protocol, otherwise UDP tcPlayerStatus errorPlayerStatus; ///< status to return if player not found + tcPlayerStatus serverPlayerStatus; ///< status to use for server actions wxEvtHandler* evtHandler; ///< wxWidgets event handler for posting messages to application const unsigned int entityUpdateInterval; ///< 30 Hz tics *************** *** 157,160 **** --- 177,183 ---- void DistributeChatText(); bool IsNewPlayer(int id); + + void ProcessAllianceCommand(tcPlayerStatus& player, const wxString& args); + void ProcessGameMasterCommand(tcPlayerStatus& player, const wxString& args); void ProcessMessage(int messageId, int connectionId, unsigned messageSize, const unsigned char *data); Index: tcControlMessageHandler.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcControlMessageHandler.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcControlMessageHandler.h 16 Apr 2005 20:43:55 -0000 1.7 --- tcControlMessageHandler.h 29 Apr 2005 18:52:02 -0000 1.8 *************** *** 48,52 **** { CM_BEEP = 1, - CM_STARTGAME = 2, CM_TIME = 3, ///< time message also includes time acceleratin/pause state CM_ALLIANCE = 4, --- 48,51 ---- Index: tcConnectionData.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcConnectionData.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcConnectionData.h 17 Apr 2005 22:34:59 -0000 1.9 --- tcConnectionData.h 29 Apr 2005 18:52:02 -0000 1.10 *************** *** 68,71 **** --- 68,72 ---- const wxIPV4address& GetPeerAddress() const; unsigned long GetReadCount() const; + unsigned int GetResentCount() const; wxSocketBase* GetSocket(); unsigned long GetWriteCount() const; *************** *** 99,102 **** --- 100,104 ---- unsigned int lastCountUpdate; unsigned int lastResendUpdate; + unsigned int resentCount; ///< number of packets resent because of ack timeout void AttachAckRider(tcMessage* message); |
|
From: Dewitt C. <ddc...@us...> - 2005-04-29 18:52:12
|
Update of /cvsroot/gcblue/gcb_wx/include/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27186/include/ai Modified Files: Brain.h Log Message: Index: Brain.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/Brain.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Brain.h 2 Mar 2005 22:28:35 -0000 1.6 --- Brain.h 29 Apr 2005 18:52:01 -0000 1.7 *************** *** 35,38 **** --- 35,40 ---- class tcPlatformObject; + class tcStream; + class tcCommandStream; namespace ai *************** *** 75,78 **** --- 77,87 ---- void Update(double t); + + tcCommandStream& operator<<(tcCommandStream& stream); + tcCommandStream& operator>>(tcCommandStream& stream); + void ClearNewCommand(); + bool HasNewCommand() const; + + Brain(tcPlatformObject* platform_); ~Brain(); *************** *** 84,87 **** --- 93,97 ---- long target; ///< id of target (may be more general way to handle this) bool updating; ///< true if in the middle of Update + bool hasNewCommand; ///< for multiplayer, true if task or bb state has been changed Blackboard board; ///< for inter-task communication |
|
From: Dewitt C. <ddc...@us...> - 2005-04-29 18:52:12
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27186/include/common Modified Files: tcStream.h Log Message: Index: tcStream.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcStream.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcStream.h 16 Apr 2005 20:43:55 -0000 1.8 --- tcStream.h 29 Apr 2005 18:52:01 -0000 1.9 *************** *** 54,57 **** --- 54,58 ---- tcStream& operator<<(short& val); tcStream& operator<<(bool& val); + tcStream& operator<<(char& val); tcStream& operator<<(unsigned char& val); tcStream& operator<<(unsigned short& val); *************** *** 67,70 **** --- 68,72 ---- tcStream& operator>>(short& val); tcStream& operator>>(bool& val); + tcStream& operator>>(char& val); tcStream& operator>>(unsigned char& val); tcStream& operator>>(unsigned short& val); |
|
From: Dewitt C. <ddc...@us...> - 2005-04-29 18:52:12
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27186/include/graphics Modified Files: tcChatBox.h tcConsoleBox.h Log Message: Index: tcConsoleBox.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcConsoleBox.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcConsoleBox.h 2 Mar 2005 22:28:37 -0000 1.7 --- tcConsoleBox.h 29 Apr 2005 18:52:01 -0000 1.8 *************** *** 47,51 **** { REMOVE_LINES = 64, ! MAX_LINES = 256 }; wxArrayString textArray; --- 47,53 ---- { REMOVE_LINES = 64, ! MAX_LINES = 256, ! MIN_LINES_DISPLAY = 8, ///< in offset mode, show at least this many lines ! SCROLL_LINES = 4 ///< number of lines to scroll up/down }; wxArrayString textArray; *************** *** 62,73 **** --- 64,79 ---- int Print(const char* line); + void ScrollBuffer(int delta); void Clear(); virtual void Draw(); void ForceRedraw() {forceRedraw = true;} + unsigned int GetLineOffset() const; bool IsCurrentLineEmpty(); + virtual void OnKeyDown(wxKeyEvent& event); virtual void OnSize(wxSizeEvent& event); bool Redraw() const {return redraw != 0;} ///< @return true if console will be updated void SetDelayedTextEffect(bool effectOn) {useDelayedTextEffect = effectOn;} + void SetLineOffset(unsigned int offset); void SetLineSpacing(int anSpacing) {nlinespace = anSpacing;} void SetWrap(int n) {nwrapcol = n;} *************** *** 83,86 **** --- 89,93 ---- bool isFocused; bool drawBorder; + unsigned int lineOffset; ///< for reviewing buffer history float fontSize; osg::Vec4 fontColor; Index: tcChatBox.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcChatBox.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcChatBox.h 2 Oct 2004 22:41:32 -0000 1.1 --- tcChatBox.h 29 Apr 2005 18:52:01 -0000 1.2 *************** *** 44,47 **** --- 44,49 ---- void Draw(); void OnLButtonDown(wxMouseEvent& event); + void OnChar(wxKeyEvent& event); + void OnKeyDown(wxKeyEvent& event); void SendChatText(wxCommandEvent& event); |
|
From: Dewitt C. <ddc...@us...> - 2005-04-29 18:52:12
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27186/include/sim Modified Files: Game.h tcAirfieldObject.h tcCarrierObject.h tcFlightOpsObject.h tcFlightPort.h tcGameObject.h tcPlatformObject.h tcSimState.h tcUserInfo.h Log Message: Index: tcUserInfo.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcUserInfo.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcUserInfo.h 23 Nov 2004 23:30:50 -0000 1.6 --- tcUserInfo.h 29 Apr 2005 18:52:02 -0000 1.7 *************** *** 29,49 **** #include "wx/wx.h" ! #ifdef WIN32 ! #include "wx/msw/private.h" // for MS Windows specific definitions ! #endif /** ! * */ class tcUserInfo { public: ! UINT8 mnOwnAlliance; ! int IsOwnAlliance(UINT anAlliance) const; - UINT8 GetOwnAlliance() const; - void SetOwnAlliance(UINT alliance) {mnOwnAlliance = alliance;} tcUserInfo(); ! virtual ~tcUserInfo(); }; --- 29,72 ---- #include "wx/wx.h" ! ! #include <string> /** ! * Singleton class with info on single-player player or multiplayer client ! * player. */ class tcUserInfo { public: ! enum ! { ! RANK_GM = 8 ! }; ! unsigned char mnOwnAlliance; ! ! ! bool IsOwnAlliance(unsigned char anAlliance) const; ! unsigned char GetOwnAlliance() const; ! void SetOwnAlliance(unsigned char alliance); ! ! const std::string& GetUsername() const; ! void SetUsername(const std::string& s); ! ! float GetScore() const; ! void SetScore(float x); ! ! ! unsigned char GetRank() const; ! const std::string RankToString(unsigned char rank); ! unsigned char ScoreToRank(float score); ! ! static tcUserInfo* Get(); ///< singleton accessor ! private: ! std::string username; ///< (client) username of player for multiplayer ! float score; ///< (client) score for user for info only, true score is maintained by server ! unsigned char rank; tcUserInfo(); ! ~tcUserInfo(); }; Index: tcGameObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGameObject.h,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** tcGameObject.h 17 Apr 2005 22:35:00 -0000 1.36 --- tcGameObject.h 29 Apr 2005 18:52:02 -0000 1.37 *************** *** 35,38 **** --- 35,39 ---- #include "tcSensorState.h" #include "tcLauncherState.h" + #include "tcControllableObject.h" namespace osg *************** *** 90,94 **** * Base class for all game objects. */ ! class tcGameObject { public: --- 91,95 ---- * Base class for all game objects. */ ! class tcGameObject : public tcControllableObject { public: *************** *** 103,107 **** tnPoolIndex mnDBKey; ///< key of database entry tcDBString mzUnit; ///< specific name of class instance ! UINT8 mnAlliance; /** derived objects can have different DB obj type in their scope --- 104,108 ---- tnPoolIndex mnDBKey; ///< key of database entry tcDBString mzUnit; ///< specific name of class instance ! /** derived objects can have different DB obj type in their scope *************** *** 114,117 **** --- 115,120 ---- virtual void ApplyDamage(float damage); ///< called when new damage occurs + virtual void ApplyRepairs(float repair); ///< called when repairs occur (damage removed) + float RangeTo(tcGameObject& p) const; float BearingTo(tcGameObject& p) const; *************** *** 139,142 **** --- 142,148 ---- virtual bool HasNewCommand() const; + bool GetRecreate() const; + void SetRecreate(bool state); + virtual bool IsDestroyed(); *************** *** 177,180 **** --- 183,187 ---- virtual ~tcGameObject(); protected: + bool recreateFlag; ///< workaround, true to resend create request for obj (multiplayer client only) static tcMapData *mapData; static Database::tcDatabase *database; Index: tcFlightOpsObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcFlightOpsObject.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcFlightOpsObject.h 6 Apr 2005 02:19:48 -0000 1.4 --- tcFlightOpsObject.h 29 Apr 2005 18:52:02 -0000 1.5 *************** *** 60,65 **** ! virtual bool AddChildToFlightDeck(std::string className, std::string unitName, teLocation loc); ! virtual bool AddChildToFlightDeck(tcDatabaseObject* databaseObject, std::string unitName, teLocation loc); virtual int CheckLanding(tcGameObject* obj); virtual void Clear(); --- 60,67 ---- ! virtual tcGameObject* AddChildToFlightDeck(std::string className, std::string unitName, ! teLocation loc, unsigned int position); ! virtual tcGameObject* AddChildToFlightDeck(tcDatabaseObject* databaseObject, std::string unitName, ! teLocation loc, unsigned int position); virtual int CheckLanding(tcGameObject* obj); virtual void Clear(); *************** *** 81,84 **** --- 83,89 ---- virtual tcUpdateStream& operator>>(tcUpdateStream& stream); + virtual void ClearNewCommand(); + virtual bool HasNewCommand() const; + tcFlightOpsObject(tcFlightportDBObject* dbObject, tcGameObject* gameObject); virtual ~tcFlightOpsObject(); Index: tcFlightPort.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcFlightPort.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcFlightPort.h 6 Apr 2005 02:19:48 -0000 1.9 --- tcFlightPort.h 29 Apr 2005 18:52:02 -0000 1.10 *************** *** 27,30 **** --- 27,35 ---- #include "tcGameObject.h" + class tcStream; + class tcCommandStream; + class tcCreateStream; + class tcUpdateStream; + namespace Database { *************** *** 45,54 **** enum teOperation { ! OP_NONE, ! OP_TRANSIT, ! OP_UNLOAD, ! OP_LOAD, ///< or refuel ! OP_REPAIR, ! OP_CHECK }; --- 50,59 ---- enum teOperation { ! OP_NONE = 0, ! OP_TRANSIT = 1, ! OP_UNLOAD = 2, ! OP_LOAD = 3, ///< or refuel ! OP_REPAIR = 4, ! OP_CHECK = 5 }; *************** *** 60,73 **** { public: ! teLocation current_location; ! int current_spot; ! teLocation goal_location; ! int goal_spot; // destination within deck1, deck2, or launch ! teOperation op; ! double ready_time; // time for op to be completed ! tcGameObject *obj; ! std::string LocationToString(teLocation loc); ! std::string OperationToString(teOperation op); }; --- 65,81 ---- { public: ! teLocation current_location; ! int current_spot; ! teLocation goal_location; ! int goal_spot; // destination within deck1, deck2, or launch ! teOperation op; ! double ready_time; // time for op to be completed ! tcGameObject *obj; ! tcUpdateStream& operator<<(tcUpdateStream& stream); ! tcUpdateStream& operator>>(tcUpdateStream& stream); ! ! std::string LocationToString(teLocation loc); ! std::string OperationToString(teOperation op); }; *************** *** 75,83 **** * for occupying unit. obj_info is NULL if the spot is empty. */ ! struct tsSpotInfo { tcAirState *obj_info; ///< air state info for object occupying or in transit to spot, NULL if empty float x,y,z; ///< surface assumed flat in between spots [m] float orientation; ///< orientation for runway, 0 along -z axis (heading axis for ships) float length; ///< [m] }; --- 83,94 ---- * for occupying unit. obj_info is NULL if the spot is empty. */ ! struct tsSpotInfo ! { tcAirState *obj_info; ///< air state info for object occupying or in transit to spot, NULL if empty float x,y,z; ///< surface assumed flat in between spots [m] float orientation; ///< orientation for runway, 0 along -z axis (heading axis for ships) float length; ///< [m] + + bool IsEmpty() const {return obj_info == 0;} }; *************** *** 95,99 **** double last_update_time; ! int AddObject(tcGameObject *obj, teLocation loc); void AddSpot(teLocation loc, float x, float y, float z, float orientation = 0, float length = 0); int CheckLanding(tcGameObject *obj); --- 106,110 ---- double last_update_time; ! int AddObject(tcGameObject *obj, teLocation loc, unsigned int position); void AddSpot(teLocation loc, float x, float y, float z, float orientation = 0, float length = 0); int CheckLanding(tcGameObject *obj); *************** *** 126,131 **** void UpdateUnitKin(tcAirState *airstate); // update unit kinematics based on parent info and rel_pos tcFlightPort(); ! virtual ~tcFlightPort(); private: /* tcAirState objects for all units in flightport are stored in --- 137,153 ---- void UpdateUnitKin(tcAirState *airstate); // update unit kinematics based on parent info and rel_pos + tcCommandStream& operator<<(tcCommandStream& stream); + tcCreateStream& operator<<(tcCreateStream& stream); + tcUpdateStream& operator<<(tcUpdateStream& stream); + + tcCommandStream& operator>>(tcCommandStream& stream); + tcCreateStream& operator>>(tcCreateStream& stream); + tcUpdateStream& operator>>(tcUpdateStream& stream); + + void ClearNewCommand(); + bool HasNewCommand() const; + tcFlightPort(); ! ~tcFlightPort(); private: /* tcAirState objects for all units in flightport are stored in *************** *** 137,140 **** --- 159,171 ---- unsigned hangarCapacity; unsigned inHangarCount; // count of units in hangar or in transit to hangar + short int localId; ///< used to assign object id within flightport + + // data for multiplayer commands + struct CommandInfo + { + short int id; ///< id of unit that command applies to + unsigned char op; ///< 0, launch unit, 1-3 move unit + }; + std::vector<CommandInfo> commandList; }; Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** tcSimState.h 29 Mar 2005 00:12:24 -0000 1.37 --- tcSimState.h 29 Apr 2005 18:52:02 -0000 1.38 *************** *** 177,180 **** --- 177,183 ---- void SetMultiplayerClient(); void SetMultiplayerServer(); + bool IsMultiplayerActive() const; + bool IsMultiplayerClient() const; + void SetScenarioDescription(std::string s); void SetScenarioLoaded(bool state); Index: tcAirfieldObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcAirfieldObject.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcAirfieldObject.h 17 Aug 2004 02:22:56 -0000 1.2 --- tcAirfieldObject.h 29 Apr 2005 18:52:02 -0000 1.3 *************** *** 31,34 **** --- 31,39 ---- #include "tcFlightOpsObject.h" + class tcStream; + class tcCommandStream; + class tcCreateStream; + class tcUpdateStream; + /** * Models an airfield *************** *** 39,42 **** --- 44,49 ---- { public: + virtual void ApplyDamage(float damage); + virtual void Clear(); virtual void RandInitNear(float afLon_deg, float afLat_deg); *************** *** 48,51 **** --- 55,71 ---- virtual void Update(double afStatusTime); + virtual tcCommandStream& operator<<(tcCommandStream& stream); + virtual tcCreateStream& operator<<(tcCreateStream& stream); + virtual tcUpdateStream& operator<<(tcUpdateStream& stream); + + virtual tcCommandStream& operator>>(tcCommandStream& stream); + virtual tcCreateStream& operator>>(tcCreateStream& stream); + virtual tcUpdateStream& operator>>(tcUpdateStream& stream); + + virtual void ClearNewCommand(); + virtual bool HasNewCommand() const; + + + tcAirfieldObject(); tcAirfieldObject(tcAirfieldObject&); Index: tcPlatformObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPlatformObject.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** tcPlatformObject.h 17 Apr 2005 22:35:00 -0000 1.26 --- tcPlatformObject.h 29 Apr 2005 18:52:02 -0000 1.27 *************** *** 76,80 **** UPDATE_GUIDANCE = 0x01, UPDATE_LAUNCHERS = 0x02, ! UPDATE_SENSORS = 0x04 }; --- 76,81 ---- UPDATE_GUIDANCE = 0x01, UPDATE_LAUNCHERS = 0x02, ! UPDATE_SENSORS = 0x04, ! UPDATE_TASKS = 0x08 }; *************** *** 94,97 **** --- 95,99 ---- virtual void ApplyDamage(float damage); + virtual void ApplyRepairs(float repair); ///< called when repairs occur (damage removed) virtual void Clear(); virtual void DesignateDatum(tcPoint p); Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** Game.h 20 Feb 2005 21:54:32 -0000 1.54 --- Game.h 29 Apr 2005 18:52:02 -0000 1.55 *************** *** 167,171 **** tcCommandQueue* commandQueue; tcSimPythonInterface* pythonInterface; ! tcUserInfo mcUserInfo; tcGameView mcGameView; tcGoalTracker* goalTracker; ///< monitors simstate vs. victory goals --- 167,171 ---- tcCommandQueue* commandQueue; tcSimPythonInterface* pythonInterface; ! tcUserInfo* userInfo; tcGameView mcGameView; tcGoalTracker* goalTracker; ///< monitors simstate vs. victory goals Index: tcCarrierObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcCarrierObject.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcCarrierObject.h 6 Apr 2005 02:19:48 -0000 1.11 --- tcCarrierObject.h 29 Apr 2005 18:52:02 -0000 1.12 *************** *** 45,48 **** --- 45,50 ---- { public: + virtual void ApplyDamage(float damage); + virtual void Clear(); virtual void RandInitNear(float afLon_deg, float afLat_deg); *************** *** 62,65 **** --- 64,70 ---- virtual tcUpdateStream& operator>>(tcUpdateStream& stream); + virtual void ClearNewCommand(); + virtual bool HasNewCommand() const; + tcCarrierObject(); tcCarrierObject(tcCarrierObject&); |
|
From: Dewitt C. <ddc...@us...> - 2005-04-17 22:35:41
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14954/src/sim Modified Files: tcAeroAirObject.cpp tcAirObject.cpp tcCommandObject.cpp tcGameObject.cpp tcLauncherState.cpp tcPlatformObject.cpp tcSensorPlatform.cpp tcSubObject.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: tcSubObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSubObject.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcSubObject.cpp 10 Mar 2005 03:28:29 -0000 1.6 --- tcSubObject.cpp 17 Apr 2005 22:35:32 -0000 1.7 *************** *** 97,108 **** } - /** - * - */ - bool tcSubObject::HasUnacknowledgedCommand() const - { - return tcPlatformObject::HasUnacknowledgedCommand() || - commandObj.HasUnacknowledgedCommand(); - } bool tcSubObject::IsDestroyed() --- 97,100 ---- Index: tcAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirObject.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcAirObject.cpp 10 Mar 2005 03:28:29 -0000 1.19 --- tcAirObject.cpp 17 Apr 2005 22:35:32 -0000 1.20 *************** *** 89,97 **** } - bool tcAirObject::HasUnacknowledgedCommand() const - { - return tcPlatformObject::HasUnacknowledgedCommand() || - commandObj.HasUnacknowledgedCommand(); - } --- 89,92 ---- Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tcLauncherState.cpp 16 Apr 2005 20:44:43 -0000 1.28 --- tcLauncherState.cpp 17 Apr 2005 22:35:32 -0000 1.29 *************** *** 526,537 **** /** - * @return true if at least one launcher has an unacknowledged cmd outstanding - */ - bool tcLauncherState::HasUnacknowledgedCommand() const - { - return (commandObj.HasUnacknowledgedCommand()); - } - - /** * */ --- 526,529 ---- Index: tcSensorPlatform.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorPlatform.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcSensorPlatform.cpp 16 Apr 2005 20:44:43 -0000 1.2 --- tcSensorPlatform.cpp 17 Apr 2005 22:35:32 -0000 1.3 *************** *** 321,328 **** } - bool tcSensorPlatform::HasUnacknowledgedCommand() const - { - return sensorCommandObj.HasUnacknowledgedCommand(); - } /** --- 321,324 ---- Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** tcPlatformObject.cpp 29 Mar 2005 00:12:29 -0000 1.40 --- tcPlatformObject.cpp 17 Apr 2005 22:35:32 -0000 1.41 *************** *** 656,668 **** unsigned char updateMask = 0; updateMask = UPDATE_GUIDANCE; // always update guidance for now ! if (stream.isAck || mcLauncherState.HasUnacknowledgedCommand()) { updateMask |= UPDATE_LAUNCHERS; } ! if (stream.isAck || tcSensorPlatform::HasUnacknowledgedCommand()) { updateMask |= UPDATE_SENSORS; } stream << updateMask; --- 656,671 ---- unsigned char updateMask = 0; updateMask = UPDATE_GUIDANCE; // always update guidance for now ! ! if (mcLauncherState.HasNewCommand()) { updateMask |= UPDATE_LAUNCHERS; } ! if (tcSensorPlatform::HasNewCommand()) { updateMask |= UPDATE_SENSORS; } + if (stream.GetDetailLevel() == tcStream::WRITE_ALL) updateMask = 0xFF; + stream << updateMask; *************** *** 761,772 **** } - bool tcPlatformObject::HasUnacknowledgedCommand() const - { - return commandObj.HasUnacknowledgedCommand() || mcLauncherState.HasNewCommand() || - tcSensorPlatform::HasUnacknowledgedCommand(); - } - - - --- 764,767 ---- Index: tcAeroAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAeroAirObject.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcAeroAirObject.cpp 29 Mar 2005 00:12:28 -0000 1.12 --- tcAeroAirObject.cpp 17 Apr 2005 22:35:32 -0000 1.13 *************** *** 32,35 **** --- 32,37 ---- #include "tc3DModel.h" #include "tcParticleEffect.h" + #include "common/tcStream.h" + #include "common/tcObjStream.h" #ifdef _DEBUG *************** *** 40,43 **** --- 42,79 ---- + tcCommandStream& tcAeroAirObject::operator<<(tcCommandStream& stream) + { + tcAirObject::operator<<(stream); + + commandObj.LoadCommandParam(stream, throttleFraction, THROTTLE_CMD); + + return stream; + } + + tcCommandStream& tcAeroAirObject::operator>>(tcCommandStream& stream) + { + tcAirObject::operator>>(stream); + + stream << throttleFraction; + + return stream; + } + + + + + void tcAeroAirObject::ClearNewCommand() + { + tcAirObject::ClearNewCommand(); + commandObj.ClearNewCommand(); + } + + bool tcAeroAirObject::HasNewCommand() const + { + return tcAirObject::HasNewCommand() || commandObj.HasNewCommand(); + } + + + void tcAeroAirObject::Clear() { *************** *** 90,93 **** --- 126,136 ---- } + + void tcAeroAirObject::SetThrottleFraction(float fract) + { + throttleFraction = fract; + commandObj.SetNewCommand(THROTTLE_CMD); + } + void tcAeroAirObject::ApplyRestrictions() { Index: tcGameObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameObject.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tcGameObject.cpp 29 Mar 2005 00:12:28 -0000 1.33 --- tcGameObject.cpp 17 Apr 2005 22:35:32 -0000 1.34 *************** *** 473,481 **** } - bool tcGameObject::HasUnacknowledgedCommand() const - { - return false; - } - /** --- 473,476 ---- Index: tcCommandObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCommandObject.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcCommandObject.cpp 2 Nov 2004 04:23:56 -0000 1.2 --- tcCommandObject.cpp 17 Apr 2005 22:35:32 -0000 1.3 *************** *** 42,55 **** void tcCommandObject::ClearNewCommand() { ! newCommand = false; } bool tcCommandObject::HasNewCommand() const { - return newCommand; - } - - bool tcCommandObject::HasUnacknowledgedCommand() const - { return (commandStatus != 0); } --- 42,50 ---- void tcCommandObject::ClearNewCommand() { ! commandStatus = 0; } bool tcCommandObject::HasNewCommand() const { return (commandStatus != 0); } *************** *** 57,60 **** --- 52,56 ---- + /** * Used with multiplayer client to load a parameter from the server that *************** *** 69,72 **** --- 65,72 ---- stream >> temp; // read into temporary variable + param = temp; // apply update + + /* + if (stream.GetAck()) { *************** *** 89,92 **** --- 89,93 ---- } + */ } *************** *** 99,102 **** --- 100,106 ---- stream >> temp; // read into temporary variable + param = temp; + + /* if (stream.GetAck()) { *************** *** 119,122 **** --- 123,127 ---- } + */ } *************** *** 129,132 **** --- 134,141 ---- temp << stream; // read into temporary obj + param.CopyCommandInfoFrom(temp); // apply update + + /* + if (stream.GetAck()) { *************** *** 149,152 **** --- 158,162 ---- } + */ } *************** *** 159,169 **** { commandStatus |= flag; - newCommand = true; } tcCommandObject::tcCommandObject() ! : commandStatus(0), ! newCommand(0) { } --- 169,177 ---- { commandStatus |= flag; } tcCommandObject::tcCommandObject() ! : commandStatus(0) { } |