本文整理汇总了C++中MoverPtr::isDisabled方法的典型用法代码示例。如果您正苦于以下问题:C++ MoverPtr::isDisabled方法的具体用法?C++ MoverPtr::isDisabled怎么用?C++ MoverPtr::isDisabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoverPtr
的用法示例。
在下文中一共展示了MoverPtr::isDisabled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: meetsCriteria
bool TeamSensorSystem::meetsCriteria (GameObjectPtr looker, MoverPtr mover, long contactCriteria) {
bool isSensor[NUM_CONTACT_STATUSES] = {false, true, true, true, true, false};
long status = mover->getContactStatus(teamId, true);
if (mover->getFlag(OBJECT_FLAG_REMOVED))
return(false);
if (status == CONTACT_NONE)
return(false);
if (contactCriteria & CONTACT_CRITERIA_VISUAL_OR_SENSOR)
if ((status != CONTACT_VISUAL) && !isSensor[status])
return(false);
if (contactCriteria & CONTACT_CRITERIA_VISUAL)
if (status != CONTACT_VISUAL)
return(false);
if (contactCriteria & CONTACT_CRITERIA_SENSOR)
if (!isSensor[status])
return(false);
if (contactCriteria & CONTACT_CRITERIA_NOT_CHALLENGED) {
if (mover->getChallenger() != NULL)
return(false);
}
if (contactCriteria & CONTACT_CRITERIA_NOT_DISABLED) {
if (mover->isDisabled())
return(false);
}
if (contactCriteria & CONTACT_CRITERIA_ENEMY) {
if ((teamId == -1) || !mover->getTeam())
return(false);
if (!Team::teams[teamId]->isEnemy(mover->getTeam()))
return(false);
}
if (contactCriteria & CONTACT_CRITERIA_ARMED) {
if (mover->numFunctionalWeapons == 0)
return(false);
}
return(true);
}
示例2: calcContactStatus
long SensorSystem::calcContactStatus (MoverPtr mover) {
if (!owner->getTeam())
return(CONTACT_NONE);
if (mover->getFlag(OBJECT_FLAG_REMOVED)) {
return(CONTACT_NONE);
}
//----------------------------------------------------------
//If object we are looking for is at the edge, NO CONTACT!!
if (!Terrain::IsGameSelectTerrainPosition(mover->getPosition()))
return CONTACT_NONE;
//-------------------------------------------------------------
// Should be properly set when active probes are implemented...
long newContactStatus = CONTACT_NONE;
if (!notShutdown || (range == 0.0) && !broken)
{
if (owner->lineOfSight(mover) && !mover->isDisabled())
newContactStatus = CONTACT_VISUAL;
return(newContactStatus);
}
if ((masterIndex == -1) || (range < 0.0)) {
return(CONTACT_NONE);
}
if (owner->isMover()) {
MoverPtr mover = (MoverPtr)owner;
if ((mover->sensor == 255) || mover->inventory[mover->sensor].disabled || broken) {
return(CONTACT_NONE);
}
}
if (mover->getFlag(OBJECT_FLAG_SENSOR) && !mover->isDisabled())
{
bool moverNotContact = mover->hasNullSignature() || (mover->getEcmRange() != 0.0f);
bool moverInvisible = (mover->getStatus() == OBJECT_STATUS_SHUTDOWN);
if (!moverInvisible && !moverNotContact)
{
float distanceToMover = owner->distanceFrom(mover->getPosition());
float sensorRange = getEffectiveRange();
if (distanceToMover <= sensorRange)
{
//-------------------------------------------
//No need to check shutdown and probe AGAIN!
newContactStatus = getSensorQuality();
//---------------------------------------
// If ecm affecting me, my skill drops...
// CUT, per Mitch 2/10/00
if ((ecmEffect < 1.0) && (newContactStatus > CONTACT_SENSOR_QUALITY_1))
newContactStatus--;
//---------------------------------------------------
// We now we are within sensor range, check visual.
float startRadius = 0.0f;
if (!owner->isMover())
startRadius = owner->getAppearRadius();
if (hasLOSCapability && owner->lineOfSight(mover,startRadius))
newContactStatus = CONTACT_VISUAL;
}
else //Still need to check if visual!!! ECM and Lookout Towers!!
{
float startRadius = 0.0f;
if (!owner->isMover())
startRadius = owner->getAppearRadius();
if (hasLOSCapability && owner->lineOfSight(mover,startRadius))
newContactStatus = CONTACT_VISUAL;
}
}
else
{
//Target is shutdown, can ONLY be visual cause this platform has no probe.
float startRadius = 0.0f;
if (!owner->isMover())
startRadius = owner->getAppearRadius();
if (hasLOSCapability && owner->lineOfSight(mover,startRadius))
newContactStatus = CONTACT_VISUAL;
}
}
//Let us know that we can see something, sensor or otherwise!!
if (mover->getTeam() && (owner->getTeam() == Team::home) && mover->getTeam()->isEnemy(Team::home) &&
(newContactStatus != CONTACT_NONE))
{
SensorSystemManager::enemyInLOS = true;
}
return(newContactStatus);
}
示例3: render
//.........这里部分代码省略.........
gos_SetRenderState( gos_State_TextureAddress, gos_TextureWrap );
gos_SetRenderState( gos_State_ZCompare, 0);
gos_SetRenderState( gos_State_ZWrite, 0);
DWORD gosTextureHandle = mcTextureManager->get_gosTextureHandle(viewRectHandle);
gos_SetRenderState( gos_State_Texture, gosTextureHandle );
gos_DrawQuads( &corners[0], 4 );
unsigned long colors[MAX_MOVERS];
unsigned long ringColors[MAX_MOVERS];
Stuff::Vector3D positions[MAX_MOVERS];
unsigned long ranges[MAX_MOVERS];
bool selected[MAX_MOVERS];
count = 0;
//------------------------------------------------------------
// draw non-movers, must do separate check for vehicles, I'm not sure they
// have sensors
for ( i = 0; i < MAX_TEAMS; ++i )
{
TeamSensorSystem* pSys = SensorManager->getTeamSensor( i );
if ( pSys )
{
for ( int j = 0; j < pSys->numSensors; ++j )
{
SensorSystem* pSensor = pSys->sensors[j];
if ( !pSensor )
continue;
if ( pSensor->owner->isDestroyed() || pSensor->owner->isDisabled() || pSensor->owner->getStatus() == OBJECT_STATUS_SHUTDOWN )
continue;
if ( pSensor->getRange() < 1.1 || pSensor->broken)
continue;
if (!pSensor->owner->getTeam())
continue;
ObjectClass objClass = pSensor->owner->getObjectClass();
unsigned long colorBlip = pSensor->owner->getSelected() ? 0xff4bff4b : 0xff00cc00;
unsigned long colorRing = 0xff00cc00;
if ( pSensor->owner->getTeam()->isNeutral( Team::home ) )
{
colorBlip = pSensor->owner->getSelected() ? 0xff4c4cff : 0xff0000ff;
colorRing = 0xff0000ff;
}
else if ( pSensor->owner->getTeam()->isEnemy( Team::home ) ) // enemy
{
{
colorBlip = pSensor->owner->getSelected() ? 0xffff3f3f : 0xffff0000;
colorRing = 0xffff0000;
}
}
if ( objClass != BATTLEMECH && objClass != GROUNDVEHICLE)
{
if ( objClass == ARTILLERY )
{
示例4: handleTacticalOrder
long MoverGroup::handleTacticalOrder (TacticalOrder tacOrder, long priority, Stuff::Vector3D* jumpGoalList, bool queueGroupOrder) {
if (numMovers == 0)
return(NO_ERR);
if (queueGroupOrder)
tacOrder.pack(NULL, NULL);
//bool processOrder = true;
bool isJump = false;
bool isMove = false;
Stuff::Vector3D goalList[MAX_MOVERGROUP_COUNT];
Stuff::Vector3D location = tacOrder.getWayPoint(0);
//MoverPtr pointVehicle = getPoint();
if (tacOrder.code == TACTICAL_ORDER_ATTACK_OBJECT)
if (tacOrder.attackParams.method == ATTACKMETHOD_DFA) {
//-------------------------------------------------
// Let's just make it a move/jump order, for now...
tacOrder.code = TACTICAL_ORDER_JUMPTO_OBJECT;
tacOrder.moveParams.wait = false;
tacOrder.moveParams.wayPath.mode[0] = TRAVEL_MODE_SLOW;
GameObjectPtr target = ObjectManager->getByWatchID(tacOrder.targetWID);
Assert(tacOrder.targetWID != 0, 0, " DFA AttackObject WID is 0 ");
if (!target)
return(NO_ERR);
tacOrder.setWayPoint(0, target->getPosition());
}
if (tacOrder.code == TACTICAL_ORDER_JUMPTO_OBJECT) {
tacOrder.code = TACTICAL_ORDER_JUMPTO_POINT;
GameObjectPtr target = ObjectManager->get(tacOrder.targetWID);
Assert(tacOrder.targetWID != 0, 0, " DFA AttackObject WID is 0 ");
if (!target)
return(NO_ERR);
tacOrder.setWayPoint(0, target->getPosition());
}
//vector_3d offsetTable[MAX_GROUPMOVE_OFFSETS];
//long numOffsets = 0;
switch (tacOrder.code) {
case TACTICAL_ORDER_WAIT:
break;
case TACTICAL_ORDER_MOVETO_POINT:
case TACTICAL_ORDER_MOVETO_OBJECT: {
Fatal(0, "Need to support jumpGoalList (and goalList) for MOVETO as well in mc2 ");
isMove = true;
//-----------------------------------------------------------
// Sort by distance to destination. Their selectionIndex will
// be set to modify this goal...
SortListPtr list = Mover::sortList;
if (list) {
list->clear(false);
long moverCount = 0;
for (long i = 0; i < numMovers; i++) {
MoverPtr mover = getMover(i);
Assert(mover != NULL, moverWIDs[i], " MoverGroup.handleTacticalOrder: NULL mover ");
if (!mover->isDisabled()) {
list->setId(moverCount, i);
list->setValue(moverCount, mover->distanceFrom(location));
moverCount++;
}
}
list->sort(false);
//--------------------------------
// Let's build the offset table...
/*
numOffsets = moverCount - 1;
if (numOffsets > MAX_GROUPMOVE_OFFSETS)
numOffsets = MAX_GROUPMOVE_OFFSETS;
long offsetsStart = GroupMoveOffsetsIndex[numOffsets - 1];
for (i = 0; i < numOffsets; i++)
offsetTable[i] = relativePositionToPoint(location, GroupMoveOffsets[offsetsStart + i][0], GroupMoveOffsets[offsetsStart + i][1], RELPOS_FLAG_PASSABLE_START);
*/
//-----------------------------------
// Now, calc the order of movement...
long curIndex = 1;
for (i = 0; i < moverCount; i++) {
MoverPtr mover = getMover(list->getId(i));
if (mover->getWatchID() == pointWID)
mover->selectionIndex = 0;
else
mover->selectionIndex = curIndex++;
}
}
}
break;
case TACTICAL_ORDER_JUMPTO_POINT:
case TACTICAL_ORDER_JUMPTO_OBJECT: {
//-----------------------------------------------------------
// Sort by distance to destination. Their selectionIndex will
// be set to modify this goal...
isJump = true;
//-------------------------------------------------------------------------
// We can assume that all movers in this group are jump-capable. Otherwise,
// the group wouldn't be allowed to jump by the interface. In addition,
// we KNOW that all movers in this group can jump to the selected
// goal (of course, they won't due to terrain and crowding)...
//.........这里部分代码省略.........
示例5: calcJumpGoals
long MoverGroup::calcJumpGoals (Stuff::Vector3D goal, long numMovers, Stuff::Vector3D* goalList, GameObjectPtr DFATarget) {
long numJumping = 0;
//-----------------------------
// First, build the jump map...
long jumpMap[JUMPMAP_CELL_DIM][JUMPMAP_CELL_DIM];
//------------------------------------------------------------
// The initial goal tile is placed at the center of the map...
long goalCell[2] = {0, 0};
land->worldToCell(goal, goalCell[0], goalCell[1]);
long mapCellUL[2] = {0, 0};
mapCellUL[0] = goalCell[0] - JUMPMAP_CELL_DIM / 2;
mapCellUL[1] = goalCell[1] - JUMPMAP_CELL_DIM / 2;
// -1 = OPEN
// -2 = BLOCKED
// 0 thru # = already selected for that # mover in the group
for (long r = 0; r < JUMPMAP_CELL_DIM; r++)
for (long c = 0; c < JUMPMAP_CELL_DIM; c++) {
long cellRow = mapCellUL[0] + r;
long cellCol = mapCellUL[1] + c;
if (GameMap->inBounds(cellRow, cellCol)) {
MapCellPtr mapCell = GameMap->getCell(cellRow, cellCol);
//-----------------------
// Tile (terrain) type...
//long tileType = curTile.getTileType();
if (!mapCell->getPassable())
jumpMap[r][c] = -2;
else
jumpMap[r][c] = -1;
#ifdef USE_OVERLAYS_IN_MC2
long overlay = mapCell->getOverlay();
if (OverlayIsBridge[overlay]) {
switch (overlay) {
case OVERLAY_WATER_BRIDGE_NS:
case OVERLAY_RAILROAD_WATER_BRIDGE_NS:
jumpMap[row][col] = -2;
jumpMap[row][col + 2] = -2;
jumpMap[row + 1][col] = -2;
jumpMap[row + 1][col + 2] = -2;
jumpMap[row + 2][col] = -2;
jumpMap[row + 2][col + 2] = -2;
break;
case OVERLAY_WATER_BRIDGE_EW:
case OVERLAY_RAILROAD_WATER_BRIDGE_EW:
jumpMap[row][col] = -2;
jumpMap[row][col + 1] = -2;
jumpMap[row][col + 2] = -2;
jumpMap[row + 2][col] = -2;
jumpMap[row + 2][col + 1] = -2;
jumpMap[row + 2][col + 2] = -2;
break;
case OVERLAY_WATER_BRIDGE_NS_DESTROYED:
case OVERLAY_RAILROAD_WATER_BRIDGE_NS_DESTROYED:
case OVERLAY_WATER_BRIDGE_EW_DESTROYED:
case OVERLAY_RAILROAD_WATER_BRIDGE_EW_DESTROYED:
jumpMap[row][col] = -2;
jumpMap[row][col + 1] = -2;
jumpMap[row][col + 2] = -2;
jumpMap[row + 1][col] = -2;
jumpMap[row + 1][col + 1] = -2;
jumpMap[row + 1][col + 2] = -2;
jumpMap[row + 2][col] = -2;
jumpMap[row + 2][col + 1] = -2;
jumpMap[row + 2][col + 2] = -2;
break;
}
}
#endif
}
else
jumpMap[r][c] = -2;
}
long moverCount = ObjectManager->getNumMovers();
for (long i = 0; i < moverCount; i++) {
MoverPtr mover = ObjectManager->getMover(i);
if ((mover->getObjectClass() != ELEMENTAL) && (mover != DFATarget) && !mover->isDisabled()) {
long mapCellRow, mapCellCol;
mover->getCellPosition(mapCellRow, mapCellCol);
mapCellRow -= mapCellUL[0];
mapCellCol -= mapCellUL[1];
if (inMapBounds(mapCellRow, mapCellCol, JUMPMAP_CELL_DIM, JUMPMAP_CELL_DIM))
jumpMap[mapCellRow][mapCellCol] = -2;
}
}
#ifdef _DEBUG
#if DEBUGJUMPGOALS
char debugStr[256];
sprintf(debugStr, "GROUP JUMP(%.2f,%.2f,%.2f)--UL = %d,%d: ", goal.x, goal.y, goal.z,mapCellUL[0], mapCellUL[1]);
#endif
#endif
//-----------------------------------------------------------------
//.........这里部分代码省略.........
示例6: teamLineOfSight
//---------------------------------------------------------------------------
bool Team::teamLineOfSight(Stuff::Vector3D tPos, float extRad)
{
//-----------------------------------------------------------
// For each member of the team, check LOS to point provided.
for(size_t i = 0; i < rosterSize; i++)
{
MoverPtr obj = (MoverPtr)ObjectManager->getByWatchID(roster[i]);
if(!obj->isDisabled() && !obj->isDestroyed() && (obj->getStatus() != OBJECT_STATUS_SHUTDOWN))
{
Stuff::Vector3D distance;
distance.Subtract(tPos, obj->getPosition());
float dist = distance.GetApproximateLength();
//Figure out altitude above minimum terrain altitude and look up in table.
float baseElevation = MapData::waterDepth;
if(MapData::waterDepth < Terrain::userMin)
baseElevation = Terrain::userMin;
float altitude = obj->getPosition().z - baseElevation;
float altitudeIntegerRange = (Terrain::userMax - baseElevation) * 0.00390625f;
int32_t altLevel = 0;
if(altitudeIntegerRange > Stuff::SMALL)
altLevel = altitude / altitudeIntegerRange;
if(altLevel < 0)
altLevel = 0;
if(altLevel > 255)
altLevel = 255;
float radius = visualRangeTable[altLevel];
//Scouting specialty skill.
if(obj->isMover())
{
MoverPtr mover = (MoverPtr)obj;
if(mover->pilot && mover->pilot->isScout())
radius += (radius * 0.2f);
radius *= mover->getLOSFactor();
}
if(dist <= (radius * 25.0f * worldUnitsPerMeter))
{
if(lineOfSight(obj->getLOSPosition(), tPos, id, extRad, 0.0f, false))
return true;
}
}
}
//-------------------------------------------------------------------------
// Check the lookout towers now. You can find them in special Buildings!!
for(size_t spBuilding = 0; spBuilding < ObjectManager->numSpecialBuildings; spBuilding++)
{
if(ObjectManager->specialBuildings[spBuilding] &&
ObjectManager->specialBuildings[spBuilding]->getExists() &&
ObjectManager->specialBuildings[spBuilding]->isLookoutTower() &&
(ObjectManager->specialBuildings[spBuilding]->getTeamId() == id))
{
GameObjectPtr obj = ObjectManager->specialBuildings[spBuilding];
if(!obj->isDisabled() && !obj->isDestroyed() && (obj->getStatus() != OBJECT_STATUS_SHUTDOWN))
{
Stuff::Vector3D distance;
distance.Subtract(tPos, obj->getPosition());
float dist = distance.GetApproximateLength();
//Figure out altitude above minimum terrain altitude and look up in table.
float baseElevation = MapData::waterDepth;
if(MapData::waterDepth < Terrain::userMin)
baseElevation = Terrain::userMin;
float altitude = obj->getPosition().z - baseElevation;
float altitudeIntegerRange = (Terrain::userMax - baseElevation) * 0.00390625f;
int32_t altLevel = 0;
if(altitudeIntegerRange > Stuff::SMALL)
altLevel = altitude / altitudeIntegerRange;
if(altLevel < 0)
altLevel = 0;
if(altLevel > 255)
altLevel = 255;
float radius = visualRangeTable[altLevel];
//Scouting specialty skill.
if(obj->isMover())
{
MoverPtr mover = (MoverPtr)obj;
if(mover->pilot && mover->pilot->isScout())
radius += (radius * 0.2f);
radius *= mover->getLOSFactor();
}
if(dist <= (radius * 25.0f * worldUnitsPerMeter))
{
if(lineOfSight(obj->getLOSPosition(), tPos, id, 0.0f, obj->getAppearRadius(), false))
return true;
}
}
}
}
return false;
}