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

Function GetPlayerSlot

Descent3/multisafe.cpp:1262–1272  ·  view source on GitHub ↗

Gets the player slot from the specified object, if the object is a player or player weapon Returns -1 if can't find player

Source from the content-addressed store, hash-verified

1260// Gets the player slot from the specified object, if the object is a player or player weapon
1261// Returns -1 if can't find player
1262int GetPlayerSlot(int objhandle) {
1263 object *objp = ObjGet(objhandle);
1264 if (!objp)
1265 return -1;
1266 if (objp->type == OBJ_WEAPON)
1267 objp = ObjGetUltimateParent(objp);
1268 if (objp->type == OBJ_PLAYER)
1269 return objp->id;
1270 else
1271 return -1;
1272}
1273#define GB_TOKEN "GUIDEBOT:"
1274// If the src message is from the guidebot, xlates it into the proper format. If not a GB
1275// message, just copies the string over.

Callers 1

msafe_CallFunctionFunction · 0.85

Calls 2

ObjGetFunction · 0.85
ObjGetUltimateParentFunction · 0.85

Tested by

no test coverage detected