fix infinite loop while saving empty minimap
This commit is contained in:
parent
0c14a8e602
commit
139f389d88
|
@ -15,11 +15,12 @@ IF(NOT CMAKE_BUILD_TYPE)
|
||||||
SET(CMAKE_BUILD_TYPE "RelWithDebInfo")
|
SET(CMAKE_BUILD_TYPE "RelWithDebInfo")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
##IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
SET(ARCH_FLAGS "-m64 -march=x86-64 -mtune=generic")
|
## SET(ARCH_FLAGS "-m64 -march=x86-64 -mtune=generic")
|
||||||
ELSE()
|
##ELSE()
|
||||||
SET(ARCH_FLAGS "-m32 -march=i686 -mtune=generic")
|
## SET(ARCH_FLAGS "-m32 -march=i686 -mtune=generic")
|
||||||
ENDIF()
|
##ENDIF()
|
||||||
|
|
||||||
SET(WARNS_FLAGS "-Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-variable")
|
SET(WARNS_FLAGS "-Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-variable")
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNS_FLAGS} ${ARCH_FLAGS} -std=gnu++0x -pipe")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNS_FLAGS} ${ARCH_FLAGS} -std=gnu++0x -pipe")
|
||||||
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb")
|
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb")
|
||||||
|
|
|
@ -47,7 +47,7 @@ void exitSignalHandler(int sig)
|
||||||
case SIGINT:
|
case SIGINT:
|
||||||
if(!signaled) {
|
if(!signaled) {
|
||||||
signaled = true;
|
signaled = true;
|
||||||
g_eventDispatcher.addEvent(std::bind(&Application::close, g_app));
|
g_eventDispatcher.addEvent(std::bind(&Application::close, &g_app));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,7 @@ Application::Application()
|
||||||
m_appCompactName = "app";
|
m_appCompactName = "app";
|
||||||
m_appVersion = "none";
|
m_appVersion = "none";
|
||||||
m_foregroundFrameCounter.setMaxFps(60);
|
m_foregroundFrameCounter.setMaxFps(60);
|
||||||
|
m_stopping = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::init(const std::string& compactName, const std::vector<std::string>& args)
|
void Application::init(const std::string& compactName, const std::vector<std::string>& args)
|
||||||
|
@ -170,7 +171,6 @@ void Application::run()
|
||||||
{
|
{
|
||||||
assert(m_initialized);
|
assert(m_initialized);
|
||||||
|
|
||||||
m_stopping = false;
|
|
||||||
m_running = true;
|
m_running = true;
|
||||||
|
|
||||||
// run the first poll
|
// run the first poll
|
||||||
|
|
|
@ -192,7 +192,7 @@ bool Protocol::xteaDecrypt(const InputMessagePtr& inputMessage)
|
||||||
uint16 decryptedSize = inputMessage->getU16() + 2;
|
uint16 decryptedSize = inputMessage->getU16() + 2;
|
||||||
int sizeDelta = decryptedSize - encryptedSize;
|
int sizeDelta = decryptedSize - encryptedSize;
|
||||||
if(sizeDelta > 0 || -sizeDelta > encryptedSize) {
|
if(sizeDelta > 0 || -sizeDelta > encryptedSize) {
|
||||||
g_logger.traceError("invalid decrypted a network message");
|
g_logger.traceError("invalid decrypted network message");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -317,13 +317,13 @@ void Map::saveOtcm(const std::string& fileName)
|
||||||
{
|
{
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
|
|
||||||
|
uint16 id;
|
||||||
for(auto& pair : m_tiles) {
|
for(auto& pair : m_tiles) {
|
||||||
Position pos = pair.first;
|
Position pos = pair.first;
|
||||||
TilePtr tile = pair.second;
|
TilePtr tile = pair.second;
|
||||||
if(!tile || tile->isEmpty())
|
if(!tile || tile->isEmpty())
|
||||||
continue;
|
continue;
|
||||||
out.write((char*)&pos, sizeof(pos));
|
out.write((char*)&pos, sizeof(pos));
|
||||||
uint16 id;
|
|
||||||
for(const ThingPtr& thing : tile->getThings()) {
|
for(const ThingPtr& thing : tile->getThings()) {
|
||||||
if(ItemPtr item = thing->asItem()) {
|
if(ItemPtr item = thing->asItem()) {
|
||||||
id = item->getId();
|
id = item->getId();
|
||||||
|
@ -334,9 +334,9 @@ void Map::saveOtcm(const std::string& fileName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
id = 0xFFFF;
|
|
||||||
out.write((char*)&id, sizeof(id));
|
|
||||||
}
|
}
|
||||||
|
id = 0xFFFF;
|
||||||
|
out.write((char*)&id, sizeof(id));
|
||||||
|
|
||||||
g_resources.saveFile(fileName, out);
|
g_resources.saveFile(fileName, out);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue