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

Function MultiDoBashPlayerShip

Descent3/multi.cpp:9437–9470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9435int ObjInitTypeSpecific(object *objp, bool reinitializing);
9436
9437void MultiDoBashPlayerShip(uint8_t *data) {
9438 int count = 0;
9439
9440 SKIP_HEADER(data, &count);
9441 int ship_index = FindShipName((const char *)data + count);
9442 if (ship_index < 0)
9443 ship_index = 0;
9444
9445 // If told to switch to the Black Pyro, make sure it's allowed
9446 if (!stricmp(Ships[ship_index].name, "Black Pyro")) {
9447 extern bool MercInstalled();
9448 if (!MercInstalled()) {
9449 BailOnMultiplayer("Exiting: Game requires Black Pyro");
9450 }
9451 }
9452
9453 AddHUDMessage("%s not allowed", Ships[Players[Player_num].ship_index].name);
9454 AddHUDMessage("Switching to %s", Ships[ship_index].name);
9455
9456 PlayerChangeShip(Player_num, ship_index);
9457 mprintf(0, "Server told us to switch ships to the %s\n", (char *)data + count);
9458
9459 FreeCockpit();
9460 CloseShipHUD();
9461
9462 // ObjInitTypeSpecific(Player_object,0); //reset physics, model, etc.
9463 InitShipHUD(Players[Player_num].ship_index);
9464 InitCockpit(Players[Player_num].ship_index);
9465
9466 if (GetHUDMode() == HUD_COCKPIT)
9467 SetHUDMode(HUD_COCKPIT);
9468 else if (GetHUDMode() == HUD_FULLSCREEN)
9469 SetHUDMode(HUD_FULLSCREEN);
9470}
9471
9472// If its been x seconds since we've sent a heartbeat, send another!
9473

Callers 1

MultiProcessDataFunction · 0.85

Calls 12

SKIP_HEADERFunction · 0.85
FindShipNameFunction · 0.85
MercInstalledFunction · 0.85
BailOnMultiplayerFunction · 0.85
AddHUDMessageFunction · 0.85
PlayerChangeShipFunction · 0.85
FreeCockpitFunction · 0.85
CloseShipHUDFunction · 0.85
InitShipHUDFunction · 0.85
InitCockpitFunction · 0.85
GetHUDModeFunction · 0.85
SetHUDModeFunction · 0.85

Tested by

no test coverage detected