// Should be the only function that ever creates a fireteam void G_RegisterFireteam( /*const char* name,*/ int entityNum ) { fireteamData_t* ft; gentity_t* leader; int count, ident; if ( entityNum < 0 || entityNum >= MAX_CLIENTS ) { G_Error( "G_RegisterFireteam: invalid client" ); } leader = &g_entities[entityNum]; if ( !leader->client ) { G_Error( "G_RegisterFireteam: attempting to register a Fireteam to an entity with no client\n" ); } if ( G_IsOnFireteam( entityNum, NULL ) ) { G_ClientPrintAndReturn( entityNum, "You are already on a fireteam, leave it first" ); } /* if(!name || !*name) { G_ClientPrintAndReturn(entityNum, "You must choose a name for your fireteam"); }*/ if ( ( ft = G_FindFreeFireteam() ) == NULL ) { G_ClientPrintAndReturn( entityNum, "No free fireteams available" ); } if ( leader->client->sess.sessionTeam != TEAM_AXIS && leader->client->sess.sessionTeam != TEAM_ALLIES ) { G_ClientPrintAndReturn( entityNum, "Only players on a team can create a fireteam" ); } count = G_CountTeamFireteams( leader->client->sess.sessionTeam ); if ( count >= MAX_FIRETEAMS / 2 ) { G_ClientPrintAndReturn( entityNum, "Your team already has the maximum number of fireteams allowed" ); } ident = G_FindFreeFireteamIdent( leader->client->sess.sessionTeam ) + 1; if ( ident == 0 ) { G_ClientPrintAndReturn( entityNum, "Um, something is broken, spoink Gordon" ); } // good to go now, i hope! ft->inuse = qtrue; memset( ft->joinOrder, -1, sizeof( level.fireTeams[0].joinOrder ) ); ft->joinOrder[0] = leader - g_entities; ft->ident = ident; if ( g_autoFireteams.integer ) { ft->priv = qfalse; trap_SendServerCommand( entityNum, "aft -1" ); leader->client->pers.autofireteamEndTime = level.time + 20500; } else { ft->priv = qfalse; } // Q_strncpyz(ft->name, name, 32); G_UpdateFireteamConfigString( ft ); }
// Should be the only function that ever creates a fireteam void G_RegisterFireteam(int entityNum, qboolean priv) { fireteamData_t *ft; gentity_t *leader; int count, ident; if (entityNum < 0 || entityNum >= MAX_CLIENTS) { G_Error("G_RegisterFireteam: invalid client"); } leader = &g_entities[entityNum]; if (!leader->client) { G_Error("G_RegisterFireteam: attempting to register a Fireteam to an entity with no client\n"); } if (G_IsOnFireteam(entityNum, NULL)) { G_ClientPrintAndReturn(entityNum, "You are already on a fireteam, leave it first"); } if ((ft = G_FindFreeFireteam()) == NULL) { G_ClientPrintAndReturn(entityNum, "No free fireteams available"); } // Nico, allow cross-team fireteams count = G_CountFireteams(); if (count >= MAX_FIRETEAMS) { G_ClientPrintAndReturn(entityNum, "Your team already has the maximum number of fireteams allowed"); } ident = G_FindFreeFireteamIdent() + 1; if (ident == 0) { G_ClientPrintAndReturn(entityNum, "Um, something is broken, spoink Gordon"); } // good to go now, i hope! ft->inuse = qtrue; memset(ft->joinOrder, -1, sizeof (level.fireTeams[0].joinOrder)); ft->joinOrder[0] = leader - g_entities; ft->ident = ident; ft->priv = priv; G_UpdateFireteamConfigString(ft); }
// Should be the only function that ever creates a fireteam void G_RegisterFireteam(int entityNum) { fireteamData_t *ft; gentity_t *leader; int count, ident; if (entityNum < 0 || entityNum >= MAX_CLIENTS) { G_Error("G_RegisterFireteam: invalid client\n"); } leader = &g_entities[entityNum]; if (!leader->client) { G_Error("G_RegisterFireteam: attempting to register a fireteam to an entity with no client\n"); } if (G_IsOnFireteam(entityNum, NULL)) { G_ClientPrint(entityNum, "You are already on a fireteam, leave it first"); return; } if ((ft = G_FindFreeFireteam()) == NULL) { G_ClientPrint(entityNum, "No free fireteams available"); return; } if (leader->client->sess.sessionTeam != TEAM_AXIS && leader->client->sess.sessionTeam != TEAM_ALLIES) { G_ClientPrint(entityNum, "Only players on a team can create a fireteam"); return; } count = G_CountTeamFireteams(leader->client->sess.sessionTeam); if (count >= MAX_FIRETEAMS / 2) { G_ClientPrint(entityNum, "Your team already has the maximum number of fireteams allowed"); return; } ident = G_FindFreeFireteamIdent(leader->client->sess.sessionTeam) + 1; if (ident == 0) { G_Error("G_RegisterFireteam: free fireteam is invalid\n"); return; } // good to go now ft->inuse = qtrue; memset(ft->joinOrder, -1, sizeof(level.fireTeams[0].joinOrder)); ft->joinOrder[0] = leader - g_entities; ft->ident = ident; if (g_autoFireteams.integer) { ft->priv = qfalse; trap_SendServerCommand(entityNum, "aft -1"); leader->client->pers.autofireteamEndTime = level.time + 20500; } else { ft->priv = qfalse; } #ifdef FEATURE_OMNIBOT Bot_Event_FireTeamCreated(entityNum, ft->ident); Bot_Event_JoinedFireTeam(leader - g_entities, leader); #endif G_UpdateFireteamConfigString(ft); }