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

C++ GML_STDMUTEX_LOCK函数代码示例

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

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



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

示例1: StringTrimInPlace

unsigned int CCategoryHandler::GetCategory(std::string name)
{
	StringTrimInPlace(name);
	StringToLowerInPlace(name);

	if (name.empty())
		return 0; // the empty category

	unsigned int cat = 0;
	
	GML_STDMUTEX_LOCK(cat); // GetCategory

	if (categories.find(name) == categories.end()) {
		// this category is yet unknown
		if (firstUnused >= CCategoryHandler::GetMaxCategories()) {
			// skip this category
			LOG_L(L_WARNING, "too many unit categories (%i), skipping %s",
					firstUnused, name.c_str());
			cat = 0;
		} else {
			// create the category (bit field value)
			cat = (1 << firstUnused);
			//LOG_L(L_DEBUG, "New unit-category %s #%i", name.c_str(), firstUnused);
		}
		// if (cat == 0), this will prevent further warnings for this category
		categories[name] = cat;
		firstUnused++;
	} else {
		// this category is already known
		cat = categories[name];
	}

	return cat;
}
开发者ID:Arkazon,项目名称:spring,代码行数:34,代码来源:CategoryHandler.cpp


示例2: LOG_L

void CAICallback::DrawUnit(const char* unitName, const float3& pos,
		float rotation, int lifetime, int teamId, bool transparent,
		bool drawBorder, int facing)
{
	CUnitDrawer::TempDrawUnit tdu;
	tdu.unitdef = unitDefHandler->GetUnitDefByName(unitName);
	if (!tdu.unitdef) {
		LOG_L(L_WARNING, "Unknown unit in CAICallback::DrawUnit %s", unitName);
		return;
	}
	tdu.pos = pos;
	tdu.rotation = rotation;
	tdu.team = teamId;
	tdu.drawBorder = drawBorder;
	tdu.facing = facing;
	std::pair<int, CUnitDrawer::TempDrawUnit> tp(gs->frameNum + lifetime, tdu);

	GML_STDMUTEX_LOCK(temp); // DrawUnit

	if (transparent) {
		unitDrawer->tempTransparentDrawUnits.insert(tp);
	} else {
		unitDrawer->tempDrawUnits.insert(tp);
	}
}
开发者ID:Anarchid,项目名称:spring,代码行数:25,代码来源:AICallback.cpp


示例3: GML_STDMUTEX_LOCK

bool CInMapDrawModel::AddPoint(const float3& constPos, const std::string& label, int playerID)
{
	if (!playerHandler->IsValidPlayer(playerID)) {
		return false;
	}

	GML_STDMUTEX_LOCK(inmap); // LocalPoint

	// GotNetMsg() alreadys checks validity of playerID
	const CPlayer* sender = playerHandler->Player(playerID);
	const bool allowed = AllowedMsg(sender);

	float3 pos = constPos;
	pos.ClampInBounds();
	pos.y = ground->GetHeightAboveWater(pos.x, pos.z, false) + 2.0f;

	// event clients may process the point
	// if their owner is allowed to see it
	if (allowed && eventHandler.MapDrawCmd(playerID, MAPDRAW_POINT, &pos, NULL, &label)) {
		return false;
	}

	// let the engine handle it (disallowed
	// points added here are filtered while
	// rendering the quads)
	MapPoint point(sender->spectator, sender->team, sender, pos, label);

	const int quad = int(pos.z * QUAD_SCALE) * drawQuadsX +
	                 int(pos.x * QUAD_SCALE);
	drawQuads[quad].points.push_back(point);

	numPoints++;

	return true;
}
开发者ID:AlexDiede,项目名称:spring,代码行数:35,代码来源:InMapDrawModel.cpp


示例4: GML_STDMUTEX_LOCK

void CConsoleHistory::ResetPosition()
{
	GML_STDMUTEX_LOCK(hist); // ResetPosition

	pos = lines.end();
	return;
}
开发者ID:AMDmi3,项目名称:spring,代码行数:7,代码来源:ConsoleHistory.cpp


示例5: GML_STDMUTEX_LOCK

void CLogOutput::Output(const std::string& str)
{
	GML_STDMUTEX_LOCK(log); // Output

	std::string msg;

#if !defined UNITSYNC && !defined DEDICATED
	if (gs) {
		msg += IntToString(gs->frameNum, "[f=%07d] ");
	}
#endif

	msg += str;

	if (!initialized) {
		ToStderr(msg);
		preInitLog().push_back(msg);
		return;
	}

#ifdef _MSC_VER
	int index = strlen(str.c_str()) - 1;
	bool newline = ((index < 0) || (str[index] != '\n'));
	OutputDebugString(msg.c_str());
	if (newline) {
		OutputDebugString("\n");
	}
#endif // _MSC_VER

	ToFile(msg);
	ToStderr(msg);
}
开发者ID:DarksidedStudios,项目名称:spring,代码行数:32,代码来源:LogOutput.cpp


示例6: GML_STDMUTEX_LOCK

void CInMapDraw::LocalLine(const float3& constPos1, const float3& constPos2,
                           int playerID)
{
	if (!playerHandler->IsValidPlayer(playerID))
		return;

	GML_STDMUTEX_LOCK(inmap); // LocalLine

	const CPlayer* sender = playerHandler->Player(playerID);

	float3 pos1 = constPos1;
	float3 pos2 = constPos2;
	pos1.CheckInBounds();
	pos2.CheckInBounds();
	pos1.y = ground->GetHeight(pos1.x, pos1.z) + 2.0f;
	pos2.y = ground->GetHeight(pos2.x, pos2.z) + 2.0f;

	if (AllowedMsg(sender) && eventHandler.MapDrawCmd(playerID, MAPDRAW_LINE, &pos1, &pos2, NULL)) {
		return;
	}

	MapLine line;
	line.pos  = pos1;
	line.pos2 = pos2;
	line.color = sender->spectator ? color4::white : teamHandler->Team(sender->team)->color;
	line.senderAllyTeam = teamHandler->AllyTeam(sender->team);
	line.senderSpectator = sender->spectator;

	const int quad = int(pos1.z * quadScale) * drawQuadsX +
	                 int(pos1.x * quadScale);
	drawQuads[quad].lines.push_back(line);
}
开发者ID:lunixbochs,项目名称:spring,代码行数:32,代码来源:InMapDraw.cpp


示例7: GML_STDMUTEX_LOCK

void EventBatchHandler::UpdateDrawUnits() {
    GML_STDMUTEX_LOCK(runit); // UpdateDrawUnits

    unitCreatedDestroyedEventBatch.execute();
    unitCloakStateChangedEventBatch.execute();
    unitLOSStateChangedEventBatch.execute();
}
开发者ID:rYuuk,项目名称:spring,代码行数:7,代码来源:EventBatchHandler.cpp


示例8: GML_STDMUTEX_LOCK

void CUnitHandler::RemoveBuilderCAI(CBuilderCAI* b)
{
	GML_STDMUTEX_LOCK(cai); // RemoveBuilderCAI

	// called from ~CUnit --> owner is still valid
	assert(b->owner != NULL);
	builderCAIs.erase(b->owner->id);
}
开发者ID:AlexDiede,项目名称:spring,代码行数:8,代码来源:UnitHandler.cpp


示例9: GML_STDMUTEX_LOCK

/**
 * @brief Process the queue of pending fartexture creation requests.
 * This loops through the queue calling ReallyCreateFarTexture() on each entry,
 * and empties the queue afterwards.
 */
void CFartextureHandler::CreateFarTextures()
{
	GML_STDMUTEX_LOCK(tex); // CreateFarTextures
	for(std::vector<S3DModel*>::const_iterator it = pending.begin(); it != pending.end(); ++it) {
		ReallyCreateFarTexture(*it);
	}
	pending.clear();
}
开发者ID:achoum,项目名称:spring,代码行数:13,代码来源:FartextureHandler.cpp


示例10: GML_STDMUTEX_LOCK

void EventBatchHandler::UpdateObjects() {
	{ 
		GML_STDMUTEX_LOCK(runit); // UpdateObjects

		UpdateUnits();
	}
	{
		GML_STDMUTEX_LOCK(rfeat); // UpdateObjects

		UpdateFeatures();
	}
	{
		GML_STDMUTEX_LOCK(rproj); // UpdateObjects

		UpdateProjectiles();
	}
}
开发者ID:AMDmi3,项目名称:spring,代码行数:17,代码来源:EventBatchHandler.cpp


示例11: glBindTexture

void CBasicTreeDrawer::Draw(float treeDistance,bool drawReflection)
{
	glBindTexture(GL_TEXTURE_2D, treetex);
	glEnable(GL_ALPHA_TEST);

	int cx=(int)(camera->pos.x/(SQUARE_SIZE*TREE_SQUARE_SIZE));
	int cy=(int)(camera->pos.z/(SQUARE_SIZE*TREE_SQUARE_SIZE));

	CBasicTreeSquareDrawer drawer;
	drawer.td = this;
	drawer.cx = cx;
	drawer.cy = cy;
	drawer.treeDistance = treeDistance;

	GML_STDMUTEX_LOCK(tree); // Draw

	readmap->GridVisibility (camera, TREE_SQUARE_SIZE, treeDistance*2*SQUARE_SIZE*TREE_SQUARE_SIZE, &drawer);

	int startClean=lastListClean*20%nTrees;
	lastListClean=gs->frameNum;
	int endClean=gs->frameNum*20%nTrees;

	if(startClean>endClean){
		for(TreeSquareStruct *pTSS=trees+startClean; pTSS<trees+nTrees; ++pTSS) {
			if(pTSS->lastSeen<gs->frameNum-50 && pTSS->displist){
				glDeleteLists(pTSS->displist,1);
				pTSS->displist=0;
			}
			if(pTSS->lastSeenFar<gs->frameNum-50 && pTSS->farDisplist){
				glDeleteLists(pTSS->farDisplist,1);
				pTSS->farDisplist=0;
			}
		}
		for(TreeSquareStruct *pTSS=trees; pTSS<trees+endClean; ++pTSS) {
			if(pTSS->lastSeen<gs->frameNum-50 && pTSS->displist){
				glDeleteLists(pTSS->displist,1);
				pTSS->displist=0;
			}
			if(pTSS->lastSeenFar<gs->frameNum-50 && pTSS->farDisplist){
				glDeleteLists(pTSS->farDisplist,1);
				pTSS->farDisplist=0;
			}
		}
	} else {
		for(TreeSquareStruct *pTSS=trees+startClean; pTSS<trees+endClean; ++pTSS) {
			if(pTSS->lastSeen<gs->frameNum-50 && pTSS->displist){
				glDeleteLists(pTSS->displist,1);
				pTSS->displist=0;
			}
			if(pTSS->lastSeenFar<gs->frameNum-50 && pTSS->farDisplist){
				glDeleteLists(pTSS->farDisplist,1);
				pTSS->farDisplist=0;
			}
		}
	}
	glDisable(GL_BLEND);
	glDisable(GL_ALPHA_TEST);
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:58,代码来源:BasicTreeDrawer.cpp


示例12: GML_STDMUTEX_LOCK

void CGroup::RemoveUnit(CUnit *unit)
{
	GML_STDMUTEX_LOCK(group); // RemoveUnit

	eventHandler.GroupChanged(id);
	if(ai)
		ai->RemoveUnit(unit->id);
	units.erase(unit);
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:9,代码来源:Group.cpp


示例13: GML_STDMUTEX_LOCK

void CDynWater::AddExplosion(const float3& pos, float strength, float size)
{
	if(pos.y>size || size < 8)
		return;

	GML_STDMUTEX_LOCK(water); // AddExplosion

	explosions.push_back(Explosion(pos,std::min(size*20,strength),size));
}
开发者ID:DeadnightWarrior,项目名称:spring,代码行数:9,代码来源:DynWater.cpp


示例14: GML_STDMUTEX_LOCK

void CNetProtocol::InitLocalClient()
{
	GML_STDMUTEX_LOCK(net); // InitLocalClient

	serverConn.reset(new netcode::CLocalConnection);
	serverConn->Flush();
	
	logOutput.Print("Connecting to local server");
}
开发者ID:Dmytry,项目名称:spring,代码行数:9,代码来源:NetProtocol.cpp


示例15: GML_STDMUTEX_LOCK

void CInMapDraw::Draw(void)
{
	GML_STDMUTEX_LOCK(inmap); //! Draw

	CVertexArray* va = GetVertexArray();
	va->Initialize();
	CVertexArray* lineva = GetVertexArray();
	lineva->Initialize();

	InMapDraw_QuadDrawer drawer;
	drawer.imd = this;
	drawer.lineva = lineva;
	drawer.va = va;
	drawer.visLabels = &visibleLabels;

	glDepthMask(0);
	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_BLEND);
	glBindTexture(GL_TEXTURE_2D, texture);

	readmap->GridVisibility(camera, DRAW_QUAD_SIZE, 3000.0f, &drawer);

	glDisable(GL_TEXTURE_2D);
	glLineWidth(3.f);
	lineva->DrawArrayC(GL_LINES); //! draw lines

	// XXX hopeless drivers, retest in a year or so...
	// width greater than 2 causes GUI flicker on ATI hardware as of driver version 9.3
	// so redraw lines with width 1
	if (globalRendering->atiHacks) {
		glLineWidth(1.f);
		lineva->DrawArrayC(GL_LINES);
	}

	// draw points
	glLineWidth(1);
	glEnable(GL_TEXTURE_2D);
	va->DrawArrayTC(GL_QUADS); //! draw point markers 

	if (!visibleLabels.empty()) {
		font->SetColors(); //! default

		//! draw point labels
		for (std::vector<MapPoint*>::iterator pi = visibleLabels.begin(); pi != visibleLabels.end(); ++pi) {
			float3 pos = (*pi)->pos;
			pos.y += 111.0f;

			font->SetTextColor((*pi)->color[0]/255.0f, (*pi)->color[1]/255.0f, (*pi)->color[2]/255.0f, 1.0f); //FIXME (overload!)
			font->glWorldPrint(pos, 26.0f, (*pi)->label);
		}

		visibleLabels.clear();
	}

	glDepthMask(1);
}
开发者ID:BrainDamage,项目名称:spring,代码行数:56,代码来源:InMapDraw.cpp


示例16: GML_RECMUTEX_LOCK

void CGroupHandler::GroupCommand(int num, const std::string& cmd)
{
	GML_RECMUTEX_LOCK(sel); // GroupCommand
	GML_STDMUTEX_LOCK(group); // GroupCommand

	if ((cmd == "set") || (cmd == "add")) {
		if (cmd == "set") {
			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 (cmd == "selectadd")  {
		// 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 (cmd == "selectclear")  {
		// do not select the group, just remove its members from the current selection
		CUnitSet::const_iterator gi;
		for (gi = groups[num]->units.begin(); gi != groups[num]->units.end(); ++gi) {
			selectedUnits.RemoveUnit(*gi);
		}
		return;
	}
	else if (cmd == "selecttoggle")  {
		// 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,代码行数:56,代码来源:GroupHandler.cpp


示例17: GML_STDMUTEX_LOCK

void EventBatchHandler::UpdateDrawProjectiles() {
	GML_STDMUTEX_LOCK(rproj); // UpdateDrawProjectiles

#if DETACH_SYNCED
	syncedProjectileCreatedDestroyedEventBatch.delete_delayed();
#endif
	syncedProjectileCreatedDestroyedEventBatch.add_delayed();
	unsyncedProjectileCreatedDestroyedEventBatch.delete_delayed();
	unsyncedProjectileCreatedDestroyedEventBatch.add_delayed();
}
开发者ID:niavok,项目名称:spring,代码行数:10,代码来源:EventBatchHandler.cpp


示例18: GML_STDMUTEX_LOCK

void ITreeDrawer::Update() {

	GML_STDMUTEX_LOCK(tree); // Update

	std::vector<GLuint>::iterator i;
	for (i = delDispLists.begin(); i != delDispLists.end(); ++i) {
		glDeleteLists(*i, 1);
	}
	delDispLists.clear();
}
开发者ID:niavok,项目名称:spring,代码行数:10,代码来源:ITreeDrawer.cpp


示例19: GML_STDMUTEX_LOCK

void CAdvTreeDrawer::DeleteTree(float3 pos)
{
	GML_STDMUTEX_LOCK(tree); // DeleteTree

	int hash=(int)pos.x+((int)(pos.z))*20000;
	int square=((int)pos.x)/(SQUARE_SIZE*TREE_SQUARE_SIZE)+((int)pos.z)/(SQUARE_SIZE*TREE_SQUARE_SIZE)*treesX;

	trees[square].trees.erase(hash);

	ResetPos(pos);
}
开发者ID:DeadnightWarrior,项目名称:spring,代码行数:11,代码来源:AdvTreeDrawer.cpp


示例20: GML_STDMUTEX_LOCK

void CNetProtocol::InitLocalClient(const unsigned wantedNumber)
{
	GML_STDMUTEX_LOCK(net);

	server.reset(new netcode::CLocalConnection);
	server->Flush();
	if (!localDemoPlayback)
	{
		record.reset(new CDemoRecorder());
	}
	
	logOutput.Print("Connecting to local server using number %i", wantedNumber);
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:13,代码来源:NetProtocol.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GMN_DBG函数代码示例发布时间:2022-05-30
下一篇:
C++ GML_RECMUTEX_LOCK函数代码示例发布时间: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