[Gcblue-commits] gcb_wx/src/sim Game.cpp,1.126,1.127 tcFlightOpsObject.cpp,1.7,1.8 tcLauncher.cpp,1.
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-04-16 20:44:52
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11335/src/sim Modified Files: Game.cpp tcFlightOpsObject.cpp tcLauncher.cpp tcLauncherState.cpp tcSensorPlatform.cpp tcSimState.cpp Log Message: housekeeping, networking upgrades, fixed wrapping problems with world map Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** tcSimState.cpp 8 Apr 2005 01:54:12 -0000 1.76 --- tcSimState.cpp 16 Apr 2005 20:44:43 -0000 1.77 *************** *** 2535,2538 **** --- 2535,2546 ---- tcGameObject::SetClientMode(false); tcCommandObject::SetClientMode(false); + + if (tcOptions::Get()->OptionStringExists("UsePositionRegistry")) + { + if (positionRegistry == 0) + { + positionRegistry = new tcPositionRegistry; + } + } } *************** *** 2553,2556 **** --- 2561,2570 ---- tcGameObject::SetClientMode(true); tcCommandObject::SetClientMode(true); + + if (positionRegistry) + { + delete positionRegistry; + positionRegistry = 0; + } } *************** *** 2565,2568 **** --- 2579,2590 ---- tcGameObject::SetClientMode(false); tcCommandObject::SetClientMode(false); + + if (tcOptions::Get()->OptionStringExists("UsePositionRegistry")) + { + if (positionRegistry == 0) + { + positionRegistry = new tcPositionRegistry; + } + } } Index: tcFlightOpsObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcFlightOpsObject.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcFlightOpsObject.cpp 6 Apr 2005 02:19:50 -0000 1.7 --- tcFlightOpsObject.cpp 16 Apr 2005 20:44:43 -0000 1.8 *************** *** 67,71 **** tcCreateStream& tcFlightOpsObject::operator<<(tcCreateStream& stream) { ! return stream; --- 67,90 ---- tcCreateStream& tcFlightOpsObject::operator<<(tcCreateStream& stream) { ! unsigned short nChildren; ! stream >> nChildren; ! ! wxASSERT(flight_deck.GetCount() == 0); ! ! for (unsigned short k=0; k < nChildren; k++) ! { ! long key; ! stream >> key; ! ! tcDatabaseObject* databaseObj = database->GetObject(key); ! ! std::string unitName; ! stream >> unitName; ! ! unsigned char loc; ! stream >> loc; ! ! AddChildToFlightDeck(databaseObj, unitName, teLocation(loc)); ! } return stream; *************** *** 107,131 **** tcUpdateStream& tcFlightOpsObject::operator<<(tcUpdateStream& stream) { - unsigned short nChildren; - stream >> nChildren; - - wxASSERT(flight_deck.GetCount() == 0); - - for (unsigned short k=0; k < nChildren; k++) - { - long key; - stream >> key; - - tcDatabaseObject* databaseObj = database->GetObject(key); - - std::string unitName; - stream >> unitName; - - unsigned char loc; - stream >> loc; - - AddChildToFlightDeck(databaseObj, unitName, teLocation(loc)); - } - return stream; } --- 126,129 ---- Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** tcLauncherState.cpp 29 Mar 2005 00:12:29 -0000 1.27 --- tcLauncherState.cpp 16 Apr 2005 20:44:43 -0000 1.28 *************** *** 427,430 **** --- 427,447 ---- } + // update damage + unsigned short launcherDamage; + stream >> launcherDamage; + + unsigned short damageFlag = 0x0001; + + size_t nLaunchers = launchers.size(); + wxASSERT(nLaunchers <= 8*sizeof(launcherDamage)); + for (size_t k=0; k<nLaunchers; k++) + { + bool damageState = (launcherDamage & damageFlag) != 0; + launchers[k]->SetDamaged(damageState); + + damageFlag = damageFlag << 1; + } + + return stream; } *************** *** 436,444 **** --- 453,476 ---- tcUpdateStream& tcLauncherState::operator>>(tcUpdateStream& stream) { + unsigned short launcherDamage = 0; + + unsigned short damageFlag = 0x0001; + + wxASSERT(mnCount <= 8*sizeof(launcherDamage)); + for(int n = 0; n < mnCount; n++) { tcLauncher& ldata = *launchers[n]; ldata >> stream; + + // update damage flag + if (launchers[n]->IsDamaged()) + { + launcherDamage |= damageFlag; + } + damageFlag = damageFlag << 1; } + + stream << launcherDamage; return stream; Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -d -r1.126 -r1.127 *** Game.cpp 31 Mar 2005 03:51:13 -0000 1.126 --- Game.cpp 16 Apr 2005 20:44:43 -0000 1.127 *************** *** 237,240 **** --- 237,250 ---- UninitGame(); + // if in multiplayer client mode, switch to multiplayer off mode + if (networkView->GetNetworkMode() == tcNetworkView::MULTIPLAYER_CLIENT) + { + /* TODO: should have one object for network state vs. current system + ** with state in tcGame, tcSimState, tcNetworkView */ + wxASSERT(multiplayerMode == 1); + networkView->SetNetworkMode(tcNetworkView::MULTIPLAYER_OFF); + multiplayerMode = 0; + } + simState->RandInit(); // generate new random scenario HookRandomFriendly(); Index: tcLauncher.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncher.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcLauncher.cpp 31 Mar 2005 03:51:13 -0000 1.16 --- tcLauncher.cpp 16 Apr 2005 20:44:43 -0000 1.17 *************** *** 781,785 **** tcLauncher::tcLauncher() { ! wxASSERT(false); } --- 781,785 ---- tcLauncher::tcLauncher() { ! } Index: tcSensorPlatform.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorPlatform.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcSensorPlatform.cpp 4 Mar 2005 00:46:18 -0000 1.1 --- tcSensorPlatform.cpp 16 Apr 2005 20:44:43 -0000 1.2 *************** *** 265,268 **** --- 265,284 ---- tcUpdateStream& tcSensorPlatform::operator<<(tcUpdateStream& stream) { + unsigned short sensorDamage; + stream >> sensorDamage; + + + unsigned short damageFlag = 0x0001; + + size_t nSensors = sensorState.size(); + wxASSERT(nSensors <= 8*sizeof(sensorDamage)); + + for(size_t n=0; n < nSensors; n++) + { + bool damageState = (sensorDamage & damageFlag) != 0; + sensorState[n]->SetDamaged(damageState); + + damageFlag = damageFlag << 1; + } return stream; *************** *** 274,277 **** --- 290,311 ---- tcUpdateStream& tcSensorPlatform::operator>>(tcUpdateStream& stream) { + unsigned short sensorDamage = 0; + + unsigned short damageFlag = 0x0001; + + size_t nSensors = sensorState.size(); + wxASSERT(nSensors <= 8*sizeof(sensorDamage)); + + for(size_t n=0; n < nSensors; n++) + { + if (sensorState[n]->IsDamaged()) + { + sensorDamage |= damageFlag; + } + damageFlag = damageFlag << 1; + } + + stream << sensorDamage; + return stream; } |