[Gcblue-commits] gcb_wx/src/sim tcAero.cpp,1.6,1.7 tcAeroAirObject.cpp,1.14,1.15 tcAirObject.cpp,1.2
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-05-21 02:01:19
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19637/src/sim Modified Files: tcAero.cpp tcAeroAirObject.cpp tcAirObject.cpp tcCommandObject.cpp tcFlightPort.cpp tcGameObject.cpp tcLauncher.cpp tcPlatformObject.cpp tcRadar.cpp tcSensorPlatform.cpp tcSimState.cpp tcStores.cpp Log Message: Mods to allow aircraft to load / unload with airbase stores, simplified flight model Index: tcFlightPort.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcFlightPort.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcFlightPort.cpp 10 May 2005 02:26:06 -0000 1.17 --- tcFlightPort.cpp 21 May 2005 02:01:04 -0000 1.18 *************** *** 782,786 **** if (airstate->current_location == READY) { ! if ((airstate->current_spot >= 0) && (airstate->current_spot < ready_spots.size())) { ready_spots[airstate->current_spot].obj_info = airstate; --- 782,786 ---- if (airstate->current_location == READY) { ! if ((airstate->current_spot >= 0) && ((unsigned)airstate->current_spot < ready_spots.size())) { ready_spots[airstate->current_spot].obj_info = airstate; *************** *** 789,793 **** else if (airstate->current_location == LAUNCH) { ! if ((airstate->current_spot >= 0) && (airstate->current_spot < launch_spots.size())) { launch_spots[airstate->current_spot].obj_info = airstate; --- 789,793 ---- else if (airstate->current_location == LAUNCH) { ! if ((airstate->current_spot >= 0) && ((unsigned)airstate->current_spot < launch_spots.size())) { launch_spots[airstate->current_spot].obj_info = airstate; Index: tcLauncher.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncher.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcLauncher.cpp 6 May 2005 23:57:51 -0000 1.19 --- tcLauncher.cpp 21 May 2005 02:01:04 -0000 1.20 *************** *** 39,42 **** --- 39,48 ---- tcSimState* tcLauncher::simState = 0; + void tcLauncher::AttachSimState(tcSimState* ss) + { + simState = ss; + } + + /** * *************** *** 210,213 **** --- 216,237 ---- /** + * This can be a substitute for IsItemCompatible by testing != 0 + * @see IsItemCompatible + */ + unsigned int tcLauncher::GetCapacityForItem(const std::string& item) const + { + unsigned nTypes = GetCompatibleCount(); + for (unsigned k=0; k<nTypes; k++) + { + if (item == mpLauncherDBObj->maChildClass[k].mz) + { + return mpLauncherDBObj->maCapacity[k]; + } + } + + return 0; + } + + /** * @return number of compatible items for this launcher */ *************** *** 383,386 **** --- 407,411 ---- mnUncommitted = 0; errorCode = 0; + capacity = GetCapacityForItem(childClass); // set detailed launch mode if missile *************** *** 441,449 **** { mnCurrent = quantity; ! if (mnCurrent > (int)mpLauncherDBObj->mnCapacity) { ! mnCurrent = (int)mpLauncherDBObj->mnCapacity; } mnUncommitted = mnCurrent; } --- 466,476 ---- { mnCurrent = quantity; ! if (mnCurrent > (int)capacity) { ! mnCurrent = (int)capacity; } mnUncommitted = mnCurrent; + mfTimeToReady = 0; + SetLoadState(false); } *************** *** 664,668 **** long fcID = parent->mnID; ! unsigned fcIdx = fireControlSensorIdx; bool canDetect = simState->RadarCanDetect(nSensorKey, targetObj, --- 691,695 ---- long fcID = parent->mnID; ! unsigned int fcIdx = fireControlSensorIdx; bool canDetect = simState->RadarCanDetect(nSensorKey, targetObj, *************** *** 684,687 **** --- 711,717 ---- } + + + /** * Converts launcher status code into string. *************** *** 774,784 **** wxASSERT(dbObj); wxASSERT(parent); SetChildClass(dbObj->mzChildClass.mz); ! ! mnCurrent = mpLauncherDBObj->mnCapacity; ! mnUncommitted = mpLauncherDBObj->mnCapacity; ! ! if (!simState) simState = tcSimState::Get(); ! } --- 804,811 ---- wxASSERT(dbObj); wxASSERT(parent); + wxASSERT(simState); + SetChildClass(dbObj->mzChildClass.mz); ! SetChildQuantity(capacity); } Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** tcPlatformObject.cpp 8 May 2005 23:28:59 -0000 1.45 --- tcPlatformObject.cpp 21 May 2005 02:01:04 -0000 1.46 *************** *** 667,674 **** if (updateMask & UPDATE_GUIDANCE) { ! ! commandObj.LoadCommandParam(stream, mcGS.mfGoalHeading_deg, HEADING_CMD); ! commandObj.LoadCommandParam(stream, mcGS.mfGoalSpeed_kts, SPEED_CMD); ! commandObj.LoadCommandParam(stream, mcGS.mfGoalAltitude_m, ALT_CMD); stream >> mcGS.mbIntercept; --- 667,673 ---- if (updateMask & UPDATE_GUIDANCE) { ! stream >> mcGS.mfGoalHeading_deg; ! stream >> mcGS.mfGoalSpeed_kts; ! stream >> mcGS.mfGoalAltitude_m; stream >> mcGS.mbIntercept; Index: tcAeroAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAeroAirObject.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcAeroAirObject.cpp 6 May 2005 23:57:51 -0000 1.14 --- tcAeroAirObject.cpp 21 May 2005 02:01:04 -0000 1.15 *************** *** 48,52 **** tcAirObject::operator<<(stream); ! commandObj.LoadCommandParam(stream, throttleFraction, THROTTLE_CMD); return stream; --- 48,52 ---- tcAirObject::operator<<(stream); ! stream >> throttleFraction; return stream; *************** *** 318,322 **** float mfSpeed_mps = k.mfSpeed_kts*C_KTSTOMPS; ! rhv2 = GetAirDensity(k.mfAlt_m)*mfSpeed_mps*mfSpeed_mps; vsound = GetSoundSpeed(k.mfAlt_m); vmach = mfSpeed_mps/vsound; --- 318,323 ---- float mfSpeed_mps = k.mfSpeed_kts*C_KTSTOMPS; ! float rho = GetAirDensity(k.mfAlt_m); ! rhv2 = rho*mfSpeed_mps*mfSpeed_mps; vsound = GetSoundSpeed(k.mfAlt_m); vmach = mfSpeed_mps/vsound; *************** *** 331,366 **** float weight_N = C_G * mass_kg; ! /* Skip induced drag, angle of attack calculation ! ** for now. TODO add later. ! float inducedDrag_N; ! */ // calculate lift needed to balance weight ! float lift_N = weight_N * cosf(k.mfClimbAngle_rad); ! float Cl = lift_N / (rhv2 * mpDBObject->mfWingArea_sm); ! float inducedDrag_N; ! if (Cl > mpDBObject->mfMaxCl) { throttleFraction = 1.0f; ! mcGS.mfGoalAltitude_m = k.mfAlt_m - 50.0f*mpDBObject->mfMaxCl; // avoid flooding connection with stall adjustments ! //SetAltitude(k.mfAlt_m - 50.0f*mpDBObject->mfMaxCl); // max throttle and dive to get out of stall ! Cl = mpDBObject->mfMaxCl; inducedDrag_N = 0; // stall, no induced drag } ! else if (Cl > 0.9f*mpDBObject->mfMaxCl) ! { ! throttleFraction = 1.0f; ! mcGS.mfGoalAltitude_m = k.mfAlt_m - 500.0f*(Cl-0.9f*mpDBObject->mfMaxCl); ! //SetAltitude(k.mfAlt_m - 500.0f*(Cl-0.9f*mpDBObject->mfMaxCl)); // max throttle and dive to avoid impending stall ! inducedDrag_N = mpDBObject->mfKdi * Cl * Cl * lift_N; ! } ! else { ! inducedDrag_N = mpDBObject->mfKdi * Cl * Cl * lift_N; } ! ! angleOfAttack = Cl*liftCoeffToAoa; ! float netForce_N = fThrust_N - fDrag_N - inducedDrag_N - weight_N *sinf(k.mfClimbAngle_rad); --- 332,364 ---- float weight_N = C_G * mass_kg; ! // calculate lift needed to balance weight ! //float lift_N = weight_N * cosf(k.mfClimbAngle_rad); ! //float Cl = lift_N / (rhv2 * mpDBObject->mfWingArea_sm); ! ! float inducedDrag_N = 0; ! float ias_mps = sqrtf(0.8f * rho) * mfSpeed_mps; // approximate indicated airspeed + float stall_margin = ias_mps - mpDBObject->stallSpeed_mps; ! const float induced_drag_zone = 100.0f; ! const float aoaConstant = 0.001f; ! ! if (stall_margin <= 0) { throttleFraction = 1.0f; ! mcGS.mfGoalAltitude_m = k.mfAlt_m - 50.0f; // avoid flooding connection with stall adjustments inducedDrag_N = 0; // stall, no induced drag } ! else if (stall_margin < induced_drag_zone) { ! inducedDrag_N = mpDBObject->mfKdi * (induced_drag_zone - stall_margin); ! angleOfAttack = aoaConstant * (induced_drag_zone - stall_margin); } ! else ! { ! inducedDrag_N = 0; ! angleOfAttack = 0; ! } float netForce_N = fThrust_N - fDrag_N - inducedDrag_N - weight_N *sinf(k.mfClimbAngle_rad); *************** *** 388,392 **** */ tcAeroAirObject::tcAeroAirObject() ! : tcAirObject(), liftCoeffToAoa(1) { mnModelType = MTYPE_FIXEDWINGX; --- 386,390 ---- */ tcAeroAirObject::tcAeroAirObject() ! : tcAirObject() { mnModelType = MTYPE_FIXEDWINGX; *************** *** 397,401 **** */ tcAeroAirObject::tcAeroAirObject(tcAirDBObject *obj) ! : tcAirObject(obj), liftCoeffToAoa(obj->mfMaxAoa_rad/obj->mfMaxCl) { mpDBObject = obj; --- 395,399 ---- */ tcAeroAirObject::tcAeroAirObject(tcAirDBObject *obj) ! : tcAirObject(obj) { mpDBObject = obj; Index: tcCommandObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCommandObject.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcCommandObject.cpp 5 May 2005 02:14:54 -0000 1.4 --- tcCommandObject.cpp 21 May 2005 02:01:04 -0000 1.5 *************** *** 51,131 **** - - - /** - * 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 tcCommandObject::LoadCommandParam(tcCommandStream& stream, float& param, int flag) - { - float temp; - stream >> temp; // read into temporary variable - - param = temp; // apply update - - /* - - if (stream.GetAck()) - { - if ((commandStatus & flag) && (temp == param)) - { - commandStatus &= (~flag); // clear flag, successful ack - } - } - else // not an ack - { - if (clientMode && (commandStatus & flag)) - { - // ignore update - } - else - { - param = temp; // apply update - commandStatus &= (~flag); // clear flag - } - - } - */ - } - - /** - * version that takes int param - */ - void tcCommandObject::LoadCommandParam(tcCommandStream& stream, int& param, int flag) - { - int temp; - stream >> temp; // read into temporary variable - - param = temp; - - /* - if (stream.GetAck()) - { - if ((commandStatus & flag) && (temp == param)) - { - commandStatus &= (~flag); // clear flag, successful ack - } - } - else // not an ack - { - if (clientMode && (commandStatus & flag)) - { - // ignore update - } - else - { - param = temp; // apply update - commandStatus &= (~flag); // clear flag - } - - } - */ - } - - - /** * Called on new command. Sets bit in commandStatus and --- 51,54 ---- Index: tcGameObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameObject.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** tcGameObject.cpp 29 Apr 2005 18:52:55 -0000 1.35 --- tcGameObject.cpp 21 May 2005 02:01:04 -0000 1.36 *************** *** 274,277 **** --- 274,294 ---- /** + * O[nChildren] search to verify child + */ + bool tcGameObject::IsChild(const tcGameObject* child) const + { + size_t nChildren = children.size(); + for (size_t n=0; n<nChildren; n++) + { + if (children[n] == child) + { + return true; + } + } + + return false; + } + + /** * Removes child without freeing memory (use for transfers only). */ Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** tcSimState.cpp 8 May 2005 23:28:59 -0000 1.80 --- tcSimState.cpp 21 May 2005 02:01:05 -0000 1.81 *************** *** 2730,2733 **** --- 2730,2734 ---- tcGoal::AttachSimState(this); + tcLauncher::AttachSimState(this); tcLauncherState::AttachSimState(this); tcSensorState::AttachSimState(this); Index: tcAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirObject.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcAirObject.cpp 8 May 2005 23:28:59 -0000 1.23 --- tcAirObject.cpp 21 May 2005 02:01:04 -0000 1.24 *************** *** 47,51 **** tcPlatformObject::operator<<(stream); ! commandObj.LoadCommandParam(stream, readyForLanding, LANDING_CMD); return stream; --- 47,51 ---- tcPlatformObject::operator<<(stream); ! stream >> readyForLanding; return stream; Index: tcSensorPlatform.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorPlatform.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcSensorPlatform.cpp 17 Apr 2005 22:35:32 -0000 1.3 --- tcSensorPlatform.cpp 21 May 2005 02:01:04 -0000 1.4 *************** *** 222,227 **** for(size_t n=0; n < nSensors; n++) { ! sensorCommandObj.LoadCommandParam(stream, sensorState[n]->mbActive, ! (0x01) << n); } --- 222,226 ---- for(size_t n=0; n < nSensors; n++) { ! stream >> sensorState[n]->mbActive; } Index: tcAero.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAero.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcAero.cpp 2 Nov 2004 04:23:56 -0000 1.6 --- tcAero.cpp 21 May 2005 02:01:04 -0000 1.7 *************** *** 68,73 **** } ! ! float GetAirDensity(float afAltitude_m) { float fDensity_kgm3; // kg/m^3 --- 68,77 ---- } ! /** ! * TODO look at replacing this with lookup table (or caching equation ! * to table) ! */ ! float GetAirDensity(float afAltitude_m) ! { float fDensity_kgm3; // kg/m^3 *************** *** 78,92 **** } ! // valid from 0 to 36000 m altitude ! // data source, http://www.digitaldutch.com/atmoscalc/index.htm ! // standard atmosphere 1976, 59 deg F model ! float GetSoundSpeed(float afAltitude_m) { float fSoundSpeed_mps; // speed is slightly low near crossover, 11000 m ! if (afAltitude_m <= 10969.0f) { fSoundSpeed_mps = 340.6335f - 0.0041f*afAltitude_m; } ! else { fSoundSpeed_mps = 303.7310f - 0.001130470f*afAltitude_m + 3.597586e-008f*afAltitude_m*afAltitude_m; --- 82,101 ---- } ! /** ! ** valid from 0 to 36000 m altitude ! ** data source, http://www.digitaldutch.com/atmoscalc/index.htm ! ** standard atmosphere 1976, 59 deg F model ! */ ! float GetSoundSpeed(float afAltitude_m) ! { float fSoundSpeed_mps; // speed is slightly low near crossover, 11000 m ! if (afAltitude_m <= 10969.0f) ! { fSoundSpeed_mps = 340.6335f - 0.0041f*afAltitude_m; } ! else ! { fSoundSpeed_mps = 303.7310f - 0.001130470f*afAltitude_m + 3.597586e-008f*afAltitude_m*afAltitude_m; Index: tcStores.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcStores.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcStores.cpp 2 Dec 2004 04:17:27 -0000 1.2 --- tcStores.cpp 21 May 2005 02:01:05 -0000 1.3 *************** *** 182,186 **** void tcStores::CompleteOperation(StoreOperation& op) { ! tcLauncher* launcher = parent->GetLauncher(op.launcherIdx); wxASSERT(launcher); if (!launcher) return; --- 182,191 ---- void tcStores::CompleteOperation(StoreOperation& op) { ! tcGameObject* obj = GetChildOrParent(op.obj); ! ! wxASSERT(obj); ! if (obj == 0) return; ! ! tcLauncher* launcher = obj->GetLauncher(op.launcherIdx); wxASSERT(launcher); if (!launcher) return; *************** *** 188,203 **** if (op.transferType == StoreOperation::LOAD) { ! launcher->mnCurrent = 1; ! launcher->mnUncommitted = 1; ! launcher->mfTimeToReady = 0; } else { ! AddItems(op.item, op.quantity); ! launcher->mnCurrent = 0; ! launcher->mnUncommitted = 0; ! launcher->mfTimeToReady = 0; } - launcher->SetLoadState(false); // clear load state } --- 193,204 ---- if (op.transferType == StoreOperation::LOAD) { ! launcher->SetChildQuantity(op.quantity); // assumes empty launcher } else { ! wxASSERT(launcher->mnCurrent == op.quantity); // no partial unloading ! AddItems(op.item, launcher->mnCurrent); ! launcher->SetChildQuantity(0); } } *************** *** 240,243 **** --- 241,268 ---- /** + * Helper method to support operations between tcStores and + * child object of parent. + * @return parent if child is 0, child if child is valid, 0 otherwise + */ + tcGameObject* tcStores::GetChildOrParent(tcGameObject* child) + { + wxASSERT(parent); + + if (child == 0) + { + return parent; + } + else if (parent->IsChild(child)) + { + return child; + } + else + { + fprintf(stderr, "tcStores::GetChildOrParent - Child not found\n"); + return 0; + } + } + + /** * */ *************** *** 245,249 **** { wxASSERT(storesDBObj); ! for (size_t n=0; n<storesDBObj->compatibleItems.size(); n++) { if (storesDBObj->compatibleItems[n] == item) return true; --- 270,281 ---- { wxASSERT(storesDBObj); ! ! size_t nCompatible = storesDBObj->compatibleItems.size(); ! ! /* if no compatible items are entered, all items are compatible. ! ** This can be used for airfield depots or other general storage */ ! if (nCompatible == 0) return true; ! ! for (size_t n=0; n<nCompatible; n++) { if (storesDBObj->compatibleItems[n] == item) return true; *************** *** 263,280 **** /** ! * */ ! bool tcStores::LoadLauncher(unsigned int idx, const std::string& item) { ! wxASSERT(parent); ! ! tcLauncher* launcher = parent->GetLauncher(idx); if (launcher->mnCurrent) { ! if (parent->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - Cannot load non-empty launcher\n", ! parent->mzUnit.mz, parent->mzClass.mz); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); } --- 295,318 ---- /** ! * Loads exactly one item into launcher */ ! bool tcStores::LoadLauncher(unsigned int idx, const std::string& item, ! tcGameObject* child) { ! tcGameObject* obj = GetChildOrParent(child); ! ! wxASSERT(obj); ! if (obj == 0) return false; + tcLauncher* launcher = obj->GetLauncher(idx); + wxASSERT(launcher); + if (!launcher) return false; + if (launcher->mnCurrent) { ! if (obj->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - Cannot load non-empty launcher\n", ! obj->mzUnit.mz, obj->mzClass.mz); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); } *************** *** 282,288 **** --- 320,340 ---- } + unsigned int launcherCapacity = launcher->GetCapacityForItem(item); + + if (launcherCapacity == 0) + { + if (obj->IsOwnAlliance()) + { + wxString s = wxString::Format("%s (%s) - Incompatible item for launcher\n", + obj->mzUnit.mz, obj->mzClass.mz); + tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); + } + return false; // item not compatible with launcher + } + std::vector<StoreItem>::iterator iter; bool found = false; int nStores = (int)stores.size(); + unsigned int loadQuantity = 0; for (int k=nStores-1; (k>=0) && !found; k--) { *************** *** 291,295 **** found = true; wxASSERT(stores[k].quantity); ! stores[k].quantity--; if (stores[k].quantity == 0) { --- 343,355 ---- found = true; wxASSERT(stores[k].quantity); ! if (stores[k].quantity >= launcherCapacity) ! { ! loadQuantity = launcherCapacity; ! } ! else ! { ! loadQuantity = stores[k].quantity; ! } ! stores[k].quantity -= loadQuantity; if (stores[k].quantity == 0) { *************** *** 301,308 **** if (!found) { ! if (parent->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - No %s in %s\n", ! parent->mzUnit.mz, parent->mzClass.mz, item.c_str(), storesDBObj->displayName.c_str()); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); --- 361,368 ---- if (!found) { ! if (obj->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - No %s in %s\n", ! obj->mzUnit.mz, obj->mzClass.mz, item.c_str(), storesDBObj->displayName.c_str()); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); *************** *** 317,321 **** for (opIter = ops.begin(); (opIter != ops.end()) && (!found); ++opIter) { ! if (opIter->launcherIdx == idx) { matchIter = opIter; --- 377,381 ---- for (opIter = ops.begin(); (opIter != ops.end()) && (!found); ++opIter) { ! if ((opIter->launcherIdx == idx) && (opIter->obj == child)) { matchIter = opIter; *************** *** 329,336 **** if (matchIter->item == item) { ! if (parent->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - Already loading %s in %s\n", ! parent->mzUnit.mz, parent->mzClass.mz, item.c_str(), storesDBObj->displayName.c_str()); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); --- 389,396 ---- if (matchIter->item == item) { ! if (obj->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - Already loading %s in %s\n", ! obj->mzUnit.mz, obj->mzClass.mz, item.c_str(), storesDBObj->displayName.c_str()); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); *************** *** 342,346 **** AddItems(matchIter->item, matchIter->quantity); matchIter->item = item; ! matchIter->quantity = 1; // only load 1 at a time matchIter->timeToComplete = storesDBObj->moveTime; } --- 402,406 ---- AddItems(matchIter->item, matchIter->quantity); matchIter->item = item; ! matchIter->quantity = loadQuantity; matchIter->timeToComplete = storesDBObj->moveTime; } *************** *** 350,364 **** op.item = item; op.launcherIdx = idx; ! op.quantity = 1; // only load 1 at a time op.timeToComplete = storesDBObj->moveTime; op.transferType = StoreOperation::LOAD; ops.push_back(op); } ! if (parent->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - Loading %s in %s\n", ! parent->mzUnit.mz, parent->mzClass.mz, item.c_str(), storesDBObj->displayName.c_str()); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); --- 410,425 ---- op.item = item; op.launcherIdx = idx; ! op.quantity = loadQuantity; op.timeToComplete = storesDBObj->moveTime; op.transferType = StoreOperation::LOAD; + op.obj = child; ops.push_back(op); } ! if (obj->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - Loading %s in %s\n", ! obj->mzUnit.mz, obj->mzClass.mz, item.c_str(), storesDBObj->displayName.c_str()); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); *************** *** 380,397 **** /** ! * */ ! bool tcStores::UnloadLauncher(unsigned int idx) { ! wxASSERT(parent); ! tcLauncher* launcher = parent->GetLauncher(idx); if (launcher->mnCurrent == 0) { ! if (parent->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - Cannot unload empty launcher\n", ! parent->mzUnit.mz, parent->mzClass.mz); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); } --- 441,463 ---- /** ! * Unloads all items from launcher */ ! bool tcStores::UnloadLauncher(unsigned int idx, tcGameObject* child) { ! tcGameObject* obj = GetChildOrParent(child); ! ! wxASSERT(obj); ! if (obj == 0) return false; ! tcLauncher* launcher = obj->GetLauncher(idx); ! wxASSERT(launcher); ! if (!launcher) return false; if (launcher->mnCurrent == 0) { ! if (obj->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - Cannot unload empty launcher\n", ! obj->mzUnit.mz, obj->mzClass.mz); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); } *************** *** 403,410 **** if (!IsCompatible(item)) { ! if (parent->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - No magazine to hold %s from %s\n", ! parent->mzUnit.mz, parent->mzClass.mz, item.c_str(), storesDBObj->displayName.c_str()); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); --- 469,476 ---- if (!IsCompatible(item)) { ! if (obj->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - No magazine to hold %s from %s\n", ! obj->mzUnit.mz, obj->mzClass.mz, item.c_str(), storesDBObj->displayName.c_str()); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); *************** *** 416,423 **** if (IsFull()) { ! if (parent->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - Magazine full, cannot unload %s from %s\n", ! parent->mzUnit.mz, parent->mzClass.mz, item.c_str(), storesDBObj->displayName.c_str()); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); --- 482,489 ---- if (IsFull()) { ! if (obj->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - Magazine full, cannot unload %s from %s\n", ! obj->mzUnit.mz, obj->mzClass.mz, item.c_str(), storesDBObj->displayName.c_str()); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); *************** *** 432,436 **** for (opIter = ops.begin(); (opIter != ops.end()) && (!found); ++opIter) { ! if (opIter->launcherIdx == idx) { matchIter = opIter; --- 498,502 ---- for (opIter = ops.begin(); (opIter != ops.end()) && (!found); ++opIter) { ! if ((opIter->launcherIdx == idx) && (opIter->obj == child)) { matchIter = opIter; *************** *** 443,450 **** wxASSERT(matchIter->transferType == StoreOperation::UNLOAD); ! if (parent->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - Already unloading %s from %s\n", ! parent->mzUnit.mz, parent->mzClass.mz, item.c_str(), storesDBObj->displayName.c_str()); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); --- 509,516 ---- wxASSERT(matchIter->transferType == StoreOperation::UNLOAD); ! if (obj->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - Already unloading %s from %s\n", ! obj->mzUnit.mz, obj->mzClass.mz, item.c_str(), storesDBObj->displayName.c_str()); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); *************** *** 459,470 **** op.timeToComplete = storesDBObj->moveTime; op.transferType = StoreOperation::UNLOAD; ops.push_back(op); launcher->SetLoadState(true); ! if (parent->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - Unloading %s from %s\n", ! parent->mzUnit.mz, parent->mzClass.mz, item.c_str(), storesDBObj->displayName.c_str()); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); --- 525,537 ---- op.timeToComplete = storesDBObj->moveTime; op.transferType = StoreOperation::UNLOAD; + op.obj = child; ops.push_back(op); launcher->SetLoadState(true); ! if (obj->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s) - Unloading %s from %s\n", ! obj->mzUnit.mz, obj->mzClass.mz, item.c_str(), storesDBObj->displayName.c_str()); tcMessageInterface::Get()->ChannelMessage("Info", s.c_str()); Index: tcRadar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadar.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tcRadar.cpp 29 Apr 2005 18:52:56 -0000 1.28 --- tcRadar.cpp 21 May 2005 02:01:04 -0000 1.29 *************** *** 279,283 **** * guidance from the fire control radar. */ ! void tcRadar::SetIlluminator(long illum_id, unsigned sensor_idx) { wxASSERT(isSemiactive || isCommandReceiver); --- 279,283 ---- * guidance from the fire control radar. */ ! void tcRadar::SetIlluminator(long illum_id, unsigned char sensor_idx) { wxASSERT(isSemiactive || isCommandReceiver); |