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

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

51自学网 2021-06-03 08:57:27
  C++
这篇教程C++ trap_BotMatchVariable函数代码示例写得很实用,希望能帮到您。

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

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

示例1: BotAddressedToBot

/*==================BotAddressedToBot==================*/int BotAddressedToBot(bot_state_t *bs, bot_match_t *match) {	char addressedto[MAX_MESSAGE_SIZE];	char netname[MAX_MESSAGE_SIZE];	//char name[MAX_MESSAGE_SIZE];	char botname[128];	int client;	//char buf[MAX_MESSAGE_SIZE];	trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));	client = ClientOnSameTeamFromName(bs, netname);	if (client < 0) return qfalse;		//if the message is addressed to someone	if (match->subtype & ST_ADDRESSED) {		// compare addressee with botname		trap_BotMatchVariable(match, ADDRESSEE, addressedto, sizeof(addressedto));		ClientName(bs->client, botname, 128);		// is that me?		if ( strlen(addressedto) && (stristr(botname, addressedto)) ){			return qtrue;		}		// no its not!		if( bot_developer.integer & AIDBG_CHAT){			//Com_sprintf(buf, sizeof(buf), "not addressed to me but %s", addressedto);			//trap_EA_Say(bs->client, buf);		}		return qfalse;	}	// not addressed, take it	return qtrue;}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:40,


示例2: BotMatch_Kill

/*==================BotMatch_Kill==================*/void BotMatch_Kill(bot_state_t *bs, bot_match_t *match) {	char enemy[MAX_MESSAGE_SIZE];	char netname[MAX_MESSAGE_SIZE];	int client;	if (!TeamPlayIsOn()) return;	//if not addressed to this bot	if (!BotAddressedToBot(bs, match)) return;	trap_BotMatchVariable(match, ENEMY, enemy, sizeof(enemy));	//	client = FindEnemyByName(bs, enemy);	if (client < 0) {		BotAI_BotInitialChat(bs, "whois", enemy, NULL);		trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));		client = ClientFromName(netname);		trap_BotEnterChat(bs->cs, client, CHAT_TELL);		return;	}	bs->teamgoal.entitynum = client;	//set the time to send a message to the team mates	bs->teammessage_time = FloatTime() + 2 * random();	//set the ltg type	bs->ltgtype = LTG_KILL;	//set the team goal time	bs->teamgoal_time = FloatTime() + TEAM_KILL_SOMEONE;	//	BotSetTeamStatus(bs);#ifdef DEBUG	BotPrintTeamGoal(bs);#endif //DEBUG}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:37,


示例3: BotMatch_CTF

/*==================BotMatch_CTF==================*/void BotMatch_CTF( bot_state_t *bs, bot_match_t *match ) {	char flag[128], netname[MAX_NETNAME];	trap_BotMatchVariable( match, FLAG, flag, sizeof( flag ) );	if ( match->subtype & ST_GOTFLAG ) {		if ( !Q_stricmp( flag, "red" ) ) {			bs->redflagstatus = 1;			if ( BotCTFTeam( bs ) == CTF_TEAM_BLUE ) {				trap_BotMatchVariable( match, NETNAME, netname, sizeof( netname ) );				bs->flagcarrier = ClientFromName( netname );			}		} else {			bs->blueflagstatus = 1;			if ( BotCTFTeam( bs ) == CTF_TEAM_RED ) {				trap_BotMatchVariable( match, NETNAME, netname, sizeof( netname ) );				bs->flagcarrier = ClientFromName( netname );			}		}		bs->flagstatuschanged = 1;	} else if ( match->subtype & ST_CAPTUREDFLAG )     {		bs->redflagstatus = 0;		bs->blueflagstatus = 0;		bs->flagcarrier = 0;		bs->flagstatuschanged = 1;	} else if ( match->subtype & ST_RETURNEDFLAG )     {		if ( !Q_stricmp( flag, "red" ) ) {			bs->redflagstatus = 0;		} else { bs->blueflagstatus = 0;}		bs->flagstatuschanged = 1;	}}
开发者ID:JackalFrost,项目名称:RTCW-WSGF,代码行数:37,


示例4: BotAddressedToBot

/*==================BotAddressedToBot==================*/int BotAddressedToBot( bot_state_t *bs, bot_match_t *match ) {	char addressedto[MAX_MESSAGE_SIZE];	char netname[MAX_MESSAGE_SIZE];	char name[MAX_MESSAGE_SIZE];	char botname[128];	int client;	bot_match_t addresseematch;	trap_BotMatchVariable( match, NETNAME, netname, sizeof( netname ) );	client = ClientFromName( netname );	if ( client < 0 ) {		return qfalse;	}	if ( !BotSameTeam( bs, client ) ) {		return qfalse;	}	//if the message is addressed to someone	if ( match->subtype & ST_ADDRESSED ) {		trap_BotMatchVariable( match, ADDRESSEE, addressedto, sizeof( addressedto ) );		//the name of this bot		ClientName( bs->client, botname, 128 );		//		while ( trap_BotFindMatch( addressedto, &addresseematch, MTCONTEXT_ADDRESSEE ) ) {			if ( addresseematch.type == MSG_EVERYONE ) {				return qtrue;			} else if ( addresseematch.type == MSG_MULTIPLENAMES )     {				trap_BotMatchVariable( &addresseematch, TEAMMATE, name, sizeof( name ) );				if ( strlen( name ) ) {					if ( stristr( botname, name ) ) {						return qtrue;					}					if ( stristr( bs->subteam, name ) ) {						return qtrue;					}				}				trap_BotMatchVariable( &addresseematch, MORE, addressedto, MAX_MESSAGE_SIZE );			} else {				trap_BotMatchVariable( &addresseematch, TEAMMATE, name, MAX_MESSAGE_SIZE );				if ( strlen( name ) ) {					if ( stristr( botname, name ) ) {						return qtrue;					}					if ( stristr( bs->subteam, name ) ) {						return qtrue;					}				}				break;			}		}		//Com_sprintf(buf, sizeof(buf), "not addressed to me but %s", addressedto);		//trap_EA_Say(bs->client, buf);		return qfalse;	} else {		//make sure not everyone reacts to this message		if ( random() > (float ) 1.0 / ( NumPlayersOnSameTeam( bs ) - 1 ) ) {			return qfalse;		}	}	return qtrue;}
开发者ID:JackalFrost,项目名称:RTCW-WSGF,代码行数:65,


示例5: BotMatch_StopTeamLeaderShip

/*=======================================================================================================================================BotMatch_StopTeamLeaderShip=======================================================================================================================================*/void BotMatch_StopTeamLeaderShip(bot_state_t *bs, bot_match_t *match) {	int client;	char teammate[MAX_MESSAGE_SIZE];	char netname[MAX_MESSAGE_SIZE];	if (!TeamPlayIsOn()) {		return;	}	// get the team mate that stops being the team leader	trap_BotMatchVariable(match, TEAMMATE, teammate, sizeof(teammate));	// if chats for him or herself	if (match->subtype & ST_I) {		trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));		client = FindClientByName(netname);	}	// chats for someone else	else {		client = FindClientByName(teammate);	}	if (client >= 0) {		if (!Q_stricmp(bs->teamleader, ClientName(client, netname, sizeof(netname)))) {			bs->teamleader[0] = '/0';		}	}}
开发者ID:ioid3-games,项目名称:ioid3-rtcw,代码行数:31,


示例6: BotMatch_StartTeamLeaderShip

/*=======================================================================================================================================BotMatch_StartTeamLeaderShip=======================================================================================================================================*/void BotMatch_StartTeamLeaderShip(bot_state_t *bs, bot_match_t *match) {	int client;	char teammate[MAX_MESSAGE_SIZE];	if (!TeamPlayIsOn()) {		return;	}	// if chats for him or herself	if (match->subtype & ST_I) {		// get the team mate that will be the team leader		trap_BotMatchVariable(match, NETNAME, teammate, sizeof(teammate));		strncpy(bs->teamleader, teammate, sizeof(bs->teamleader));		bs->teamleader[sizeof(bs->teamleader) - 1] = '/0';	}	// chats for someone else	else {		// get the team mate that will be the team leader		trap_BotMatchVariable(match, TEAMMATE, teammate, sizeof(teammate));		client = FindClientByName(teammate);		if (client >= 0) {			ClientName(client, bs->teamleader, sizeof(bs->teamleader));		}	}}
开发者ID:ioid3-games,项目名称:ioid3-rtcw,代码行数:30,


示例7: BotGetTime

/*=======================================================================================================================================BotGetTime=======================================================================================================================================*/float BotGetTime(bot_match_t *match) {	bot_match_t timematch;	char timestring[MAX_MESSAGE_SIZE];	float t;	// if the matched string has a time	if (match->subtype & ST_TIME) {		// get the time string		trap_BotMatchVariable(match, TIME, timestring, MAX_MESSAGE_SIZE);		// match it to find out if the time is in seconds or minutes		if (trap_BotFindMatch(timestring, &timematch, MTCONTEXT_TIME)) {			if (timematch.type == MSG_FOREVER) {				t = 99999999;			} else {				trap_BotMatchVariable(&timematch, TIME, timestring, MAX_MESSAGE_SIZE);				if (timematch.type == MSG_MINUTES) {					t = atof(timestring) * 60;				} else if (timematch.type == MSG_SECONDS) {					t = atof(timestring);				} else {t = 0;}			}			// if there's a valid time			if (t > 0) {				return trap_AAS_Time() + t;			}		}	}	return 0;}
开发者ID:ioid3-games,项目名称:ioid3-rtcw,代码行数:35,


示例8: BotMatch_GetItem

/*==================BotMatch_GetItem==================*/void BotMatch_GetItem(bot_state_t *bs, bot_match_t *match) {	char itemname[MAX_MESSAGE_SIZE];	char netname[MAX_MESSAGE_SIZE];	int client;	if (!TeamPlayIsOn()) return;	//if not addressed to this bot	if (!BotAddressedToBot(bs, match)) return;	//get the match variable	trap_BotMatchVariable(match, ITEM, itemname, sizeof(itemname));	//	if (!BotGetMessageTeamGoal(bs, itemname, &bs->teamgoal)) {		//BotAI_BotInitialChat(bs, "cannotfind", itemname, NULL);		//trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);		return;	}	trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));	client = ClientOnSameTeamFromName(bs, netname);	//	bs->decisionmaker = client;	bs->ordered = qtrue;	bs->order_time = FloatTime();	//set the time to send a message to the team mates	bs->teammessage_time = FloatTime() + 2 * random();	//set the ltg type	bs->ltgtype = LTG_GETITEM;	//set the team goal time	bs->teamgoal_time = FloatTime() + TEAM_GETITEM_TIME;	//	BotSetTeamStatus(bs);#ifdef DEBUG	BotPrintTeamGoal(bs);#endif //DEBUG}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:39,


示例9: BotMatch_CheckPoint

/*=======================================================================================================================================BotMatch_CheckPoint=======================================================================================================================================*/void BotMatch_CheckPoint(bot_state_t *bs, bot_match_t *match) {	int areanum;	char buf[MAX_MESSAGE_SIZE];	vec3_t position;	bot_waypoint_t *cp;	if (!TeamPlayIsOn()) {		return;	}	trap_BotMatchVariable(match, POSITION, buf, MAX_MESSAGE_SIZE);	VectorClear(position);	// BotGPSToPosition(buf, position);	sscanf(buf, "%f %f %f", &position[0], &position[1], &position[2]);	position[2] += 0.5;	areanum = BotPointAreaNum(position);	if (!areanum) {		if (BotAddressedToBot(bs, match)) {			BotAI_BotInitialChat(bs, "checkpoint_invalid", NULL);			trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);		}		return;	}	trap_BotMatchVariable(match, NAME, buf, MAX_MESSAGE_SIZE);	// check if there already exists a checkpoint with this name	cp = BotFindWayPoint(bs->checkpoints, buf);	if (cp) {		if (cp->next) {			cp->next->prev = cp->prev;		}		if (cp->prev) {			cp->prev->next = cp->next;		} else {bs->checkpoints = cp->next;}		cp->inuse = qfalse;	}	// create a new check point	cp = BotCreateWayPoint(buf, position, areanum);	// add the check point to the bot's known chech points	cp->next = bs->checkpoints;	if (bs->checkpoints) {		bs->checkpoints->prev = cp;	}	bs->checkpoints = cp;	if (BotAddressedToBot(bs, match)) {		Com_sprintf(buf, sizeof(buf), "%1.0f %1.0f %1.0f", cp->goal.origin[0], cp->goal.origin[1], cp->goal.origin[2]);		BotAI_BotInitialChat(bs, "checkpoint_confirm", cp->name, buf, NULL);		trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);	}}
开发者ID:ioid3-games,项目名称:ioid3-rtcw,代码行数:64,


示例10: BotAddresseeMatch

/*=================BotAddresseeMatch=================*/qboolean BotAddresseeMatch(bot_state_t *bs, bot_match_t *match){	int teammates;	char addressee[MAX_MESSAGE_SIZE];	char name[MAX_MESSAGE_SIZE];	char *botname;	bot_match_t submatch;	// If the message isn't addressed to anyone in particular, the bot may or may not react	if ( !(match->subtype & ST_ADDRESSED) )	{		// If the message was only given to this bot, the bot definitely reacts		submatch.type = 0;		if (trap_BotFindMatch(match->string, &submatch, MTCONTEXT_REPLYCHAT) &&			submatch.type == MSG_CHATTELL)			return qtrue;		// The bot still might randomly react, though it's less likely with more teammates		teammates = BotTeammates(bs);		if (!teammates)			return qtrue;		return (random() <= 1.0 / teammates);	}	// Search for the bot's name in the message's addressee list	botname = SimplifyName(EntityNameFast(bs->ent));	trap_BotMatchVariable(match, ADDRESSEE, addressee, sizeof(addressee));	while (trap_BotFindMatch(addressee, &submatch, MTCONTEXT_ADDRESSEE))	{		// If matching everyone on the team, automatically respond		if (submatch.type == MSG_EVERYONE)			return qtrue;		// The bot responds if the next name matches its name or its subteam's name		trap_BotMatchVariable(&submatch, TEAMMATE, name, sizeof(name));		if (strlen(name))		{			if (stristr(botname, name))				return qtrue;			if (stristr(bs->subteam, name))				return qtrue;		}		// Exit if this is the last name in the list		if (submatch.type != MSG_MULTIPLENAMES)			break;		// Get the next name in the list		trap_BotMatchVariable(&submatch, MORE, addressee, sizeof(addressee));	}	// The bot was not found in the specific addressee list	return qfalse;}
开发者ID:Garey27,项目名称:quake3-brainworks,代码行数:59,


示例11: BotMatch_CatchMe

void BotMatch_CatchMe(bot_state_t *bs, bot_match_t *match){	char netname[MAX_MESSAGE_SIZE];	int client;	//if not addressed to this bot	if ( !TeamPlayIsOn() || !BotAddressedToBot(bs, match) ) return;	// who wants me to to come?	trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));	client = ClientOnSameTeamFromName(bs, netname);	bs->teammate = client;			bs->teammatevisible_time = FloatTime();		//last time the team mate was assumed visible	bs->decisionmaker = client;	// bs->ordered = qtrue;	//bs->order_time = FloatTime();	//set the time to send a message to the team mates	bs->teammessage_time = FloatTime() + 2 * random();	//set the ltg type	bs->ltgtype = LTG_JOINMATE;	//set the team goal time	bs->teamgoal_time = FloatTime() + 300;	// 5 minutes}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:25,


示例12: BotMatch_GetItem

/*=======================================================================================================================================BotMatch_GetItem=======================================================================================================================================*/void BotMatch_GetItem(bot_state_t *bs, bot_match_t *match) {	char itemname[MAX_MESSAGE_SIZE];	if (!TeamPlayIsOn()) {		return;	}	// if not addressed to this bot	if (!BotAddressedToBot(bs, match)) {		return;	}	// get the match variable	trap_BotMatchVariable(match, ITEM, itemname, sizeof(itemname));	if (!BotGetMessageTeamGoal(bs, itemname, &bs->teamgoal)) {		// BotAI_BotInitialChat(bs, "cannotfind", itemname, NULL);		// trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);		return;	}	// set the time to send a message to the team mates	bs->teammessage_time = trap_AAS_Time() + 2 * random();	// set the ltg type	bs->ltgtype = LTG_GETITEM;	// set the team goal time	bs->teamgoal_time = trap_AAS_Time() + TEAM_GETITEM_TIME;#ifdef DEBUG	BotPrintTeamGoal(bs);#endif // DEBUG}
开发者ID:ioid3-games,项目名称:ioid3-rtcw,代码行数:33,


示例13: BotMatch_WrongWall

void BotMatch_WrongWall(bot_state_t* bs, bot_match_t *match){	char netname[MAX_MESSAGE_SIZE];	char buf[MAX_INFO_STRING];	int client;	if(gametype != GT_SPRAY)		return;	// talking about me ? (avoid clientfromname, its ambiguous)	trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));	trap_GetConfigstring(CS_PLAYERS + bs->client, buf, sizeof(buf));	Q_CleanStr( buf );	if (!Q_stricmp(Info_ValueForKey(buf, "n"), netname)){		// could be someone with same name, so make (more) sure		if( ClientInSprayroom(bs->client) ){			bs->which_wall = BotChooseCorrectWall(bs);			bs->enemy = -1;			// chat			BotAI_BotInitialChat(bs, "wall_missed", NULL);			trap_BotEnterChat(bs->cs, 0, CHAT_ALL);			return;		}	}	// check if opposite team	client = ClientFromName(netname);	if(!BotSameTeam(bs, client)){		float rnd;		// flame		rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_INSULT, 0, 1);		if(random() > rnd) return;			BotAI_BotInitialChat(bs, "wall_insult", netname, NULL);		trap_BotEnterChat(bs->cs, 0, CHAT_ALL);	}}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:34,


示例14: BotMatch_FormationSpace

/*=======================================================================================================================================BotMatch_FormationSpace=======================================================================================================================================*/void BotMatch_FormationSpace(bot_state_t *bs, bot_match_t *match) {	char buf[MAX_MESSAGE_SIZE];	float space;	if (!TeamPlayIsOn()) {		return;	}	// if not addressed to this bot	if (!BotAddressedToBot(bs, match)) {		return;	}	trap_BotMatchVariable(match, NUMBER, buf, MAX_MESSAGE_SIZE);	// if it's the distance in feet	if (match->subtype & ST_FEET) {		space = 0.3048 * 32 * atof(buf);	}	// else it's in meters	else {space = 32 * atof(buf);}	// check if the formation intervening space is valid	if (space < 48 || space > 500) {		space = 100;	}	bs->formation_dist = space;}
开发者ID:ioid3-games,项目名称:ioid3-rtcw,代码行数:31,


示例15: BotMatch_Patrol

/*==================BotMatch_Patrol==================*/void BotMatch_Patrol(bot_state_t *bs, bot_match_t *match) {	char netname[MAX_MESSAGE_SIZE];	int client;	if (!TeamPlayIsOn()) return;	//if not addressed to this bot	if (!BotAddressedToBot(bs, match)) return;	//get the patrol waypoints	if (!BotGetPatrolWaypoints(bs, match)) return;	//	trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));	//	client = FindClientByName(netname);	//	bs->decisionmaker = client;	bs->ordered = qtrue;	bs->order_time = FloatTime();	//set the time to send a message to the team mates	bs->teammessage_time = FloatTime() + 2 * random();	//set the ltg type	bs->ltgtype = LTG_PATROL;	//get the team goal time	bs->teamgoal_time = BotGetTime(match);	//set the team goal time if not set already	if (!bs->teamgoal_time) bs->teamgoal_time = FloatTime() + TEAM_PATROL_TIME;	//	BotSetTeamStatus(bs);	// remember last ordered task	BotRememberLastOrderedTask(bs);#ifdef DEBUG	BotPrintTeamGoal(bs);#endif //DEBUG}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:38,


示例16: BotMatch_CTF

/*==================BotMatch_CTF==================*/void BotMatch_CTF(bot_state_t *bs, bot_match_t *match) {	char flag[128], netname[MAX_NETNAME];	if (gametype == GT_CTF) {		trap_BotMatchVariable(match, FLAG, flag, sizeof(flag));		if (match->subtype & ST_GOTFLAG) {			if (!Q_stricmp(flag, "red")) {				bs->redflagstatus = 1;				if (BotTeam(bs) == TEAM_BLUE) {					trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));					bs->flagcarrier = ClientFromName(netname);				}			}			else {				bs->blueflagstatus = 1;				if (BotTeam(bs) == TEAM_RED) {					trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));					bs->flagcarrier = ClientFromName(netname);				}			}			bs->flagstatuschanged = 1;			bs->lastflagcapture_time = FloatTime();		}		else if (match->subtype & ST_CAPTUREDFLAG) {			bs->redflagstatus = 0;			bs->blueflagstatus = 0;			bs->flagcarrier = 0;			bs->flagstatuschanged = 1;		}		else if (match->subtype & ST_RETURNEDFLAG) {			if (!Q_stricmp(flag, "red")) bs->redflagstatus = 0;			else bs->blueflagstatus = 0;			bs->flagstatuschanged = 1;		}	}#ifdef MISSIONPACK	else if (gametype == GT_1FCTF) {		if (match->subtype & ST_1FCTFGOTFLAG) {			trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));			bs->flagcarrier = ClientFromName(netname);		}	}#endif}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:50,


示例17: BotMatch_EnterGame

void BotMatch_EnterGame(bot_state_t *bs, bot_match_t *match) {	int client;	char netname[MAX_NETNAME];	trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));	client = FindClientByName(netname);	if (client >= 0) {		notleader[client] = qfalse;	}}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:10,


示例18: BotMatch_JoinSubteam

/*==================BotMatch_JoinSubteam==================*/void BotMatch_JoinSubteam(bot_state_t *bs, bot_match_t *match) {	char teammate[MAX_MESSAGE_SIZE];	char netname[MAX_MESSAGE_SIZE];	int client;	if (!TeamPlayIsOn()) return;	//if not addressed to this bot	if (!BotAddressedToBot(bs, match)) return;	//get the sub team name	trap_BotMatchVariable(match, TEAMNAME, teammate, sizeof(teammate));	//set the sub team name	strncpy(bs->subteam, teammate, 32);	bs->subteam[31] = '/0';	//	trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));	BotAI_BotInitialChat(bs, "joinedteam", teammate, NULL);	client = ClientFromName(netname);	trap_BotEnterChat(bs->cs, client, CHAT_TELL);}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:24,


示例19: BotMatch_NewLeader

void BotMatch_NewLeader(bot_state_t *bs, bot_match_t *match) {	int client;	char netname[MAX_NETNAME];	trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));	client = FindClientByName(netname);	if (!BotSameTeam(bs, client))		return;	Q_strncpyz(bs->teamleader, netname, sizeof(bs->teamleader));}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:10,


示例20: BotMatch_DefendKeyArea

/*==================BotMatch_DefendKeyArea==================*/void BotMatch_DefendKeyArea(bot_state_t *bs, bot_match_t *match) {	char itemname[MAX_MESSAGE_SIZE];	char netname[MAX_MESSAGE_SIZE];	int client;	if (!TeamPlayIsOn()) return;	//if not addressed to this bot	if (!BotAddressedToBot(bs, match)) return;	//get the match variable	trap_BotMatchVariable(match, KEYAREA, itemname, sizeof(itemname));	//	if (!BotGetMessageTeamGoal(bs, itemname, &bs->teamgoal)) {		//BotAI_BotInitialChat(bs, "cannotfind", itemname, NULL);		//trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);		return;	}	//	trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));	//	client = ClientFromName(netname);	//the team mate who ordered	bs->decisionmaker = client;	bs->ordered = qtrue;	bs->order_time = FloatTime();	//set the time to send a message to the team mates	bs->teammessage_time = FloatTime() + 2 * random();	//set the ltg type	bs->ltgtype = LTG_DEFENDKEYAREA;	//get the team goal time	bs->teamgoal_time = BotGetTime(match);	//set the team goal time	if (!bs->teamgoal_time) bs->teamgoal_time = FloatTime() + TEAM_DEFENDKEYAREA_TIME;	//away from defending	bs->defendaway_time = 0;	//	BotSetTeamStatus(bs);	// remember last ordered task	BotRememberLastOrderedTask(bs);#ifdef DEBUG	BotPrintTeamGoal(bs);#endif //DEBUG}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:47,


示例21: BotMatch_JoinSubteam

/*====================BotMatch_JoinSubteam====================*/void BotMatch_JoinSubteam(bot_state_t *bs, bot_match_t *match, gentity_t *sender){	// Set the bot's subteam name	trap_BotMatchVariable(match, TEAMNAME, bs->subteam, sizeof(bs->subteam));	// Make sure the string is properly terminated	bs->subteam[ sizeof(bs->subteam)-1 ] = '/0';	// Inform the sender that the bot has joined this subteam	Bot_InitialChat(bs, "joinedteam", bs->subteam, NULL);	trap_BotEnterChat(bs->cs, sender->s.number, CHAT_TELL);}
开发者ID:Garey27,项目名称:quake3-brainworks,代码行数:17,


示例22: BotMatch_Suicide

/*==================BotMatch_Suicide==================*/void BotMatch_Suicide(bot_state_t *bs, bot_match_t *match) {	char netname[MAX_MESSAGE_SIZE];	int client;	if (!TeamPlayIsOn()) return;	//if not addressed to this bot	if (!BotAddressedToBot(bs, match)) return;	//	trap_EA_Command(bs->client, "kill");	//	trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));	client = ClientFromName(netname);	//	BotVoiceChat(bs, client, VOICECHAT_TAUNT);	trap_EA_Action(bs->client, ACTION_AFFIRMATIVE);}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:21,


示例23: BotMatch_FormationSpace

/*=======================BotMatch_FormationSpace=======================*/void BotMatch_FormationSpace(bot_state_t *bs, bot_match_t *match){	char number[MAX_MESSAGE_SIZE];	// Determine the spacing distance in meters	trap_BotMatchVariable(match, NUMBER, number, MAX_MESSAGE_SIZE);	bs->formation_dist = 32 * atof(number);	// Scale the distance by the appropriate units if specified	if (match->subtype & ST_FEET)		bs->formation_dist *= 0.3048;	// Reasonably bound the formation distance	if (bs->formation_dist < 48 || bs->formation_dist > 500)		bs->formation_dist = 32 * 3.5;}
开发者ID:Garey27,项目名称:quake3-brainworks,代码行数:21,


示例24: BotCheckEvents

/*===============BotMatchMessageThis function returns if the message could be matched.  It does notmean the bot actually processed the message.NOTE: Death messages are sent as an EV_OBITUARY event, not actual consolemessages.  As such, they are processed by BotCheckEvents() in ai_scan.c.===============*/qboolean BotMatchMessage(bot_state_t *bs, char *message){	bot_match_t match;	char name[MAX_MESSAGE_SIZE];	gentity_t *sender;	// Try to match this message as a CTF teamchat message	match.type = 0;	if (!trap_BotFindMatch(message, &match,						   MTCONTEXT_MISC | MTCONTEXT_INITIALTEAMCHAT | MTCONTEXT_CTF))		return qfalse;	// Ignore messages in deathmatch modes, but return true because it's a real message	if ( !(game_style & GS_TEAM) )		return qtrue;	// Check if this message is a team management message	trap_BotMatchVariable(&match, NETNAME, name, sizeof(name));	sender = TeammateFromName(bs, name);	if (BotMatch_Team(bs, &match, sender))		return qtrue;	// Ignore messages not from a teammate	if (!sender)	{		Bot_InitialChat(bs, "whois", name, NULL);		trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);		return qtrue;	}	// Ignore other messages if they aren't intended for this bot	if (!BotAddresseeMatch(bs, &match))		return qtrue;	// Check if this message is an order	if (BotMatch_Order(bs, &match, sender))		return qtrue;	// Check if this message is a subteam request	if (BotMatch_Subteam(bs, &match, sender))		return qtrue;	// Still return true because the message matched-- our code just elected not to process it	BotAI_Print(PRT_WARNING, "Unknown match type %i/n", match.type);	return qtrue;}
开发者ID:Garey27,项目名称:quake3-brainworks,代码行数:57,


示例25: BotMatch_LeaveSubteam

/*==================BotMatch_LeaveSubteam==================*/void BotMatch_LeaveSubteam(bot_state_t *bs, bot_match_t *match) {	char netname[MAX_MESSAGE_SIZE];	int client;	if (!TeamPlayIsOn()) return;	//if not addressed to this bot	if (!BotAddressedToBot(bs, match)) return;	//	if (strlen(bs->subteam))	{		BotAI_BotInitialChat(bs, "leftteam", bs->subteam, NULL);		trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));		client = ClientFromName(netname);		trap_BotEnterChat(bs->cs, client, CHAT_TELL);	} //end if	strcpy(bs->subteam, "");}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:22,


示例26: BotMatch_GetFlag

/*==================BotMatch_GetFlag==================*/void BotMatch_GetFlag(bot_state_t *bs, bot_match_t *match) {	char netname[MAX_MESSAGE_SIZE];	int client;	if (gametype == GT_CTF) {		if (!ctf_redflag.areanum || !ctf_blueflag.areanum)			return;	}#ifdef MISSIONPACK	else if (gametype == GT_1FCTF) {		if (!ctf_neutralflag.areanum || !ctf_redflag.areanum || !ctf_blueflag.areanum)			return;	}#endif	else {		return;	}	//if not addressed to this bot	if (!BotAddressedToBot(bs, match)) return;	//	trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));	//	client = FindClientByName(netname);	//	bs->decisionmaker = client;	bs->ordered = qtrue;	bs->order_time = FloatTime();	//set the time to send a message to the team mates	bs->teammessage_time = FloatTime() + 2 * random();	//set the ltg type	bs->ltgtype = LTG_GETFLAG;	//set the team goal time	bs->teamgoal_time = FloatTime() + CTF_GETFLAG_TIME;	// get an alternate route in ctf	if (gametype == GT_CTF) {		//get an alternative route goal towards the enemy base		BotGetAlternateRouteGoal(bs, BotOppositeTeam(bs));	}	//	BotSetTeamStatus(bs);	// remember last ordered task	BotRememberLastOrderedTask(bs);#ifdef DEBUG	BotPrintTeamGoal(bs);#endif //DEBUG}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:51,


示例27: BotMatch_JoinSubteam

/*=======================================================================================================================================BotMatch_JoinSubteam=======================================================================================================================================*/void BotMatch_JoinSubteam(bot_state_t *bs, bot_match_t *match) {	char teammate[MAX_MESSAGE_SIZE];	if (!TeamPlayIsOn()) {		return;	}	// if not addressed to this bot	if (!BotAddressedToBot(bs, match)) {		return;	}	// get the sub team name	trap_BotMatchVariable(match, TEAMNAME, teammate, MAX_MESSAGE_SIZE);	// set the sub team name	strncpy(bs->subteam, teammate, 32);	bs->subteam[31] = '/0';	BotAI_BotInitialChat(bs, "joinedteam", teammate, NULL);	trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);}
开发者ID:ioid3-games,项目名称:ioid3-rtcw,代码行数:23,


示例28: BotMatch_Dismiss

/*==================BotMatch_Dismiss==================*/void BotMatch_Dismiss(bot_state_t *bs, bot_match_t *match) {	char netname[MAX_MESSAGE_SIZE];	int client;	if (!TeamPlayIsOn()) return;	//if not addressed to this bot	if (!BotAddressedToBot(bs, match)) return;	trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));	client = ClientFromName(netname);	//	bs->decisionmaker = client;	//	bs->ltgtype = 0;	bs->lead_time = 0;	bs->lastgoal_ltgtype = 0;	//	BotAI_BotInitialChat(bs, "dismissed", NULL);	trap_BotEnterChat(bs->cs, client, CHAT_TELL);}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:24,


示例29: BotMatch_AttackEnemyBase

/*==================BotMatch_AttackEnemyBase==================*/void BotMatch_AttackEnemyBase(bot_state_t *bs, bot_match_t *match) {	char netname[MAX_MESSAGE_SIZE];	int client;	if (gametype == GT_CTF) {		BotMatch_GetFlag(bs, match);	}#ifdef MISSIONPACK	else if (gametype == GT_1FCTF || gametype == GT_OBELISK || gametype == GT_HARVESTER) {		if (!redobelisk.areanum || !blueobelisk.areanum)			return;	}#endif	else {		return;	}	//if not addressed to this bot	if (!BotAddressedToBot(bs, match)) return;	//	trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));	//	client = FindClientByName(netname);	//	bs->decisionmaker = client;	bs->ordered = qtrue;	bs->order_time = FloatTime();	//set the time to send a message to the team mates	bs->teammessage_time = FloatTime() + 2 * random();	//set the ltg type	bs->ltgtype = LTG_ATTACKENEMYBASE;	//set the team goal time	bs->teamgoal_time = FloatTime() + TEAM_ATTACKENEMYBASE_TIME;	bs->attackaway_time = 0;	//	BotSetTeamStatus(bs);	// remember last ordered task	BotRememberLastOrderedTask(bs);#ifdef DEBUG	BotPrintTeamGoal(bs);#endif //DEBUG}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:46,



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


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