MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / DMFCInputCommand_Team

Function DMFCInputCommand_Team

netgames/dmfc/dmfcinputcommand.cpp:170–195  ·  view source on GitHub ↗

handle the client wishing to change teams Usage: "$team " where team_name is the name of the team you want to change to

Source from the content-addressed store, hash-verified

168// handle the client wishing to change teams
169// Usage: "$team <string team_name>" where team_name is the name of the team you want to change to
170void DMFCInputCommand_Team(const char *input_string) {
171 char team[100];
172
173 // parse "$team"
174 if (!StringParseWord(input_string, team, 100, &input_string)) {
175 basethis->DisplayInputCommandHelp(DTXT_IC_TEAM);
176 return;
177 }
178
179 // parse team name
180 if (!StringParseWord(input_string, team, 100, &input_string)) {
181 basethis->DisplayInputCommandHelp(DTXT_IC_TEAM);
182 return;
183 }
184
185 int t = basethis->GetTeamFromString(team);
186
187 int curr_team = basethis->Players[basethis->GetPlayerNum()].team;
188
189 if ((t == -1) || (t == curr_team) || (curr_team == -1))
190 return;
191
192 mprintf(0, "Attempting to change teams to %s team\n", team);
193 DLLAddHUDMessage(DTXT_TEAMCHANGEATTEMPT, team);
194 basethis->RequestTeamChange(t, basethis->GetPlayerNum(), true);
195}
196
197// handle the server wanting to change the team for a player
198// Usage: "$changeteam <int pnum> <string team_name>" where pnum is the playernum, and team_name is the name of the

Callers

nothing calls this directly

Calls 5

StringParseWordFunction · 0.85
GetTeamFromStringMethod · 0.80
GetPlayerNumMethod · 0.80
RequestTeamChangeMethod · 0.80

Tested by

no test coverage detected