| 285 | } |
| 286 | |
| 287 | void CRConSystem::ExecuteRConCommand( const char *inszCommand ) |
| 288 | { |
| 289 | // get parameters |
| 290 | |
| 291 | IConsole *pConsole=m_pSystem->GetIConsole(); assert(pConsole); |
| 292 | |
| 293 | ICVar *pVar1 = pConsole->GetCVar("cl_rcon_serverip"); assert(pVar1); |
| 294 | string serverip = pVar1->GetString(); |
| 295 | |
| 296 | ICVar *pVar2 = pConsole->GetCVar("cl_rcon_port"); assert(pVar2); |
| 297 | WORD wPort = pVar2->GetIVal(); |
| 298 | |
| 299 | ICVar *pVar3 = pConsole->GetCVar("cl_rcon_password"); assert(pVar3); |
| 300 | string sPasswd = pVar3->GetString(); |
| 301 | |
| 302 | // send packet |
| 303 | CQPRConCommand cqpRConCommand; |
| 304 | CStream stmPacket; |
| 305 | CIPAddress ip(wPort,serverip.c_str()); |
| 306 | |
| 307 | // If server ip not specified use, current server. |
| 308 | if (serverip.empty()) |
| 309 | { |
| 310 | ip.Set( m_ipServer ); |
| 311 | } |
| 312 | |
| 313 | unsigned int nClientCode[4]; |
| 314 | GetPassCode( sPasswd.c_str(),nClientCode ); |
| 315 | memcpy( cqpRConCommand.m_nRConPasswordCode,nClientCode,sizeof(nClientCode) ); |
| 316 | |
| 317 | char tempCmd[256]; |
| 318 | strncpy(tempCmd,inszCommand,sizeof(tempCmd)-1); |
| 319 | tempCmd[sizeof(tempCmd)-1] = 0; |
| 320 | cqpRConCommand.m_sRConCommand = tempCmd; |
| 321 | |
| 322 | cqpRConCommand.Save(stmPacket); |
| 323 | m_sSocket.Send(stmPacket.GetPtr(),BITS2BYTES(stmPacket.GetSize()),&ip); |
| 324 | |
| 325 | // prinout |
| 326 | CryLogAlways("$5RCon (%s:%d)'%s'",serverip.c_str(),(int)wPort,tempCmd ); |
| 327 | } |
nothing calls this directly
no test coverage detected