[Gcblue-commits] gcb_wx/src/sim Game.cpp, 1.165, 1.166 tcAero.cpp, 1.10, 1.11 tcFlightPort.cpp, 1.3
Status: Alpha
Brought to you by:
ddcforge
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv22513/src/sim Modified Files: Game.cpp tcAero.cpp tcFlightPort.cpp tcLauncherState.cpp tcMissileObject.cpp tcOpticalSensor.cpp tcSensorState.cpp Log Message: Index: tcMissileObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMissileObject.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** tcMissileObject.cpp 20 Nov 2006 00:17:44 -0000 1.37 --- tcMissileObject.cpp 6 Dec 2006 01:20:43 -0000 1.38 *************** *** 54,66 **** stream >> mfGoalHeading_rad; stream >> mfGoalPitch_rad; - stream >> mfGoalSpeed_kts; - stream >> mfInterceptTime; - stream >> mfLastGuidanceUpdate; - stream >> mfGuidanceUpdateInterval; - msWaypoint << stream; stream >> mfRangeToObjective_km; - stream >> mnCurrentSegment; msKState << stream; tcSensorState* sensor = GetSensorMutable(0); if (sensor) --- 54,71 ---- stream >> mfGoalHeading_rad; stream >> mfGoalPitch_rad; stream >> mfRangeToObjective_km; msKState << stream; + + // update msKState params from mcKin to save bandwidth + msKState.mfSpeed_mps = C_KTSTOMPS * mcKin.mfSpeed_kts; + msKState.mfGroundSpeed_mps = cosf(mcKin.mfClimbAngle_rad) * msKState.mfSpeed_mps; + msKState.mfPitch_rad = mcKin.mfPitch_rad; + msKState.mfHeading_rad = mcKin.mfHeading_rad; + msKState.mfAltitude_m = mcKin.mfAlt_m; + + mfInterceptTime = (msKState.mfSpeed_mps > 0) ? 1000.0f * mfRangeToObjective_km / msKState.mfSpeed_mps : 999.9; + + tcSensorState* sensor = GetSensorMutable(0); if (sensor) *************** *** 81,91 **** stream << mfGoalHeading_rad; stream << mfGoalPitch_rad; - stream << mfGoalSpeed_kts; - stream << mfInterceptTime; - stream << mfLastGuidanceUpdate; - stream << mfGuidanceUpdateInterval; - msWaypoint >> stream; stream << mfRangeToObjective_km; - stream << mnCurrentSegment; msKState >> stream; --- 86,90 ---- *************** *** 769,773 **** tcGameObject::SaveToFile(file); file.Write(&mfGoalHeading_rad,sizeof(mfGoalHeading_rad)); - file.Write(&mfGoalSpeed_kts,sizeof(mfGoalSpeed_kts)); file.Write(&mfInterceptTime,sizeof(mfInterceptTime)); file.Write(&mfLastGuidanceUpdate,sizeof(mfLastGuidanceUpdate)); --- 768,771 ---- *************** *** 792,796 **** tcGameObject::LoadFromFile(file); file.Read(&mfGoalHeading_rad,sizeof(mfGoalHeading_rad)); - file.Read(&mfGoalSpeed_kts,sizeof(mfGoalSpeed_kts)); file.Read(&mfInterceptTime,sizeof(mfInterceptTime)); file.Read(&mfLastGuidanceUpdate,sizeof(mfLastGuidanceUpdate)); --- 790,793 ---- *************** *** 852,856 **** mfGoalHeading_rad = o.mfGoalHeading_rad; mfGoalPitch_rad = o.mfGoalPitch_rad; - mfGoalSpeed_kts = o.mfGoalSpeed_kts; mfInterceptTime = o.mfInterceptTime; subSurfaceLaunch = o.subSurfaceLaunch; --- 849,852 ---- Index: tcFlightPort.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcFlightPort.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** tcFlightPort.cpp 2 Dec 2006 02:23:48 -0000 1.32 --- tcFlightPort.cpp 6 Dec 2006 01:20:43 -0000 1.33 *************** *** 93,97 **** tcUpdateStream& tcAirState::operator<<(tcUpdateStream& stream) { ! char val; stream >> val; --- 93,99 ---- tcUpdateStream& tcAirState::operator<<(tcUpdateStream& stream) { ! bool detailedUpdate = (stream.GetDetailLevel() > 0); ! ! char val; stream >> val; *************** *** 115,119 **** // if this obj is in a ready or launch spot, then update launcher and fuel state ! if (current_location != HANGAR) { if (tcPlatformObject* platform = dynamic_cast<tcPlatformObject*>(obj)) --- 117,121 ---- // if this obj is in a ready or launch spot, then update launcher and fuel state ! if (detailedUpdate || (current_location != HANGAR)) { if (tcPlatformObject* platform = dynamic_cast<tcPlatformObject*>(obj)) *************** *** 149,152 **** --- 151,161 ---- tcUpdateStream& tcAirState::operator>>(tcUpdateStream& stream) { + bool detailedUpdate = (stream.GetDetailLevel() > 0); + + if (detailedUpdate) + { + int jj = 55; + } + char val; *************** *** 169,173 **** stream << x; ! if (current_location != HANGAR) { if (tcPlatformObject* platform = dynamic_cast<tcPlatformObject*>(obj)) --- 178,182 ---- stream << x; ! if (detailedUpdate || (current_location != HANGAR)) { if (tcPlatformObject* platform = dynamic_cast<tcPlatformObject*>(obj)) *************** *** 210,213 **** --- 219,234 ---- unsigned short nChildren = GetCount(); + unsigned char detailedUpdate; + stream >> detailedUpdate; + + if (detailedUpdate == 1) + { + stream.SetDetailLevel(1); + } + else + { + stream.SetDetailLevel(0); + } + unsigned char nUpdate; stream >> nUpdate; *************** *** 293,304 **** tcUpdateStream& tcFlightPort::operator>>(tcUpdateStream& stream) { - long freeSpace = stream.GetMaxSize() - stream.size() - 1; // 1 byte for update count header - // if freeSpace < 0, the message should be rejected anyway so don't worry about special case // for this tcUpdateStream tempStream1; tcUpdateStream tempStream2; unsigned short nChildren = GetCount(); if (nextUpdateIdx >= nChildren) nextUpdateIdx = 0; --- 314,335 ---- tcUpdateStream& tcFlightPort::operator>>(tcUpdateStream& stream) { // if freeSpace < 0, the message should be rejected anyway so don't worry about special case // for this + long freeSpace = stream.GetMaxSize() - stream.size() - 2; // 1 byte for update count header, 1 for detailedUpdate tcUpdateStream tempStream1; tcUpdateStream tempStream2; + unsigned char detailedUpdate; + if (stream.GetDetailLevel() > 0) + { + detailedUpdate = 1; + } + else + { + detailedUpdate = 0; + } + + unsigned short nChildren = GetCount(); if (nextUpdateIdx >= nChildren) nextUpdateIdx = 0; *************** *** 311,314 **** --- 342,346 ---- { tempStream1.clear(); + tempStream1.SetDetailLevel(stream.GetDetailLevel()); tcAirState* airState = GetAirState(nextUpdateIdx); *************** *** 335,339 **** --- 367,373 ---- } + stream << detailedUpdate; stream << nUpdates; + stream << tempStream2; Index: tcAero.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAero.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcAero.cpp 20 Nov 2006 00:17:43 -0000 1.10 --- tcAero.cpp 6 Dec 2006 01:20:43 -0000 1.11 *************** *** 42,51 **** { stream >> mfFlightTime; ! stream >> mfSpeed_mps; ! stream >> mfGroundSpeed_mps; ! stream >> mfPitch_rad; ! stream >> mfHeading_rad; ! stream >> mfAltitude_m; ! stream >> mfHeadingControl; return stream; --- 42,50 ---- { stream >> mfFlightTime; ! //stream >> mfSpeed_mps; ! //stream >> mfGroundSpeed_mps; ! //stream >> mfPitch_rad; ! //stream >> mfHeading_rad; ! //stream >> mfAltitude_m; return stream; *************** *** 58,67 **** { stream << mfFlightTime; ! stream << mfSpeed_mps; ! stream << mfGroundSpeed_mps; ! stream << mfPitch_rad; ! stream << mfHeading_rad; ! stream << mfAltitude_m; ! stream << mfHeadingControl; return stream; --- 57,65 ---- { stream << mfFlightTime; ! //stream << mfSpeed_mps; ! //stream << mfGroundSpeed_mps; ! //stream << mfPitch_rad; ! //stream << mfHeading_rad; ! //stream << mfAltitude_m; return stream; Index: tcOpticalSensor.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcOpticalSensor.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcOpticalSensor.cpp 23 Nov 2006 00:07:33 -0000 1.15 --- tcOpticalSensor.cpp 6 Dec 2006 01:20:43 -0000 1.16 *************** *** 88,92 **** else { ! return 0; } } --- 88,92 ---- else { ! return 1.0f; } } Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** tcLauncherState.cpp 28 Nov 2006 01:57:37 -0000 1.39 --- tcLauncherState.cpp 6 Dec 2006 01:20:43 -0000 1.40 *************** *** 340,346 **** if (parent->mcKin.RangeToKm(lon_rad, lat_rad) > maxRange_km) { ! wxString msg = wxString::Format("Out of range (%.1f km)", ! maxRange_km); ! tcGame::DisplayMessage(msg.c_str()); return false; } --- 340,349 ---- if (parent->mcKin.RangeToKm(lon_rad, lat_rad) > maxRange_km) { ! if (!tcSimState::Get()->IsMultiplayerServer()) ! { ! wxString msg = wxString::Format("Out of range (%.1f km)", ! maxRange_km); ! tcGame::DisplayMessage(msg.c_str()); ! } return false; } Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.165 retrieving revision 1.166 diff -C2 -d -r1.165 -r1.166 *** Game.cpp 2 Dec 2006 02:23:48 -0000 1.165 --- Game.cpp 6 Dec 2006 01:20:43 -0000 1.166 *************** *** 2910,2914 **** } ! tcFlightPortGui* gui = new tcFlightPortGui(platform->mnID, wxPoint(250, 200), xmlFile.c_str()); } } --- 2910,2922 ---- } ! tcFlightPortGui* existingGui = tcFlightPortGui::GetExistingGui(platform->mnID); ! if (existingGui == 0) ! { ! tcFlightPortGui* gui = new tcFlightPortGui(platform->mnID, wxPoint(250, 200), xmlFile.c_str()); ! } ! else// toggle close if exists already ! { ! existingGui->DestroyGui(); ! } } } *************** *** 2917,2924 **** if (tcPlatformObject* obj = tcSimPythonInterface::Get()->GetHookedObj()) { ! if (tcStores* stores = obj->GetMagazine(0)) ! { ! tcStoresGui* gui = new tcStoresGui(obj->mnID, -1, 0, wxPoint(500, 200), "xml/stores_gui_table.xml"); ! } } } --- 2925,2941 ---- if (tcPlatformObject* obj = tcSimPythonInterface::Get()->GetHookedObj()) { ! if (tcStores* stores = obj->GetMagazine(0)) ! { ! tcStoresGui* existingGui = tcStoresGui::GetExistingGui(obj->mnID, -1); ! if (existingGui == 0) ! { ! tcStoresGui* gui = new tcStoresGui(obj->mnID, -1, 0, wxPoint(500, 200), "xml/stores_gui_table.xml"); ! } ! else// toggle close if exists already ! { ! existingGui->DestroyGui(); ! } ! ! } } } *************** *** 2928,2932 **** if (obj) { ! tcPlatformGui* gui = new tcPlatformGui(obj->mnID, -1, wxPoint(220, 70), "xml/platform_gui_default.xml"); } } --- 2945,2957 ---- if (obj) { ! tcPlatformGui* existingGui = tcPlatformGui::GetExistingGui(obj->mnID, -1); ! if (existingGui == 0) ! { ! tcPlatformGui* gui = new tcPlatformGui(obj->mnID, -1, wxPoint(220, 70), "xml/platform_gui_default.xml"); ! } ! else // toggle close if exists already ! { ! existingGui->DestroyGui(); ! } } } Index: tcSensorState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorState.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcSensorState.cpp 24 Oct 2006 01:34:06 -0000 1.19 --- tcSensorState.cpp 6 Dec 2006 01:20:43 -0000 1.20 *************** *** 46,59 **** { stream >> mbActive; - //stream >> mnDBKey; - - stream >> mfLastScan; - stream >> mfCurrentScanPeriod_s; - stream >> mnMode; - mcTrack << stream; ! stream >> fireControlId; ! stream >> fireControlIdx; //stream >> mountAz_rad; //stream >> mfSensorHeight_m; --- 46,59 ---- { stream >> mbActive; ! stream >> mfCurrentScanPeriod_s; // need for antenna animation ! ! //mcTrack << stream; + //stream >> mnDBKey; + //stream >> mfLastScan; + //stream >> mnMode; + //stream >> fireControlId; + //stream >> fireControlIdx; //stream >> mountAz_rad; //stream >> mfSensorHeight_m; *************** *** 68,81 **** { stream << mbActive; - //stream << mnDBKey; - stream << mfLastScan; stream << mfCurrentScanPeriod_s; ! stream << mnMode; ! mcTrack >> stream; ! ! stream << fireControlId; ! stream << fireControlIdx; //stream << mountAz_rad; //stream << mfSensorHeight_m; --- 68,81 ---- { stream << mbActive; stream << mfCurrentScanPeriod_s; ! ! //mcTrack >> stream; + //stream << mnDBKey; + //stream << mfLastScan; + //stream << mnMode; + //stream << fireControlId; + //stream << fireControlIdx; //stream << mountAz_rad; //stream << mfSensorHeight_m; |