Optimizations

This commit is contained in:
momo5502 2016-06-26 14:25:54 +02:00
parent 154c81ee10
commit b83d85b651
7 changed files with 10 additions and 12 deletions

View File

@ -26,7 +26,7 @@ namespace Components
for (size_t i = startIndex; i < this->Length(); ++i)
{
if (i > startIndex) result.append(" ");
result.append((*this)[i]);
result.append(this->operator[](i));
}
return result;

View File

@ -386,7 +386,7 @@ namespace Components
if (params.Length() != 2) return;
int client = -1;
if (std::string(params[1]) != "all")
if (params[1] != "all"s)
{
client = atoi(params[1]);

View File

@ -212,7 +212,7 @@ namespace Components
http_message* message = reinterpret_cast<http_message*>(ev_data);
// if (std::string(message->uri.p, message->uri.len) == "/")
// if (message->uri.p, message->uri.len == "/"s)
// {
// mg_printf(nc,
// "HTTP/1.1 200 OK\r\n"

View File

@ -276,7 +276,7 @@ namespace Components
}
// Load custom menus
if (std::string(menuList->name) == "ui_mp/code.txt") // Should be menus, but code is loaded ingame
if (menuList->name == "ui_mp/code.txt"s) // Should be menus, but code is loaded ingame
{
for (auto menu : Menus::CustomMenus)
{
@ -531,7 +531,7 @@ namespace Components
if (menuList)
{
// Parse scriptmenus!
if (!strcmp(menuList->menus[0]->window.name, "default_menu") || Utils::EndsWith(filename, ".menu"))
if (menuList->menus[0]->window.name == "default_menu"s || Utils::EndsWith(filename, ".menu"))
{
if (FileSystem::File(filename).Exists())
{
@ -555,11 +555,9 @@ namespace Components
bool Menus::IsMenuVisible(Game::UiContext *dc, Game::menuDef_t *menu)
{
std::string _connect = "connect";
if (menu && menu->window.name)
{
if (menu->window.name == _connect) // Check if we're supposed to draw the loadscreen
if (menu->window.name == "connect"s) // Check if we're supposed to draw the loadscreen
{
Game::menuDef_t* originalConnect = AssetHandler::FindOriginalAsset(Game::XAssetType::ASSET_TYPE_MENU, "connect").menu;

View File

@ -15,7 +15,7 @@ namespace Components
Logger::Print("Awaiting thread termination...\n");
News::Thread.join();
if (!strlen(Localization::Get("MPUI_CHANGELOG_TEXT")) || Localization::Get("MPUI_CHANGELOG_TEXT") == std::string("Loading..."))
if (!strlen(Localization::Get("MPUI_CHANGELOG_TEXT")) || Localization::Get("MPUI_CHANGELOG_TEXT") == "Loading..."s)
{
Logger::Print("Failed to fetch changelog!\n");
result = false;

View File

@ -473,7 +473,7 @@ namespace Components
//
// if (FastFiles::Current() == "iw4x_ui_mp" && type == Game::XAssetType::ASSET_TYPE_MATERIAL)
// {
// if (std::string(name) == "preview_mp_bloc")
// if (name == "preview_mp_bloc"s)
// {
// blocTable = asset.material->stateBitTable;
// }

View File

@ -1181,7 +1181,7 @@ namespace Game
float uvBottom;
};
struct Font
typedef struct Font_s
{
char* name;
int size;
@ -1189,7 +1189,7 @@ namespace Game
Material* image;
Material* glowImage;
FontEntry* characters;
};
} Font;
typedef enum
{