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

Function XlateGBMessage

Descent3/multisafe.cpp:1277–1295  ·  view source on GitHub ↗

If the src message is from the guidebot, xlates it into the proper format. If not a GB message, just copies the string over. Returns true if is a GB message

Source from the content-addressed store, hash-verified

1275// message, just copies the string over.
1276// Returns true if is a GB message
1277bool XlateGBMessage(char *dest, char *src) {
1278 if (strnicmp(src, GB_TOKEN, sizeof(GB_TOKEN) - 1) != 0) {
1279 strcpy(dest, src);
1280 return 0;
1281 }
1282 char *t = src + strlen(GB_TOKEN); // skip the first part of the string
1283 while (*t == ' ') // skip spaces
1284 t++;
1285 if (*t == '"') // skip the leading quote
1286 t++;
1287 char gbname[100];
1288 Current_pilot.get_guidebot_name(gbname);
1289 sprintf(dest, "\1\255\255\1%s:\1\1\255\1 %s", gbname, t);
1290 while (dest[strlen(dest) - 1] == ' ') // strip spaces at end
1291 dest[strlen(dest) - 1] = 0;
1292 if (dest[strlen(dest) - 1] == '"') // Remove the trailing quote
1293 dest[strlen(dest) - 1] = 0;
1294 return 1;
1295}
1296char Custom_HUD_text[MSAFE_MESSAGE_LENGTH] = "";
1297extern bool Demo_call_ok;
1298// The main entry point for all the multisafe functions

Callers 1

msafe_CallFunctionFunction · 0.85

Calls 1

get_guidebot_nameMethod · 0.80

Tested by

no test coverage detected