Optimize ConnectProtocol

This commit is contained in:
momo5502 2016-08-14 18:40:13 +02:00
parent fe4bf5704d
commit 72e98f8bbb
2 changed files with 3 additions and 6 deletions

View File

@ -2,7 +2,7 @@
namespace Components
{
ConnectProtocol::Container ConnectProtocol::ConnectContainer = { false, false, "" };
ConnectProtocol::Container ConnectProtocol::ConnectContainer = { false, "" };
bool ConnectProtocol::Evaluated()
{
@ -202,12 +202,10 @@ namespace Components
});
// Invocation handler
// TODO: Don't call it every frame, once is enough!
Renderer::OnFrame([] ()
Renderer::Once([] ()
{
if (!ConnectProtocol::ConnectContainer.Invoked && ConnectProtocol::Used())
if (ConnectProtocol::Used())
{
ConnectProtocol::ConnectContainer.Invoked = true;
Command::Execute(fmt::sprintf("connect %s", ConnectProtocol::ConnectContainer.ConnectString.data()), false);
}
});

View File

@ -14,7 +14,6 @@ namespace Components
{
public:
bool Evaluated;
bool Invoked;
std::string ConnectString;
};