Exemple #1
0
bool Team::isTargeting(GameObjectWatchID targetWID, GameObjectWatchID exceptWID)
{
	if(exceptWID)
		for(size_t i = 0; i < rosterSize; i++)
		{
			if(roster[i] == exceptWID)
				continue;
			MoverPtr mover = dynamic_cast<MoverPtr>(ObjectManager->getByWatchID(roster[i]));
			Assert(mover != nullptr, roster[i], " Team.isTargeting: nullptr mover ");
			MechWarriorPtr pilot = mover->getPilot();
			if(pilot)
			{
				GameObjectPtr target = pilot->getCurrentTarget();
				if(target && (target->getWatchID() == targetWID))
					return(true);
			}
		}
	else
		for(size_t i = 0; i < rosterSize; i++)
		{
			MoverPtr mover = dynamic_cast<MoverPtr>(ObjectManager->getByWatchID(roster[i]));
			Assert(mover != nullptr, roster[i], " Team.isTargeting: nullptr mover ");
			MechWarriorPtr pilot = mover->getPilot();
			if(pilot)
			{
				GameObjectPtr target = pilot->getCurrentTarget();
				if(target && (target->getWatchID() == targetWID))
					return(true);
			}
		}
	return(false);
}
Exemple #2
0
void Team::statusCount(int32_t* statusTally)
{
	//----------------------------------------------------------
	// statusTally counts the number of objects in the team with
	// each of the statuses...
	for(size_t i = 0; i < rosterSize; i++)
	{
		MoverPtr obj = (MoverPtr)ObjectManager->getByWatchID(roster[i]);
		Assert(obj != nullptr, i, " Team.statusCount: nullptr roster object ");
		MechWarriorPtr pilot = obj->getPilot();
		if(!obj->getExists())
			statusTally[8]++;
		else if(!obj->getAwake())
			statusTally[7]++;
		else if(pilot && (pilot->getStatus() == WARRIOR_STATUS_WITHDRAWN))
			statusTally[6]++;
		else
		{
			int32_t status = obj->getStatus();
			if((status < 0) || (status > 5))
				Fatal(status, " Status out of bounds ");
			statusTally[obj->getStatus()]++;
		}
	}
}
Exemple #3
0
void MoverGroup::triggerAlarm (long alarmCode, unsigned long triggerId) {

	for (long i = 0; i < numMovers; i++) {
		MechWarriorPtr pilot = getMover(i)->getPilot();
		if (pilot)
			pilot->triggerAlarm(alarmCode, triggerId);
	}
}
Exemple #4
0
void MoverGroup::triggerAlarm(int32_t alarmCode, uint32_t triggerId)
{
	for (size_t i = 0; i < numMovers; i++)
	{
		MechWarriorPtr pilot = getMover(i)->getPilot();
		if (pilot)
			pilot->triggerAlarm(alarmCode, triggerId);
	}
}
PathQueueRecPtr MovePathManager::remove(MechWarriorPtr pilot)
{
    PathQueueRecPtr rec = pilot->getMovePathRequest();
    if(rec)
    {
        remove(rec);
        pilot->setMovePathRequest(nullptr);
        return(rec);
    }
    return(nullptr);
}
Exemple #6
0
int32_t MoverGroup::orderEject(int32_t origin)
{
	int32_t result = TACORDER_FAILURE;
	for (size_t i = 0; i < numMovers; i++)
	{
		Assert(getMover(i) != nullptr, 0, " MoverGroup.orderEject: nullptr mover ");
		MechWarriorPtr pilot = getMover(i)->getPilot();
		if (pilot)
			result = pilot->orderEject(true, true, origin);
	}
	return (result);
}
Exemple #7
0
int32_t MoverGroup::orderWithdraw(int32_t origin, Stuff::Vector3D location)
{
	int32_t result = TACORDER_FAILURE;
	for (size_t i = 0; i < numMovers; i++)
	{
		Assert(getMover(i) != nullptr, 0, " MoverGroup.orderWithdraw: nullptr mover ");
		MechWarriorPtr pilot = getMover(i)->getPilot();
		if (pilot)
			result = pilot->orderWithdraw(true, origin, location);
	}
	return (result);
}
Exemple #8
0
int32_t MoverGroup::orderTraversePath(int32_t origin, WayPathPtr wayPath, uint32_t params)
{
	int32_t result = TACORDER_FAILURE;
	for (size_t i = 0; i < numMovers; i++)
	{
		Assert(getMover(i) != nullptr, 0, " MoverGroup.orderTraversePath: nullptr mover ");
		MechWarriorPtr pilot = getMover(i)->getPilot();
		if (pilot)
			result = pilot->orderTraversePath(true, true, origin, wayPath, params);
	}
	return (result);
}
Exemple #9
0
long MoverGroup::orderWithdraw (long origin, Stuff::Vector3D location) {

	long result = TACORDER_FAILURE;

	for (long i = 0; i < numMovers; i++) {
		Assert(getMover(i) != NULL, 0, " MoverGroup.orderWithdraw: NULL mover ");
		MechWarriorPtr pilot = getMover(i)->getPilot();
		if (pilot)
			result = pilot->orderWithdraw(true, origin, location);
	}

	return(result);
}
Exemple #10
0
long MoverGroup::orderAttackObject (long origin, GameObjectPtr target, long attackType, long attackMethod, long attackRange, long aimLocation, long fromArea, unsigned long params) {

	long result = TACORDER_FAILURE;

	for (long i = 0; i < numMovers; i++) {
		Assert(getMover(i) != NULL, 0, " MoverGroup.orderAttackObject: NULL mover ");
		MechWarriorPtr pilot = getMover(i)->getPilot();
		if (pilot)
			result = pilot->orderAttackObject(true, origin, target, attackType, attackMethod, attackRange, aimLocation, fromArea, params);
	}

	return(result);
}
Exemple #11
0
int32_t MoverGroup::orderMoveToPoint(
	bool setTacOrder, int32_t origin, Stuff::Vector3D location, uint32_t params)
{
	int32_t result = TACORDER_FAILURE;
	for (size_t i = 0; i < numMovers; i++)
	{
		Assert(getMover(i) != nullptr, 0, " MoverGroup.orderMoveToPoint: nullptr mover ");
		MechWarriorPtr pilot = getMover(i)->getPilot();
		if (pilot)
			result = pilot->orderMoveToPoint(true, setTacOrder, origin, location, -1, params);
	}
	return (result);
}
Exemple #12
0
long MoverGroup::orderPatrolPath (long origin, WayPathPtr wayPath) {

	long result = TACORDER_FAILURE;

	for (long i = 0; i < numMovers; i++) {
		Assert(getMover(i) != NULL, 0, " MoverGroup.orderPatrolPath: NULL mover ");
		MechWarriorPtr pilot = getMover(i)->getPilot();
		if (pilot)
			result = pilot->orderPatrolPath(true, true, origin, wayPath);
	}

	return(result);
}
Exemple #13
0
long MoverGroup::orderPowerUp (long origin) {

	long result = TACORDER_FAILURE;

	for (long i = 0; i < numMovers; i++) {
		Assert(getMover(i) != NULL, 0, " MoverGroup.orderPowerUp: NULL mover ");
		MechWarriorPtr pilot = getMover(i)->getPilot();
		if (pilot)
			result = pilot->orderPowerUp(true, origin);
	}

	return(result);
}
Exemple #14
0
long MoverGroup::orderMoveToObject (bool setTacOrder, long origin, GameObjectPtr target, long fromArea, unsigned long params) {

	long result = TACORDER_FAILURE;

	for (long i = 0; i < numMovers; i++) {
		Assert(getMover(i) != NULL, 0, " MoverGroup.orderMoveToObject: NULL mover ");
		MechWarriorPtr pilot = getMover(i)->getPilot();
		if (pilot)
			result = pilot->orderMoveToObject(true, setTacOrder, origin, target, fromArea, -1, params);
	}

	return(result);
}
Exemple #15
0
long MoverGroup::orderMoveToPoint (bool setTacOrder, long origin, Stuff::Vector3D location, unsigned long params) {

	long result = TACORDER_FAILURE;

	for (long i = 0; i < numMovers; i++) {
		Assert(getMover(i) != NULL, 0, " MoverGroup.orderMoveToPoint: NULL mover ");
		MechWarriorPtr pilot = getMover(i)->getPilot();
		if (pilot)
			result = pilot->orderMoveToPoint(true, setTacOrder, origin, location, -1, params);
	}

	return(result);
}
Exemple #16
0
int32_t MoverGroup::orderMoveToObject(
	bool setTacOrder, int32_t origin, GameObjectPtr target, int32_t fromArea, uint32_t params)
{
	int32_t result = TACORDER_FAILURE;
	for (size_t i = 0; i < numMovers; i++)
	{
		Assert(getMover(i) != nullptr, 0, " MoverGroup.orderMoveToObject: nullptr mover ");
		MechWarriorPtr pilot = getMover(i)->getPilot();
		if (pilot)
			result =
				pilot->orderMoveToObject(true, setTacOrder, origin, target, fromArea, -1, params);
	}
	return (result);
}
Exemple #17
0
void MoverGroup::statusCount (long* statusTally) {

	for (long i = 0; i < numMovers; i++) {
		MoverPtr mover = getMover(i);
		MechWarriorPtr pilot = mover->getPilot();
		if (!mover->getExists())
			statusTally[8]++;
		else if (!mover->getAwake())
			statusTally[7]++;
		else if (pilot && (pilot->getStatus() == WARRIOR_STATUS_WITHDRAWN))
			statusTally[6]++;
		else
			statusTally[mover->getStatus()]++;
	}
}
Exemple #18
0
int32_t MoverGroup::orderAttackObject(int32_t origin, GameObjectPtr target, int32_t attackType,
	int32_t attackMethod, int32_t attackRange, int32_t aimLocation, int32_t fromArea,
	uint32_t params)
{
	int32_t result = TACORDER_FAILURE;
	for (size_t i = 0; i < numMovers; i++)
	{
		Assert(getMover(i) != nullptr, 0, " MoverGroup.orderAttackObject: nullptr mover ");
		MechWarriorPtr pilot = getMover(i)->getPilot();
		if (pilot)
			result = pilot->orderAttackObject(true, origin, target, attackType, attackMethod,
				attackRange, aimLocation, fromArea, params);
	}
	return (result);
}
Exemple #19
0
void MovePathManager::calcPath(void)
{
    if(queueFront)
    {
        //------------------------------
        // Grab the next in the queue...
        PathQueueRecPtr curQRec = queueFront;
        remove(queueFront);
        //--------------------------------------------------
        // If the mover is no longer around, don't bother...
        MechWarriorPtr pilot = curQRec->pilot;
        pilot->setMovePathRequest(nullptr);
        MoverPtr mover = pilot->getVehicle();
        if(!mover)
            return;
        /*int32_t err = */pilot->calcMovePath(curQRec->selectionIndex, curQRec->moveParams);
    }
}
Exemple #20
0
MoverPtr MoverGroup::selectPoint (bool excludePoint) {

	for (long i = 0; i < numMovers; i++)
		if (!excludePoint || (moverWIDs[i] != pointWID)) {
			MoverPtr mover = getMover(i);
			MechWarriorPtr pilot = mover->getPilot();
			if (pilot && pilot->alive()) {
				//----------------------------------------
				// Found a legitimate point, so set him...
				setPoint(mover);
				return(mover);
			}
		}

	//-----------------------
	// No legitimate point...
	setPoint(NULL);
	return(NULL);
}
Exemple #21
0
void MovePathManager::request(MechWarriorPtr pilot, int32_t selectionIndex, uint32_t moveParams, int32_t source)
{
    //-----------------------------------------------------
    // If the pilot is already awaiting a calc, purge it...
    remove(pilot);
    if(!freeList)
        Fatal(0, " Too many pilots calcing paths ");
    //---------------------------------------------
    // Grab the first free move path rec in line...
    PathQueueRecPtr pathQRec = freeList;
    //-----------------------------------------
    // Cut the new record from the free list...
    freeList = freeList->next;
    if(freeList)
        freeList->prev = nullptr;
    //---------------------------------------------------
    // New record has no next. Already has no previous...
    pathQRec->num = source;
    pathQRec->pilot = pilot;
    pathQRec->selectionIndex = selectionIndex;
    pathQRec->moveParams = moveParams;
    if(queueEnd)
    {
        queueEnd->next = pathQRec;
        pathQRec->prev = queueEnd;
        pathQRec->next = nullptr;
        queueEnd = pathQRec;
    }
    else
    {
        pathQRec->prev = nullptr;
        pathQRec->next = nullptr;
        queueFront = queueEnd = pathQRec;
    }
    pilot->setMovePathRequest(pathQRec);
    numPaths++;
    sourceTally[source]++;
    if(numPaths > peakPaths)
        peakPaths = numPaths;
}