MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / cSendCmdToServer

Function cSendCmdToServer

source/modes/ConsoleCommands.cpp:82–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82Command::Result cSendCmdToServer(const Command::ArgumentList_t& args, ConsoleInterface& c, AbstractModeManager&)
83{
84 // If we should send a console command, we do it
85 if(!ODClient::getSingleton().isConnected())
86 {
87 c.print("Trying to send a console command while not connected");
88 return Command::Result::FAILED;
89 }
90
91 if(args.empty())
92 {
93 c.print("Trying to send an empty console command");
94 return Command::Result::INVALID_ARGUMENT;
95 }
96
97 ClientNotification *clientNotification = new ClientNotification(
98 ClientNotificationType::askExecuteConsoleCommand);
99 uint32_t nbArgs = args.size();
100 clientNotification->mPacket << nbArgs;
101 for(const std::string& str : args)
102 clientNotification->mPacket << str;
103
104 ODClient::getSingleton().queueClientNotification(clientNotification);
105 return Command::Result::SUCCESS;
106}
107
108Command::Result cAmbientLight(const Command::ArgumentList_t& args, ConsoleInterface& c, AbstractModeManager&)
109{

Callers

nothing calls this directly

Calls 3

isConnectedMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected