• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GML_RECMUTEX_LOCK函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GML_RECMUTEX_LOCK

void CGroupHandler::RemoveGroup(CGroup* group)
{
	GML_RECMUTEX_LOCK(sel); // RemoveGroup
	GML_STDMUTEX_LOCK(group); // RemoveGroup

	if(group->id<10){
		logOutput.Print("Warning trying to remove hotkey group %i",group->id);
		return;
	}
	if(selectedUnits.selectedGroup==group->id)
		selectedUnits.ClearSelected();
	groups[group->id]=0;
	freeGroups.push_back(group->id);
	delete group;
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:15,代码来源:GroupHandler.cpp


示例2: GML_RECMUTEX_LOCK

void CGroupHandler::RemoveGroup(CGroup* group)
{
	GML_RECMUTEX_LOCK(grpsel); // RemoveGroup

	if (group->id < FIRST_SPECIAL_GROUP) {
		LOG_L(L_WARNING, "Trying to remove hot-key group %i", group->id);
		return;
	}
	if (selectedUnits.selectedGroup == group->id) {
		selectedUnits.ClearSelected();
	}
	groups[group->id] = NULL;
	freeGroups.push_back(group->id);
	delete group;
}
开发者ID:FriedRice,项目名称:spring,代码行数:15,代码来源:GroupHandler.cpp


示例3: GML_RECMUTEX_LOCK

void CSelectedUnits::ClearSelected()
{
	GML_RECMUTEX_LOCK(sel); // ClearSelected

	CUnitSet::iterator ui;
	for (ui = selectedUnits.begin(); ui != selectedUnits.end(); ++ui) {
		(*ui)->isSelected = false;
		DeleteDeathDependence(*ui, DEPENDENCE_SELECTED);
	}

	selectedUnits.clear();
	selectionChanged = true;
	possibleCommandsChanged = true;
	selectedGroup = -1;
}
开发者ID:atamanokuklu,项目名称:spring,代码行数:15,代码来源:SelectedUnits.cpp


示例4: GetMyTeamUnit

bool CAICallback::AddUnitToGroup(int unitId, int groupId)
{
	bool added = false;

	CUnit* unit = GetMyTeamUnit(unitId);
	if (unit) {
		GML_RECMUTEX_LOCK(group); // AddUnitToGroup

		if (CHECK_GROUPID(groupId) && gh->groups[groupId]) {
			added = unit->SetGroup(gh->groups[groupId]);
		}
	}

	return added;
}
开发者ID:AlexDiede,项目名称:spring,代码行数:15,代码来源:AICallback.cpp


示例5: GML_RECMUTEX_LOCK

void CGroupHandler::GroupCommand(int num)
{
	GML_RECMUTEX_LOCK(sel); // GroupCommand
	GML_STDMUTEX_LOCK(group); // GroupCommand

	if (keys[SDLK_LCTRL]) {
		if (!keys[SDLK_LSHIFT]) {
			groups[num]->ClearUnits();
		}
		const CUnitSet& selUnits = selectedUnits.selectedUnits;
		CUnitSet::const_iterator ui;
		for(ui = selUnits.begin(); ui != selUnits.end(); ++ui) {
			(*ui)->SetGroup(groups[num]);
		}
	}
	else if (keys[SDLK_LSHIFT])  {
		// do not select the group, just add its members to the current selection
		CUnitSet::const_iterator gi;
		for (gi = groups[num]->units.begin(); gi != groups[num]->units.end(); ++gi) {
			selectedUnits.AddUnit(*gi);
		}
		return;
	}
	else if (keys[SDLK_LALT] || keys[SDLK_LMETA])  {
		// do not select the group, just toggle its members with the current selection
		const CUnitSet& selUnits = selectedUnits.selectedUnits;
		CUnitSet::const_iterator gi;
		for (gi = groups[num]->units.begin(); gi != groups[num]->units.end(); ++gi) {
			if (selUnits.find(*gi) == selUnits.end()) {
				selectedUnits.AddUnit(*gi);
			} else {
				selectedUnits.RemoveUnit(*gi);
			}
		}
		return;
	}

	if(selectedUnits.selectedGroup==num && !groups[num]->units.empty()){
		float3 p(0,0,0);
		for(CUnitSet::iterator gi=groups[num]->units.begin();gi!=groups[num]->units.end();++gi){
			p+=(*gi)->pos;
		}
		p/=groups[num]->units.size();
		camHandler->GetCurrentController().SetPos(p);
	}

	selectedUnits.SelectGroup(num);
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:48,代码来源:GroupHandler.cpp


示例6: GML_RECMUTEX_LOCK

void CFeatureDrawer::Draw()
{
	ISky::SetupFog();

	GML_RECMUTEX_LOCK(feat); // Draw

	CBaseGroundDrawer* gd = readmap->GetGroundDrawer();

	if (gd->DrawExtraTex()) {
		glActiveTextureARB(GL_TEXTURE2_ARB);
		glEnable(GL_TEXTURE_2D);
		glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_ADD_SIGNED_ARB);
		glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);

		SetTexGen(1.0f / (gs->pwr2mapx * SQUARE_SIZE), 1.0f / (gs->pwr2mapy * SQUARE_SIZE), 0.0f, 0.0f);

		glBindTexture(GL_TEXTURE_2D, gd->infoTex);
		glActiveTextureARB(GL_TEXTURE0_ARB);
	}

	unitDrawer->SetupForUnitDrawing();
	GetVisibleFeatures(0, true);

	for (int modelType = MODELTYPE_3DO; modelType < MODELTYPE_OTHER; modelType++) {
		opaqueModelRenderers[modelType]->PushRenderState();
		DrawOpaqueFeatures(modelType);
		opaqueModelRenderers[modelType]->PopRenderState();
	}

	unitDrawer->CleanUpUnitDrawing();

	farTextureHandler->Draw();

	if (gd->DrawExtraTex()) {
		glActiveTextureARB(GL_TEXTURE2_ARB);
		glDisable(GL_TEXTURE_2D);
		glDisable(GL_TEXTURE_GEN_S);
		glDisable(GL_TEXTURE_GEN_T);
		glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
		glActiveTextureARB(GL_TEXTURE0_ARB);
	}

	glDisable(GL_TEXTURE_2D);
	glDisable(GL_FOG);
#ifdef USE_GML
	DrawFeatureStats();
#endif
}
开发者ID:Tastyfish-Studios,项目名称:Red-Herring-Engine,代码行数:48,代码来源:FeatureDrawer.cpp


示例7: GML_RECMUTEX_LOCK

CGroup* CGroupHandler::CreateNewGroup()
{
	GML_RECMUTEX_LOCK(group); // GroupCommand

	if (freeGroups.empty()) {
		CGroup* group = new CGroup(firstUnusedGroup++, this);
		groups.push_back(group);
		return group;
	} else {
		int id = freeGroups.back();
		freeGroups.pop_back();
		CGroup* group = new CGroup(id, this);
		groups[id] = group;
		return group;
	}
}
开发者ID:niavok,项目名称:spring,代码行数:16,代码来源:GroupHandler.cpp


示例8: GML_RECMUTEX_LOCK

void CWaitCommandsAI::AddTimeWait(const Command& cmd)
{
	GML_RECMUTEX_LOCK(sel); // AddTimeWait

	// save the current selection
	const CUnitSet tmpSet = selectedUnits.selectedUnits;
	CUnitSet::const_iterator it;
	for (it = tmpSet.begin(); it != tmpSet.end(); ++it) {
		InsertWaitObject(TimeWait::New(cmd, *it));
	}
	// restore the selection
	selectedUnits.ClearSelected();
	for (it = tmpSet.begin(); it != tmpSet.end(); ++it) {
		selectedUnits.AddUnit(*it);
	}
}
开发者ID:DarksidedStudios,项目名称:spring,代码行数:16,代码来源:WaitCommandsAI.cpp


示例9: assert

void CQuadField::AddProjectile(CProjectile* p)
{
    assert(p->synced);

    GML_RECMUTEX_LOCK(quad); // AddProjectile

    CProjectile::QuadFieldCellData qfcd;

    typedef CQuadField::Quad Cell;
    typedef std::list<CProjectile*> List;

    if (p->hitscan) {
        // all coordinates always map to a valid quad
        qfcd.SetCoor(0, int2(CELL_IDX_X(p->pos.x                    ), CELL_IDX_Z(p->pos.z                    )));
        qfcd.SetCoor(1, int2(CELL_IDX_X(p->pos.x + p->speed.x * 0.5f), CELL_IDX_Z(p->pos.z + p->speed.z * 0.5f)));
        qfcd.SetCoor(2, int2(CELL_IDX_X(p->pos.x + p->speed.x       ), CELL_IDX_Z(p->pos.z + p->speed.z       )));

        Cell& cell = baseQuads[numQuadsX * qfcd.GetCoor(0).y + qfcd.GetCoor(0).x];
        List& list = cell.projectiles;

        // projectiles are point-objects so they exist
        // only in a single cell EXCEPT hit-scan types
        qfcd.SetIter(0, list.insert(list.end(), p));

        for (unsigned int n = 1; n < 3; n++) {
            Cell& ncell = baseQuads[numQuadsX * qfcd.GetCoor(n).y + qfcd.GetCoor(n).x];
            List& nlist = ncell.projectiles;

            // prevent possible double insertions (into the same quad-list)
            // if case p->speed is not large enough to reach adjacent quads
            if (qfcd.GetCoor(n) != qfcd.GetCoor(n - 1)) {
                qfcd.SetIter(n, nlist.insert(nlist.end(), p));
            } else {
                qfcd.SetIter(n, nlist.end());
            }
        }
    } else {
        qfcd.SetCoor(0, int2(CELL_IDX_X(p->pos.x), CELL_IDX_Z(p->pos.z)));

        Cell& cell = baseQuads[numQuadsX * qfcd.GetCoor(0).y + qfcd.GetCoor(0).x];
        List& list = cell.projectiles;

        qfcd.SetIter(0, list.insert(list.end(), p));
    }

    p->SetQuadFieldCellData(qfcd);
}
开发者ID:AMDmi3,项目名称:spring,代码行数:47,代码来源:QuadField.cpp


示例10: glPushAttrib

void CFeatureDrawer::DrawFadeFeatures(bool noAdvShading)
{
	const bool oldAdvShading = unitDrawer->advShading;

	{
		unitDrawer->advShading = unitDrawer->advShading && !noAdvShading;

		if (unitDrawer->advShading) {
			unitDrawer->SetupForUnitDrawing();
		} else {
			unitDrawer->SetupForGhostDrawing();
		}

		glPushAttrib(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		glDepthMask(GL_TRUE);
		glEnable(GL_ALPHA_TEST);
		glAlphaFunc(GL_GREATER, 0.5f);

		if (globalRendering->drawFog) {
			glEnable(GL_FOG);
			glFogfv(GL_FOG_COLOR, mapInfo->atmosphere.fogColor);
		}

		{
			GML_RECMUTEX_LOCK(feat); // DrawFadeFeatures

			for (int modelType = MODELTYPE_3DO; modelType < MODELTYPE_OTHER; modelType++) {
				cloakedModelRenderers[modelType]->PushRenderState();
				DrawFadeFeaturesHelper(modelType);
				cloakedModelRenderers[modelType]->PopRenderState();
			}
		}

		glDisable(GL_FOG);

		glPopAttrib();

		if (unitDrawer->advShading) {
			unitDrawer->CleanUpUnitDrawing();
		} else {
			unitDrawer->CleanUpGhostDrawing();
		}

		unitDrawer->advShading = oldAdvShading;
	}
}
开发者ID:Mocahteam,项目名称:SpringPP,代码行数:46,代码来源:FeatureDrawer.cpp


示例11: glDisable

void CFeatureDrawer::DrawShadowPass()
{
	glDisable(GL_CULL_FACE); //FIXME: enable culling for s3o models
	glPolygonOffset(1.0f, 1.0f);
	glEnable(GL_POLYGON_OFFSET_FILL);

	Shader::IProgramObject* po =
		shadowHandler->GetShadowGenProg(CShadowHandler::SHADOWGEN_PROGRAM_MODEL);

	po->Enable();

	{
		GML_RECMUTEX_LOCK(feat); // DrawShadowPass

		// note: for the shadow-pass, we want to make sure
		// out-of-view features casting frustum-intersecting
		// shadows are still rendered, but this is expensive
		// and does not make much difference
		//
		// GetVisibleFeatures(1, false);

		// need the alpha-mask for transparent features
		glEnable(GL_TEXTURE_2D);
		glPushAttrib(GL_COLOR_BUFFER_BIT);
		glEnable(GL_ALPHA_TEST);
		glAlphaFunc(GL_GREATER, 0.5f);

		// needed for 3do models (else they will use any currently bound texture)
		// note: texture0 is by default a 1x1 texture with rgba(0,0,0,255)
		// (we are just interested in the 255 alpha here)
		glBindTexture(GL_TEXTURE_2D, 0);

		for (int modelType = MODELTYPE_3DO; modelType < MODELTYPE_OTHER; modelType++) {
			DrawOpaqueFeatures(modelType);
		}

		glPopAttrib();
		glDisable(GL_TEXTURE_2D);
	}

	po->Disable();

	glDisable(GL_POLYGON_OFFSET_FILL);
	glEnable(GL_CULL_FACE);
}
开发者ID:spring-multiverse,项目名称:spring,代码行数:45,代码来源:FeatureDrawer.cpp


示例12: GML_RECMUTEX_LOCK

float CGameHelper::GuiTraceRayFeature(const float3& start, const float3& dir, float length, CFeature*& feature)
{
    float nearHit = length;

    GML_RECMUTEX_LOCK(quad); // GuiTraceRayFeature

    std::vector<int> quads = qf->GetQuadsOnRay(start, dir, length);
    std::vector<int>::iterator qi;

    for (qi = quads.begin(); qi != quads.end(); ++qi) {
        const CQuadField::Quad& quad = qf->GetQuad(*qi);
        std::list<CFeature*>::const_iterator ui;

        // NOTE: switch this to custom volumes fully?
        // (not used for any LOF checks, maybe wasteful)
        for (ui = quad.features.begin(); ui != quad.features.end(); ++ui) {
            CFeature* f = *ui;

            if (!gu->spectatingFullView && !f->IsInLosForAllyTeam(gu->myAllyTeam)) {
                continue;
            }
            if (f->noSelect) {
                continue;
            }

            CollisionVolume* cv = f->collisionVolume;
            const float3& midPosOffset = cv? cv->GetOffsets(): ZeroVector;
            const float3 dif = (f->midPos + midPosOffset) - start;
            float closeLength = dif.dot(dir);

            if (closeLength < 0)
                continue;
            if (closeLength > nearHit)
                continue;

            float3 closeVect = dif - dir * closeLength;
            if (closeVect.SqLength() < f->sqRadius) {
                nearHit = closeLength;
                feature = f;
            }
        }
    }

    return nearHit;
}
开发者ID:javaphoon,项目名称:spring,代码行数:45,代码来源:GameHelper.cpp


示例13: GML_RECMUTEX_LOCK

CGroup* CGroupHandler::CreateNewGroup()
{
	GML_RECMUTEX_LOCK(group); // GroupCommand

	if(freeGroups.empty()){
		CGroup* group=new CGroup(firstUnusedGroup++, this);
		groups.push_back(group);
		if(group!=groups[group->id]){
			handleerror(0,"Id error when creating group","Error",0);
		}
		return group;
	} else {
		int id=freeGroups.back();
		freeGroups.pop_back();
		CGroup* group=new CGroup(id, this);
		groups[id]=group;
		return group;
	}
}
开发者ID:DeadnightWarrior,项目名称:spring,代码行数:19,代码来源:GroupHandler.cpp


示例14: glPushAttrib

void CFeatureDrawer::DrawFadeFeatures(bool noAdvShading)
{
	const bool oldAdvShading = unitDrawer->UseAdvShading();

	{
		unitDrawer->SetUseAdvShading(unitDrawer->UseAdvShading() && !noAdvShading);

		if (unitDrawer->UseAdvShading()) {
			unitDrawer->SetupForUnitDrawing(false);
		} else {
			unitDrawer->SetupForGhostDrawing();
		}

		glPushAttrib(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		glDepthMask(GL_TRUE);
		glEnable(GL_ALPHA_TEST);
		glAlphaFunc(GL_GREATER, 0.5f);

		ISky::SetupFog();

		{
			GML_RECMUTEX_LOCK(feat); // DrawFadeFeatures

			for (int modelType = MODELTYPE_3DO; modelType < MODELTYPE_OTHER; modelType++) {
				cloakedModelRenderers[modelType]->PushRenderState();
				DrawFadeFeaturesHelper(modelType);
				cloakedModelRenderers[modelType]->PopRenderState();
			}
		}

		glDisable(GL_FOG);

		glPopAttrib();

		if (unitDrawer->UseAdvShading()) {
			unitDrawer->CleanUpUnitDrawing(false);
		} else {
			unitDrawer->CleanUpGhostDrawing();
		}

		unitDrawer->SetUseAdvShading(oldAdvShading);
	}
}
开发者ID:AMDmi3,项目名称:spring,代码行数:43,代码来源:FeatureDrawer.cpp


示例15: GML_RECMUTEX_LOCK

void CSelectedUnits::SendCommand(const Command& c)
{
	if (selectionChanged) {
		// send new selection
		GML_RECMUTEX_LOCK(sel); // SendSelection

		// first, convert CUnit* to unit IDs.
		std::vector<short> selectedUnitIDs(selectedUnits.size());
		std::vector<short>::iterator i = selectedUnitIDs.begin();
		CUnitSet::const_iterator ui = selectedUnits.begin();
		for(; ui != selectedUnits.end(); ++i, ++ui) {
			*i = (*ui)->id;
		}
		net->Send(CBaseNetProtocol::Get().SendSelect(gu->myPlayerNum, selectedUnitIDs));
		selectionChanged = false;
	}

	net->Send(CBaseNetProtocol::Get().SendCommand(gu->myPlayerNum, c.GetID(), c.options, c.params));
}
开发者ID:lordelven,项目名称:spring,代码行数:19,代码来源:SelectedUnits.cpp


示例16: GML_RECMUTEX_LOCK

void C3DModelLoader::Update() {
	if (GML::SimEnabled() && !GML::ShareLists()) {
		GML_RECMUTEX_LOCK(model); // Update

		for (std::list<S3DModelPiece*>::iterator it = createLists.begin(); it != createLists.end(); ++it) {
			CreateListsNow(*it);
		}
		createLists.clear();

		for (std::list<LocalModel*>::iterator i = fixLocalModels.begin(); i != fixLocalModels.end(); ++i) {
			(*i)->ReloadDisplayLists();
		}
		fixLocalModels.clear();

		for (std::list<LocalModel*>::iterator i = deleteLocalModels.begin(); i != deleteLocalModels.end(); ++i) {
			delete *i;
		}
		deleteLocalModels.clear();
	}
}
开发者ID:Anarchid,项目名称:spring,代码行数:20,代码来源:IModelParser.cpp


示例17: GML_RECMUTEX_LOCK

void CQuadField::RemoveUnit(CUnit* unit)
{
    GML_RECMUTEX_LOCK(quad); // RemoveUnit

    std::vector<int>::const_iterator qi;
    for (qi = unit->quads.begin(); qi != unit->quads.end(); ++qi) {
        std::list<CUnit*>& quadUnits     = baseQuads[*qi].units;
        std::list<CUnit*>& quadAllyUnits = baseQuads[*qi].teamUnits[unit->allyteam];
        std::list<CUnit*>::iterator ui;

        ui = std::find(quadUnits.begin(), quadUnits.end(), unit);
        if (ui != quadUnits.end())
            quadUnits.erase(ui);

        ui = std::find(quadAllyUnits.begin(), quadAllyUnits.end(), unit);
        if (ui != quadAllyUnits.end())
            quadAllyUnits.erase(ui);
    }
    unit->quads.clear();
}
开发者ID:AMDmi3,项目名称:spring,代码行数:20,代码来源:QuadField.cpp


示例18: GML_RECMUTEX_LOCK

void CQuadField::RemoveUnit(CUnit* unit)
{
	GML_RECMUTEX_LOCK(quad); // RemoveUnit
	std::vector<int>::iterator qi;
	for (qi = unit->quads.begin(); qi != unit->quads.end(); ++qi) {
		std::list<CUnit*>::iterator ui;
		for (ui = baseQuads[*qi].units.begin(); ui != baseQuads[*qi].units.end(); ++ui) {
			if(*ui==unit){
				baseQuads[*qi].units.erase(ui);
				break;
			}
		}
		for(ui=baseQuads[*qi].teamUnits[unit->allyteam].begin();ui!=baseQuads[*qi].teamUnits[unit->allyteam].end();++ui){
			if(*ui==unit){
				baseQuads[*qi].teamUnits[unit->allyteam].erase(ui);
				break;
			}
		}
	}
}
开发者ID:achoum,项目名称:spring,代码行数:20,代码来源:QuadField.cpp


示例19: GML_RECMUTEX_LOCK

void CQuadField::MovedUnit(CUnit *unit)
{
	vector<int> newQuads=GetQuads(unit->pos,unit->radius);

	//! compare if the quads have changed, if not stop here
	if(newQuads.size()==unit->quads.size()){
		vector<int>::iterator qi1,qi2;
		qi1=unit->quads.begin();
		for(qi2=newQuads.begin();qi2!=newQuads.end();++qi2){
			if(*qi1!=*qi2)
				break;
			++qi1;
		}
		if(qi2==newQuads.end())
			return;
	}

	GML_RECMUTEX_LOCK(quad); // MovedUnit - possible performance hog

	std::vector<int>::iterator qi;
	for (qi = unit->quads.begin(); qi != unit->quads.end(); ++qi) {
		std::list<CUnit*>::iterator ui;
		for (ui = baseQuads[*qi].units.begin(); ui != baseQuads[*qi].units.end(); ++ui) {
			if(*ui==unit){
				baseQuads[*qi].units.erase(ui);
				break;
			}
		}
		for(ui=baseQuads[*qi].teamUnits[unit->allyteam].begin();ui!=baseQuads[*qi].teamUnits[unit->allyteam].end();++ui){
			if(*ui==unit){
				baseQuads[*qi].teamUnits[unit->allyteam].erase(ui);
				break;
			}
		}
	}
	for(qi=newQuads.begin();qi!=newQuads.end();++qi){
		baseQuads[*qi].units.push_front(unit);
		baseQuads[*qi].teamUnits[unit->allyteam].push_front(unit);
	}
	unit->quads=newQuads;
}
开发者ID:DeadnightWarrior,项目名称:spring,代码行数:41,代码来源:QuadField.cpp


示例20: GML_RECMUTEX_LOCK

void CMiniMap::SelectUnits(int x, int y) const
{
	GML_RECMUTEX_LOCK(sel); //FIXME redundant? (selectedUnits already has mutexes)

	if (!keyInput->IsKeyPressed(SDLK_LSHIFT) && !keyInput->IsKeyPressed(SDLK_LCTRL)) {
		selectedUnits.ClearSelected();
	}

	CMouseHandler::ButtonPressEvt& bp = mouse->buttons[SDL_BUTTON_LEFT];

	if (fullProxy && (bp.movement > 4)) {
		// use a selection box
		const float3 newPos = GetMapPosition(x, y);
		const float3 oldPos = GetMapPosition(bp.x, bp.y);
		const float xmin = std::min(oldPos.x, newPos.x);
		const float xmax = std::max(oldPos.x, newPos.x);
		const float zmin = std::min(oldPos.z, newPos.z);
		const float zmax = std::max(oldPos.z, newPos.z);

		const float4  planeRight(-1.0f, 0.0f,  0.0f,  xmin);
		const float4   planeLeft( 1.0f, 0.0f,  0.0f, -xmax);
		const float4    planeTop( 0.0f, 0.0f,  1.0f, -zmax);
		const float4 planeBottom( 0.0f, 0.0f, -1.0f,  zmin);

		selectedUnits.HandleUnitBoxSelection(planeRight, planeLeft, planeTop, planeBottom);
	}
	else {
		// Single unit
		const float size = unitSelectRadius;
		const float3 pos = GetMapPosition(x, y);

		CUnit* unit;
		if (gu->spectatingFullSelect) {
			unit = helper->GetClosestUnit(pos, size);
		} else {
			unit = helper->GetClosestFriendlyUnit(pos, size, gu->myAllyTeam);
		}

		selectedUnits.HandleSingleUnitClickSelection(unit, false);
	}
}
开发者ID:azotlikid,项目名称:spring,代码行数:41,代码来源:MiniMap.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GML_STDMUTEX_LOCK函数代码示例发布时间:2022-05-30
下一篇:
C++ GMIME_IS_PART函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap