Fix all the bugs ;D

This commit is contained in:
momo5502 2016-01-04 10:54:31 +01:00
parent 50fc70b071
commit ba9bcf0f67
4 changed files with 15 additions and 16 deletions

View File

@ -29,7 +29,6 @@ namespace Components
if (wFlag[0] == L'-') if (wFlag[0] == L'-')
{ {
Flags::EnabledFlags.push_back(std::string(++wFlag.begin(), wFlag.end())); Flags::EnabledFlags.push_back(std::string(++wFlag.begin(), wFlag.end()));
OutputDebugStringA(Flags::EnabledFlags[Flags::EnabledFlags.size() - 1].data());
} }
} }
} }

View File

@ -140,17 +140,19 @@ namespace Components
int Network::PacketInterceptionHandler(const char* packet) int Network::PacketInterceptionHandler(const char* packet)
{ {
std::string packetCommand = packet;
auto pos = packetCommand.find_first_of("\\\n ");
if (pos != std::string::npos)
{
packetCommand = packetCommand.substr(0, pos);
}
packetCommand = Utils::StrToLower(packetCommand);
// Check if custom handler exists // Check if custom handler exists
for (auto i = Network::PacketHandlers.begin(); i != Network::PacketHandlers.end(); i++) for (auto i = Network::PacketHandlers.begin(); i != Network::PacketHandlers.end(); i++)
{ {
std::string packetCommand = packet; if (Utils::StrToLower(i->first) == packetCommand)
auto pos = packetCommand.find_first_of("\n ");
if (pos != std::string::npos)
{
packetCommand = packetCommand.substr(0, pos);
}
if (Utils::StrToLower(i->first) == Utils::StrToLower(packetCommand))
{ {
Network::SelectedPacket = i->first; Network::SelectedPacket = i->first;
return 0; return 0;

View File

@ -163,9 +163,9 @@ namespace Components
} }
} }
void ServerList::InsertRequest(Network::Address address, bool accquireMutex) void ServerList::InsertRequest(Network::Address address, bool acquireMutex)
{ {
if (accquireMutex) ServerList::RefreshContainer.Mutex.lock(); if (acquireMutex) ServerList::RefreshContainer.Mutex.lock();
ServerList::Container::ServerContainer container; ServerList::Container::ServerContainer container;
container.Sent = false; container.Sent = false;
@ -187,7 +187,7 @@ namespace Components
ServerList::RefreshContainer.SendCount++; ServerList::RefreshContainer.SendCount++;
} }
if (accquireMutex) ServerList::RefreshContainer.Mutex.unlock(); if (acquireMutex) ServerList::RefreshContainer.Mutex.unlock();
} }
void ServerList::Insert(Network::Address address, Utils::InfoString info) void ServerList::Insert(Network::Address address, Utils::InfoString info)
@ -250,8 +250,6 @@ namespace Components
ServerList::GetList().push_back(server); ServerList::GetList().push_back(server);
ServerList::VisibleList.push_back(index); ServerList::VisibleList.push_back(index);
ServerList::SortList(); ServerList::SortList();
OutputDebugStringA(Utils::VA("Inserted with IP: %s", server.Addr.GetString()));
} }
break; break;
@ -310,7 +308,7 @@ namespace Components
void ServerList::Frame() void ServerList::Frame()
{ {
ServerList::RefreshContainer.Mutex.lock(); if (!ServerList::RefreshContainer.Mutex.try_lock()) return;
if (ServerList::RefreshContainer.AwatingList) if (ServerList::RefreshContainer.AwatingList)
{ {

View File

@ -27,7 +27,7 @@ namespace Components
static void Refresh(); static void Refresh();
static void RefreshVisibleList(); static void RefreshVisibleList();
static void InsertRequest(Network::Address address, bool accquireMutex = true); static void InsertRequest(Network::Address address, bool acquireMutex = true);
static void Insert(Network::Address address, Utils::InfoString info); static void Insert(Network::Address address, Utils::InfoString info);
static bool IsFavouriteList(); static bool IsFavouriteList();