Пример #1
0
void CPlayer::StopControllingUnit()
{
	if (fpsController.GetControllee() == NULL || mouse == NULL) {
		return;
	}

	CPlayer* that = gu->GetMyPlayer();
	CUnit* thatUnit = that->fpsController.GetControllee();
	CUnit* thisUnit = this->fpsController.GetControllee();

	// note: probably better to issue CMD_STOP via thisUnit->commandAI
	thisUnit->AttackUnit(NULL, true, false, true);
	thisUnit->fpsControlPlayer = NULL;
	fpsController.SetControlleeUnit(NULL);
	selectedUnitsHandler.ClearNetSelect(this->playerNum);

	if (thatUnit == thisUnit) {
		// update the unsynced state
		selectedUnitsHandler.ClearSelected();

		gu->fpsMode = false;
		assert(gu->myPlayerNum == this->playerNum);

		// switch back to the camera we were using before
		camHandler->PopMode();

		if (mouse->locked && !mouse->wasLocked) {
			mouse->locked = false;
			mouse->ShowMouse();
		}
	}
}
Пример #2
0
void CPlayer::StopControllingUnit()
{
	if (fpsController.GetControllee() == NULL || mouse == NULL) {
		return;
	}

	CPlayer* that = gu->GetMyPlayer();
	CUnit* thatUnit = that->fpsController.GetControllee();
	CUnit* thisUnit = this->fpsController.GetControllee();

	thisUnit->fpsControlPlayer = NULL;
	thisUnit->AttackUnit(NULL, true, true);

	if (thatUnit == thisUnit) {
		// update the  unsynced state
		gu->fpsMode = false;
		assert(gu->myPlayerNum == this->playerNum);

		// switch back to the camera we were using before
		camHandler->PopMode();

		if (mouse->locked && !mouse->wasLocked) {
			mouse->locked = false;
			mouse->ShowMouse();
		}
	}

	fpsController.SetControlleeUnit(NULL);
}