您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DeleteDeathDependence函数代码示例

51自学网 2021-06-01 20:26:32
  C++
这篇教程C++ DeleteDeathDependence函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DeleteDeathDependence函数的典型用法代码示例。如果您正苦于以下问题:C++ DeleteDeathDependence函数的具体用法?C++ DeleteDeathDependence怎么用?C++ DeleteDeathDependence使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了DeleteDeathDependence函数的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: DeleteDeathDependence

void CWaitCommandsAI::SquadWait::RemoveUnit(CUnit* unit){	if (buildUnits.erase(unit))		DeleteDeathDependence(unit, DEPENDENCE_WAITCMD);	if (waitUnits.erase(unit))		DeleteDeathDependence(unit, DEPENDENCE_WAITCMD);}
开发者ID:FriedRice,项目名称:spring,代码行数:7,


示例2: DeleteDeathDependence

void CWaitCommandsAI::SquadWait::RemoveUnit(CUnit* unit){	CUnitSet::iterator bit = buildUnits.find(unit);	if (bit != buildUnits.end()) {		DeleteDeathDependence(*bit);		buildUnits.erase(bit);	}	CUnitSet::iterator wit = waitUnits.find(unit);	if (wit != waitUnits.end()) {		DeleteDeathDependence(*wit);		waitUnits.erase(wit);	}}
开发者ID:DarksidedStudios,项目名称:spring,代码行数:13,


示例3: DeleteDeathDependence

bool CWeapon::AttackGround(float3 pos, bool userTarget){	if (!userTarget && weaponDef->noAutoTarget) {		return false;	}	if (weaponDef->interceptor || !weaponDef->canAttackGround ||	    (weaponDef->onlyTargetCategory != 0xffffffff)) {		return false;	}	if (!weaponDef->waterweapon && (pos.y < 1.0f)) {		pos.y = 1.0f;	}	weaponMuzzlePos=owner->pos+owner->frontdir*relWeaponMuzzlePos.z+owner->updir*relWeaponMuzzlePos.y+owner->rightdir*relWeaponMuzzlePos.x;	if(weaponMuzzlePos.y<ground->GetHeight2(weaponMuzzlePos.x,weaponMuzzlePos.z))		weaponMuzzlePos=owner->pos+UpVector*10;		//hope that we are underground because we are a popup weapon and will come above ground later	if(!TryTarget(pos,userTarget,0))		return false;	if(targetUnit){		DeleteDeathDependence(targetUnit);		targetUnit=0;	}	haveUserTarget=userTarget;	targetType=Target_Pos;	targetPos=pos;	return true;}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:28,


示例4: DeleteDeathDependence

CCommandAI::~CCommandAI(){	if (orderTarget) {		DeleteDeathDependence(orderTarget);		orderTarget = 0;	}}
开发者ID:Gepard,项目名称:spring,代码行数:7,


示例5: DeleteDeathDependence

void CAirMoveType::CheckForCollision(void){	if (!collide) return;	SyncedFloat3& pos = owner->midPos;	SyncedFloat3& forward = owner->frontdir;	float3 midTestPos = pos + forward * 121;	std::vector<CUnit*> others = qf->GetUnitsExact(midTestPos, 115);	float dist = 200;	if (lastColWarning) {		DeleteDeathDependence(lastColWarning);		lastColWarning = 0;		lastColWarningType = 0;	}	for (std::vector<CUnit*>::iterator ui = others.begin(); ui != others.end(); ++ui) {		if (*ui == owner || !(*ui)->unitDef->canfly)			continue;		SyncedFloat3& op = (*ui)->midPos;		float3 dif = op - pos;		float3 forwardDif = forward * (forward.dot(dif));		if (forwardDif.SqLength() < dist * dist) {			float frontLength = forwardDif.Length();			float3 ortoDif = dif - forwardDif;			// note that the radii are multiplied by two since we rely on			// aircraft having half-size hitspheres (see unitloader)			//			// FIXME: with the new collision volumes, is this still true?			//			// yes: for backward compatibility, aircraft that do not define			// their own custom volumes get halved hitspheres by default			float minOrtoDif = ((*ui)->radius + owner->radius) * 2 + frontLength * 0.1f + 10;			if (ortoDif.SqLength() < minOrtoDif * minOrtoDif) {				dist = frontLength;				lastColWarning = (*ui);			}		}	}	if (lastColWarning) {		lastColWarningType = 2;		AddDeathDependence(lastColWarning);		return;	}	for (std::vector<CUnit*>::iterator ui = others.begin(); ui != others.end(); ++ui) {		if (*ui == owner)			continue;		if (((*ui)->midPos - pos).SqLength() < dist * dist) {			lastColWarning = *ui;		}	}	if (lastColWarning) {		lastColWarningType = 1;		AddDeathDependence(lastColWarning);	}	return;}
开发者ID:Dmytry,项目名称:spring,代码行数:60,


示例6: targetPos

bool CWeapon::AttackUnit(CUnit *unit,bool userTarget){    if((!userTarget && weaponDef->noAutoTarget))        return false;    if(weaponDef->interceptor)        return false;    weaponPos=owner->pos+owner->frontdir*relWeaponPos.z+owner->updir*relWeaponPos.y+owner->rightdir*relWeaponPos.x;    if(weaponPos.y<ground->GetHeight2(weaponPos.x,weaponPos.z))        weaponPos=owner->pos+10;		//hope that we are underground because we are a popup weapon and will come above ground later    if(!unit) {        if(targetType!=Target_Unit)			//make the unit be more likely to keep the current target if user start to move it            targetType=Target_None;        haveUserTarget=false;        return false;    }    float3 targetPos(helper->GetUnitErrorPos(unit,owner->allyteam));    targetPos+=errorVector*(weaponDef->targetMoveError*30*unit->speed.Length()*(1.0-owner->limExperience));    if(!TryTarget(targetPos,userTarget,unit))        return false;    if(targetUnit) {        DeleteDeathDependence(targetUnit);        targetUnit=0;    }    haveUserTarget=userTarget;    targetType=Target_Unit;    targetUnit=unit;    targetPos=unit->midPos+float3(0,0.3,0)*unit->radius;    AddDeathDependence(targetUnit);    return true;}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:33,


示例7: while

void CWaitCommandsAI::GatherWait::Update(){	if (waitUnits.size() < 2) {		delete this;		return;	}	CUnitSet::iterator it = waitUnits.begin();	while (it != waitUnits.end()) {		WaitState state = GetWaitState(*it);		if (state == Active) {			// do nothing		}		else if(state == Queued) {			return;		}		else if (state == Missing) {			DeleteDeathDependence(*it);			it = RemoveUnitFromSet(it, waitUnits);			if (waitUnits.empty()) {				delete this;				return;			}			continue;		}		++it;	}	// all units are actively waiting on this command, unblock them and die	SendWaitCommand(waitUnits);	delete this;}
开发者ID:DarksidedStudios,项目名称:spring,代码行数:32,


示例8: SetRepairTarget

void RepairTask::SetRepairTarget (aiUnit *u){    if (target) DeleteDeathDependence (target);    target = u;    if (u) AddDeathDependence (u);}
开发者ID:achoum,项目名称:spring,代码行数:7,


示例9: assert

void CAirCAI::ExecuteAreaAttack(Command &c){	assert(owner->unitDef->canAttack);	AAirMoveType* myPlane = (AAirMoveType*) owner->moveType;	if (targetDied) {		targetDied = false;		inCommand = false;	}	const float3 pos(c.params[0], c.params[1], c.params[2]);	const float radius = c.params[3];	if (inCommand) {		if (myPlane->aircraftState == AAirMoveType::AIRCRAFT_LANDED)			inCommand = false;		if (orderTarget && orderTarget->pos.SqDistance2D(pos) > Square(radius)) {			inCommand = false;			DeleteDeathDependence(orderTarget);			orderTarget = 0;		}		if (owner->commandShotCount < 0) {			if ((c.params.size() == 4) && (commandQue.size() > 1)) {				owner->AttackUnit(0, true);				FinishCommand();			}			else if (owner->userAttackGround) {				// reset the attack position after each run				float3 attackPos = pos + (gs->randVector() * radius);					attackPos.y = ground->GetHeightAboveWater(attackPos.x, attackPos.z);				owner->AttackGround(attackPos, false);				owner->commandShotCount = 0;			}		}	} else {		owner->commandShotCount = -1;		if (myPlane->aircraftState != AAirMoveType::AIRCRAFT_LANDED) {			inCommand = true;			std::vector<int> enemyUnitIDs;			helper->GetEnemyUnits(pos, radius, owner->allyteam, enemyUnitIDs);			if (enemyUnitIDs.empty()) {				float3 attackPos = pos + gs->randVector() * radius;				attackPos.y = ground->GetHeightAboveWater(attackPos.x, attackPos.z);				owner->AttackGround(attackPos, false);			} else {				// note: the range of randFloat() is inclusive of 1.0f				const unsigned int idx(gs->randFloat() * (enemyUnitIDs.size() - 1));				orderTarget = uh->GetUnitUnsafe( enemyUnitIDs[idx] );				owner->AttackUnit(orderTarget, false);				AddDeathDependence(orderTarget);			}		}	}}
开发者ID:BrainDamage,项目名称:spring,代码行数:59,


示例10: DeleteDeathDependence

void CUnit::FinishedBuilding(void){	beingBuilt = false;	buildProgress = 1.0f;	if (soloBuilder) {		DeleteDeathDependence(soloBuilder);		soloBuilder = NULL;	}	if (!(immobile && (mass == 100000))) {		mass = unitDef->mass;		//set this now so that the unit is harder to move during build	}	ChangeLos(realLosRadius,realAirLosRadius);	if (unitDef->startCloaked) {		wantCloak = true;		isCloaked = true;	}	if (unitDef->windGenerator>0) {		if (wind.curStrength > unitDef->windGenerator) {			cob->Call(COBFN_SetSpeed, (int)(unitDef->windGenerator * 3000.0f));		} else {			cob->Call(COBFN_SetSpeed, (int)(wind.curStrength       * 3000.0f));		}		cob->Call(COBFN_SetDirection, (int)GetHeadingFromVector(-wind.curDir.x, -wind.curDir.z));	}	if (unitDef->activateWhenBuilt) {		Activate();	}	gs->Team(team)->metalStorage  += unitDef->metalStorage;	gs->Team(team)->energyStorage += unitDef->energyStorage;	//Sets the frontdir in sync with heading.	frontdir = GetVectorFromHeading(heading) + float3(0,frontdir.y,0);	if (unitDef->isAirBase) {		airBaseHandler->RegisterAirBase(this);	}	luaCallIns.UnitFinished(this);	globalAI->UnitFinished(this);	if (unitDef->isFeature) {		UnBlock();		CFeature* f =			featureHandler->CreateWreckage(pos, wreckName, heading, buildFacing,			                               0, team, false, "");		if (f) {			f->blockHeightChanges = true;		}		KillUnit(false, true, 0);	}}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:58,


示例11: DeleteDeathDependence

void CWeapon::HoldFire(){    if(targetUnit) {        DeleteDeathDependence(targetUnit);        targetUnit=0;    }    targetType=Target_None;    haveUserTarget=false;}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:9,


示例12: DeleteDeathDependence

void CTAAirMoveType::CheckForCollision(void){	if (!collide) return;	SyncedFloat3& pos = owner->midPos;	SyncedFloat3 forward = owner->speed;	forward.Normalize();	float3 midTestPos = pos + forward * 121;	std::vector<CUnit*> others = qf->GetUnitsExact(midTestPos, 115);	float dist = 200;	if (lastColWarning) {		DeleteDeathDependence(lastColWarning);		lastColWarning = 0;		lastColWarningType = 0;	}	for (std::vector<CUnit*>::iterator ui = others.begin(); ui != others.end(); ++ui) {		if (*ui == owner || !(*ui)->unitDef->canfly)			continue;		SyncedFloat3& op = (*ui)->midPos;		float3 dif = op - pos;		float3 forwardDif = forward * (forward.dot(dif));		if (forwardDif.SqLength() < dist * dist) {			float frontLength = forwardDif.Length();			float3 ortoDif = dif - forwardDif;			// note: the radius is multiplied by two since we rely on aircraft			// having small spheres (see unitloader)			float minOrtoDif = ((*ui)->radius + owner->radius) * 2 + frontLength * 0.05f + 5;			if (ortoDif.SqLength() < minOrtoDif * minOrtoDif) {				dist = frontLength;				lastColWarning = (*ui);			}		}	}	if (lastColWarning) {		lastColWarningType = 2;		AddDeathDependence(lastColWarning);		return;	}	for (std::vector<CUnit*>::iterator ui = others.begin(); ui != others.end(); ++ui) {		if (*ui == owner)			continue;		if (((*ui)->midPos - pos).SqLength() < dist * dist) {			lastColWarning = *ui;		}	}	if (lastColWarning) {		lastColWarningType = 1;		AddDeathDependence(lastColWarning);	}	return;}
开发者ID:Dmytry,项目名称:spring,代码行数:57,


示例13: assert

void UnitGroup::UnitDestroyed (aiUnit *unit){	ForceUnit *fu = dynamic_cast<ForceUnit*>(unit);	assert (fu);	DeleteDeathDependence (fu);	units.erase (fu);    delete fu;}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:9,


示例14: DeleteDeathDependence

void CSelectedUnitsHandler::RemoveUnit(CUnit* unit){	if (selectedUnits.erase(unit))		DeleteDeathDependence(unit, DEPENDENCE_SELECTED);	selectionChanged = true;	possibleCommandsChanged = true;	selectedGroup = -1;	unit->isSelected = false;}
开发者ID:DoctorEmmettBrown,项目名称:spring,代码行数:9,


示例15: DeleteDeathDependence

void CUnit::SetLastAttacker(CUnit* attacker){    lastAttack=gs->frameNum;    if(lastAttacker && lastAttacker!=userTarget)        DeleteDeathDependence(lastAttacker);    lastAttacker=attacker;    if(attacker)        AddDeathDependence(attacker);}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:10,


示例16: GML_RECMUTEX_LOCK

void CSelectedUnits::RemoveUnit(CUnit* unit){	GML_RECMUTEX_LOCK(sel); // RemoveUnit	if (selectedUnits.erase(unit))		DeleteDeathDependence(unit, DEPENDENCE_SELECTED);	selectionChanged = true;	possibleCommandsChanged = true;	selectedGroup = -1;	unit->isSelected = false;}
开发者ID:atamanokuklu,项目名称:spring,代码行数:11,


示例17: GML_RECMUTEX_LOCK

void CSelectedUnits::RemoveUnit(CUnit* unit){	GML_RECMUTEX_LOCK(sel); // RemoveUnit	selectedUnits.erase(unit);	DeleteDeathDependence(unit);	selectionChanged=true;	possibleCommandsChanged=true;	selectedGroup=-1;	unit->commandAI->selected=false;}
开发者ID:Gepard,项目名称:spring,代码行数:11,


示例18: DeleteDeathDependence

void CSelectedUnits::RemoveUnit(CUnit* unit){	selectedUnits.erase(unit);	DeleteDeathDependence(unit);	selectionChanged=true;	possibleCommandsChanged=true;	selectedGroup=-1;	PUSH_CODE_MODE;	ENTER_MIXED;	unit->commandAI->selected=false;	POP_CODE_MODE;}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:12,


示例19: switch

void CCommandAI::SlowUpdate(){	if(commandQue.empty())		return;	Command& c=commandQue.front();	switch(c.id){	case CMD_WAIT:		break;	case CMD_STOP:{		owner->AttackUnit(0,true);		std::vector<CWeapon*>::iterator wi;		for(wi=owner->weapons.begin();wi!=owner->weapons.end();++wi)			(*wi)->HoldFire();		FinishCommand();		break;};	case CMD_ATTACK:	case CMD_DGUN:		if(inCommand){			if(targetDied || (c.params.size() == 1 && uh->units[int(c.params[0])] && !(uh->units[int(c.params[0])]->losStatus[owner->allyteam] & LOS_INRADAR))){				FinishCommand();				break;			}			if ((c.params.size() == 3) && (owner->commandShotCount > 0) && (commandQue.size() > 1)) {				FinishCommand();				break;			}		} else {			if(c.params.size()==1){				if(uh->units[int(c.params[0])]!=0 && uh->units[int(c.params[0])]!=owner){					owner->AttackUnit(uh->units[int(c.params[0])], c.id==CMD_DGUN);					if(orderTarget)						DeleteDeathDependence(orderTarget);					orderTarget=uh->units[int(c.params[0])];					AddDeathDependence(orderTarget);					inCommand=true;				} else {					FinishCommand();				}			} else {				float3 pos(c.params[0],c.params[1],c.params[2]);				owner->AttackGround(pos, c.id==CMD_DGUN);				inCommand=true;			}		}		break;	default:		FinishCommand();		break;	}}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:52,


示例20: AddMetal

void CFactory::StopBuild(){	cob->Call("StopBuilding");	if(curBuild){		if(curBuild->beingBuilt){			AddMetal(curBuild->metalCost*curBuild->buildProgress);			uh->DeleteUnit(curBuild);		}		DeleteDeathDependence(curBuild);	}	curBuild=0;	quedBuild=false;}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:13,


示例21: AddMetal

void CFactory::StopBuild(){	// cancel a build-in-progress	script->StopBuilding();	if (curBuild) {		if (curBuild->beingBuilt) {			AddMetal(curBuild->metalCost * curBuild->buildProgress, false);			curBuild->KillUnit(false, true, NULL);		}		DeleteDeathDependence(curBuild);	}	curBuild = 0;	quedBuild = false;}
开发者ID:eXLabT,项目名称:spring,代码行数:14,


示例22: assert

void CAirCAI::ExecuteAreaAttack(Command &c){	assert(owner->unitDef->canAttack);	CAirMoveType* myPlane = (CAirMoveType*) owner->moveType;	if(targetDied){		targetDied = false;		inCommand = false;	}	const float3 pos(c.params[0], c.params[1], c.params[2]);	const float radius = c.params[3];	if(inCommand){		if(myPlane->aircraftState == CAirMoveType::AIRCRAFT_LANDED)			inCommand = false;		if(orderTarget && orderTarget->pos.distance2D(pos) > radius){			inCommand = false;			DeleteDeathDependence(orderTarget);			orderTarget = 0;		}		if (owner->commandShotCount > 0) {			if ((c.params.size() == 4) && (commandQue.size() > 1)) {				owner->AttackUnit(0, true);				FinishCommand();			}			else if (owner->userAttackGround) {				// reset the attack position after each run				float3 attackPos = pos + (gs->randVector() * radius);				attackPos.y = ground->GetHeight(attackPos.x, attackPos.z);				owner->AttackGround(attackPos, false);				owner->commandShotCount = 0;			}		}	} else {		owner->commandShotCount = -1;		if(myPlane->aircraftState != CAirMoveType::AIRCRAFT_LANDED){			inCommand = true;			std::vector<int> eu;			helper->GetEnemyUnits(pos, radius, owner->allyteam, eu);			if(eu.empty()){				float3 attackPos = pos + gs->randVector() * radius;				attackPos.y = ground->GetHeight(attackPos.x, attackPos.z);				owner->AttackGround(attackPos, false);			} else {				int num = (int) (gs->randFloat() * eu.size());				orderTarget = uh->units[eu[num]];				owner->AttackUnit(orderTarget, false);				AddDeathDependence(orderTarget);			}		}	}}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:50,



注:本文中的DeleteDeathDependence函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ DeleteEnhMetaFile函数代码示例
C++ DeleteDC函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。