MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / FindPlayerId

Function FindPlayerId

engine/Poseidon/Network/NetworkClientActions.cpp:1073–1091  ·  view source on GitHub ↗

Find DirectPlay ID of player for text form of player

Source from the content-addressed store, hash-verified

1071 }
1072 }
1073 return CMDNone;
1074}
1075
1076// Find DirectPlay ID of player for text form of player
1077static int FindPlayerId(const char* name, AutoArray<PlayerIdentity>& identities)
1078{
1079 for (int i = 0; i < identities.Size(); i++)
1080 {
1081 if (stricmp(name, identities[i].name) == 0)
1082 {
1083 return identities[i].dpnid;
1084 }
1085 }
1086 int playerid = atoi(name);
1087 for (int i = 0; i < identities.Size(); i++)
1088 {
1089 if (identities[i].playerid == playerid)
1090 {
1091 return identities[i].dpnid;
1092 }
1093 }
1094 return AI_PLAYER; // not found

Callers 1

ProcessCommandMethod · 0.85

Calls 2

stricmpFunction · 0.50
SizeMethod · 0.45

Tested by

no test coverage detected