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

Method ProcessCommand

engine/Poseidon/Network/NetworkClientActions.cpp:1164–1412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1162 if (id)
1163 {
1164 RString senderName = id->name;
1165 GChatList.Add(CCGlobal, senderName, message, false, true);
1166 RefArray<NetworkObject> dummy;
1167 GNetworkManager.Chat(CCGlobal, senderName, dummy, message);
1168 }
1169}
1170
1171bool NetworkClient::ProcessCommand(RString command)
1172{
1173 const char* beg = command;
1174 if (*beg != '#')
1175 {
1176 return false;
1177 }
1178 beg++;
1179
1180 const char* end = strchr(beg, ' ');
1181 int len = end ? end - beg : strlen(beg);
1182 NetworkCommandType type = FindCommandType(beg, len);
1183 beg += len;
1184 while (*beg == ' ')
1185 {
1186 beg++;
1187 }
1188
1189 switch (type)
1190 {
1191 case CMDNone:
1192 case CMDAdmin:
1193 break;
1194 case CMDLogin:
1195 {
1196 NetworkCommandMessage msg;
1197 msg.type = NCMTLogin;
1198 msg.content.WriteString(beg);
1199 SendMsg(&msg, NMFGuaranteed);
1200 }
1201 break;
1202 case CMDLogout:
1203 if (_gameMaster)
1204 {
1205 NetworkCommandMessage msg;
1206 msg.type = NCMTLogout;
1207 SendMsg(&msg, NMFGuaranteed);
1208 }
1209 break;
1210 case CMDKick:
1211 if (_gameMaster || GetNetworkManager().IsServer())
1212 {
1213 int id = FindPlayerId(beg, _identities);
1214 if (id != AI_PLAYER)
1215 {
1216 SendKick(id);
1217 }
1218 }
1219 break;
1220 case CMDBan:
1221 if (_gameMaster || GetNetworkManager().IsServer())

Callers

nothing calls this directly

Calls 9

FindCommandTypeFunction · 0.85
FindPlayerIdFunction · 0.85
GetIdentityTextFunction · 0.85
WriteStringMethod · 0.80
LowerMethod · 0.80
IsServerMethod · 0.45
WriteMethod · 0.45
SizeMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected