gcblue-commits Mailing List for Global Conflict Blue (Page 54)
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...> - 2004-05-08 22:20:38
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28993/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.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcStream.cpp 1 May 2004 21:49:06 -0000 1.4 --- tcStream.cpp 8 May 2004 22:20:28 -0000 1.5 *************** *** 75,78 **** --- 75,86 ---- } + /** + * Skips over count bytes from current stream position + */ + void tcStream::skip(unsigned char count) + { + std::stringstream::seekp(count, ios_base::cur); + } + void tcStream::write(const char* buff, std::streamsize count) { *************** *** 163,166 **** --- 171,182 ---- } + tcStream& tcStream::operator<<(tcStream& stream) + { + size_t len = stream.size(); + write(stream.str().c_str(), (std::streamsize)len); + + return *this; + } + /*** read operators ***/ *************** *** 240,241 **** --- 256,265 ---- return *this; } + + tcStream& tcStream::operator>>(tcStream& stream) + { + size_t len = size(); + stream.write(str().c_str(), (std::streamsize)len); + + return *this; + } |
|
From: Dewitt C. <ddc...@us...> - 2004-05-08 22:20:38
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28993/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.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcStream.h 1 May 2004 21:49:23 -0000 1.4 --- tcStream.h 8 May 2004 22:20:27 -0000 1.5 *************** *** 42,45 **** --- 42,46 ---- void read(char* buff, std::streamsize count); size_t size(); + void skip(unsigned char count); void write(const char* buff, std::streamsize count); *************** *** 58,61 **** --- 59,63 ---- tcStream& operator<<(double& val); tcStream& operator<<(std::string& val); + tcStream& operator<<(tcStream& stream); /// read operators *************** *** 70,73 **** --- 72,76 ---- tcStream& operator>>(double& val); tcStream& operator>>(std::string& val); + tcStream& operator>>(tcStream& stream); tcStream(const char* data, std::streamsize count); ///< creates stream from char array |
|
From: Dewitt C. <ddc...@us...> - 2004-05-08 21:25:36
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19946/src/sim Modified Files: Game.cpp tcNetworkView.cpp tcSensorMap.cpp tcSimState.cpp Log Message: Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** tcSimState.cpp 27 Apr 2004 01:24:25 -0000 1.41 --- tcSimState.cpp 8 May 2004 21:25:26 -0000 1.42 *************** *** 282,291 **** // needs to be re-written to use the toLaunch queue ! for (int i=0;i<nSize;i++) { maPlatformState.GetNextAssoc(cmappos,nKey,pplat); pplat->Update(mfSimTime); { tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*>(pplat); ! if (pPlatformObj != NULL) { // TODO: investigate possible problem here with off menu click ??? pplat->Launch(nNewKey,nLauncher); --- 282,293 ---- // needs to be re-written to use the toLaunch queue ! for (int i=0;i<nSize;i++) ! { maPlatformState.GetNextAssoc(cmappos,nKey,pplat); pplat->Update(mfSimTime); { tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*>(pplat); ! if (pPlatformObj != NULL) ! { // TODO: investigate possible problem here with off menu click ??? pplat->Launch(nNewKey,nLauncher); *************** *** 302,315 **** } UpdateLaunch(); if (multiplayerMode != MM_CLIENT) { - mcSensorMap.Update(mfSimTime); - UpdateSensors(); UpdateObjFormations(mfSimTime); UpdateObjEngagements(mfSimTime); // FC engagement list and auto launch } ! if ((mfSimTime-mfLastTileAgeOut) > 25.4f) { mfLastTileAgeOut = mfSimTime; mpMapData->AgeOutTiles(mfSimTime); --- 304,317 ---- } UpdateLaunch(); + mcSensorMap.Update(mfSimTime); if (multiplayerMode != MM_CLIENT) { UpdateObjFormations(mfSimTime); UpdateObjEngagements(mfSimTime); // FC engagement list and auto launch } ! if ((mfSimTime-mfLastTileAgeOut) > 25.4f) ! { mfLastTileAgeOut = mfSimTime; mpMapData->AgeOutTiles(mfSimTime); *************** *** 667,733 **** } } - /********************************************************************/ - #define MAX_UPDATESENSORS 16 - void tcSimState::UpdateSensors() - { - /* - tcGameObject *pplat; - tcSensorState *pSensorState; - std::vector<tcSensorState*> *pSS; - int nSensors; - tnPoolIndex cmappos = maPlatformState.GetStartPosition(); - tnPoolIndex nSize = maPlatformState.GetCount(); - mnSensorPlatformCount = GetAllSensorPlatforms(maSensorPlatforms,1024); - for(int i=0;i<mnSensorPlatformCount;i++) { - maPlatformState.Lookup(maSensorPlatforms[i],pplat); - if (tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*>(pplat)) { - pSS = pPlatformObj->GetSensorStateArray(); - nSensors = (int)pSS->size(); - for (int k=0;k<nSensors;k++) { - pSensorState = pSS->at(k); - if((pSensorState!=NULL)&&(pSensorState->UpdateScan(mfSimTime))) { - switch (pSensorState->mnMode) - { - case SSMODE_FC: - case SSMODE_FCSURVEILLANCE: - { - tcRadar *pRadarSS = dynamic_cast<tcRadar*>(pSensorState); - if (pRadarSS) { - UpdateFireControl(pplat,pRadarSS); - } - } - case SSMODE_SURVEILLANCE: - if ((dynamic_cast<tcESMSensor*>(pSensorState)&& - (mpUserInfo->IsOwnAlliance(pplat->mnAlliance)))) { - int i = 3; - } - UpdateSurveillance(pplat,pSensorState); - break; - default: - if (dynamic_cast<tcESMSensor*>(pSensorState)) { - int i = 3; - } - break; - } // switch - } // if (pSensorState!=NULL)&&(pSensorState->UpdateScan(mfSimTime))) { - } //for(int k - } - else if (tcMissileObject *pMissileObj = dynamic_cast<tcMissileObject*>(pplat)) { - tcRadar *pRadarSS = pMissileObj->GetSensorState(); - if((pRadarSS!=NULL)&&(pRadarSS->UpdateScan(mfSimTime))) { - switch (pRadarSS->mnMode) { - case SSMODE_SEEKERACQUIRE: // fall through - case SSMODE_SEEKERTRACK: // fall through - case SSMODE_SEEKERSEARCH: - UpdateSeeker(pplat,pRadarSS);break; - default:break; - } // switch - } // - } // else if - - } // for(int i - */ - } /********************************************************************/ --- 669,673 ---- *************** *** 1649,1652 **** --- 1589,1601 ---- return 1; } + + /** + * @return pointer to sensor map + */ + tcSensorMap* tcSimState::GetSensorMap() + { + return &mcSensorMap; + } + /********************************************************************/ void tcSimState::GetDescription(long anKey, tcString& s) Index: tcNetworkView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcNetworkView.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcNetworkView.cpp 9 Apr 2004 03:08:09 -0000 1.11 --- tcNetworkView.cpp 8 May 2004 21:25:26 -0000 1.12 *************** *** 36,39 **** --- 36,40 ---- #include "wxcommands.h" #include "tcSimState.h" + #include "common/tcOptions.h" using namespace Gdiplus; *************** *** 171,174 **** --- 172,176 ---- { ipText = event.GetString().c_str(); + tcOptions::Get()->SetOptionString("HostAddress", ipText.c_str()); } *************** *** 258,262 **** ipEdit->SetCommand(1); ipEdit->SetClearOnReturn(false); ! ipEdit->SetBuffer(""); // read status box parameters --- 260,272 ---- ipEdit->SetCommand(1); ipEdit->SetClearOnReturn(false); ! ! if (!tcOptions::Get()->OptionStringExists("HostAddress")) ! { ! tcOptions::Get()->SetOptionString("HostAddress", "192.168.0.100"); ! } ! ipEdit->SetBuffer(tcOptions::Get()->GetOptionString("HostAddress")); ! ipText = tcOptions::Get()->GetOptionString("HostAddress"); ! ! // read status box parameters Index: tcSensorMap.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorMap.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcSensorMap.cpp 16 Feb 2004 01:06:23 -0000 1.7 --- tcSensorMap.cpp 8 May 2004 21:25:26 -0000 1.8 *************** *** 27,30 **** --- 27,31 ---- #include "tcSimState.h" #include "tcWeaponObject.h" + #include "common/tcObjStream.h" using namespace Sensor; *************** *** 35,38 **** --- 36,84 ---- /** + * Loads state from update stream + */ + tcUpdateStream& tcSensorMapTrack::operator<<(tcUpdateStream& stream) + { + tcTrack::operator<<(stream); + + stream >> mnContributors; + for (int n = 0; n < mnContributors; n++) + { + stream >> maSensorReport[n].mfTimestamp; + } + + return stream; + } + + /** + * Saves state to update stream + */ + tcUpdateStream& tcSensorMapTrack::operator>>(tcUpdateStream& stream) + { + tcTrack::operator>>(stream); + + stream << mnContributors; + for (int n = 0; n < mnContributors; n++) + { + stream << maSensorReport[n].mfTimestamp; + } + + /* + double mfLastUpdateTime; + 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; + } + + /** * @return false if id already in engaged vector */ *************** *** 396,399 **** --- 442,509 ---- /******************************* tcAllianceSensorMap ****************************/ + + /** + * Loads state from update stream. + */ + tcUpdateStream& tcAllianceSensorMap::operator<<(tcUpdateStream& stream) + { + long nTrackID; + + while ((stream >> nTrackID).eof() == false) + { + long nIdx = maTrackToSensorTrack[nTrackID]; + if (nIdx == NULL_INDEX) + { + tcSensorMapTrack *psmtrack = new tcSensorMapTrack(); + long nKey; + maTrack.AddElement(psmtrack, nKey); + maTrackToSensorTrack[nTrackID] = nKey; + (*psmtrack) << stream; + } + else + { + tcSensorMapTrack *psmtrack; + if (maTrack.Lookup(nIdx, psmtrack) == false) + { + fprintf(stderr, "tcAllianceSensorMap::operator<< -- " + "sensor map index corrupt\n"); + return stream; + } + (*psmtrack) << stream; + } + + } + + return stream; + } + + /** + * Saves state to update stream + * Iterates through tracks, saving tracks that have been recently + * updated to stream. + */ + tcUpdateStream& tcAllianceSensorMap::operator>>(tcUpdateStream& stream) + { + long pos = maTrack.GetStartPosition(); + long nSize = maTrack.GetCount(); + tcSensorMapTrack* sensorMapTrack; + + for (long i=0; i<nSize; i++) + { + long key; + maTrack.GetNextAssoc(pos, key, sensorMapTrack); + double dt = mfPreviousStatusTime - sensorMapTrack->mfTimestamp; + if (dt < 1.0) + { + stream << sensorMapTrack->mnID; + *sensorMapTrack >> stream; + } + } + + return stream; + } + + + bool tcAllianceSensorMap::AddReport(const Sensor::tcSensorReport& report) { *************** *** 427,447 **** { tnPoolIndex nIdx = maTrackToSensorTrack[anTrackID]; ! if (nIdx == NULL_INDEX) { tcSensorMapTrack *psmtrack = new tcSensorMapTrack(); tnPoolIndex nKey; maTrack.AddElement(psmtrack, nKey); maTrackToSensorTrack[anTrackID] = nKey; ! if (psmtrack->UpdateActiveReport(rpReport, anSensorID)) { //psmtrack->UpdateTrack(); rpSMTrack = psmtrack; return true; } ! else { throw "UpdateActiveReport error"; } } ! else { tcSensorMapTrack *psmtrack; ! if (maTrack.Lookup(nIdx, psmtrack) == false) { throw "sensor map index corrupt"; } --- 537,562 ---- { tnPoolIndex nIdx = maTrackToSensorTrack[anTrackID]; ! if (nIdx == NULL_INDEX) ! { tcSensorMapTrack *psmtrack = new tcSensorMapTrack(); tnPoolIndex nKey; maTrack.AddElement(psmtrack, nKey); maTrackToSensorTrack[anTrackID] = nKey; ! if (psmtrack->UpdateActiveReport(rpReport, anSensorID)) ! { //psmtrack->UpdateTrack(); rpSMTrack = psmtrack; return true; } ! else ! { throw "UpdateActiveReport error"; } } ! else ! { tcSensorMapTrack *psmtrack; ! if (maTrack.Lookup(nIdx, psmtrack) == false) ! { throw "sensor map index corrupt"; } *************** *** 458,478 **** { tnPoolIndex nIdx = maTrackToSensorTrack[anTrackID]; ! if (nIdx == NULL_INDEX) { tcSensorMapTrack *psmtrack = new tcSensorMapTrack(); tnPoolIndex nKey; maTrack.AddElement(psmtrack, nKey); maTrackToSensorTrack[anTrackID] = nKey; ! if (psmtrack->UpdatePassiveReport(rpReport, anSensorID)) { //psmtrack->UpdateTrack(); rpSMTrack = psmtrack; return true; } ! else { throw "UpdatePassiveReport error"; } } ! else { tcSensorMapTrack *psmtrack; ! if (maTrack.Lookup(nIdx, psmtrack) == false) { throw "sensor map index corrupt"; } --- 573,598 ---- { tnPoolIndex nIdx = maTrackToSensorTrack[anTrackID]; ! if (nIdx == NULL_INDEX) ! { tcSensorMapTrack *psmtrack = new tcSensorMapTrack(); tnPoolIndex nKey; maTrack.AddElement(psmtrack, nKey); maTrackToSensorTrack[anTrackID] = nKey; ! if (psmtrack->UpdatePassiveReport(rpReport, anSensorID)) ! { //psmtrack->UpdateTrack(); rpSMTrack = psmtrack; return true; } ! else ! { throw "UpdatePassiveReport error"; } } ! else ! { tcSensorMapTrack *psmtrack; ! if (maTrack.Lookup(nIdx, psmtrack) == false) ! { throw "sensor map index corrupt"; } *************** *** 484,492 **** ! int tcAllianceSensorMap::GetTrackCount(void) { return maTrack.GetCount(); } ! tnPoolIndex tcAllianceSensorMap::GetStartTrackPosition(void) { return maTrack.GetStartPosition(); } --- 604,614 ---- ! int tcAllianceSensorMap::GetTrackCount() ! { return maTrack.GetCount(); } ! tnPoolIndex tcAllianceSensorMap::GetStartTrackPosition() ! { return maTrack.GetStartPosition(); } *************** *** 500,504 **** #define SENSORMAP_AGEOUTTIME 15.0f ! void tcAllianceSensorMap::DropTrack(tnPoolIndex anID) { if (anID == NULL_INDEX) {return;} tnPoolIndex nKey = maTrackToSensorTrack[anID]; --- 622,627 ---- #define SENSORMAP_AGEOUTTIME 15.0f ! void tcAllianceSensorMap::DropTrack(tnPoolIndex anID) ! { if (anID == NULL_INDEX) {return;} tnPoolIndex nKey = maTrackToSensorTrack[anID]; *************** *** 580,584 **** /*******************************************************************************/ ! tcSensorMapTrack* tcAllianceSensorMap::GetSensorMapTrack(unsigned long anTrackID) { unsigned long nMapID; tcSensorMapTrack *pSMTrack; --- 703,708 ---- /*******************************************************************************/ ! tcSensorMapTrack* tcAllianceSensorMap::GetSensorMapTrack(unsigned long anTrackID) ! { unsigned long nMapID; tcSensorMapTrack *pSMTrack; *************** *** 663,674 **** /******************************** tcSensorMap **********************************/ ! tcAllianceSensorMap* tcSensorMap::GetMap(UINT8 anAlliance) { int nMapIdx = maMapIdxForAlliance[anAlliance]; ! if (nMapIdx == -1) { ! throw "Bad alliance passed to sensormap"; } return mapMap[nMapIdx]; } ! int tcSensorMap::GetTrackCount(UINT8 anAlliance) { tcAllianceSensorMap *pMap = GetMap(anAlliance); if (pMap == NULL) {return 0;} --- 787,817 ---- /******************************** tcSensorMap **********************************/ ! tcAllianceSensorMap* tcSensorMap::GetMap(UINT8 anAlliance) ! { int nMapIdx = maMapIdxForAlliance[anAlliance]; ! if (nMapIdx == -1) ! { ! fprintf(stderr, "Bad alliance passed to sensormap (%d)\n", anAlliance); ! return NULL; } return mapMap[nMapIdx]; } ! ! /** ! * Gets sensor map for alliance, creating if necessary ! * @return pointer to alliance sensor map ! */ ! tcAllianceSensorMap* tcSensorMap::GetOrCreateMap(UINT8 alliance) ! { ! int mapIdx = maMapIdxForAlliance[alliance]; ! if (mapIdx == -1) ! { ! CreateMapForAlliance(alliance); ! } ! return GetMap(alliance); ! } ! ! int tcSensorMap::GetTrackCount(UINT8 anAlliance) ! { tcAllianceSensorMap *pMap = GetMap(anAlliance); if (pMap == NULL) {return 0;} Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** Game.cpp 27 Apr 2004 01:24:25 -0000 1.76 --- Game.cpp 8 May 2004 21:25:26 -0000 1.77 *************** *** 121,126 **** goalTracker = simState->GetGoalTracker(); - mcOptions.Init(); - mbQuit = false; mbPaused = false; --- 121,124 ---- *************** *** 413,417 **** /* ** Initialize mcMapData * **/ ! mcMapData.AttachOptions(&mcOptions); mcMapData.LoadLowRes(); mcMapData.LoadHighRes(-8.0f, 55.0f); --- 411,415 ---- /* ** Initialize mcMapData * **/ ! mcMapData.AttachOptions(tcOptions::Get()); mcMapData.LoadLowRes(); mcMapData.LoadHighRes(-8.0f, 55.0f); *************** *** 436,440 **** meScreenMode = START; ! if (mcOptions.mbPlayMusic) { tcSound::Get()->PlayMusic("loop1"); --- 434,438 ---- meScreenMode = START; ! if (tcOptions::Get()->mbPlayMusic) { tcSound::Get()->PlayMusic("loop1"); *************** *** 479,483 **** void tcGame::InitializeSound() { ! if (mcOptions.disableSound) return; if (tcSound::Get()->Init()) --- 477,481 ---- void tcGame::InitializeSound() { ! if (tcOptions::Get()->disableSound) return; if (tcSound::Get()->Init()) *************** *** 503,507 **** startView = new tcStartView(glCanvas, wxPoint(0,0), frameSize); ! startView->AttachOptions(&mcOptions); startView->LoadBackgroundImage("start_background.jpg"); --- 501,505 ---- startView = new tcStartView(glCanvas, wxPoint(0,0), frameSize); ! startView->AttachOptions(tcOptions::Get()); startView->LoadBackgroundImage("start_background.jpg"); *************** *** 524,528 **** "OptionsView", startView); ! optionsView->AttachOptions(&mcOptions); if (optionsView->Init() == false) --- 522,526 ---- "OptionsView", startView); ! optionsView->AttachOptions(tcOptions::Get()); if (optionsView->Init() == false) *************** *** 563,567 **** briefingConsoleLeft->SetWrap(48); briefingConsoleLeft->SetActive(false); ! briefingConsoleLeft->SetSkipCount(mcOptions.renderSkipCount); briefingConsoleLeft->SetDelayedTextEffect(true); briefingConsoleLeft->LoadBackgroundImage("briefing_left.jpg"); --- 561,565 ---- briefingConsoleLeft->SetWrap(48); briefingConsoleLeft->SetActive(false); ! briefingConsoleLeft->SetSkipCount(tcOptions::Get()->renderSkipCount); briefingConsoleLeft->SetDelayedTextEffect(true); briefingConsoleLeft->LoadBackgroundImage("briefing_left.jpg"); *************** *** 583,587 **** briefingConsoleBottom->SetWrap(100); briefingConsoleBottom->SetActive(false); ! briefingConsoleBottom->SetSkipCount(mcOptions.renderSkipCount); briefingConsoleBottom->LoadBackgroundImage("briefing_bottom.jpg"); briefingConsoleBottom->Print(" "); // need this to get it to display --- 581,585 ---- briefingConsoleBottom->SetWrap(100); briefingConsoleBottom->SetActive(false); ! briefingConsoleBottom->SetSkipCount(tcOptions::Get()->renderSkipCount); briefingConsoleBottom->LoadBackgroundImage("briefing_bottom.jpg"); briefingConsoleBottom->Print(" "); // need this to get it to display *************** *** 659,663 **** tacticalMap->AttachMapData(&mcMapData); ! tacticalMap->AttachOptions(&mcOptions); tacticalMap->AttachCommandInterface(&mcCommandQueue); --- 657,661 ---- tacticalMap->AttachMapData(&mcMapData); ! tacticalMap->AttachOptions(tcOptions::Get()); tacticalMap->AttachCommandInterface(&mcCommandQueue); *************** *** 689,693 **** infoConsole->SetWrap(28); infoConsole->SetActive(false); ! infoConsole->SetSkipCount(mcOptions.renderSkipCount); --- 687,691 ---- infoConsole->SetWrap(28); infoConsole->SetActive(false); ! infoConsole->SetSkipCount(tcOptions::Get()->renderSkipCount); *************** *** 704,711 **** hookInfo->LoadBackgroundImage("console_b.jpg"); hookInfo->AttachSimState(simState); ! hookInfo->AttachOptions(&mcOptions); hookInfo->AttachUserInfo(&mcUserInfo); hookInfo->SetActive(false); ! hookInfo->SetSkipCount(mcOptions.renderSkipCount); // objectControl init --- 702,709 ---- hookInfo->LoadBackgroundImage("console_b.jpg"); hookInfo->AttachSimState(simState); ! hookInfo->AttachOptions(tcOptions::Get()); hookInfo->AttachUserInfo(&mcUserInfo); hookInfo->SetActive(false); ! hookInfo->SetSkipCount(tcOptions::Get()->renderSkipCount); // objectControl init *************** *** 723,729 **** objectControl->AttachCommandInterface(&mcCommandQueue); objectControl->AttachSimState(simState); ! objectControl->AttachOptions(&mcOptions); objectControl->AttachUserInfo(&mcUserInfo); ! objectControl->SetSkipCount(mcOptions.renderSkipCount); /* ** tcOOBView init * **/ --- 721,727 ---- objectControl->AttachCommandInterface(&mcCommandQueue); objectControl->AttachSimState(simState); ! objectControl->AttachOptions(tcOptions::Get()); objectControl->AttachUserInfo(&mcUserInfo); ! objectControl->SetSkipCount(tcOptions::Get()->renderSkipCount); /* ** tcOOBView init * **/ *************** *** 746,750 **** oobView->AttachSimState(simState); oobView->mnAlliance = mcUserInfo.GetOwnAlliance(); // TODO: make this configurable ! oobView->SetSkipCount(mcOptions.renderSkipCount); // popupControl init --- 744,748 ---- oobView->AttachSimState(simState); oobView->mnAlliance = mcUserInfo.GetOwnAlliance(); // TODO: make this configurable ! oobView->SetSkipCount(tcOptions::Get()->renderSkipCount); // popupControl init *************** *** 864,868 **** mcGameView.AttachMapView(tacticalMap); mcGameView.AttachUserInfo(&mcUserInfo); ! mcGameView.AttachOptions(&mcOptions); mcGameView.AttachObjectControl(objectControl); --- 862,866 ---- mcGameView.AttachMapView(tacticalMap); mcGameView.AttachUserInfo(&mcUserInfo); ! mcGameView.AttachOptions(tcOptions::Get()); mcGameView.AttachObjectControl(objectControl); *************** *** 1280,1288 **** if (nLastCount == 0) { - if (mcOptions.debugLevel > 0) - { - wxMessageBox("UpdateFrame(game mode) init1\n"); - } - bResult = QueryPerformanceCounter(&nPerformanceCount); --- 1278,1281 ---- *************** *** 1306,1314 **** snStartCount = nPerformanceCount; - - if (mcOptions.debugLevel > 0) - { - wxMessageBox("UpdateFrame(game mode) init2\n"); - } } --- 1299,1302 ---- *************** *** 1416,1420 **** ! if(mcOptions.mbPlayMusic) { tcSound::Get()->UpdateAutoMusic(gameTime); --- 1404,1408 ---- ! if (tcOptions::Get()->mbPlayMusic) { tcSound::Get()->UpdateAutoMusic(gameTime); *************** *** 1438,1453 **** mpGraphicsEngine->RenderAll(); - - if (mcOptions.debugLevel > 1) - { - wxMessageBox("pre Frame()\n"); - } - viewer->Frame(); } ! if (mcOptions.debugLevel > 1) ! { ! wxMessageBox("post Frame()\n"); ! } snFrameCount++; --- 1426,1432 ---- mpGraphicsEngine->RenderAll(); viewer->Frame(); } ! snFrameCount++; *************** *** 1473,1482 **** tacticalMap->mfFrameRate = sfFrameRate; - if (mcOptions.debugLevel > 1) - { - mcOptions.debugLevel = 0; - mcOptions.Synchronize(); - } - // update multiplayer interface at start and end of this method tcMultiplayerInterface::Get()->Update(); --- 1452,1455 ---- *************** *** 1545,1549 **** simState->GetPlatformAlliance(hookID, nAlliance); ! if ((mcUserInfo.IsOwnAlliance(nAlliance))||(mcOptions.mnCommandMode == 0)) return MENUMODE_PLATFORM; else --- 1518,1522 ---- simState->GetPlatformAlliance(hookID, nAlliance); ! if ((mcUserInfo.IsOwnAlliance(nAlliance))||(tcOptions::Get()->mnCommandMode == 0)) return MENUMODE_PLATFORM; else |
|
From: Dewitt C. <ddc...@us...> - 2004-05-08 21:25:35
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19946/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.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcUpdateMessageHandler.cpp 2 May 2004 16:22:45 -0000 1.6 --- tcUpdateMessageHandler.cpp 8 May 2004 21:25:26 -0000 1.7 *************** *** 87,90 **** --- 87,99 ---- /** + * Adds header information to sensor update stream + * Currently this is just an alliance field + */ + void tcUpdateMessageHandler::AddSensorUpdateHeader(long alliance, tcStream& stream) + { + stream << alliance; + } + + /** * Saves update data for obj to stream. Obj must be * created first for this data to be applied. *************** *** 122,125 **** --- 131,136 ---- case DESTROY: break; + case SENSOR_UPDATE: + break; default: fprintf(stderr, "tcUpdateMessageHandler::InitializeMessage - bad message type\n"); *************** *** 149,152 **** --- 160,164 ---- case UPDATE: case DESTROY: + case SENSOR_UPDATE: fprintf(stderr, "tcUpdateMessageHandler::Handle - " "illegal msg type for server (%d)\n", messageType); *************** *** 210,213 **** --- 222,232 ---- } break; + case SENSOR_UPDATE: + { + tcUpdateStream stream((const char*)data, messageSize); + stream >> messageType; + HandleSensorUpdate(stream); + } + break; default: fprintf(stderr, "tcUpdateMessageHandler::Handle - " *************** *** 292,297 **** else { ! fprintf(stderr, "Error - HandleCommandUpdate - obj %d not found\n", id); ! fprintf(stdout, "\n"); return; } --- 311,315 ---- else { ! fprintf(stdout, "%d (unknown)\n", id); return; } *************** *** 412,415 **** --- 430,466 ---- } + + /** + * Handle SENSOR_UPDATE update message (client only) + */ + void tcUpdateMessageHandler::HandleSensorUpdate(tcUpdateStream& stream) + { + tcSimState* simState = tcSimState::Get(); + wxASSERT(simState); + + long alliance; + stream >> alliance; + if ((alliance < 0) || (alliance > 255)) + { + fprintf(stderr, "Error - HandleSensorUpdate - Alliance out of range (%d)\n", + alliance); + return; + } + fprintf(stdout, "<< Received sensor update msg, time %.1f, alliance %d\n", + simState->GetTime(), alliance); + + tcSensorMap* sensorMap = simState->GetSensorMap(); + tcAllianceSensorMap* allianceSensorMap = sensorMap->GetOrCreateMap(alliance); + + if (allianceSensorMap) + { + *allianceSensorMap << stream; + } + else + { + fprintf(stderr, "Error - HandleSensorUpdate - NULL alliance sensor map\n"); + } + } + /** * Handle UPDATE update message (client only) Index: tcMultiplayerInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMultiplayerInterface.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcMultiplayerInterface.cpp 2 May 2004 16:22:45 -0000 1.13 --- tcMultiplayerInterface.cpp 8 May 2004 21:25:26 -0000 1.14 *************** *** 587,590 **** --- 587,591 ---- * This must be called regularly to perform network functions. * (avoids need for multithreadeding) + * Need to clean this up to better isolate server vs. client processing */ void tcMultiplayerInterface::Update() *************** *** 601,604 **** --- 602,610 ---- UpdateObjects(); + if (IsServer()) + { + UpdateSensorMaps(); + } + /* update time when paused only. This is redundant ** with obj state update which also has time info, but is *************** *** 919,922 **** --- 925,995 ---- } + /** + * Send sensor map update for player at connIdx + */ + void tcMultiplayerInterface::UpdateSensorMap(unsigned connIdx) + { + tcUpdateStream stream; + tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::SENSOR_UPDATE, stream); + + int connId = GetConnectionId(connIdx); + tcPlayerStatus& pstatus = GetPlayerStatus(connId); + int alliance = pstatus.alliance; + + tcUpdateMessageHandler::AddSensorUpdateHeader(alliance, stream); + size_t initialStreamSize = stream.size(); + + tcSimState* simState = tcSimState::Get(); + wxASSERT(simState); + + tcSensorMap* sensorMap = simState->GetSensorMap(); + wxASSERT(sensorMap); + + tcAllianceSensorMap* allianceSensorMap = sensorMap->GetMap(alliance); + + if (allianceSensorMap) + { + *allianceSensorMap >> stream; + if (stream.size() > initialStreamSize) + { + SendUpdateMessage(connId, stream); + fprintf(stdout, ">> sensormap update msg sent, connId (%d) size (%d)\n", + connId, stream.size()); + } + } + else + { + fprintf(stderr, "Error - tcMultiplayerInterface::UpdateSensorMap - " + "NULL allianceSensorMap\n"); + } + + } + + /** + * Periodically send sensor updates to clients + */ + void tcMultiplayerInterface::UpdateSensorMaps() + { + wxASSERT(IsServer()); + + static double lastUpdate = -1; + + tcSimState* simState = tcSimState::Get(); + wxASSERT(simState); + + double t = simState->GetTime(); + + if (t < lastUpdate + 0.5) return; + + lastUpdate = t; + + unsigned nConnections = GetNumConnections(); + + for (unsigned n=0;n<nConnections;n++) + { + UpdateSensorMap(n); + } + + } /** |
|
From: Dewitt C. <ddc...@us...> - 2004-05-08 21:25:35
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19946/src/common Modified Files: simmath.cpp tcOptions.cpp Log Message: Index: simmath.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/simmath.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** simmath.cpp 23 Apr 2004 00:15:16 -0000 1.10 --- simmath.cpp 8 May 2004 21:25:25 -0000 1.11 *************** *** 253,256 **** --- 253,269 ---- tcStream& tcTrack::operator>>(tcStream& stream) { + stream << mfLon_rad; + stream << mfLat_rad; + stream << mfAlt_m; + stream << mfSpeed_kts; + stream << mfHeading_rad; + stream << mfClimbAngle_rad; + stream << mfTimestamp; + stream << mnID; + stream << mnPassivePlatformID; + stream << mnClassification; + stream << mnAffiliation; + stream << mnAlliance; + stream << mnFlags; return stream; Index: tcOptions.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptions.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcOptions.cpp 29 Feb 2004 22:51:35 -0000 1.6 --- tcOptions.cpp 8 May 2004 21:25:26 -0000 1.7 *************** *** 24,28 **** --- 24,37 ---- #include "AError.h" #include <stdio.h> + #include "common/tinyxml.h" + /** + * @return singleton instance + */ + tcOptions* tcOptions::Get() + { + static tcOptions instance; + return &instance; + } /******************************************************************************/ *************** *** 153,156 **** --- 162,219 ---- } + /** + * @return option string value for string option matching optionName + * if option is not found, adds option with value "default" + */ + const char* tcOptions::GetOptionString(const char* optionName) + { + TiXmlNode* node = rootNode->FirstChild(optionName); + if (!node) + { + node = rootNode->InsertEndChild(TiXmlElement(optionName)); + } + + TiXmlNode* child = node->FirstChild(); + if (!child) + { + child = node->InsertEndChild(TiXmlText("default")); + } + + return child->Value(); + } + + /** + * @return true if option string is defined, false otherwise + */ + bool tcOptions::OptionStringExists(const char* optionName) const + { + TiXmlNode* node = rootNode->FirstChild(optionName); + + return (node != 0); + } + + /** + * Updates option string value, creating if necessary + */ + void tcOptions::SetOptionString(const char* optionName, const char* optionValue) + { + TiXmlNode* node = rootNode->FirstChild(optionName); + if (!node) + { + node = rootNode->InsertEndChild(TiXmlElement(optionName)); + } + + TiXmlNode* child = node->FirstChild(); + if (child) + { + child->SetValue(optionValue); + } + else + { + child = node->InsertEndChild(TiXmlText(optionValue)); + } + + } + /******************************************************************************/ void tcOptions::Serialize(int abRead) *************** *** 217,236 **** tcOptions::tcOptions() { ! for(int i=0;i<N_OPTIONS;i++) ! { ! maOptionInfo[i].meType = tsOptionInfo::OT_BOOLEAN; ! maOptionInfo[i].mnStateCount = 0; ! for(int k=0;k<N_OPTION_VALUES;k++) ! { ! maOptionInfo[i].mzCaption[k] = "INVALID"; ! } ! maOptionInfo[i].mnValue = 0; ! maOptionInfo[i].mpAssociated = NULL; ! } ! mnNumOptions = 0; } /******************************************************************************/ tcOptions::~tcOptions() { } --- 280,337 ---- tcOptions::tcOptions() { ! for(int i=0;i<N_OPTIONS;i++) ! { ! maOptionInfo[i].meType = tsOptionInfo::OT_BOOLEAN; ! maOptionInfo[i].mnStateCount = 0; ! for(int k=0;k<N_OPTION_VALUES;k++) ! { ! maOptionInfo[i].mzCaption[k] = "INVALID"; ! } ! maOptionInfo[i].mnValue = 0; ! maOptionInfo[i].mpAssociated = NULL; ! } ! mnNumOptions = 0; ! ! optionsXml = new TiXmlDocument("xml//options.xml"); ! if (!optionsXml->LoadFile()) ! { ! std::cout << "Created empty XML options file " << std::endl; ! optionsXml->SaveFile(); ! } ! optionsXml->LoadFile(); ! rootNode = optionsXml->FirstChild("Options"); ! if (!rootNode) ! { ! rootNode = optionsXml->InsertEndChild(TiXmlElement("Options")); ! } ! ! /* test code ! SetOptionString("testOption", "This is a test option 1 2 3"); ! fprintf(stdout, "TEST STRING: [%s]\n", GetOptionString("testOption")); ! ! SetOptionString("testOption", "This is the modified test option 4 5 6"); ! fprintf(stdout, "TEST STRING2: [%s]\n", GetOptionString("testOption")); ! ! TiXmlNode* node = rootNode->InsertEndChild(TiXmlElement("Test")); ! node->InsertEndChild(TiXmlText("This is some example text")); ! TiXmlNode* testNode = rootNode->FirstChild("Test"); ! TiXmlNode* childNode = testNode->FirstChild(); ! if (childNode) ! { ! fprintf(stdout, "TEST VALUE: [%s]\n", childNode->Value()); ! } ! */ ! Init(); // initializes binary options data } + + /******************************************************************************/ tcOptions::~tcOptions() { + if (optionsXml) + { + optionsXml->SaveFile(); + delete optionsXml; + } } |
|
From: Dewitt C. <ddc...@us...> - 2004-05-08 21:25:34
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19946/include/sim Modified Files: Game.h tcSensorMap.h tcSimState.h Log Message: Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcSimState.h 27 Apr 2004 01:24:17 -0000 1.22 --- tcSimState.h 8 May 2004 21:25:25 -0000 1.23 *************** *** 106,110 **** void AddPlatform(tcGameObject *pplat); void AddPlatformWithKey(tcGameObject *pplat, tnPoolIndex key); ! void AddRandomPlatform(void); void AttachCommandInterface(tcCommandQueue *apCommandInterface) {mpCommandInterface=apCommandInterface;} void AttachDB(tcDatabase *pDatabase); --- 106,110 ---- void AddPlatform(tcGameObject *pplat); void AddPlatformWithKey(tcGameObject *pplat, tnPoolIndex key); ! void AddRandomPlatform(); void AttachCommandInterface(tcCommandQueue *apCommandInterface) {mpCommandInterface=apCommandInterface;} void AttachDB(tcDatabase *pDatabase); *************** *** 146,152 **** tcGameObject* GetObjectByName(std::string unitName); int GetPlatformsWithinRegion(tnPoolIndex *apKeyList, int anLength, tcRect *apRegion); ! long GetRandomPlatform(void); int GetSeekerTrack(long anKey, tcTrack& track); ! double GetTime(void) {return mfSimTime;} long GetTimeAcceleration() const; bool IsLauncherReady(tcGameObject *apGameObj, unsigned anLauncher); --- 146,153 ---- tcGameObject* GetObjectByName(std::string unitName); int GetPlatformsWithinRegion(tnPoolIndex *apKeyList, int anLength, tcRect *apRegion); ! long GetRandomPlatform(); int GetSeekerTrack(long anKey, tcTrack& track); ! tcSensorMap* GetSensorMap(); ! double GetTime() {return mfSimTime;} long GetTimeAcceleration() const; bool IsLauncherReady(tcGameObject *apGameObj, unsigned anLauncher); *************** *** 157,161 **** bool RadarCanDetect(tnPoolIndex anSensorKey, const tcGameObject* target, tcGameObject* reference, float afSensorAz, long fcID = -1, unsigned fcIdx = 0); ! void RandInit(void); void RemoveDestroyedObjects(void); void RequestLaunch(long anKey,int anLauncher); --- 158,162 ---- bool RadarCanDetect(tnPoolIndex anSensorKey, const tcGameObject* target, tcGameObject* reference, float afSensorAz, long fcID = -1, unsigned fcIdx = 0); ! void RandInit(); void RemoveDestroyedObjects(void); void RequestLaunch(long anKey,int anLauncher); *************** *** 171,175 **** void SetTime(double afNewTime) {mfSimTime=afNewTime;} /////< Sets sim time, normally 0 at start of sim void SetTimeAcceleration(long accel); ! void Update(void); void UpdateAI(double afSimTime); void UpdateLandings(double afSimTime); --- 172,176 ---- void SetTime(double afNewTime) {mfSimTime=afNewTime;} /////< Sets sim time, normally 0 at start of sim void SetTimeAcceleration(long accel); ! void Update(); void UpdateAI(double afSimTime); void UpdateLandings(double afSimTime); *************** *** 178,184 **** void UpdateObjEngagements(double afSimTime); void UpdateObjFormations(double afSimTime); ! void UpdateObjTerrainInfo(void); ! void UpdateSensors(void); ! void UpdateWeaponHits(void); private: tcSimState(); --- 179,184 ---- void UpdateObjEngagements(double afSimTime); void UpdateObjFormations(double afSimTime); ! void UpdateObjTerrainInfo(); ! void UpdateWeaponHits(); private: tcSimState(); Index: tcSensorMap.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorMap.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcSensorMap.h 16 Feb 2004 01:06:22 -0000 1.5 --- tcSensorMap.h 8 May 2004 21:25:25 -0000 1.6 *************** *** 32,40 **** class tcSimState; ! namespace Sensor { ! // stores all state information needed by sensor for surveillance tracks ! class tcSensorReport { public: float mfLon_rad; --- 32,45 ---- class tcSimState; + class tcUpdateStream; ! namespace Sensor ! { ! /** ! * stores all state information needed by sensor for surveillance tracks ! */ ! class tcSensorReport ! { public: float mfLon_rad; *************** *** 44,48 **** float mfHeading_rad; double mfTimestamp; ! double mfStartTime; // birth time of track from report tnPoolIndex mnTrackID; tnPoolIndex mnSensorPlatformID; --- 49,53 ---- float mfHeading_rad; double mfTimestamp; ! double mfStartTime; ///< birth time of track from report tnPoolIndex mnTrackID; tnPoolIndex mnSensorPlatformID; *************** *** 50,54 **** std::vector<UINT32> maEmitter; unsigned mbClassified : 1; ! void Clear() { mfLon_rad=0;mfLat_rad=0;mfAlt_m=0; mfSpeed_kts=0;mfHeading_rad=0; --- 55,60 ---- std::vector<UINT32> maEmitter; unsigned mbClassified : 1; ! void Clear() ! { mfLon_rad=0;mfLat_rad=0;mfAlt_m=0; mfSpeed_kts=0;mfHeading_rad=0; *************** *** 63,68 **** }; ! struct tsEmitterInfo { ! tnPoolIndex mnEmitterID; // database ID of emitter double mfTimestamp; int mnMode; --- 69,75 ---- }; ! struct tsEmitterInfo ! { ! tnPoolIndex mnEmitterID; ///< database ID of emitter double mfTimestamp; int mnMode; *************** *** 80,88 **** //tcTrack track; double mfLastUpdateTime; ! 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 --- 87,95 ---- //tcTrack track; double mfLastUpdateTime; ! 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 *************** *** 103,107 **** int GetEmitterCount() {return mnEmitters;} ! const tsEmitterInfo* GetEmitter(int anIdx) { if ((anIdx < 0)||(anIdx >= mnEmitters)) {return NULL;} return &maEmitterInfo[anIdx]; --- 110,115 ---- int GetEmitterCount() {return mnEmitters;} ! const tsEmitterInfo* GetEmitter(int anIdx) ! { if ((anIdx < 0)||(anIdx >= mnEmitters)) {return NULL;} return &maEmitterInfo[anIdx]; *************** *** 130,134 **** bool UpdatePassiveReport(tcSensorReport*& rpReport, tnPoolIndex anSensorID); ! void UpdateTrack(void); tcSensorMapTrack* operator= (tcSensorMapTrack *pa) {return pa;} --- 138,146 ---- bool UpdatePassiveReport(tcSensorReport*& rpReport, tnPoolIndex anSensorID); ! void UpdateTrack(); ! ! ! tcUpdateStream& operator<<(tcUpdateStream& stream); ! tcUpdateStream& operator>>(tcUpdateStream& stream); tcSensorMapTrack* operator= (tcSensorMapTrack *pa) {return pa;} *************** *** 148,155 **** enum {MAX_SMTRACKS = 512, MAX_TRACKS = 512}; public: ! int GetTrackCount(void); ! tnPoolIndex GetStartTrackPosition(void); void GetNextTrack(tnPoolIndex& pos, tcSensorMapTrack*& pTrack); ! void Clear(void); void DropTrack(tnPoolIndex anID); --- 160,167 ---- enum {MAX_SMTRACKS = 512, MAX_TRACKS = 512}; public: ! int GetTrackCount(); ! tnPoolIndex GetStartTrackPosition(); void GetNextTrack(tnPoolIndex& pos, tcSensorMapTrack*& pTrack); ! void Clear(); void DropTrack(tnPoolIndex anID); *************** *** 164,167 **** --- 176,183 ---- bool GetTrack(unsigned long anTrackID, tcTrack& track); int Serialize(tcFile& file, bool mbLoad); + tcUpdateStream& operator<<(tcUpdateStream& stream); + tcUpdateStream& operator>>(tcUpdateStream& stream); + + tcAllianceSensorMap(); virtual ~tcAllianceSensorMap(); *************** *** 173,178 **** }; ! // holds tcAllianceSensorMaps for all alliances ! class tcSensorMap { enum {MAX_MAPS = 4, MAX_ALLIANCES = 256}; public: --- 189,198 ---- }; ! /** ! * holds tcAllianceSensorMaps for all alliances ! * @see tcAllianceSensorMap ! */ ! class tcSensorMap ! { enum {MAX_MAPS = 4, MAX_ALLIANCES = 256}; public: *************** *** 182,185 **** --- 202,206 ---- tcAllianceSensorMap* GetMap(UINT8 anAlliance); + tcAllianceSensorMap* GetOrCreateMap(UINT8 alliance); void CreateMapForAlliance(UINT8 anAlliance); *************** *** 190,194 **** tnPoolIndex anTrackID, tcSensorMapTrack*& rpSMTrack, UINT8 anAlliance); ! void Clear(void); void Update(double afStatusTime); --- 211,215 ---- tnPoolIndex anTrackID, tcSensorMapTrack*& rpSMTrack, UINT8 anAlliance); ! void Clear(); void Update(double afStatusTime); *************** *** 196,200 **** bool GetTrack(unsigned long anTrackID, tcTrack& track, UINT8 anAlliance); int Serialize(tcFile& file, bool mbLoad); ! bool Test(void); tcSensorMap(); --- 217,221 ---- bool GetTrack(unsigned long anTrackID, tcTrack& track, UINT8 anAlliance); int Serialize(tcFile& file, bool mbLoad); ! bool Test(); tcSensorMap(); Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Game.h 27 Apr 2004 01:24:17 -0000 1.34 --- Game.h 8 May 2004 21:25:25 -0000 1.35 *************** *** 156,160 **** tcSimState *simState; tcMapData mcMapData; - tcOptions mcOptions; tcCommandQueue mcCommandQueue; tcSimPythonInterface *pythonInterface; --- 156,159 ---- |
|
From: Dewitt C. <ddc...@us...> - 2004-05-08 21:25:34
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19946/include/common Modified Files: tcOptions.h Log Message: Index: tcOptions.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcOptions.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcOptions.h 29 Feb 2004 22:51:35 -0000 1.5 --- tcOptions.h 8 May 2004 21:25:25 -0000 1.6 *************** *** 1,6 **** /* ! ** tcOptions.h ** ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- /* ! ** @file tcOptions.h ** ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 25,32 **** --- 25,36 ---- #include "wx/wx.h" + #include <string> #define N_OPTIONS 32 // max number of options #define N_OPTION_VALUES 4 // max number of states for each option + class TiXmlDocument; + class TiXmlNode; + struct tsOptionInfo { *************** *** 42,46 **** }; ! // TODO: fix option drawing class tcOptions { --- 46,57 ---- }; ! /** ! * A singleton class for game configuration options ! * Eventually the older binary options format will be replaced with ! * XML. Currently XML can handle string options via GetOptionString ! * and SetOptionString. ! * ! * TODO: fix option drawing ! */ class tcOptions { *************** *** 61,71 **** void AddOption(tsOptionInfo& oi); ! int Init(void); ! void Synchronize(void); void Serialize(int abRead); ! tcOptions(); ! virtual ~tcOptions(); private: }; --- 72,93 ---- void AddOption(tsOptionInfo& oi); ! ! const char* GetOptionString(const char* optionName); ! bool OptionStringExists(const char* optionName) const; ! void SetOptionString(const char* optionName, const char* optionValue); ! ! void Synchronize(); void Serialize(int abRead); ! ! static tcOptions* Get(); ///< accessor for singleton instance ! private: + TiXmlDocument *optionsXml; ///< XML options file + TiXmlNode* rootNode; ///< root node for XML options file + int Init(); + + tcOptions(); + ~tcOptions(); }; |
|
From: Dewitt C. <ddc...@us...> - 2004-05-08 21:25:34
|
Update of /cvsroot/gcblue/gcb_wx/include/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19946/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.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcUpdateMessageHandler.h 2 May 2004 16:22:44 -0000 1.5 --- tcUpdateMessageHandler.h 8 May 2004 21:25:25 -0000 1.6 *************** *** 57,61 **** COMMAND_UPDATE = 3, ///< command-related update COMMAND_ACK = 4, ///< ack of command-related update ! DESTROY = 5 ///< destroys game obj }; --- 57,62 ---- COMMAND_UPDATE = 3, ///< command-related update COMMAND_ACK = 4, ///< ack of command-related update ! DESTROY = 5, ///< destroys game obj ! SENSOR_UPDATE = 6 ///< update of sensor map tracks }; *************** *** 65,70 **** --- 66,73 ---- static void AddCreateRequest(long id, tcStream& stream); static void AddDestroy(long id, tcStream& stream); + static void AddSensorUpdateHeader(long alliance, tcStream& stream); static void AddUpdate(tcGameObject* obj, tcUpdateStream& stream); + static void InitializeMessage(int messageType, tcStream& stream); *************** *** 75,78 **** --- 78,82 ---- void HandleCreateRequest(tcStream& stream, int connectionId); void HandleDestroy(tcStream& stream); + void HandleSensorUpdate(tcUpdateStream& stream); void HandleUpdate(tcUpdateStream& stream, int connectionId); Index: tcMultiplayerInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcMultiplayerInterface.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcMultiplayerInterface.h 2 May 2004 16:22:44 -0000 1.13 --- tcMultiplayerInterface.h 8 May 2004 21:25:25 -0000 1.14 *************** *** 128,131 **** --- 128,133 ---- void UpdateObjects(); void UpdatePlayerInfo(); + void UpdateSensorMaps(); + void UpdateSensorMap(unsigned connIdx); void UpdateTime(); |
|
From: Dewitt C. <ddc...@us...> - 2004-05-08 21:25:33
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19946/docs Modified Files: CHANGES.txt Log Message: Index: CHANGES.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/CHANGES.txt,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** CHANGES.txt 2 May 2004 16:24:07 -0000 1.18 --- CHANGES.txt 8 May 2004 21:25:24 -0000 1.19 *************** *** 3,6 **** --- 3,13 ---- 0.6 --------------------------------------------------------------------- + *** 2004-05-XX Dewitt Colclough *** + - Added sensor update to multiplayer + - Converted tcOptions into a singleton class + - Added XML string options, eventually all options should be handled + with XML. + + *** 2004-05-01 Dewitt Colclough *** - Added capability for multiplayer client to control heading, speed, altitude of |
|
From: Dewitt C. <ddc...@us...> - 2004-05-02 16:24:15
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11641/docs Modified Files: CHANGES.txt Log Message: Index: CHANGES.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/CHANGES.txt,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** CHANGES.txt 1 May 2004 21:48:44 -0000 1.17 --- CHANGES.txt 2 May 2004 16:24:07 -0000 1.18 *************** *** 6,9 **** --- 6,11 ---- - Added capability for multiplayer client to control heading, speed, altitude of basic platform objects. + - Added create request msg for case where client receives updates on unknown object. + - Added bytes in/out count to connection status display *** 2004-04-28 Xavi Rubio *** |
|
From: Dewitt C. <ddc...@us...> - 2004-05-02 16:22:53
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11419/src/network Modified Files: tcConnectionData.cpp tcMultiplayerInterface.cpp tcNetworkInterface.cpp tcUpdateMessageHandler.cpp Log Message: Index: tcUpdateMessageHandler.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcUpdateMessageHandler.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcUpdateMessageHandler.cpp 1 May 2004 21:49:06 -0000 1.5 --- tcUpdateMessageHandler.cpp 2 May 2004 16:22:45 -0000 1.6 *************** *** 94,98 **** { stream << obj->mnID; // write id ! // write obj state to stream *obj >> stream; --- 94,98 ---- { stream << obj->mnID; // write id ! // write obj state to stream *obj >> stream; *************** *** 108,128 **** switch (messageType) { ! case CREATE: ! break; ! case CREATE_REQUEST: ! break; ! case UPDATE: ! // update messages start with time and time acceleration info ! tcSimState::Get()->SaveTimeToStream(stream); ! break; ! case COMMAND_UPDATE: ! break; ! case COMMAND_ACK: ! break; ! case DESTROY: ! break; ! default: ! fprintf(stderr, "tcUpdateMessageHandler::InitializeMessage - bad message type\n"); ! break; } --- 108,128 ---- switch (messageType) { ! case CREATE: ! break; ! case CREATE_REQUEST: ! break; ! case UPDATE: ! // update messages start with time and time acceleration info ! tcSimState::Get()->SaveTimeToStream(stream); ! break; ! case COMMAND_UPDATE: ! break; ! case COMMAND_ACK: ! break; ! case DESTROY: ! break; ! default: ! fprintf(stderr, "tcUpdateMessageHandler::InitializeMessage - bad message type\n"); ! break; } *************** *** 135,139 **** tcSimState* simState = tcSimState::Get(); wxASSERT(simState); ! // end up creating stream twice. could split to use multiple handlers to avoid this tcStream stream((const char*)data, messageSize); --- 135,139 ---- tcSimState* simState = tcSimState::Get(); wxASSERT(simState); ! // end up creating stream twice. could split to use multiple handlers to avoid this tcStream stream((const char*)data, messageSize); *************** *** 142,147 **** stream >> messageType; ! switch (messageType) { case CREATE: { --- 142,178 ---- stream >> messageType; ! if (isServer) { + switch (messageType) + { + case CREATE: + case UPDATE: + case DESTROY: + fprintf(stderr, "tcUpdateMessageHandler::Handle - " + "illegal msg type for server (%d)\n", messageType); + return; + case COMMAND_UPDATE: + { + tcCommandStream stream((const char*)data, messageSize); + stream >> messageType; + HandleCommandUpdate(stream, connectionId); + } + break; + case COMMAND_ACK: + { + tcCommandStream stream((const char*)data, messageSize); + stream >> messageType; + HandleCommandAck(stream); + } + break; + default: + fprintf(stderr, "tcUpdateMessageHandler::Handle - unknown msg type for server\n"); + break; + } + } + else + { + switch (messageType) + { case CREATE: { *************** *** 155,159 **** tcUpdateStream stream((const char*)data, messageSize); stream >> messageType; ! HandleUpdate(stream); } break; --- 186,190 ---- tcUpdateStream stream((const char*)data, messageSize); stream >> messageType; ! HandleUpdate(stream, connectionId); } break; *************** *** 180,185 **** break; default: ! fprintf(stderr, "tcUpdateMessageHandler::Handle - bad message type\n"); break; } --- 211,218 ---- break; default: ! fprintf(stderr, "tcUpdateMessageHandler::Handle - " ! "unknown msg type for client (%d)\n", messageType); break; + } } *************** *** 196,200 **** wxASSERT(simState); ! fprintf(stdout, "Upding obj cmd acks, time %.1f: ", simState->GetTime()); long id; --- 229,233 ---- wxASSERT(simState); ! fprintf(stdout, "<< Received obj cmd acks, time %.1f: ", simState->GetTime()); long id; *************** *** 231,235 **** ! // Init ack messag tcCommandStream commandStream; tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::COMMAND_ACK, commandStream); --- 264,268 ---- ! // Init ack message tcCommandStream commandStream; tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::COMMAND_ACK, commandStream); *************** *** 238,242 **** unsigned nAcks = 0; ! fprintf(stdout, "Updating obj cmds, time %.1f: ", simState->GetTime()); long id; --- 271,275 ---- unsigned nAcks = 0; ! fprintf(stdout, "<< Received obj cmds, time %.1f: ", simState->GetTime()); long id; *************** *** 270,274 **** tcMultiplayerInterface::Get()->SendUpdateMessage(connectionId, commandStream); #ifdef _DEBUG ! fprintf(stdout, "Sent obj command update ack, time: %.1f\n", simState->GetTime()); #endif } --- 303,307 ---- tcMultiplayerInterface::Get()->SendUpdateMessage(connectionId, commandStream); #ifdef _DEBUG ! fprintf(stdout, ">> Sent obj command update ack, time: %.1f\n", simState->GetTime()); #endif } *************** *** 284,288 **** tcDatabase* database = simState->mpDatabase; // convert database to singleton eventually ! fprintf(stdout, "Creating objs, time %.1f: ", simState->GetTime()); long id; --- 317,321 ---- tcDatabase* database = simState->mpDatabase; // convert database to singleton eventually ! fprintf(stdout, "<< Received obj create msg, time %.1f: ", simState->GetTime()); long id; *************** *** 326,331 **** * Handle CREATE_REQUEST message (server only) */ ! void tcUpdateMessageHandler::HandleCreateRequest(tcStream& stream) { } --- 359,380 ---- * Handle CREATE_REQUEST message (server only) */ ! void tcUpdateMessageHandler::HandleCreateRequest(tcStream& stream, int connectionId) { + wxASSERT(isServer); + + tcPlayerStatus& pstatus = + tcMultiplayerInterface::Get()->GetPlayerStatus(connectionId); + + long id; + + fprintf(stdout, "<< Received create req for objs: "); + + while ((stream >> id).eof() == false) + { + pstatus.EraseEntry(id); + fprintf(stdout, "%d ", id); + } + + fprintf(stdout, "\n"); } *************** *** 338,342 **** wxASSERT(simState); ! fprintf(stdout, "Destroying objs, time %.1f: ", simState->GetTime()); long id; --- 387,391 ---- wxASSERT(simState); ! fprintf(stdout, "<< Received destroy objs msg, time %.1f: ", simState->GetTime()); long id; *************** *** 366,378 **** * Handle UPDATE update message (client only) */ ! void tcUpdateMessageHandler::HandleUpdate(tcUpdateStream& stream) { tcSimState* simState = tcSimState::Get(); wxASSERT(simState); // Load time info from stream tcSimState::Get()->LoadTimeFromStream(stream); ! fprintf(stdout, "Updating objs, time %.1f: ", simState->GetTime()); long id; --- 415,433 ---- * Handle UPDATE update message (client only) */ ! void tcUpdateMessageHandler::HandleUpdate(tcUpdateStream& stream, int connectionId) { + wxASSERT(!isServer); + tcSimState* simState = tcSimState::Get(); wxASSERT(simState); + + std::queue<long> missingIds; // queue to keep track of ids that are missing locally + + // Load time info from stream tcSimState::Get()->LoadTimeFromStream(stream); ! fprintf(stdout, "<< Received obj update msg, time %.1f: ", simState->GetTime()); long id; *************** *** 391,394 **** --- 446,450 ---- else { + missingIds.push(id); fprintf(stderr, "Error - HandleUpdate - obj %d not found\n", id); fprintf(stdout, "\n"); *************** *** 397,400 **** --- 453,477 ---- } fprintf(stdout, "\n"); + + /** + ** if any missing ids occurred, send a create request message back to the server + **/ + if (!missingIds.empty()) + { + // Init ack message + tcStream createReqStream; + tcUpdateMessageHandler::InitializeMessage( + tcUpdateMessageHandler::CREATE_REQUEST, createReqStream); + fprintf(stdout, ">> Sending create request msg, time %.1f, ids: ", simState->GetTime()); + while (missingIds.empty()) + { + long id = missingIds.front(); + missingIds.pop(); + tcUpdateMessageHandler::AddCreateRequest(id, createReqStream); + fprintf(stdout, "%d ", id); + } + tcMultiplayerInterface::Get()->SendUpdateMessage(connectionId, createReqStream); + fprintf(stdout, "\n"); + } } Index: tcConnectionData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcConnectionData.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcConnectionData.cpp 13 Apr 2004 21:37:41 -0000 1.5 --- tcConnectionData.cpp 2 May 2004 16:22:45 -0000 1.6 *************** *** 37,40 **** --- 37,56 ---- /** + * @return total number of bytes read from this connection + */ + unsigned long tcConnectionData::GetReadCount() const + { + return readCount; + } + + /** + * @return total number of bytes written to this connection + */ + unsigned long tcConnectionData::GetWriteCount() const + { + return writeCount; + } + + /** * Attempts to read next whole message. If message is incomplete, the partial * message is returned to the socket read buffer. This method does not block. *************** *** 100,107 **** --- 116,126 ---- readQueueTCP.push(bufferIdx); + readCount += message->GetMessageSize(); #ifdef _DEBUG + /* fprintf(stdout, " Received message, size: %d, id:%d, t:%d data:%s\n", message->GetMessageSize(), message->GetMessageId(), message->GetMessageTimestamp(), testString.c_str()); + */ #endif *************** *** 145,152 **** readQueueUDP.push(bufferIdx); fprintf(stdout, " Received UDP message, size: %d, id:%d, t:%d\n", ! message->GetMessageSize(), message->GetMessageId(), ! message->GetMessageTimestamp()); ! } --- 164,173 ---- readQueueUDP.push(bufferIdx); + /* fprintf(stdout, " Received UDP message, size: %d, id:%d, t:%d\n", ! message->GetMessageSize(), message->GetMessageId(), ! message->GetMessageTimestamp()); ! */ ! readCount += message->GetMessageSize(); } *************** *** 228,233 **** if (message->bufferIdx >= message->data.header.messageSize) { ! fprintf(stdout,"Sent message, size:%d, id:%d, t:%d\n", ! message->GetMessageSize(), message->GetMessageId(), tcTime::Get30HzCount()); writeQueueTCP.pop(); networkInterface->ReturnMessage(bufferId); --- 249,255 ---- if (message->bufferIdx >= message->data.header.messageSize) { ! //fprintf(stdout,"Sent message, size:%d, id:%d, t:%d\n", ! // message->GetMessageSize(), message->GetMessageId(), tcTime::Get30HzCount()); ! writeCount += message->GetMessageSize(); writeQueueTCP.pop(); networkInterface->ReturnMessage(bufferId); *************** *** 279,284 **** } ! fprintf(stdout,"Sent UDP packet to %s, size:%d, id:%d, t:%d\n", ! peerName.c_str(), message->GetMessageSize(), message->GetMessageId(), tcTime::Get30HzCount()); writeQueueUDP.pop(); --- 301,307 ---- } ! writeCount += message->GetMessageSize(); ! //fprintf(stdout,"Sent UDP packet to %s, size:%d, id:%d, t:%d\n", ! // peerName.c_str(), message->GetMessageSize(), message->GetMessageId(), tcTime::Get30HzCount()); writeQueueUDP.pop(); *************** *** 296,299 **** --- 319,324 ---- idString = "Err"; id = -1; + readCount = 0; + writeCount = 0; } Index: tcMultiplayerInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMultiplayerInterface.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcMultiplayerInterface.cpp 1 May 2004 21:49:06 -0000 1.12 --- tcMultiplayerInterface.cpp 2 May 2004 16:22:45 -0000 1.13 *************** *** 44,47 **** --- 44,65 ---- /** + * Erases map entry for id. Used to force server to resend + * create message for id. + */ + void tcPlayerStatus::EraseEntry(long id) + { + std::map<long, double>::iterator iter; + + if (id == -1) return; + + iter = lastUpdate.find(id); + if (iter == lastUpdate.end()) + { + return; + } + lastUpdate.erase(iter); // erase entry + } + + /** * Gets time of last update to player for a game object * @param updateTime set to last updateTime for obj id Index: tcNetworkInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcNetworkInterface.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcNetworkInterface.cpp 23 Apr 2004 00:15:17 -0000 1.10 --- tcNetworkInterface.cpp 2 May 2004 16:22:45 -0000 1.11 *************** *** 161,168 **** if (connectionIdx >= GetNumConnections()) return "Error"; float dt_sec = (1.0f/30.0f)* ! (float)(tcTime::Get30HzCount() - connectionData[connectionIdx].timestamp); ! wxString status = wxString::Format("%s (%.0f)", ! connectionData[connectionIdx].idString.c_str(), dt_sec); return status.c_str(); } --- 161,173 ---- if (connectionIdx >= GetNumConnections()) return "Error"; + tcConnectionData& connData = connectionData[connectionIdx]; + float dt_sec = (1.0f/30.0f)* ! (float)(tcTime::Get30HzCount() - connData.timestamp); ! unsigned long bytesIn = connData.GetReadCount(); ! unsigned long bytesOut = connData.GetWriteCount(); ! ! wxString status = wxString::Format("%s (%.0f) %07d %07d", ! connData.idString.c_str(), dt_sec, bytesIn, bytesOut); return status.c_str(); } *************** *** 364,369 **** void tcNetworkInterface::OnSocketEvent(wxSocketEvent& event) { ! std::cout << "Socket event: "; ! switch(event.GetSocketEvent()) { --- 369,376 ---- void tcNetworkInterface::OnSocketEvent(wxSocketEvent& event) { ! #ifdef _DEBUG ! // std::cout << "Socket event: "; ! #endif ! switch(event.GetSocketEvent()) { *************** *** 373,377 **** { #ifdef _DEBUG ! std::cout << "wxSOCKET_INPUT - UDP"; #endif RouteUDP(); --- 380,384 ---- { #ifdef _DEBUG ! // std::cout << "wxSOCKET_INPUT - UDP"; #endif RouteUDP(); *************** *** 380,384 **** { #ifdef _DEBUG ! std::cout << "wxSOCKET_INPUT - TCP"; #endif int connectionIdx = LookupConnectionIndex(event.m_id); --- 387,391 ---- { #ifdef _DEBUG ! // std::cout << "wxSOCKET_INPUT - TCP"; #endif int connectionIdx = LookupConnectionIndex(event.m_id); *************** *** 393,406 **** break; case wxSOCKET_LOST: ! std::cout << "wxSOCKET_LOST"; break; case wxSOCKET_CONNECTION: ! std::cout << "wxSOCKET_CONNECTION"; break; default: ! std::cout << "Unexpected event!"; break; } - std::cout << std::endl; } --- 400,412 ---- break; case wxSOCKET_LOST: ! std::cout << "wxSOCKET_LOST" << std::endl; break; case wxSOCKET_CONNECTION: ! std::cout << "wxSOCKET_CONNECTION" << std::endl; break; default: ! std::cout << "Unexpected event!" << std::endl; break; } } *************** *** 584,589 **** #ifdef _DEBUG ! fprintf(stdout, " Received UDP from %s, size: %d, data: %s\n", ! peerName.c_str(), readCount, (char*)buff); #endif --- 590,595 ---- #ifdef _DEBUG ! // fprintf(stdout, " Received UDP from %s, size: %d, data: %s\n", ! // peerName.c_str(), readCount, (char*)buff); #endif |
|
From: Dewitt C. <ddc...@us...> - 2004-05-02 16:22:53
|
Update of /cvsroot/gcblue/gcb_wx/include/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11419/include/network Modified Files: tcConnectionData.h tcMultiplayerInterface.h tcUpdateMessageHandler.h Log Message: Index: tcUpdateMessageHandler.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcUpdateMessageHandler.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcUpdateMessageHandler.h 1 May 2004 21:49:23 -0000 1.4 --- tcUpdateMessageHandler.h 2 May 2004 16:22:44 -0000 1.5 *************** *** 73,79 **** void HandleCommandUpdate(tcCommandStream& stream, int connectionId); ///< command update void HandleCreate(tcCreateStream& stream); ! void HandleCreateRequest(tcStream& stream); void HandleDestroy(tcStream& stream); ! void HandleUpdate(tcUpdateStream& stream); --- 73,79 ---- void HandleCommandUpdate(tcCommandStream& stream, int connectionId); ///< command update void HandleCreate(tcCreateStream& stream); ! void HandleCreateRequest(tcStream& stream, int connectionId); void HandleDestroy(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.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcMultiplayerInterface.h 1 May 2004 21:49:23 -0000 1.12 --- tcMultiplayerInterface.h 2 May 2004 16:22:44 -0000 1.13 *************** *** 52,55 **** --- 52,56 ---- std::map<long, double> lastUpdate; ///< map of (obj id, update time) pairs + void EraseEntry(long id); bool GetLastUpdate(long id, double& updateTime); void SetUpdate(long id, double updateTime); Index: tcConnectionData.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcConnectionData.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcConnectionData.h 4 Apr 2004 20:49:42 -0000 1.4 --- tcConnectionData.h 2 May 2004 16:22:44 -0000 1.5 *************** *** 55,60 **** std::queue<unsigned int> writeQueueUDP; ///< fifo of message indices waiting for UDP transmit std::vector<unsigned int> ack; ///< vector of transmitted messages waiting for ack ! void ReadNextMessageTCP(); void ReadNextMessageUDP(unsigned int messageSize, unsigned char *buffer); --- 55,63 ---- std::queue<unsigned int> writeQueueUDP; ///< fifo of message indices waiting for UDP transmit std::vector<unsigned int> ack; ///< vector of transmitted messages waiting for ack + unsigned long readCount; ///< number of bytes read from this connection + unsigned long writeCount; ///< number of bytes written to this connection ! unsigned long GetReadCount() const; ! unsigned long GetWriteCount() const; void ReadNextMessageTCP(); void ReadNextMessageUDP(unsigned int messageSize, unsigned char *buffer); |
|
From: Dewitt C. <ddc...@us...> - 2004-05-01 21:50:45
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7343 Modified Files: GCblue.vcproj Log Message: Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** GCblue.vcproj 13 Apr 2004 00:24:36 -0000 1.50 --- GCblue.vcproj 1 May 2004 21:50:35 -0000 1.51 *************** *** 179,182 **** --- 179,185 ---- </File> <File + RelativePath=".\src\common\tcObjStream.cpp"> + </File> + <File RelativePath="src\common\tcOggStreamer.cpp"> </File> *************** *** 561,564 **** --- 564,570 ---- </File> <File + RelativePath=".\include\common\tcObjStream.h"> + </File> + <File RelativePath="include\common\tcOggStreamer.h"> </File> |
|
From: Dewitt C. <ddc...@us...> - 2004-05-01 21:50:35
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7315/src/common Added Files: tcObjStream.cpp Log Message: --- NEW FILE: tcObjStream.cpp --- /* ** @file tcObjStream.cpp ** ** Copyright (C) 2004 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 */ #include "common/tcStream.h" #include "common/tcObjStream.h" #include <iostream> #include <sstream> // ------------------------- tcCreateStream ------------------------- /** * */ tcCreateStream::tcCreateStream(const char* data, std::streamsize count) : tcStream(data, count) { } /** * copy constructor */ tcCreateStream::tcCreateStream(const tcStream& stream) : tcStream(stream) { } /** * */ tcCreateStream::tcCreateStream() { } // ------------------------- tcCommandStream ------------------------- /** * */ bool tcCommandStream::GetAck() const { return isAck; } /** * Sets ack state of this command stream */ void tcCommandStream::SetAck(bool state) { isAck = state; } /** * */ tcCommandStream::tcCommandStream(const char* data, std::streamsize count) : tcStream(data, count), isAck(false) { } /** * copy constructor */ tcCommandStream::tcCommandStream(const tcStream& stream) : tcStream(stream) { } /** * */ tcCommandStream::tcCommandStream() : isAck(false) { } // ------------------------- tcUpdateStream ------------------------- /** * */ tcUpdateStream::tcUpdateStream(const char* data, std::streamsize count) : tcStream(data, count) { } /** * copy constructor */ tcUpdateStream::tcUpdateStream(const tcStream& stream) : tcStream(stream) { } tcUpdateStream::tcUpdateStream() { } |
|
From: Dewitt C. <ddc...@us...> - 2004-05-01 21:50:31
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7283/include/common Added Files: tcObjStream.h Log Message: --- NEW FILE: tcObjStream.h --- /* ** @file tcObjStream.h ** ** Copyright (C) 2004 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 _TCOBJSTREAM_H_ #define _TCOBJSTREAM_H_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "common/tcStream.h" /** * This file holds the classes derived from tcStream that are used for obj * updates for multiplayer. If these grow in complexity, split into separate * files. */ /** * Stream with all data necessary to create object (at client) */ class tcCreateStream : public tcStream { public: tcCreateStream(); tcCreateStream(const char* data, std::streamsize count); explicit tcCreateStream(const tcStream& stream); }; /** * Stream for basic update of object kinematic state */ class tcUpdateStream : public tcStream { public: tcUpdateStream(); tcUpdateStream(const char* data, std::streamsize count); explicit tcUpdateStream(const tcStream& stream); }; /** * Stream for update of command-related state, such as guidance * changes, AI orders */ class tcCommandStream : public tcStream { public: bool isAck; ///< set true to indicate acknowledgement command update bool GetAck() const; void SetAck(bool state); tcCommandStream(); tcCommandStream(const char* data, std::streamsize count); explicit tcCommandStream(const tcStream& stream); }; #endif |
|
From: Dewitt C. <ddc...@us...> - 2004-05-01 21:49:32
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7022/include/sim Modified Files: tcAirObject.h tcGameObject.h tcMissileObject.h tcPlatformObject.h tcWeaponObject.h Log Message: Index: tcWeaponObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcWeaponObject.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcWeaponObject.h 23 Apr 2004 00:14:56 -0000 1.2 --- tcWeaponObject.h 1 May 2004 21:49:24 -0000 1.3 *************** *** 27,30 **** --- 27,31 ---- class tcStream; + class tcUpdateStream; namespace Database *************** *** 49,54 **** long intendedTarget; ! virtual tcStream& operator<<(tcStream& stream); ! virtual tcStream& operator>>(tcStream& stream); tcWeaponObject(); --- 50,55 ---- long intendedTarget; ! virtual tcUpdateStream& operator<<(tcUpdateStream& stream); ! virtual tcUpdateStream& operator>>(tcUpdateStream& stream); tcWeaponObject(); Index: tcGameObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGameObject.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcGameObject.h 27 Apr 2004 01:24:17 -0000 1.17 --- tcGameObject.h 1 May 2004 21:49:24 -0000 1.18 *************** *** 43,46 **** --- 43,49 ---- class tcSimState; class tcStream; + class tcCommandStream; + class tcCreateStream; + class tcUpdateStream; /** *************** *** 93,100 **** // mpDBObject should always point to relevant data for current model class tcDatabaseObject *mpDBObject; ! double mfStatusTime; // timestamp for parameters ! tcKinematics mcKin; // position, motion, etc parameters ! tcTerrainInfo mcTerrain; // ground height ASL, water depth ! float mfDamageLevel; // 0 is no damage, up to toughness amount float RangeTo(tcGameObject& p); --- 96,103 ---- // mpDBObject should always point to relevant data for current model class tcDatabaseObject *mpDBObject; ! double mfStatusTime; ///< timestamp for parameters ! tcKinematics mcKin; ///< position, motion, etc parameters ! tcTerrainInfo mcTerrain; ///< ground height ASL, water depth ! float mfDamageLevel; ///< 0 is no damage, up to toughness amount float RangeTo(tcGameObject& p); *************** *** 109,115 **** virtual void PrintToFile(tcFile&); virtual void SaveToFile(tcFile& file); - virtual tcStream& operator<<(tcStream& stream); - virtual tcStream& operator>>(tcStream& stream); virtual void LoadFromFile(tcFile& file); --- 112,127 ---- virtual void PrintToFile(tcFile&); virtual void SaveToFile(tcFile& file); + 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; + virtual bool HasUnacknowledgedCommand() const; virtual void LoadFromFile(tcFile& file); Index: tcMissileObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcMissileObject.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcMissileObject.h 23 Apr 2004 00:14:56 -0000 1.7 --- tcMissileObject.h 1 May 2004 21:49:24 -0000 1.8 *************** *** 30,34 **** using namespace Aero; ! class tcStream; /** --- 30,34 ---- using namespace Aero; ! class tcUpdateStream; /** *************** *** 66,71 **** void LoadFromFile(tcFile& file); virtual void Serialize(tcFile& file, bool mbLoad); ! virtual tcStream& operator<<(tcStream& stream); ! virtual tcStream& operator>>(tcStream& stream); tcMissileObject(); --- 66,71 ---- void LoadFromFile(tcFile& file); virtual void Serialize(tcFile& file, bool mbLoad); ! virtual tcUpdateStream& operator<<(tcUpdateStream& stream); ! virtual tcUpdateStream& operator>>(tcUpdateStream& stream); tcMissileObject(); Index: tcAirObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcAirObject.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcAirObject.h 13 Feb 2004 01:31:32 -0000 1.6 --- tcAirObject.h 1 May 2004 21:49:24 -0000 1.7 *************** *** 25,28 **** --- 25,31 ---- #include "tcplatformobject.h" + class tcUpdateStream; + class tcCommandStream; + #define MAX_PITCH_RAD 0.875f *************** *** 30,40 **** { public: tcGenericDBObject *mpDBObject; int readyForLanding; ///< 1 if gear down/ready for landing, 0 otherwise virtual void ApplyRestrictions(); virtual void Clear(void); virtual void RandInitNear(float afLon_deg, float afLat_deg); ! virtual void SetLandingState(int state) {readyForLanding = state;} void SetPitchLimit(float limit_rad); virtual void UpdateClimb(float dt_s); --- 33,56 ---- { public: + enum + { + LANDING_CMD = 0x0001 + }; + tcGenericDBObject *mpDBObject; int readyForLanding; ///< 1 if gear down/ready for landing, 0 otherwise + bool newCommand; ///< flag to indicate new obj command since last update + /** + * bitfield to manage acknowledgement for command updates. + * appropriate bit is set when new command update is generated, + * bit is cleared when ack update is received. + */ + int commandStatus; + virtual void ApplyRestrictions(); virtual void Clear(void); virtual void RandInitNear(float afLon_deg, float afLat_deg); ! virtual void SetLandingState(int state); void SetPitchLimit(float limit_rad); virtual void UpdateClimb(float dt_s); *************** *** 46,49 **** --- 62,75 ---- virtual void Serialize(tcFile& file, bool mbLoad); + virtual tcCommandStream& operator<<(tcCommandStream& stream); + virtual tcUpdateStream& operator<<(tcUpdateStream& stream); + + virtual tcCommandStream& operator>>(tcCommandStream& stream); + virtual tcUpdateStream& operator>>(tcUpdateStream& stream); + + virtual void ClearNewCommand(); + virtual bool HasNewCommand() const; + virtual bool HasUnacknowledgedCommand() const; + tcAirObject(); tcAirObject(tcAirObject&); Index: tcPlatformObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPlatformObject.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcPlatformObject.h 29 Apr 2004 00:05:13 -0000 1.15 --- tcPlatformObject.h 1 May 2004 21:49:24 -0000 1.16 *************** *** 30,33 **** --- 30,36 ---- class tcStream; + class tcCommandStream; + class tcCreateStream; + class tcUpdateStream; namespace Database *************** *** 50,55 **** ALT_CMD = 0x0004, LAUNCH_CMD = 0x0008, ! AI_CMD = 0x0010, ! NEW_CMD = 0x8000 }; enum --- 53,57 ---- ALT_CMD = 0x0004, LAUNCH_CMD = 0x0008, ! AI_CMD = 0x0010 }; enum *************** *** 69,77 **** tsFormationParameters msFormationParameters; tcGenericDBObject *mpDBObject; /** ! * bits set when new command is received from UI (client) or from client via ! * mp interface (server). ! * bits cleared when matching state update received (client) or state update is ! * transmitted (server) */ int commandStatus; --- 71,80 ---- tsFormationParameters msFormationParameters; tcGenericDBObject *mpDBObject; + + bool newCommand; ///< flag to indicate new obj command since last update /** ! * bitfield to manage acknowledgement for command updates. ! * appropriate bit is set when new command update is generated, ! * bit is cleared when ack update is received. */ int commandStatus; *************** *** 106,111 **** void LoadFromFile(tcFile& file); virtual void Serialize(tcFile& file, bool mbLoad); ! virtual tcStream& operator<<(tcStream& stream); ! virtual tcStream& operator>>(tcStream& stream); --- 109,124 ---- void LoadFromFile(tcFile& file); virtual void Serialize(tcFile& file, bool mbLoad); ! ! 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; ! virtual bool HasUnacknowledgedCommand() const; *************** *** 120,124 **** virtual void ApplyRestrictions(void); virtual void SetFireControlSensors(); ! void LoadCommandParam(tcStream& stream, float& param, int flag); ///< used for multiplayer serialization virtual void Move(float dt_s); virtual void UpdateClimb(float dt_s) {}; --- 133,141 ---- virtual void ApplyRestrictions(void); virtual void SetFireControlSensors(); ! ! /// implements rules for updating command params over multiplayer connection ! void LoadCommandParam(tcCommandStream& stream, float& param, int& cmdStatus, int flag); ! void LoadCommandParam(tcCommandStream& stream, int& param, int& cmdStatus, int flag); ! virtual void Move(float dt_s); virtual void UpdateClimb(float dt_s) {}; |
|
From: Dewitt C. <ddc...@us...> - 2004-05-01 21:49:32
|
Update of /cvsroot/gcblue/gcb_wx/include/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7022/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.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcUpdateMessageHandler.h 27 Apr 2004 21:39:55 -0000 1.3 --- tcUpdateMessageHandler.h 1 May 2004 21:49:23 -0000 1.4 *************** *** 35,38 **** --- 35,41 ---- class tcGameObject; class tcStream; + class tcCommandStream; + class tcCreateStream; + class tcUpdateStream; #define BEGIN_NAMESPACE(x) namespace x { *************** *** 49,65 **** enum { ! CREATE = 0, ! UPDATE = 1, ! DESTROY = 2 }; ! static void AddCreate(tcGameObject* obj, tcStream& stream); static void AddDestroy(long id, tcStream& stream); ! static void AddUpdate(tcGameObject* obj, tcStream& stream); static void InitializeMessage(int messageType, tcStream& stream); virtual void Handle(int connectionId, unsigned messageSize, const unsigned char *data); ! void HandleCreate(tcStream& stream); void HandleDestroy(tcStream& stream); ! void HandleUpdate(tcStream& stream); tcUpdateMessageHandler(); --- 52,80 ---- enum { ! CREATE = 0, ///< creates a game obj ! CREATE_REQUEST = 1, ///< request create message for unknown obj ! UPDATE = 2, ///< routine update of a game obj ! COMMAND_UPDATE = 3, ///< command-related update ! COMMAND_ACK = 4, ///< ack of command-related update ! DESTROY = 5 ///< destroys game obj }; ! ! 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); static void AddDestroy(long id, tcStream& stream); ! static void AddUpdate(tcGameObject* obj, tcUpdateStream& stream); ! static void InitializeMessage(int messageType, tcStream& stream); virtual void Handle(int connectionId, unsigned messageSize, const unsigned char *data); ! void HandleCommandAck(tcCommandStream& stream); ///< command ack ! void HandleCommandUpdate(tcCommandStream& stream, int connectionId); ///< command update ! void HandleCreate(tcCreateStream& stream); ! void HandleCreateRequest(tcStream& stream); void HandleDestroy(tcStream& stream); ! void HandleUpdate(tcUpdateStream& stream); ! tcUpdateMessageHandler(); Index: tcMultiplayerInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcMultiplayerInterface.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcMultiplayerInterface.h 27 Apr 2004 21:39:55 -0000 1.11 --- tcMultiplayerInterface.h 1 May 2004 21:49:23 -0000 1.12 *************** *** 124,127 **** --- 124,128 ---- void UpdateExistingObjects(unsigned connIdx); void UpdateNewObjects(unsigned connIdx); + void UpdateObjectCommands(unsigned connIdx, bool updateUnack, bool clearNewCmdFlag); void UpdateObjects(); void UpdatePlayerInfo(); |
|
From: Dewitt C. <ddc...@us...> - 2004-05-01 21:49:31
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7022/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.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcStream.h 23 Apr 2004 00:14:56 -0000 1.3 --- tcStream.h 1 May 2004 21:49:23 -0000 1.4 *************** *** 1,7 **** #include <sstream> ! class tcStream : private std::stringstream { public: --- 1,33 ---- + /* + ** @file tcStream.h + ** + ** Copyright (C) 2004 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 _TCSTREAM_H_ + #define _TCSTREAM_H_ + + #if _MSC_VER > 1000 + #pragma once + #endif // _MSC_VER > 1000 #include <sstream> ! class tcStream : protected std::stringstream { public: *************** *** 46,53 **** tcStream(const char* data, std::streamsize count); ///< creates stream from char array tcStream(); private: int detailLevel; ! }; \ No newline at end of file --- 72,81 ---- tcStream(const char* data, std::streamsize count); ///< creates stream from char array + tcStream(const tcStream& stream); tcStream(); private: int detailLevel; + }; ! #endif \ No newline at end of file |
|
From: Dewitt C. <ddc...@us...> - 2004-05-01 21:49:17
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6949/src/sim Modified Files: tcAirObject.cpp tcGameObject.cpp tcMissileObject.cpp tcPlatformObject.cpp tcSurfaceObject.cpp tcWeaponObject.cpp Log Message: multiplayer Index: tcWeaponObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcWeaponObject.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcWeaponObject.cpp 23 Apr 2004 00:15:18 -0000 1.3 --- tcWeaponObject.cpp 1 May 2004 21:49:06 -0000 1.4 *************** *** 25,34 **** #include "tcSimState.h" #include "common/tcStream.h" /** ! * Load state from stream */ ! tcStream& tcWeaponObject::operator<<(tcStream& stream) { tcGameObject::operator<<(stream); --- 25,35 ---- #include "tcSimState.h" #include "common/tcStream.h" + #include "common/tcObjStream.h" /** ! * Load state from update stream */ ! tcUpdateStream& tcWeaponObject::operator<<(tcUpdateStream& stream) { tcGameObject::operator<<(stream); *************** *** 40,46 **** /** ! * Save state to stream */ ! tcStream& tcWeaponObject::operator>>(tcStream& stream) { tcGameObject::operator>>(stream); --- 41,47 ---- /** ! * Save state to update stream */ ! tcUpdateStream& tcWeaponObject::operator>>(tcUpdateStream& stream) { tcGameObject::operator>>(stream); Index: tcAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirObject.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcAirObject.cpp 13 Feb 2004 01:31:33 -0000 1.7 --- tcAirObject.cpp 1 May 2004 21:49:06 -0000 1.8 *************** *** 26,29 **** --- 26,30 ---- #include "tcAirObject.h" #include "tcGenericDBObject.h" + #include "common/tcObjStream.h" /******************************************************************************/ *************** *** 31,35 **** /******************************************************************************/ ! void tcAirObject::Clear() { tcPlatformObject::Clear(); } --- 32,91 ---- /******************************************************************************/ ! tcCommandStream& tcAirObject::operator<<(tcCommandStream& stream) ! { ! tcPlatformObject::operator<<(stream); ! ! LoadCommandParam(stream, readyForLanding, commandStatus, LANDING_CMD); ! ! return stream; ! } ! ! tcCommandStream& tcAirObject::operator>>(tcCommandStream& stream) ! { ! tcPlatformObject::operator>>(stream); ! ! stream << readyForLanding; ! ! return stream; ! } ! ! tcUpdateStream& tcAirObject::operator<<(tcUpdateStream& stream) ! { ! tcPlatformObject::operator<<(stream); ! ! stream >> maxPitch_rad; ! ! return stream; ! } ! ! tcUpdateStream& tcAirObject::operator>>(tcUpdateStream& stream) ! { ! tcPlatformObject::operator>>(stream); ! ! stream << maxPitch_rad; ! ! return stream; ! } ! ! ! void tcAirObject::ClearNewCommand() ! { ! tcPlatformObject::ClearNewCommand(); ! newCommand = false; ! } ! ! bool tcAirObject::HasNewCommand() const ! { ! return tcPlatformObject::HasNewCommand() || newCommand; ! } ! ! bool tcAirObject::HasUnacknowledgedCommand() const ! { ! return tcPlatformObject::HasUnacknowledgedCommand() || (commandStatus != 0); ! } ! ! ! void tcAirObject::Clear() ! { tcPlatformObject::Clear(); } *************** *** 51,61 **** mcKin.mfRoll_rad = 0; mfDamageLevel = 0; ! mcGS.SetHeading(mcKin.mfHeading_rad); ! mcGS.SetSpeed(mcKin.mfSpeed_kts); ! mcGS.SetAltitude(mcKin.mfAlt_m); readyForLanding = 0; } /** * @param limit_rad Pitch angle limit in radians. Must be positive. */ --- 107,127 ---- mcKin.mfRoll_rad = 0; mfDamageLevel = 0; ! SetHeading(mcKin.mfHeading_rad); ! SetSpeed(mcKin.mfSpeed_kts); ! SetAltitude(mcKin.mfAlt_m); readyForLanding = 0; } /** + * Sets landing state for air object (gear up/down) + */ + void tcAirObject::SetLandingState(int state) + { + readyForLanding = state; + commandStatus |= LANDING_CMD; + newCommand = true; + } + + /** * @param limit_rad Pitch angle limit in radians. Must be positive. */ *************** *** 73,81 **** } ! void tcAirObject::PrintToFile(tcFile& file) { tcPlatformObject::PrintToFile(file); } ! void tcAirObject::SaveToFile(tcFile& file) { tcPlatformObject::SaveToFile(file); file.Write(&maxPitch_rad,sizeof(maxPitch_rad)); --- 139,149 ---- } ! void tcAirObject::PrintToFile(tcFile& file) ! { tcPlatformObject::PrintToFile(file); } ! void tcAirObject::SaveToFile(tcFile& file) ! { tcPlatformObject::SaveToFile(file); file.Write(&maxPitch_rad,sizeof(maxPitch_rad)); *************** *** 83,87 **** } ! void tcAirObject::LoadFromFile(tcFile& file) { tcPlatformObject::LoadFromFile(file); file.Read(&maxPitch_rad,sizeof(maxPitch_rad)); --- 151,156 ---- } ! void tcAirObject::LoadFromFile(tcFile& file) ! { tcPlatformObject::LoadFromFile(file); file.Read(&maxPitch_rad,sizeof(maxPitch_rad)); *************** *** 89,93 **** } ! void tcAirObject::Serialize(tcFile& file, bool mbLoad) { if (mbLoad) { LoadFromFile(file); --- 158,163 ---- } ! void tcAirObject::Serialize(tcFile& file, bool mbLoad) ! { if (mbLoad) { LoadFromFile(file); *************** *** 98,102 **** } ! void tcAirObject::ApplyRestrictions() { // check for crash if ((mcKin.mfAlt_m <= 0)||(mcTerrain.mfHeight_m >= mcKin.mfAlt_m)) { --- 168,173 ---- } ! void tcAirObject::ApplyRestrictions() ! { // check for crash if ((mcKin.mfAlt_m <= 0)||(mcTerrain.mfHeight_m >= mcKin.mfAlt_m)) { *************** *** 163,167 **** } ! void tcAirObject::UpdateHeading(float dt_s) { float heading_start,heading_end,dh; float roll_start; --- 234,239 ---- } ! void tcAirObject::UpdateHeading(float dt_s) ! { float heading_start,heading_end,dh; float roll_start; *************** *** 224,228 **** } ! void tcAirObject::Update(double afStatusTime) { const float min_update_s = 0.0f; float dt_s = (float)(afStatusTime - mfStatusTime); --- 296,301 ---- } ! void tcAirObject::Update(double afStatusTime) ! { const float min_update_s = 0.0f; float dt_s = (float)(afStatusTime - mfStatusTime); *************** *** 255,258 **** --- 328,332 ---- tcAirObject::tcAirObject(void) + : newCommand(false), commandStatus(0) { mnModelType = MTYPE_FIXEDWING; *************** *** 268,278 **** */ tcAirObject::tcAirObject(tcGenericDBObject *obj) ! : tcPlatformObject(obj) { mpDBObject = obj; mnModelType = MTYPE_FIXEDWING; - SetAltitude(2000.0f); - SetHeading(75.0f); - SetSpeed(300.0f); readyForLanding = 0; maxPitch_rad = MAX_PITCH_RAD; --- 342,349 ---- */ tcAirObject::tcAirObject(tcGenericDBObject *obj) ! : tcPlatformObject(obj), newCommand(false), commandStatus(0) { mpDBObject = obj; mnModelType = MTYPE_FIXEDWING; readyForLanding = 0; maxPitch_rad = MAX_PITCH_RAD; Index: tcSurfaceObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSurfaceObject.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcSurfaceObject.cpp 13 Feb 2004 01:31:33 -0000 1.8 --- tcSurfaceObject.cpp 1 May 2004 21:49:06 -0000 1.9 *************** *** 131,137 **** mcKin.mfSpeed_kts = mpDBObject->mfMaxSpeed_kts; mfDamageLevel = 0; ! mcGS.SetHeading(mcKin.mfHeading_rad); ! mcGS.SetSpeed(mcKin.mfSpeed_kts); ! mcGS.SetAltitude(mcKin.mfAlt_m); } --- 131,137 ---- mcKin.mfSpeed_kts = mpDBObject->mfMaxSpeed_kts; mfDamageLevel = 0; ! SetHeading(mcKin.mfHeading_rad); ! SetSpeed(mcKin.mfSpeed_kts); ! SetAltitude(mcKin.mfAlt_m); } Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tcPlatformObject.cpp 29 Apr 2004 00:08:56 -0000 1.21 --- tcPlatformObject.cpp 1 May 2004 21:49:06 -0000 1.22 *************** *** 32,35 **** --- 32,36 ---- #include "tc3DModel.h" #include "common/tcStream.h" + #include "common/tcObjStream.h" using namespace AI; *************** *** 289,295 **** } /******************************************************************************/ ! void tcPlatformObject::Clear(void) { tcGameObject::Clear(); msFormationParameters.mbFormation = false; msFormationParameters.mnFormationLeader = NULL_INDEX; --- 290,297 ---- } /******************************************************************************/ ! void tcPlatformObject::Clear() { tcGameObject::Clear(); + msFormationParameters.mbFormation = false; msFormationParameters.mnFormationLeader = NULL_INDEX; *************** *** 299,302 **** --- 301,307 ---- fuel_kg = 0; lastHeadingDelta = 0; + + newCommand = false; + commandStatus = 0; } *************** *** 339,346 **** void tcPlatformObject::SetAltitude(float new_altitude_m) { - if ((clientMode) && (commandStatus & ALT_CMD)) return; - mcGS.SetAltitude(new_altitude_m); ! commandStatus |= (ALT_CMD | NEW_CMD); } --- 344,350 ---- void tcPlatformObject::SetAltitude(float new_altitude_m) { mcGS.SetAltitude(new_altitude_m); ! commandStatus |= ALT_CMD; ! newCommand = true; } *************** *** 350,357 **** void tcPlatformObject::SetHeading(float afNewHeading) { - if ((clientMode) && (commandStatus & HEADING_CMD)) return; - mcGS.SetHeading(afNewHeading); ! commandStatus |= (HEADING_CMD | NEW_CMD); } --- 354,360 ---- void tcPlatformObject::SetHeading(float afNewHeading) { mcGS.SetHeading(afNewHeading); ! commandStatus |= HEADING_CMD; ! newCommand = true; } *************** *** 363,370 **** void tcPlatformObject::SetSpeed(float afNewSpeed) { - if ((clientMode) && (commandStatus & SPEED_CMD)) return; - mcGS.SetSpeed(afNewSpeed); ! commandStatus |= (SPEED_CMD | NEW_CMD); } --- 366,372 ---- void tcPlatformObject::SetSpeed(float afNewSpeed) { mcGS.SetSpeed(afNewSpeed); ! commandStatus |= SPEED_CMD; ! newCommand = true; } *************** *** 390,394 **** /******************************************************************************/ ! void tcPlatformObject::RandInitNear(float afLon_deg, float afLat_deg) { // tcGameObject::RandInitNear(afLon,afLat); if (mpDBObject == NULL) {return;} --- 392,397 ---- /******************************************************************************/ ! void tcPlatformObject::RandInitNear(float afLon_deg, float afLat_deg) ! { // tcGameObject::RandInitNear(afLon,afLat); if (mpDBObject == NULL) {return;} *************** *** 406,412 **** mcKin.mfRoll_rad = 0; mfDamageLevel = 0; ! mcGS.SetHeading(mcKin.mfHeading_rad); ! mcGS.SetSpeed(mcKin.mfSpeed_kts); ! mcGS.SetAltitude(mcKin.mfAlt_m); fuel_kg = mpDBObject->mfFuelCapacity_kg; lastHeadingDelta = 0; --- 409,415 ---- mcKin.mfRoll_rad = 0; mfDamageLevel = 0; ! SetHeading(mcKin.mfHeading_rad); ! SetSpeed(mcKin.mfSpeed_kts); ! SetAltitude(mcKin.mfAlt_m); fuel_kg = mpDBObject->mfFuelCapacity_kg; lastHeadingDelta = 0; *************** *** 500,524 **** * a successful acknowledge of the command. */ ! void tcPlatformObject::LoadCommandParam(tcStream& stream, float& param, int flag) { ! if (commandStatus & flag) { ! float temp; ! stream >> temp; ! if (temp == param) { ! commandStatus &= (~flag); // clear flag, successful ack } } ! else { ! stream >> param; } } /** ! * Loads state from stream */ ! tcStream& tcPlatformObject::operator<<(tcStream& stream) { tcGameObject::operator<<(stream); --- 503,567 ---- * a successful acknowledge of the command. */ ! void tcPlatformObject::LoadCommandParam(tcCommandStream& stream, float& param, int& cmdStatus, int flag) { ! float temp; ! stream >> temp; // read into temporary variable ! ! if (stream.GetAck()) { ! if ((cmdStatus & flag) && (temp == param)) { ! cmdStatus &= (~flag); // clear flag, successful ack } } ! else // not an ack { ! if (clientMode && (cmdStatus & flag)) ! { ! // ignore update ! } ! else ! { ! param = temp; // apply update ! cmdStatus &= (~flag); // clear flag ! } ! } } /** ! * version that takes int param */ ! void tcPlatformObject::LoadCommandParam(tcCommandStream& stream, int& param, int& cmdStatus, int flag) ! { ! int temp; ! stream >> temp; // read into temporary variable ! ! if (stream.GetAck()) ! { ! if ((cmdStatus & flag) && (temp == param)) ! { ! cmdStatus &= (~flag); // clear flag, successful ack ! } ! } ! else // not an ack ! { ! if (clientMode && (cmdStatus & flag)) ! { ! // ignore update ! } ! else ! { ! param = temp; // apply update ! cmdStatus &= (~flag); // clear flag ! } ! ! } ! } ! ! /** ! * Loads state from command stream ! */ ! tcCommandStream& tcPlatformObject::operator<<(tcCommandStream& stream) { tcGameObject::operator<<(stream); *************** *** 529,535 **** if (updateMask & UPDATE_GUIDANCE) { ! LoadCommandParam(stream, mcGS.mfGoalHeading_deg, HEADING_CMD); ! LoadCommandParam(stream, mcGS.mfGoalSpeed_kts, SPEED_CMD); ! LoadCommandParam(stream, mcGS.mfGoalAltitude_m, ALT_CMD); stream >> mcGS.mbIntercept; --- 572,578 ---- if (updateMask & UPDATE_GUIDANCE) { ! LoadCommandParam(stream, mcGS.mfGoalHeading_deg, commandStatus, HEADING_CMD); ! LoadCommandParam(stream, mcGS.mfGoalSpeed_kts, commandStatus, SPEED_CMD); ! LoadCommandParam(stream, mcGS.mfGoalAltitude_m, commandStatus, ALT_CMD); stream >> mcGS.mbIntercept; *************** *** 544,558 **** /** ! * Saves state to stream */ ! tcStream& tcPlatformObject::operator>>(tcStream& stream) { tcGameObject::operator>>(stream); unsigned char updateMask = 0; ! if (commandStatus & NEW_CMD) ! { ! updateMask = UPDATE_GUIDANCE; ! } stream << updateMask; --- 587,600 ---- /** ! * Saves state to command stream */ ! tcCommandStream& tcPlatformObject::operator>>(tcCommandStream& stream) { tcGameObject::operator>>(stream); unsigned char updateMask = 0; ! ! updateMask = UPDATE_GUIDANCE; ! stream << updateMask; *************** *** 570,576 **** --- 612,677 ---- } + + return stream; + } + + /** + * Loads state from create stream + */ + tcCreateStream& tcPlatformObject::operator<<(tcCreateStream& stream) + { + tcGameObject::operator<<(stream); + + return stream; + } + + /** + * Saves state to create stream + */ + tcCreateStream& tcPlatformObject::operator>>(tcCreateStream& stream) + { + tcGameObject::operator>>(stream); + return stream; } + + /** + * Loads state from update stream + */ + tcUpdateStream& tcPlatformObject::operator<<(tcUpdateStream& stream) + { + tcGameObject::operator<<(stream); + + return stream; + } + + /** + * Saves state to update stream + */ + tcUpdateStream& tcPlatformObject::operator>>(tcUpdateStream& stream) + { + tcGameObject::operator>>(stream); + + return stream; + } + + void tcPlatformObject::ClearNewCommand() + { + newCommand = false; + } + + bool tcPlatformObject::HasNewCommand() const + { + return newCommand; + } + + bool tcPlatformObject::HasUnacknowledgedCommand() const + { + return (commandStatus != 0); + } + + + /******************************************************************************/ tcPlatformObject::tcPlatformObject() *************** *** 619,623 **** tcPlatformObject::tcPlatformObject(tcGenericDBObject *obj) ! : tcGameObject(obj) { using namespace Database; --- 720,724 ---- tcPlatformObject::tcPlatformObject(tcGenericDBObject *obj) ! : tcGameObject(obj), newCommand(false), commandStatus(0) { using namespace Database; *************** *** 701,704 **** --- 802,808 ---- msTargetDatum = o.msTargetDatum; + newCommand = o.newCommand; + commandStatus = o.commandStatus; + // copy sensor state array mapSensorState.clear(); Index: tcGameObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameObject.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcGameObject.cpp 27 Apr 2004 01:24:25 -0000 1.14 --- tcGameObject.cpp 1 May 2004 21:49:06 -0000 1.15 *************** *** 30,33 **** --- 30,34 ---- #include "tcSimState.h" #include "common/tcStream.h" + #include "common/tcObjStream.h" *************** *** 267,291 **** /** ! * Loads state from stream */ ! tcStream& tcGameObject::operator<<(tcStream& stream) { ! rel_pos << stream; stream >> mnModelType; ! stream >> mnID; mzClass << stream; ! stream >> mnDBKey; mzUnit << stream; stream >> mnAlliance; - stream >> mfStatusTime; - - mcKin << stream; - - stream >> mfDamageLevel; return stream; --- 268,303 ---- /** ! * Loads state from command stream */ ! tcCommandStream& tcGameObject::operator<<(tcCommandStream& stream) { ! // no command updates for tcGameObject ! return stream; ! } ! ! /** ! * Saves state to command stream ! */ ! tcCommandStream& tcGameObject::operator>>(tcCommandStream& stream) ! { ! // no command updates for tcGameObject ! return stream; ! } + /** + * Loads state from create stream + */ + tcCreateStream& tcGameObject::operator<<(tcCreateStream& stream) + { stream >> mnModelType; ! stream >> mnID; // redundant, can remove later mzClass << stream; ! stream >> mnDBKey; // redundant, can remove later mzUnit << stream; stream >> mnAlliance; return stream; *************** *** 293,312 **** /** ! * Saves state to stream */ ! tcStream& tcGameObject::operator>>(tcStream& stream) { - rel_pos >> stream; - stream << mnModelType; ! stream << mnID; mzClass >> stream; ! stream << mnDBKey; mzUnit >> stream; stream << mnAlliance; stream << mfStatusTime; --- 305,359 ---- /** ! * Saves state to create stream */ ! tcCreateStream& tcGameObject::operator>>(tcCreateStream& stream) { stream << mnModelType; ! stream << mnID; // redundant, can remove later mzClass >> stream; ! stream << mnDBKey; // redundant, can remove later mzUnit >> stream; stream << mnAlliance; + + return stream; + } + + /** + * Loads state from update stream + */ + tcUpdateStream& tcGameObject::operator<<(tcUpdateStream& stream) + { + unsigned char hasParent; + stream >> hasParent; + if (hasParent) + { + rel_pos << stream; + } + + stream >> mfStatusTime; + + mcKin << stream; + + stream >> mfDamageLevel; + + return stream; + } + + /** + * Saves state to update stream + */ + tcUpdateStream& tcGameObject::operator>>(tcUpdateStream& stream) + { + unsigned char hasParent = (parent != 0); + stream << hasParent; + if (hasParent) + { + rel_pos >> stream; + } + stream << mfStatusTime; *************** *** 318,321 **** --- 365,382 ---- } + void tcGameObject::ClearNewCommand() + { + } + + bool tcGameObject::HasNewCommand() const + { + return false; + } + + bool tcGameObject::HasUnacknowledgedCommand() const + { + return false; + } + /** Index: tcMissileObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMissileObject.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcMissileObject.cpp 27 Apr 2004 01:24:25 -0000 1.10 --- tcMissileObject.cpp 1 May 2004 21:49:06 -0000 1.11 *************** *** 20,28 **** #include "tcMissileObject.h" #include "common/tcStream.h" /** ! * Load state from stream */ ! tcStream& tcMissileObject::operator<<(tcStream& stream) { tcWeaponObject::operator<<(stream); --- 20,29 ---- #include "tcMissileObject.h" #include "common/tcStream.h" + #include "common/tcObjStream.h" /** ! * Load state from update stream */ ! tcUpdateStream& tcMissileObject::operator<<(tcUpdateStream& stream) { tcWeaponObject::operator<<(stream); *************** *** 44,50 **** /** ! * Save state to stream */ ! tcStream& tcMissileObject::operator>>(tcStream& stream) { tcWeaponObject::operator>>(stream); --- 45,51 ---- /** ! * Save state to update stream */ ! tcUpdateStream& tcMissileObject::operator>>(tcUpdateStream& stream) { tcWeaponObject::operator>>(stream); |
|
From: Dewitt C. <ddc...@us...> - 2004-05-01 21:49:16
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6949/src/common Modified Files: tcStream.cpp Log Message: multiplayer Index: tcStream.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcStream.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcStream.cpp 23 Apr 2004 00:15:16 -0000 1.3 --- tcStream.cpp 1 May 2004 21:49:06 -0000 1.4 *************** *** 1,3 **** --- 1,22 ---- + /* + ** @file tcStream.cpp + ** + ** Copyright (C) 2004 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 + */ *************** *** 15,18 **** --- 34,45 ---- /** + * copy constructor + */ + tcStream::tcStream(const tcStream& stream) + : std::stringstream(stream.str()) + { + } + + /** * default constructor */ |
|
From: Dewitt C. <ddc...@us...> - 2004-05-01 21:49:15
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6949/src/network Modified Files: tcMultiplayerInterface.cpp tcUpdateMessageHandler.cpp Log Message: multiplayer Index: tcUpdateMessageHandler.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcUpdateMessageHandler.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcUpdateMessageHandler.cpp 27 Apr 2004 21:45:14 -0000 1.4 --- tcUpdateMessageHandler.cpp 1 May 2004 21:49:06 -0000 1.5 *************** *** 33,47 **** #include "wxcommands.h" #include "common/tcStream.h" BEGIN_NAMESPACE(network) /** * Saves data to create obj to stream. */ ! void tcUpdateMessageHandler::AddCreate(tcGameObject* obj, tcStream& stream) { stream << obj->mnID; stream << obj->mnDBKey; ! stream << obj->mnAlliance; } --- 33,79 ---- #include "wxcommands.h" #include "common/tcStream.h" + #include "common/tcObjStream.h" BEGIN_NAMESPACE(network) /** + * stream must have SetAck(true) called first + */ + void tcUpdateMessageHandler::AddCommandAck(tcGameObject* obj, tcCommandStream& stream) + { + wxASSERT(stream.GetAck()); + + stream << obj->mnID; // write id + *obj >> stream; + + } + + /** + * + */ + void tcUpdateMessageHandler::AddCommandUpdate(tcGameObject* obj, tcCommandStream& stream) + { + wxASSERT(!stream.GetAck()); + + stream << obj->mnID; // write id + *obj >> stream; + } + + /** * Saves data to create obj to stream. */ ! void tcUpdateMessageHandler::AddCreate(tcGameObject* obj, tcCreateStream& stream) { stream << obj->mnID; stream << obj->mnDBKey; ! *obj >> stream; ! } ! ! /** ! * ! */ ! void tcUpdateMessageHandler::AddCreateRequest(long id, tcStream& stream) ! { ! stream << id; } *************** *** 59,63 **** * @see tcUpdateMessageHandler::AddCreate */ ! void tcUpdateMessageHandler::AddUpdate(tcGameObject* obj, tcStream& stream) { stream << obj->mnID; // write id --- 91,95 ---- * @see tcUpdateMessageHandler::AddCreate */ ! void tcUpdateMessageHandler::AddUpdate(tcGameObject* obj, tcUpdateStream& stream) { stream << obj->mnID; // write id *************** *** 78,85 **** --- 110,123 ---- case CREATE: break; + case CREATE_REQUEST: + break; case UPDATE: // update messages start with time and time acceleration info tcSimState::Get()->SaveTimeToStream(stream); break; + case COMMAND_UPDATE: + break; + case COMMAND_ACK: + break; case DESTROY: break; *************** *** 95,108 **** void tcUpdateMessageHandler::Handle(int connectionId, unsigned messageSize, const unsigned char *data) { - // server ignores update messages - if (isServer) - { - fprintf(stderr, "Warning - update message received by server\n"); - return; - } tcSimState* simState = tcSimState::Get(); wxASSERT(simState); ! tcStream stream((const char*)data, messageSize); --- 133,140 ---- void tcUpdateMessageHandler::Handle(int connectionId, unsigned messageSize, const unsigned char *data) { tcSimState* simState = tcSimState::Get(); wxASSERT(simState); ! // end up creating stream twice. could split to use multiple handlers to avoid this tcStream stream((const char*)data, messageSize); *************** *** 113,123 **** { case CREATE: ! HandleCreate(stream); break; case UPDATE: ! HandleUpdate(stream); break; case DESTROY: ! HandleDestroy(stream); break; default: --- 145,181 ---- { case CREATE: ! { ! tcCreateStream stream((const char*)data, messageSize); ! stream >> messageType; ! HandleCreate(stream); ! } break; case UPDATE: ! { ! tcUpdateStream stream((const char*)data, messageSize); ! stream >> messageType; ! HandleUpdate(stream); ! } ! break; ! case COMMAND_UPDATE: ! { ! tcCommandStream stream((const char*)data, messageSize); ! stream >> messageType; ! HandleCommandUpdate(stream, connectionId); ! } ! break; ! case COMMAND_ACK: ! { ! tcCommandStream stream((const char*)data, messageSize); ! stream >> messageType; ! HandleCommandAck(stream); ! } break; case DESTROY: ! { ! tcStream stream((const char*)data, messageSize); ! stream >> messageType; ! HandleDestroy(stream); ! } break; default: *************** *** 129,135 **** /** * Handle CREATE update message */ ! void tcUpdateMessageHandler::HandleCreate(tcStream& stream) { tcSimState* simState = tcSimState::Get(); --- 187,282 ---- /** + * Handle COMMAND_ACK + */ + void tcUpdateMessageHandler::HandleCommandAck(tcCommandStream& stream) + { + stream.SetAck(true); + + tcSimState* simState = tcSimState::Get(); + wxASSERT(simState); + + fprintf(stdout, "Upding obj cmd acks, time %.1f: ", simState->GetTime()); + + long id; + + while ((stream >> id).eof() == false) + { + // lookup obj + tcGameObject* obj = simState->GetObject(id); + + // update obj if it exists, otherwise create object + if (obj) + { + *obj << stream; + fprintf(stdout, "%d ", id); + } + else + { + fprintf(stderr, "Error - HandleCommandAck - obj %d not found\n", id); + fprintf(stdout, "\n"); + return; + } + } + fprintf(stdout, "\n"); + + } + + /** + * Handle COMMAND_UPDATE + */ + void tcUpdateMessageHandler::HandleCommandUpdate(tcCommandStream& stream, int connectionId) + { + tcSimState* simState = tcSimState::Get(); + wxASSERT(simState); + + + // Init ack messag + tcCommandStream commandStream; + tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::COMMAND_ACK, commandStream); + commandStream.SetAck(true); + + unsigned nAcks = 0; + + fprintf(stdout, "Updating obj cmds, time %.1f: ", simState->GetTime()); + + long id; + + while ((stream >> id).eof() == false) + { + // lookup obj + tcGameObject* obj = simState->GetObject(id); + + // update obj if it exists, otherwise create object + if (obj) + { + *obj << stream; + + tcUpdateMessageHandler::AddCommandAck(obj, commandStream); + nAcks++; + + fprintf(stdout, "%d ", id); + } + else + { + fprintf(stderr, "Error - HandleCommandUpdate - obj %d not found\n", id); + fprintf(stdout, "\n"); + return; + } + } + fprintf(stdout, "\n"); + + if (nAcks) + { + tcMultiplayerInterface::Get()->SendUpdateMessage(connectionId, commandStream); + #ifdef _DEBUG + fprintf(stdout, "Sent obj command update ack, time: %.1f\n", simState->GetTime()); + #endif + } + } + + /** * Handle CREATE update message */ ! void tcUpdateMessageHandler::HandleCreate(tcCreateStream& stream) { tcSimState* simState = tcSimState::Get(); *************** *** 141,150 **** long id; long databaseId; - unsigned char alliance; while ((stream >> id).eof() == false) { stream >> databaseId; - stream >> alliance; // lookup obj --- 288,295 ---- *************** *** 163,169 **** { obj = simState->CreateGameObject(dbObj); ! obj->mnAlliance = alliance; simState->AddPlatformWithKey(obj, id); ! fprintf(stdout, "%d (%d)", id, alliance); } else --- 308,314 ---- { obj = simState->CreateGameObject(dbObj); ! *obj << stream; simState->AddPlatformWithKey(obj, id); ! fprintf(stdout, "%d (%d)", id, obj->mnAlliance); } else *************** *** 179,183 **** /** ! * Handle DESTROY update message */ void tcUpdateMessageHandler::HandleDestroy(tcStream& stream) --- 324,335 ---- /** ! * Handle CREATE_REQUEST message (server only) ! */ ! void tcUpdateMessageHandler::HandleCreateRequest(tcStream& stream) ! { ! } ! ! /** ! * Handle DESTROY update message (client only) */ void tcUpdateMessageHandler::HandleDestroy(tcStream& stream) *************** *** 212,218 **** /** ! * Handle UPDATE update message */ ! void tcUpdateMessageHandler::HandleUpdate(tcStream& stream) { tcSimState* simState = tcSimState::Get(); --- 364,370 ---- /** ! * Handle UPDATE update message (client only) */ ! void tcUpdateMessageHandler::HandleUpdate(tcUpdateStream& stream) { tcSimState* simState = tcSimState::Get(); *************** *** 248,251 **** --- 400,405 ---- + + tcUpdateMessageHandler::tcUpdateMessageHandler() { Index: tcMultiplayerInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMultiplayerInterface.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcMultiplayerInterface.cpp 27 Apr 2004 21:45:14 -0000 1.11 --- tcMultiplayerInterface.cpp 1 May 2004 21:49:06 -0000 1.12 *************** *** 32,35 **** --- 32,36 ---- #include "network/tcUpdateMessageHandler.h" #include "common/tcStream.h" + #include "common/tcObjStream.h" #include <iostream> #include <queue> *************** *** 228,231 **** --- 229,234 ---- if (IsServer()) { // server-specific handlers + // server needs update msg handler to handle command updates from client + AddMessageHandler(MSG_UPDATE, new tcUpdateMessageHandler()); } else *************** *** 638,641 **** --- 641,700 ---- } + void tcMultiplayerInterface::UpdateObjectCommands(unsigned connIdx, bool updateUnack, bool clearNewCmdFlag) + { + int connId = GetConnectionId(connIdx); + + tcPlayerStatus& pstatus = GetPlayerStatus(connId); + + tcSimState* simState = tcSimState::Get(); + wxASSERT(simState); + double t = simState->GetTime(); + + // iterate through all game objects and build command update stream + tcCommandStream commandStream; + tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::COMMAND_UPDATE, commandStream); + + tcGameObjIterator iter; + unsigned updateCount = 0; + for (iter.First();iter.NotDone();iter.Next()) + { + tcGameObject* obj = iter.Get(); + if ((pstatus.alliance == obj->mnAlliance) || !IsServer()) + { + if (obj->HasNewCommand() || (updateUnack && obj->HasUnacknowledgedCommand())) + { + tcUpdateMessageHandler::AddCommandUpdate(obj, commandStream); + if (clearNewCmdFlag) obj->ClearNewCommand(); + updateCount++; + #ifdef _DEBUG + fprintf(stdout, "%d ", obj->mnID); + #endif + } + } + + // create new message if updateCount gets too large + if (updateCount >= 4) + { + SendUpdateMessage(connId, commandStream); + #ifdef _DEBUG + fprintf(stdout, "Sent obj command update, time: %.1f\n", t); + #endif + commandStream.clear(); + tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::COMMAND_UPDATE, commandStream); + updateCount = 0; + } + } + + if (updateCount) + { + SendUpdateMessage(connId, commandStream); + #ifdef _DEBUG + fprintf(stdout, "Sent obj command update, time: %.1f\n", t); + #endif + } + } + + + /** * Server only -- send updates for existing objects to client *************** *** 653,658 **** // iterate through all game objects and build update stream ! tcStream stream; ! tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::UPDATE, stream); tcGameObjIterator iter; --- 712,717 ---- // iterate through all game objects and build update stream ! tcUpdateStream updateStream; ! tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::UPDATE, updateStream); tcGameObjIterator iter; *************** *** 666,670 **** if (pstatus.GetLastUpdate(obj->mnID, lastUpdate)) { ! tcUpdateMessageHandler::AddUpdate(obj, stream); pstatus.SetUpdate(obj->mnID, t); updateCount++; --- 725,730 ---- if (pstatus.GetLastUpdate(obj->mnID, lastUpdate)) { ! tcUpdateMessageHandler::AddUpdate(obj, updateStream); ! pstatus.SetUpdate(obj->mnID, t); updateCount++; *************** *** 675,684 **** if (updateCount >= 4) { ! SendUpdateMessage(connId, stream); #ifdef _DEBUG fprintf(stdout, "Sent obj state update, time: %.1f\n", t); #endif ! stream.clear(); ! tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::UPDATE, stream); updateCount = 0; } --- 735,744 ---- if (updateCount >= 4) { ! SendUpdateMessage(connId, updateStream); #ifdef _DEBUG fprintf(stdout, "Sent obj state update, time: %.1f\n", t); #endif ! updateStream.clear(); ! tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::UPDATE, updateStream); updateCount = 0; } *************** *** 687,691 **** if (updateCount) { ! SendUpdateMessage(connId, stream); #ifdef _DEBUG fprintf(stdout, "Sent obj state update, time: %.1f\n", t); --- 747,751 ---- if (updateCount) { ! SendUpdateMessage(connId, updateStream); #ifdef _DEBUG fprintf(stdout, "Sent obj state update, time: %.1f\n", t); *************** *** 705,709 **** // iterate through all game objects and build update stream ! tcStream stream; tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::CREATE, stream); --- 765,769 ---- // iterate through all game objects and build update stream ! tcCreateStream stream; tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::CREATE, stream); *************** *** 747,752 **** static long lastAccel = 0; // state of tcSimState::timeAcceleration at last update - if (!IsServer()) return; - tcSimState* simState = tcSimState::Get(); wxASSERT(simState); --- 807,810 ---- *************** *** 755,774 **** double t = simState->GetTime(); // update if enough time elapsed OR if timeAcceleration state has changed ! if ((t <= lastUpdate + 2.0) && (accel == lastAccel)) return; lastUpdate = t; lastAccel = accel; - // iterate through all game objects and build update stream - tcStream stream; - - unsigned nConnections = GetNumConnections(); - for (unsigned n=0;n<nConnections;n++) { ! UpdateDestroyedObjects(n); ! UpdateNewObjects(n); ! UpdateExistingObjects(n); } --- 813,843 ---- double t = simState->GetTime(); + unsigned nConnections = GetNumConnections(); + // update if enough time elapsed OR if timeAcceleration state has changed ! if ((t <= lastUpdate + 2.0) && (accel == lastAccel)) ! { ! // always do new cmd update ! for (unsigned n=0;n<nConnections;n++) ! { ! bool clearNewCmdFlag = (n == nConnections - 1); ! UpdateObjectCommands(n, false, clearNewCmdFlag); ! } ! return; ! } lastUpdate = t; lastAccel = accel; for (unsigned n=0;n<nConnections;n++) { ! if (IsServer()) ! { ! UpdateDestroyedObjects(n); ! UpdateNewObjects(n); ! UpdateExistingObjects(n); ! } ! bool clearNewCmdFlag = (n == nConnections - 1); ! UpdateObjectCommands(n, true, clearNewCmdFlag); } *************** *** 849,853 **** tcMultiplayerInterface::tcMultiplayerInterface() ! : tcpChat(true), myName("Somebody"), evtHandler(0) { networkInterface = new tcNetworkInterface(); --- 918,922 ---- tcMultiplayerInterface::tcMultiplayerInterface() ! : tcpChat(true), myName("Server"), evtHandler(0) { networkInterface = new tcNetworkInterface(); |
|
From: Dewitt C. <ddc...@us...> - 2004-05-01 21:48:58
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6881/docs Modified Files: CHANGES.txt Log Message: Index: CHANGES.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/CHANGES.txt,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** CHANGES.txt 27 Apr 2004 22:21:43 -0000 1.16 --- CHANGES.txt 1 May 2004 21:48:44 -0000 1.17 *************** *** 3,6 **** --- 3,10 ---- 0.6 --------------------------------------------------------------------- + *** 2004-05-01 Dewitt Colclough *** + - Added capability for multiplayer client to control heading, speed, altitude of + basic platform objects. + *** 2004-04-28 Xavi Rubio *** - Linux compatibility fixes in network/scriptinterface dirs |
|
From: Dewitt C. <ddc...@us...> - 2004-04-29 00:09:09
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23476/src/sim Modified Files: tcPlatformObject.cpp Log Message: Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tcPlatformObject.cpp 13 Apr 2004 21:37:41 -0000 1.20 --- tcPlatformObject.cpp 29 Apr 2004 00:08:56 -0000 1.21 *************** *** 335,338 **** --- 335,360 ---- /** + * Sets goal altitude in guidance + */ + void tcPlatformObject::SetAltitude(float new_altitude_m) + { + if ((clientMode) && (commandStatus & ALT_CMD)) return; + + mcGS.SetAltitude(new_altitude_m); + commandStatus |= (ALT_CMD | NEW_CMD); + } + + /** + * Sets goal heading in guidance + */ + void tcPlatformObject::SetHeading(float afNewHeading) + { + if ((clientMode) && (commandStatus & HEADING_CMD)) return; + + mcGS.SetHeading(afNewHeading); + commandStatus |= (HEADING_CMD | NEW_CMD); + } + + /** * Set goal speed to afNewSpeed. If goal speed * is greater than max speed then set goal to *************** *** 341,349 **** void tcPlatformObject::SetSpeed(float afNewSpeed) { ! if (afNewSpeed > mpDBObject->mfMaxSpeed_kts) ! { ! afNewSpeed = mpDBObject->mfMaxSpeed_kts; ! } mcGS.SetSpeed(afNewSpeed); } --- 363,370 ---- void tcPlatformObject::SetSpeed(float afNewSpeed) { ! if ((clientMode) && (commandStatus & SPEED_CMD)) return; ! mcGS.SetSpeed(afNewSpeed); + commandStatus |= (SPEED_CMD | NEW_CMD); } *************** *** 471,474 **** --- 492,520 ---- } + + /** + * Used with multiplayer client to load a parameter from the server that + * the client can command e.g. heading, speed, altitude. If a client command + * request is outstanding and the server update does not match, then the update + * is ignored. If the update matches, the command flag is cleared representing + * a successful acknowledge of the command. + */ + void tcPlatformObject::LoadCommandParam(tcStream& stream, float& param, int flag) + { + if (commandStatus & flag) + { + float temp; + stream >> temp; + if (temp == param) + { + commandStatus &= (~flag); // clear flag, successful ack + } + } + else + { + stream >> param; + } + } + /** * Loads state from stream *************** *** 478,482 **** tcGameObject::operator<<(stream); ! mcGS << stream; return stream; --- 524,542 ---- tcGameObject::operator<<(stream); ! unsigned char updateMask; ! stream >> updateMask; ! ! if (updateMask & UPDATE_GUIDANCE) ! { ! LoadCommandParam(stream, mcGS.mfGoalHeading_deg, HEADING_CMD); ! LoadCommandParam(stream, mcGS.mfGoalSpeed_kts, SPEED_CMD); ! LoadCommandParam(stream, mcGS.mfGoalAltitude_m, ALT_CMD); ! ! stream >> mcGS.mbIntercept; ! if (mcGS.mbIntercept) ! { ! mcGS.mcKinIntercept << stream; ! } ! } return stream; *************** *** 490,494 **** tcGameObject::operator>>(stream); ! mcGS >> stream; return stream; --- 550,572 ---- tcGameObject::operator>>(stream); ! unsigned char updateMask = 0; ! if (commandStatus & NEW_CMD) ! { ! updateMask = UPDATE_GUIDANCE; ! } ! stream << updateMask; ! ! if (updateMask & UPDATE_GUIDANCE) ! { ! stream << mcGS.mfGoalHeading_deg; ! stream << mcGS.mfGoalSpeed_kts; ! stream << mcGS.mfGoalAltitude_m; ! ! stream << mcGS.mbIntercept; ! if (mcGS.mbIntercept) ! { ! mcGS.mcKinIntercept >> stream; ! } ! } return stream; |
|
From: Dewitt C. <ddc...@us...> - 2004-04-29 00:05:22
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22764/include/scriptinterface Modified Files: tcPlatformInterface.h Log Message: Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcPlatformInterface.h 27 Apr 2004 22:03:01 -0000 1.18 --- tcPlatformInterface.h 29 Apr 2004 00:05:12 -0000 1.19 *************** *** 290,291 **** --- 290,292 ---- }; } + #endif \ No newline at end of file |
|
From: Dewitt C. <ddc...@us...> - 2004-04-29 00:05:22
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22764/include/sim Modified Files: tcPlatformObject.h Log Message: Index: tcPlatformObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPlatformObject.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcPlatformObject.h 13 Apr 2004 00:24:37 -0000 1.14 --- tcPlatformObject.h 29 Apr 2004 00:05:13 -0000 1.15 *************** *** 44,47 **** --- 44,61 ---- { public: + enum + { + HEADING_CMD = 0x0001, + SPEED_CMD = 0x0002, + ALT_CMD = 0x0004, + LAUNCH_CMD = 0x0008, + AI_CMD = 0x0010, + NEW_CMD = 0x8000 + }; + enum + { + UPDATE_GUIDANCE = 0x01 + }; + float fuel_kg; ///< current fuel tcLauncherState mcLauncherState; *************** *** 55,58 **** --- 69,80 ---- tsFormationParameters msFormationParameters; tcGenericDBObject *mpDBObject; + /** + * bits set when new command is received from UI (client) or from client via + * mp interface (server). + * bits cleared when matching state update received (client) or state update is + * transmitted (server) + */ + int commandStatus; + virtual void Clear(void); *************** *** 73,78 **** virtual void Launch(tnPoolIndex& rnKey, unsigned& rnLauncher); virtual void RandInitNear(float afLon_deg, float afLat_deg); ! virtual void SetAltitude(float new_altitude_m) {mcGS.SetAltitude(new_altitude_m);} ! virtual void SetHeading(float afNewHeading) {mcGS.SetHeading(afNewHeading);} virtual void SetSpeed(float afNewSpeed); virtual int SetLaunch(int anLauncher, int anQuantity); --- 95,100 ---- virtual void Launch(tnPoolIndex& rnKey, unsigned& rnLauncher); virtual void RandInitNear(float afLon_deg, float afLat_deg); ! virtual void SetAltitude(float new_altitude_m); ! virtual void SetHeading(float afNewHeading); virtual void SetSpeed(float afNewSpeed); virtual int SetLaunch(int anLauncher, int anQuantity); *************** *** 98,101 **** --- 120,124 ---- virtual void ApplyRestrictions(void); virtual void SetFireControlSensors(); + void LoadCommandParam(tcStream& stream, float& param, int flag); ///< used for multiplayer serialization virtual void Move(float dt_s); virtual void UpdateClimb(float dt_s) {}; |