From 80a7ecb3a42784061a1fa0361f95f8110a15ae81 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Tue, 29 Jan 2013 14:35:20 -0200 Subject: [PATCH] Speed up compilation time for luafunctions * Other compile fixes for gcc --- src/client/CMakeLists.txt | 3 +++ src/client/game.cpp | 4 ++-- src/client/game.h | 2 +- src/client/protocolgameparse.cpp | 8 ++++---- src/framework/CMakeLists.txt | 5 +++++ src/framework/graphics/apngloader.cpp | 24 ++++++++++++------------ src/framework/luaengine/luainterface.cpp | 3 +-- src/framework/ui/uihorizontallayout.cpp | 2 +- 8 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index 7ca86aa3..6c8f33f6 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -102,3 +102,6 @@ set(client_SOURCES ${client_SOURCES} # util ${CMAKE_CURRENT_LIST_DIR}/position.h ) + +set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/luafunctions.cpp + PROPERTIES LANGUAGE CXX COMPILE_FLAGS "-g0 -O0") diff --git a/src/client/game.cpp b/src/client/game.cpp index e795013a..cb265b5f 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -354,10 +354,10 @@ void Game::processRuleViolationLock() g_lua.callGlobalField("g_game", "onRuleViolationLock"); } -void Game::processVipAdd(uint id, const std::string& name, uint status) +void Game::processVipAdd(uint id, const std::string& name, uint status, int iconId, bool notifyLogin) { m_vips[id] = Vip(name, status); - g_lua.callGlobalField("g_game", "onAddVip", id, name, status); + g_lua.callGlobalField("g_game", "onAddVip", id, name, status, iconId, notifyLogin); } void Game::processVipStateChange(uint id, uint status) diff --git a/src/client/game.h b/src/client/game.h index b071dde4..13947d1c 100644 --- a/src/client/game.h +++ b/src/client/game.h @@ -98,7 +98,7 @@ protected: void processRuleViolationLock(); // vip related - void processVipAdd(uint id, const std::string& name, uint status); + void processVipAdd(uint id, const std::string& name, uint status, int iconId, bool notifyLogin); void processVipStateChange(uint id, uint status); // tutorial hint diff --git a/src/client/protocolgameparse.cpp b/src/client/protocolgameparse.cpp index e4f4f9d9..ae6091a8 100644 --- a/src/client/protocolgameparse.cpp +++ b/src/client/protocolgameparse.cpp @@ -1370,20 +1370,20 @@ void ProtocolGame::parseOpenOutfitWindow(const InputMessagePtr& msg) void ProtocolGame::parseVipAdd(const InputMessagePtr& msg) { - uint id, markId, status; + uint id, iconId = 0, status; std::string name, desc; - bool notifyLogin; + bool notifyLogin = false; id = msg->getU32(); name = g_game.formatCreatureName(msg->getString()); if(g_game.getProtocolVersion() >= 963) { desc = msg->getString(); - markId = msg->getU32(); + iconId = msg->getU32(); notifyLogin = msg->getU8(); } status = msg->getU8(); - g_game.processVipAdd(id, name, status); + g_game.processVipAdd(id, name, status, iconId, notifyLogin); } void ProtocolGame::parseVipState(const InputMessagePtr& msg) diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt index 5a9428d4..fca595db 100644 --- a/src/framework/CMakeLists.txt +++ b/src/framework/CMakeLists.txt @@ -128,6 +128,9 @@ set(framework_SOURCES ${framework_SOURCES} ${CMAKE_CURRENT_LIST_DIR}/platform/platform.h ) +set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/luafunctions.cpp + PROPERTIES LANGUAGE CXX COMPILE_FLAGS "-g0 -O0") + # some build options option(CRASH_HANDLER "Generate crash reports" ON) option(LUAJIT "Use lua jit" OFF) @@ -149,6 +152,7 @@ endif() # gcc compile flags set(WARNS_FLAGS "-Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-variable -Wno-unused-result") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNS_FLAGS} ${ARCH_FLAGS} ${CPP2011_FLAGS} -pipe") +set(CMAKE_CXX_FLAGS_COMPILESPEED "-O0") set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O1 -g -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS_RELEASE "-O2") @@ -493,3 +497,4 @@ endif() include_directories(${framework_INCLUDE_DIRS}) add_definitions(${framework_DEFINITIONS}) + diff --git a/src/framework/graphics/apngloader.cpp b/src/framework/graphics/apngloader.cpp index ad0932a2..fff7d642 100644 --- a/src/framework/graphics/apngloader.cpp +++ b/src/framework/graphics/apngloader.cpp @@ -513,8 +513,8 @@ int load_apng(std::stringstream& file, struct apng_data *apng) unsigned int i, j; unsigned int rowbytes; int imagesize, zbuf_size, zsize, trns_idx; - unsigned int len, chunk, crc; - unsigned int w, h, seq, w0, h0, x0, y0; + unsigned int len, chunk/*, crc, seq*/; + unsigned int w, h, w0, h0, x0, y0; unsigned int frames, loops, first_frame, cur_frame; unsigned int outrow1, outrow2, outimg1, outimg2; unsigned short d1, d2; @@ -573,7 +573,7 @@ int load_apng(std::stringstream& file, struct apng_data *apng) file.read((char*)&compr, 1); file.read((char*)&filter, 1); file.read((char*)&interl, 1); - crc = read32(file); + /*crc = */read32(file); channels = 1; if (coltype == 2) @@ -633,7 +633,7 @@ int load_apng(std::stringstream& file, struct apng_data *apng) palsize = col+1; } } - crc = read32(file); + /*crc = */read32(file); } else if (chunk == 0x74524E53) /* tRNS */ { @@ -670,7 +670,7 @@ int load_apng(std::stringstream& file, struct apng_data *apng) trns[5] = trns[4]; trns[4] = 0; } } - crc = read32(file); + /*crc = */read32(file); } else if (chunk == 0x6163544C) /* acTL */ { @@ -679,7 +679,7 @@ int load_apng(std::stringstream& file, struct apng_data *apng) free(frames_delay); frames_delay = (unsigned short*)malloc(frames*sizeof(int)); loops = read32(file); - crc = read32(file); + /*crc = */read32(file); if (pOut1) free(pOut1); if (pOut2) @@ -747,7 +747,7 @@ int load_apng(std::stringstream& file, struct apng_data *apng) } } - seq = read32(file); + /*seq = */read32(file); w0 = read32(file); h0 = read32(file); x0 = read32(file); @@ -756,7 +756,7 @@ int load_apng(std::stringstream& file, struct apng_data *apng) d2 = read16(file); file.read((char*)&dop, 1); file.read((char*)&bop, 1); - crc = read32(file); + /*crc = */read32(file); if(d2 == 0) d2 = 100; @@ -781,15 +781,15 @@ int load_apng(std::stringstream& file, struct apng_data *apng) { file.read((char*)(pData + zsize), len); zsize += len; - crc = read32(file); + /*crc = */read32(file); } else if (chunk == 0x66644154) /* fdAT */ { - seq = read32(file); + /*seq = */read32(file); len -= 4; file.read((char*)(pData + zsize), len); zsize += len; - crc = read32(file); + /*crc = */read32(file); } else if (chunk == 0x49454E44) /* IEND */ { @@ -818,7 +818,7 @@ int load_apng(std::stringstream& file, struct apng_data *apng) if (notabc(c)) break; file.seekg(len, std::ios_base::cur); - crc = read32(file); + /*crc = */read32(file); } } /* apng decoding - end */ diff --git a/src/framework/luaengine/luainterface.cpp b/src/framework/luaengine/luainterface.cpp index 54ecb179..d714d928 100644 --- a/src/framework/luaengine/luainterface.cpp +++ b/src/framework/luaengine/luainterface.cpp @@ -901,8 +901,7 @@ void LuaInterface::getEnv(int index) void LuaInterface::setEnv(int index) { assert(hasIndex(index)); - int ret; - ret = lua_setfenv(L, index); + lua_setfenv(L, index); assert(ret == 1); } diff --git a/src/framework/ui/uihorizontallayout.cpp b/src/framework/ui/uihorizontallayout.cpp index 6d353f80..197f20f3 100644 --- a/src/framework/ui/uihorizontallayout.cpp +++ b/src/framework/ui/uihorizontallayout.cpp @@ -96,5 +96,5 @@ bool UIHorizontalLayout::internalUpdate() }); } - return true; + return changed; }