[Gcblue-commits] gcb_wx/src/sim tcHeloObject.cpp,NONE,1.1 Game.cpp,1.88,1.89 tc3DViewer.cpp,1.33,1.3
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-08-09 02:35:29
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2303/src/sim Modified Files: Game.cpp tc3DViewer.cpp tcAirObject.cpp tcAirfieldObject.cpp tcFlightOpsObject.cpp tcFlightPort.cpp tcGameObject.cpp tcLauncherState.cpp tcMapView.cpp tcObjectControl.cpp tcPlatformObject.cpp tcScenarioSelectView.cpp tcSimState.cpp Added Files: tcHeloObject.cpp Log Message: --- NEW FILE: tcHeloObject.cpp --- /** ** @file tcHeloObject.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 "stdwx.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "tcHeloObject.h" #include "tcGenericDBObject.h" void tcHeloObject::Clear() { tcAirObject::Clear(); } void tcHeloObject::RandInitNear(float afLon_deg, float afLat_deg) { if (mpDBObject == NULL) {return;} tcAirObject::RandInitNear(afLon_deg, afLat_deg); // replace unit prefix, otherwise use tcAirObject RandInitNear mzUnit = "HELO_"; mzUnit.AssignRandomSuffix(); } void tcHeloObject::PrintToFile(tcFile& file) { tcAirObject::PrintToFile(file); } void tcHeloObject::SaveToFile(tcFile& file) { tcAirObject::SaveToFile(file); } void tcHeloObject::LoadFromFile(tcFile& file) { tcAirObject::LoadFromFile(file); } void tcHeloObject::Serialize(tcFile& file, bool mbLoad) { if (mbLoad) { LoadFromFile(file); } else { SaveToFile(file); } } void tcHeloObject::ApplyRestrictions() { // check for crash if ((mcKin.mfAlt_m <= 0)||(mcTerrain.mfHeight_m >= mcKin.mfAlt_m)) { mfDamageLevel = 1.0f; } } /** * Has problems for large time steps, > about 1 sec */ void tcHeloObject::UpdateClimb(float dt_s) { float dalt_min, dalt_max, fAltitudeRate_mps; float dalt_m = mcGS.mfGoalAltitude_m - mcKin.mfAlt_m; // set pitch based on speed mcKin.mfPitch_rad = -0.20f * mcKin.mfSpeed_kts / mpDBObject->mfMaxSpeed_kts; // set climb angle to zero and let this method update altitude mcKin.mfClimbAngle_rad = 0; if ((dalt_m > -0.25f)&&(dalt_m < 0.25f)) { return; } const float fHighZone = 100.0f; const float fLowZone = -100.0f; float fMaxRate = mpDBObject->mfAltitudeRate_mps; // reduce rate to zero near max altitude if (mcKin.mfAlt_m > mpDBObject->mfMaxAltitude_m - 200) { fMaxRate *= 0.005f * (mpDBObject->mfMaxAltitude_m - mcKin.mfAlt_m); } if ((dalt_m > fHighZone)||(dalt_m < fLowZone)) { fAltitudeRate_mps = fMaxRate; } else if (dalt_m < 0) { fAltitudeRate_mps = fMaxRate*(dalt_m/fLowZone) + 2.0f; } else { fAltitudeRate_mps = fMaxRate*(dalt_m/fHighZone) + 2.0f; } // restrict climb to altitude rate dalt_max = fAltitudeRate_mps * dt_s; dalt_min = (mcKin.mfAlt_m <= 200.0f) ? -dalt_max : -2.0f*dalt_max; if (dalt_m < dalt_min) {dalt_m = dalt_min;} else if (dalt_m > dalt_max) {dalt_m = dalt_max;} mcKin.mfAlt_m += dalt_m; } void tcHeloObject::Update(double afStatusTime) { const float min_update_s = 0.0f; float dt_s = (float)(afStatusTime - mfStatusTime); UpdateEffects(); // shouldn't be called for child objects if (parent != NULL) {return;} // captive, let parent update if applicable if (dt_s <= min_update_s) {return;} // added for pause case wxASSERT(mpDBObject); UpdateFormationGuidance(); // formation heading/speed calculation // don't use air method since we don't care about roll tcPlatformObject::UpdateHeading(dt_s); UpdateSpeed(dt_s); UpdateClimb(dt_s); ApplyRestrictions(); // crash check Move(dt_s); UpdateLauncherState(dt_s); UpdateSensors(afStatusTime); mfStatusTime = afStatusTime; } tcHeloObject::tcHeloObject() { mnModelType = MTYPE_HELO; SetAltitude(1000.0f); SetHeading(75.0f); SetSpeed(100.0f); readyForLanding = 0; } /** * Constructor that initializes using info from database entry. */ tcHeloObject::tcHeloObject(tcGenericDBObject *obj) : tcAirObject(obj) { mnModelType = MTYPE_HELO; } tcHeloObject::~tcHeloObject() { } Index: tcFlightPort.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcFlightPort.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcFlightPort.cpp 8 Aug 2004 00:31:35 -0000 1.9 --- tcFlightPort.cpp 9 Aug 2004 02:35:16 -0000 1.10 *************** *** 1,21 **** ! /** @file tcFlightport.cpp */ ! /** ! * Copyright (C) 2003 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 "stdwx.h" // precompiled header file --- 1,22 ---- ! /** ! ** @file tcFlightport.cpp ! */ ! /* Copyright (C) 2003-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 "stdwx.h" // precompiled header file *************** *** 31,34 **** --- 32,36 ---- #include "tcAirObject.h" #include "tcAeroAirObject.h" + #include "tcHeloObject.h" #include "tcFlightportDBObject.h" #include "tcGenericDBObject.h" *************** *** 140,143 **** --- 142,152 ---- int tcFlightPort::CheckLanding(tcGameObject *obj) { + bool isAir = dynamic_cast<tcAirObject*>(obj) != 0; + bool isHelo = dynamic_cast<tcHeloObject*>(obj) != 0; + + bool compatible = isAir && (!mpDBObject->heloOnly || isHelo); + + if (!compatible) return 0; + int nRunways = (int)launch_spots.size(); for (int n=0;n<nRunways;n++) *************** *** 387,393 **** Clear(); - hangarCapacity = dbObj->hangarCapacity; - inHangarCount = 0; size_t nSpots = dbObj->spotInfo.size(); for(size_t spot=0;spot<nSpots;spot++) --- 396,405 ---- Clear(); + mpDBObject = dbObj; + + hangarCapacity = mpDBObject->hangarCapacity; + inHangarCount = 0; + size_t nSpots = dbObj->spotInfo.size(); for(size_t spot=0;spot<nSpots;spot++) *************** *** 437,444 **** if (airstate->current_location == TRANSIT) { ! if (time >= airstate->ready_time) { airstate->current_location = airstate->goal_location; airstate->current_spot = airstate->goal_spot; airstate->op = OP_NONE; InitRelPos(airstate); } --- 449,462 ---- if (airstate->current_location == TRANSIT) { ! if (time >= airstate->ready_time) ! { ! if (airstate->current_location == HANGAR) inHangarCount--; ! if (airstate->goal_location == HANGAR) inHangarCount++; airstate->current_location = airstate->goal_location; airstate->current_spot = airstate->goal_spot; airstate->op = OP_NONE; + + wxASSERT(inHangarCount <= hangarCapacity); + InitRelPos(airstate); } *************** *** 452,459 **** tcGameObject *parent = unit->parent; if (parent == NULL) return; // error unit->mcKin = parent->mcKin; unit->mcKin.mfHeading_rad += unit->rel_pos.yaw; unit->mcKin.mfAlt_m += unit->rel_pos.dy; - unit->mcKin.mfSpeed_kts += 200.0f; unit->SetHeading(unit->mcKin.mfHeading_rad); unit->mfStatusTime = parent->mfStatusTime; --- 470,477 ---- tcGameObject *parent = unit->parent; if (parent == NULL) return; // error + unit->mcKin = parent->mcKin; unit->mcKin.mfHeading_rad += unit->rel_pos.yaw; unit->mcKin.mfAlt_m += unit->rel_pos.dy; unit->SetHeading(unit->mcKin.mfHeading_rad); unit->mfStatusTime = parent->mfStatusTime; *************** *** 473,482 **** --- 491,509 ---- if (tcAeroAirObject* aa_unit = dynamic_cast<tcAeroAirObject*>(unit)) { + aa_unit->mcKin.mfSpeed_kts += 200.0f; aa_unit->SetThrottleFraction(1.1); aa_unit->SetAltitude(unit->mcKin.mfAlt_m + 500.0f); aa_unit->SetLandingState(0); } + else if (tcHeloObject* helo_unit = dynamic_cast<tcHeloObject*>(unit)) + { + helo_unit->mcKin.mfClimbAngle_rad = 1.5f; + helo_unit->SetSpeed(helo_unit->mcKin.mfSpeed_kts + 5); + helo_unit->SetAltitude(helo_unit->mcKin.mfAlt_m + 500.0f); + helo_unit->SetLandingState(0); + } else if (tcAirObject *air_unit = dynamic_cast<tcAirObject*>(unit)) { + air_unit->mcKin.mfSpeed_kts += 200.0f; air_unit->SetSpeed(air_unit->mpDBObject->mfMaxSpeed_kts); air_unit->SetAltitude(unit->mcKin.mfAlt_m + 500.0f); *************** *** 524,528 **** { tcGameObject *obj = toLand.at(n); ! AddObject(obj, READY); // add landed objects to deck if possible } toLand.clear(); --- 551,560 ---- { tcGameObject *obj = toLand.at(n); ! // add landed objects to deck if possible ! if (!AddObject(obj, READY)) ! { ! obj->mfDamageLevel += 10000; // destroy object ! toLaunch.push_back(obj); // kick it out to be destroyed ! } } toLand.clear(); *************** *** 535,538 **** --- 567,571 ---- Clear(); parent = NULL; + mpDBObject = NULL; } tcFlightPort::~tcFlightPort() Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** tcPlatformObject.cpp 19 Jul 2004 00:53:01 -0000 1.27 --- tcPlatformObject.cpp 9 Aug 2004 02:35:16 -0000 1.28 *************** *** 1,6 **** ! /** @file tcPlatformObject.cpp */ ! /* ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcPlatformObject.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 197,203 **** float ds_max = mpDBObject->mfAccel_ktsps*dt_s; float ds_min = -ds_max; ! if (ds_kts < ds_min) {ds_kts = ds_min;} // restrict to turn rate else if (ds_kts > ds_max) {ds_kts = ds_max;} mcKin.mfSpeed_kts += ds_kts; } --- 197,206 ---- float ds_max = mpDBObject->mfAccel_ktsps*dt_s; float ds_min = -ds_max; ! ! if (ds_kts < ds_min) {ds_kts = ds_min;} // restrict to acceleration else if (ds_kts > ds_max) {ds_kts = ds_max;} mcKin.mfSpeed_kts += ds_kts; + + if (mcKin.mfSpeed_kts < 0) mcKin.mfSpeed_kts = 0; } Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcObjectControl.cpp 24 May 2004 00:14:47 -0000 1.16 --- tcObjectControl.cpp 9 Aug 2004 02:35:16 -0000 1.17 *************** *** 488,492 **** // intercept data for missiles ! if (mpHookedGameObj->mnModelType==MTYPE_MISSILE) { tsGuidanceParameters gp; --- 488,492 ---- // intercept data for missiles ! if (mpHookedGameObj->mnModelType == MTYPE_MISSILE) { tsGuidanceParameters gp; *************** *** 534,541 **** DrawHeadingObject(pGraphics, &msHOI, pkin->mfHeading_rad, mfGoalHeading_rad); // object heading ! bool mbSurface = (mpHookedGameObj->mnModelType == MTYPE_SURFACE) ! || (mpHookedGameObj->mnModelType == MTYPE_CARRIER); ! bool mbAir = (mpHookedGameObj->mnModelType == MTYPE_FIXEDWING) ! || (mpHookedGameObj->mnModelType == MTYPE_FIXEDWINGX); bool mbDrawSpeed = mbSurface || mbAir; bool mbDrawAltitude = mbAir; --- 534,544 ---- DrawHeadingObject(pGraphics, &msHOI, pkin->mfHeading_rad, mfGoalHeading_rad); // object heading ! bool mbSurface = (mpHookedGameObj->mnModelType == MTYPE_SURFACE) || ! (mpHookedGameObj->mnModelType == MTYPE_CARRIER); ! ! bool mbAir = (mpHookedGameObj->mnModelType == MTYPE_FIXEDWING) || ! (mpHookedGameObj->mnModelType == MTYPE_FIXEDWINGX) || ! (mpHookedGameObj->mnModelType == MTYPE_HELO); ! bool mbDrawSpeed = mbSurface || mbAir; bool mbDrawAltitude = mbAir; *************** *** 1062,1065 **** --- 1065,1071 ---- strcpy(zClass,"AIR"); break; + case DTYPE_BALLISTIC: + strcpy(zClass,"BAL"); + break; default: strcpy(zClass,"ERR"); *************** *** 1090,1093 **** --- 1096,1108 ---- strcpy(zModel,"FXAIR"); break; + case MTYPE_HELO: + strcpy(zModel,"HELO"); + break; + case MTYPE_BALLISTIC: + strcpy(zModel,"BAL"); + break; + case MTYPE_AIRFIELD: + strcpy(zModel,"FIELD"); + break; default: strcpy(zModel,"ERR"); *************** *** 1133,1136 **** --- 1148,1154 ---- strcpy(zType,"LAND"); break; + case PTYPE_BALLISTIC: + strcpy(zType,"BAL"); + break; default: strcpy(zType,"ERR"); *************** *** 1442,1445 **** --- 1460,1464 ---- case MTYPE_FIXEDWING: case MTYPE_FIXEDWINGX: + case MTYPE_HELO: { //tcSurfaceObject *pSurfaceObj = (tcSurfaceObject*)mpHookedGameObj; Index: tcGameObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameObject.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcGameObject.cpp 8 Aug 2004 00:31:35 -0000 1.19 --- tcGameObject.cpp 9 Aug 2004 02:35:16 -0000 1.20 *************** *** 502,506 **** mnID = NULL_INDEX; // remains NULL index for child model = obj->Get3DModel(); ! model->SetupUpdate(this); } --- 502,506 ---- mnID = NULL_INDEX; // remains NULL index for child model = obj->Get3DModel(); ! if (model) model->SetupUpdate(this); } Index: tcAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirObject.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcAirObject.cpp 4 Jun 2004 21:39:23 -0000 1.10 --- tcAirObject.cpp 9 Aug 2004 02:35:16 -0000 1.11 *************** *** 1,5 **** ! /** @file tcAirObject.cpp ! ** ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcAirObject.cpp ! */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** tcSimState.cpp 5 Aug 2004 02:22:35 -0000 1.50 --- tcSimState.cpp 9 Aug 2004 02:35:16 -0000 1.51 *************** *** 41,44 **** --- 41,45 ---- #include "tcBallisticWeapon.h" #include "tcBallisticDBObject.h" + #include "tcHeloObject.h" #include "tcLauncher.h" *************** *** 1366,1374 **** /* these types are defined in tcDatabase.h */ if ((apDBObject->mnModelType == MTYPE_FIXEDWING)|| ! (apDBObject->mnModelType == MTYPE_AIR)|| ! (apDBObject->mnModelType == MTYPE_HELO)) { return new tcAirObject(pGenericData); } else if (apDBObject->mnModelType == MTYPE_CARRIER) { --- 1367,1378 ---- /* these types are defined in tcDatabase.h */ if ((apDBObject->mnModelType == MTYPE_FIXEDWING)|| ! (apDBObject->mnModelType == MTYPE_AIR)) { return new tcAirObject(pGenericData); } + else if (apDBObject->mnModelType == MTYPE_HELO) + { + return new tcHeloObject(pGenericData); + } else if (apDBObject->mnModelType == MTYPE_CARRIER) { *************** *** 1439,1450 **** mcSensorMap.Clear(); } ! /********************************************************************/ void tcSimState::RandInit() { int nPlatforms = 12; // number of platforms to add - Clear(); - mcSensorMap.CreateMapForAlliance(1); - mcSensorMap.CreateMapForAlliance(2); while (nPlatforms-- > 0) { --- 1443,1464 ---- mcSensorMap.Clear(); } ! /** ! * try, catch blocks added to help isolate crashes ! */ void tcSimState::RandInit() { int nPlatforms = 12; // number of platforms to add + + try + { + Clear(); + mcSensorMap.CreateMapForAlliance(1); + mcSensorMap.CreateMapForAlliance(2); + } + catch (...) + { + throw std::string("exception in clear or CreateMapForAlliance"); + } while (nPlatforms-- > 0) { *************** *** 1452,1463 **** } ! COleDateTime current; ! current = COleDateTime::GetCurrentTime(); ! tcString str = current.Format(_T("Randomly generated on %A, %B %d, %Y %H:%M:%S")); ! sprintf(msScenarioInfo.mzDescription,"%s",str.GetBuffer()); ! strcpy(msScenarioInfo.mzName,"RANDOM-TEST"); ! GenerateRandomGoals(); msScenarioInfo.mbLoaded = true; --- 1466,1507 ---- } ! try ! { ! COleDateTime current; ! current = COleDateTime::GetCurrentTime(); ! tcString str = current.Format(_T("Randomly generated on %A, %B %d, %Y %H:%M:%S")); ! sprintf(msScenarioInfo.mzDescription,"%s",str.GetBuffer()); ! strcpy(msScenarioInfo.mzName,"RANDOM-TEST"); ! } ! catch (...) ! { ! throw std::string("exception in GetCurrentTime section"); ! } ! try ! { ! GenerateRandomGoals(); ! } ! catch (...) ! { ! throw std::string("exception in GenerateRandomGoals"); ! } ! ! try ! { ! // set random date and time of day ! int year = 1990 + (rand() % 20); ! int month = 1 + (rand() % 12); // month = 0 will raise an exception ! int day = 1 + (rand() % 28); ! int hour = rand() % 24; ! ! SetDateTime(DateZulu(year, month, day, hour, 0, 0)); ! ! } ! catch (...) ! { ! throw std::string("exception in SetDateTime"); ! } msScenarioInfo.mbLoaded = true; *************** *** 1490,1493 **** --- 1534,1538 ---- UINT platform_type; + if (mpDatabase == NULL) {return;} CTime ctime = CTime::GetCurrentTime(); *************** *** 1509,1549 **** } ! pplat = CreateRandomPlatform(platform_type); if (pplat == NULL) return; pplat->mnAlliance = ((rand()%2)==0) ? 0x01 : 0x02; - if (pplat->mnAlliance == 0x01) - { - pplat->RandInitNear(-4.5,49.5); - pplat->mnAlliance = 0x01; - } - else - { - pplat->RandInitNear(-6,50); - pplat->mnAlliance = 0x02; - tcPlatformObject *pPlatformObj; - if (pPlatformObj = dynamic_cast<tcPlatformObject*>(pplat)) - { - tcOrder default_order; - default_order.mstrOrdername = "Patrol"; - default_order.msDestination.Set((float)pPlatformObj->mcKin.mfLon_rad, - (float)pPlatformObj->mcKin.mfLat_rad); - pPlatformObj->mcAI.AddOrder(default_order); - pPlatformObj->mcAI.mfNextUpdate = randf(4.0f); - } - } ! // set child alliance to match parent ! if (int nChildren = (int)pplat->children.size()) ! { ! for(int n=0;n<nChildren;n++) ! { ! tcGameObject *child = pplat->children[n]; ! child->mnAlliance = pplat->mnAlliance; ! } ! } ! pplat->mfStatusTime = mfLastSensorUpdate; // for lack of a better time ! AddPlatform(pplat); } --- 1554,1615 ---- } ! try ! { ! pplat = CreateRandomPlatform(platform_type); ! } ! catch (...) ! { ! wxString message = wxString::Format( ! "exception adding platform of type: %d", platform_type); ! throw std::string(message.GetData()); ! } ! if (pplat == NULL) return; pplat->mnAlliance = ((rand()%2)==0) ? 0x01 : 0x02; ! try ! { ! if (pplat->mnAlliance == 0x01) ! { ! pplat->RandInitNear(-4.5,49.5); ! pplat->mnAlliance = 0x01; ! } ! else ! { ! pplat->RandInitNear(-6,50); ! pplat->mnAlliance = 0x02; ! tcPlatformObject *pPlatformObj; ! if (pPlatformObj = dynamic_cast<tcPlatformObject*>(pplat)) ! { ! tcOrder default_order; ! default_order.mstrOrdername = "Patrol"; ! default_order.msDestination.Set((float)pPlatformObj->mcKin.mfLon_rad, ! (float)pPlatformObj->mcKin.mfLat_rad); ! pPlatformObj->mcAI.AddOrder(default_order); ! pPlatformObj->mcAI.mfNextUpdate = randf(4.0f); ! } ! } ! // set child alliance to match parent ! if (int nChildren = (int)pplat->children.size()) ! { ! for(int n=0;n<nChildren;n++) ! { ! tcGameObject *child = pplat->children[n]; ! child->mnAlliance = pplat->mnAlliance; ! } ! } ! ! pplat->mfStatusTime = mfLastSensorUpdate; // for lack of a better time ! AddPlatform(pplat); ! } ! catch (...) ! { ! wxString message = wxString::Format( ! "exception adding platform class: %s, unit: %s", ! pplat->mzClass.mz, pplat->mzUnit.mz); ! throw std::string(message.GetData()); ! } } *************** *** 2106,2110 **** multiplayerMode(MM_OFF), timeAcceleration(0) ! { mpCommandInterface = NULL; mpDatabase = NULL; --- 2172,2177 ---- multiplayerMode(MM_OFF), timeAcceleration(0) ! { ! mpCommandInterface = NULL; mpDatabase = NULL; Index: tcFlightOpsObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcFlightOpsObject.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcFlightOpsObject.cpp 18 Jul 2004 03:18:01 -0000 1.2 --- tcFlightOpsObject.cpp 9 Aug 2004 02:35:16 -0000 1.3 *************** *** 26,29 **** --- 26,30 ---- #include "tcAirObject.h" #include "tcAeroAirObject.h" + #include "tcHeloObject.h" #include "tcAirDBObject.h" #include "tcFlightportDBObject.h" *************** *** 93,96 **** --- 94,101 ---- child = new tcAirObject(genericDBObj); } + else if (genericDBObj->mnModelType == MTYPE_HELO) + { + child = new tcHeloObject(genericDBObj); + } else { *************** *** 128,136 **** { // add FW air child for test ! tcDatabaseObject *dbObj = database->GetRandomOfType(MTYPE_FIXEDWINGX); tcAirDBObject *airDBObj = dynamic_cast<tcAirDBObject*>(dbObj); tcAeroAirObject *child = NULL; if (airDBObj) child = new tcAeroAirObject(airDBObj); ! wxASSERT(child); if (child != NULL) { --- 133,145 ---- { // add FW air child for test ! tcDatabaseObject *dbObj = database->GetRandomOfType(MTYPE_FIXEDWINGX); tcAirDBObject *airDBObj = dynamic_cast<tcAirDBObject*>(dbObj); tcAeroAirObject *child = NULL; if (airDBObj) child = new tcAeroAirObject(airDBObj); ! ! /* This ASSERT can happen if bad model ids are in a database table (e.g. ! ** air object in generics database table ) */ ! wxASSERT(child); ! if (child != NULL) { Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcLauncherState.cpp 5 Aug 2004 02:22:35 -0000 1.15 --- tcLauncherState.cpp 9 Aug 2004 02:35:16 -0000 1.16 *************** *** 74,81 **** { char zBuff[128]; ! strcpy(zBuff,"Error - tcLauncherState::AddFullLauncher - Child not found in db ("); ! strcat(zBuff,ldata->mzChildClass.mz); ! strcat(zBuff,")"); ! WTL(zBuff); return; } --- 74,82 ---- { char zBuff[128]; ! sprintf(zBuff, "Error - tcLauncherState::AddFullLauncher - " ! "Launcher child not found in database (%s)\n", ldata->mzChildClass.mz); ! ! fprintf(stderr, zBuff); ! wxMessageBox(zBuff, "Error", wxICON_ERROR); return; } Index: tcScenarioSelectView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcScenarioSelectView.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcScenarioSelectView.cpp 8 Aug 2004 00:31:35 -0000 1.15 --- tcScenarioSelectView.cpp 9 Aug 2004 02:35:16 -0000 1.16 *************** *** 356,361 **** { wxString s = ! wxString::Format("Error in scenario %s. Check pyerr.txt for details.", ! path.c_str()); wxMessageBox(s.c_str(),"Error",wxICON_ERROR); } --- 356,362 ---- { wxString s = ! wxString::Format("Error in scenario %s. " ! "Check log/pyerr.txt for details.", ! path.c_str()); wxMessageBox(s.c_str(),"Error",wxICON_ERROR); } Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapView.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tcMapView.cpp 8 Aug 2004 00:31:35 -0000 1.29 --- tcMapView.cpp 9 Aug 2004 02:35:16 -0000 1.30 *************** *** 845,855 **** } ! void tcTacticalMapView::DrawNTDSAirRW(Graphics *apGraphics, teAffiliation affil) { ! float symbsize=15.0f; float x = 12.0f; float y = 12.0f; ! RectF rect(x-symbsize/2,y-symbsize/2,symbsize,symbsize); ! apGraphics->DrawArc(mpPen,rect,-10,-160); ! apGraphics->DrawLine(mpPen,x-1.0f,y-1.0f,x+1.0f,y-1.0f); } --- 845,858 ---- } ! void tcTacticalMapView::DrawNTDSAirRW(Graphics *apGraphics, teAffiliation affil) ! { ! float symbsize = 15.0f; float x = 12.0f; float y = 12.0f; ! ! DrawNTDSAirFW(apGraphics, affil); ! ! apGraphics->DrawLine(mpPen, x-0.5f*symbsize, y-0.5f*symbsize, ! x+0.5f*symbsize, y-0.5f*symbsize); } Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tc3DViewer.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tc3DViewer.cpp 8 Aug 2004 00:31:35 -0000 1.33 --- tc3DViewer.cpp 9 Aug 2004 02:35:16 -0000 1.34 *************** *** 162,166 **** if (isMouseDown) { ! const float MAX_EL = 50.0f/180.0f*C_PI; // view problem at higher elevations float dAz = 0.02f*(float)(point.x - clickPoint.x); float dEl = 0.02f*(float)(point.y - clickPoint.y); --- 162,166 ---- if (isMouseDown) { ! const float MAX_EL = 65.0f/180.0f*C_PI; // view problem at higher elevations float dAz = 0.02f*(float)(point.x - clickPoint.x); float dEl = 0.02f*(float)(point.y - clickPoint.y); *************** *** 197,201 **** { cameraRange *= 0.9f; ! if (cameraRange < 5.0f) cameraRange = 5.0f; } else if (zDelta < 0) --- 197,201 ---- { cameraRange *= 0.9f; ! if (cameraRange < 3.0f) cameraRange = 3.0f; } else if (zDelta < 0) Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** Game.cpp 5 Aug 2004 02:22:35 -0000 1.88 --- Game.cpp 9 Aug 2004 02:35:16 -0000 1.89 *************** *** 1,21 **** /** @file Game.cpp main application class ! ** ! ** Copyright (C) 2003-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. ! ** [...4489 lines suppressed...] ! } ! break; ! case PC_DELETE: ! WTL("tcGame::ProcessCommand PC_DELETE"); ! simState->DeletePlatform(tacticalMap->mnHookID); ! tacticalMap->mnHookID = NULL_INDEX; ! mcHook.SetHookID(NULL_INDEX); ! mcObjectControl.SetHookID(NULL_INDEX); ! break; ! */ default: ! WTL("tcGame::ProcessCommand unrecognized game command"); ! break; ! } ! sfData = afData; ! snData = anData; ! snData2 = anData2; } #endif \ No newline at end of file Index: tcAirfieldObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirfieldObject.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcAirfieldObject.cpp 18 Jul 2004 03:18:01 -0000 1.1 --- tcAirfieldObject.cpp 9 Aug 2004 02:35:16 -0000 1.2 *************** *** 146,149 **** --- 146,150 ---- mpDBObject = obj; mcKin.mfSpeed_kts = 0; // make sure this doesn't move (shouldn't be necessary) + mnModelType = MTYPE_AIRFIELD; } |