Speed up compilation time for luafunctions

* Other compile fixes for gcc
This commit is contained in:
Eduardo Bart 2013-01-29 14:35:20 -02:00
parent 8d6ccb8d83
commit 80a7ecb3a4
8 changed files with 29 additions and 22 deletions

View File

@ -102,3 +102,6 @@ set(client_SOURCES ${client_SOURCES}
# util # util
${CMAKE_CURRENT_LIST_DIR}/position.h ${CMAKE_CURRENT_LIST_DIR}/position.h
) )
set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/luafunctions.cpp
PROPERTIES LANGUAGE CXX COMPILE_FLAGS "-g0 -O0")

View File

@ -354,10 +354,10 @@ void Game::processRuleViolationLock()
g_lua.callGlobalField("g_game", "onRuleViolationLock"); 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); 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) void Game::processVipStateChange(uint id, uint status)

View File

@ -98,7 +98,7 @@ protected:
void processRuleViolationLock(); void processRuleViolationLock();
// vip related // 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); void processVipStateChange(uint id, uint status);
// tutorial hint // tutorial hint

View File

@ -1370,20 +1370,20 @@ void ProtocolGame::parseOpenOutfitWindow(const InputMessagePtr& msg)
void ProtocolGame::parseVipAdd(const InputMessagePtr& msg) void ProtocolGame::parseVipAdd(const InputMessagePtr& msg)
{ {
uint id, markId, status; uint id, iconId = 0, status;
std::string name, desc; std::string name, desc;
bool notifyLogin; bool notifyLogin = false;
id = msg->getU32(); id = msg->getU32();
name = g_game.formatCreatureName(msg->getString()); name = g_game.formatCreatureName(msg->getString());
if(g_game.getProtocolVersion() >= 963) { if(g_game.getProtocolVersion() >= 963) {
desc = msg->getString(); desc = msg->getString();
markId = msg->getU32(); iconId = msg->getU32();
notifyLogin = msg->getU8(); notifyLogin = msg->getU8();
} }
status = 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) void ProtocolGame::parseVipState(const InputMessagePtr& msg)

View File

@ -128,6 +128,9 @@ set(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/platform/platform.h ${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 # some build options
option(CRASH_HANDLER "Generate crash reports" ON) option(CRASH_HANDLER "Generate crash reports" ON)
option(LUAJIT "Use lua jit" OFF) option(LUAJIT "Use lua jit" OFF)
@ -149,6 +152,7 @@ endif()
# gcc compile flags # gcc compile flags
set(WARNS_FLAGS "-Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-variable -Wno-unused-result") 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 "${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_DEBUG "-O0 -g")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O1 -g -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O1 -g -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_RELEASE "-O2") set(CMAKE_CXX_FLAGS_RELEASE "-O2")
@ -493,3 +497,4 @@ endif()
include_directories(${framework_INCLUDE_DIRS}) include_directories(${framework_INCLUDE_DIRS})
add_definitions(${framework_DEFINITIONS}) add_definitions(${framework_DEFINITIONS})

View File

@ -513,8 +513,8 @@ int load_apng(std::stringstream& file, struct apng_data *apng)
unsigned int i, j; unsigned int i, j;
unsigned int rowbytes; unsigned int rowbytes;
int imagesize, zbuf_size, zsize, trns_idx; int imagesize, zbuf_size, zsize, trns_idx;
unsigned int len, chunk, crc; unsigned int len, chunk/*, crc, seq*/;
unsigned int w, h, seq, w0, h0, x0, y0; unsigned int w, h, w0, h0, x0, y0;
unsigned int frames, loops, first_frame, cur_frame; unsigned int frames, loops, first_frame, cur_frame;
unsigned int outrow1, outrow2, outimg1, outimg2; unsigned int outrow1, outrow2, outimg1, outimg2;
unsigned short d1, d2; 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*)&compr, 1);
file.read((char*)&filter, 1); file.read((char*)&filter, 1);
file.read((char*)&interl, 1); file.read((char*)&interl, 1);
crc = read32(file); /*crc = */read32(file);
channels = 1; channels = 1;
if (coltype == 2) if (coltype == 2)
@ -633,7 +633,7 @@ int load_apng(std::stringstream& file, struct apng_data *apng)
palsize = col+1; palsize = col+1;
} }
} }
crc = read32(file); /*crc = */read32(file);
} }
else if (chunk == 0x74524E53) /* tRNS */ 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; trns[5] = trns[4]; trns[4] = 0;
} }
} }
crc = read32(file); /*crc = */read32(file);
} }
else if (chunk == 0x6163544C) /* acTL */ else if (chunk == 0x6163544C) /* acTL */
{ {
@ -679,7 +679,7 @@ int load_apng(std::stringstream& file, struct apng_data *apng)
free(frames_delay); free(frames_delay);
frames_delay = (unsigned short*)malloc(frames*sizeof(int)); frames_delay = (unsigned short*)malloc(frames*sizeof(int));
loops = read32(file); loops = read32(file);
crc = read32(file); /*crc = */read32(file);
if (pOut1) if (pOut1)
free(pOut1); free(pOut1);
if (pOut2) 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); w0 = read32(file);
h0 = read32(file); h0 = read32(file);
x0 = read32(file); x0 = read32(file);
@ -756,7 +756,7 @@ int load_apng(std::stringstream& file, struct apng_data *apng)
d2 = read16(file); d2 = read16(file);
file.read((char*)&dop, 1); file.read((char*)&dop, 1);
file.read((char*)&bop, 1); file.read((char*)&bop, 1);
crc = read32(file); /*crc = */read32(file);
if(d2 == 0) if(d2 == 0)
d2 = 100; d2 = 100;
@ -781,15 +781,15 @@ int load_apng(std::stringstream& file, struct apng_data *apng)
{ {
file.read((char*)(pData + zsize), len); file.read((char*)(pData + zsize), len);
zsize += len; zsize += len;
crc = read32(file); /*crc = */read32(file);
} }
else if (chunk == 0x66644154) /* fdAT */ else if (chunk == 0x66644154) /* fdAT */
{ {
seq = read32(file); /*seq = */read32(file);
len -= 4; len -= 4;
file.read((char*)(pData + zsize), len); file.read((char*)(pData + zsize), len);
zsize += len; zsize += len;
crc = read32(file); /*crc = */read32(file);
} }
else if (chunk == 0x49454E44) /* IEND */ else if (chunk == 0x49454E44) /* IEND */
{ {
@ -818,7 +818,7 @@ int load_apng(std::stringstream& file, struct apng_data *apng)
if (notabc(c)) break; if (notabc(c)) break;
file.seekg(len, std::ios_base::cur); file.seekg(len, std::ios_base::cur);
crc = read32(file); /*crc = */read32(file);
} }
} }
/* apng decoding - end */ /* apng decoding - end */

View File

@ -901,8 +901,7 @@ void LuaInterface::getEnv(int index)
void LuaInterface::setEnv(int index) void LuaInterface::setEnv(int index)
{ {
assert(hasIndex(index)); assert(hasIndex(index));
int ret; lua_setfenv(L, index);
ret = lua_setfenv(L, index);
assert(ret == 1); assert(ret == 1);
} }

View File

@ -96,5 +96,5 @@ bool UIHorizontalLayout::internalUpdate()
}); });
} }
return true; return changed;
} }