diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-07-25 19:21:22 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-07-25 19:21:22 +0000 |
commit | 33e19fb0822308a630ca6e1122b9b97882a120a7 (patch) | |
tree | 78f80d6673bd5e52431d2fad986c0f1416dfd780 /src | |
parent | c7e7b62aa94bf295ca1dc556762ad6070221e0cd (diff) | |
download | mana-33e19fb0822308a630ca6e1122b9b97882a120a7.tar.gz mana-33e19fb0822308a630ca6e1122b9b97882a120a7.tar.bz2 mana-33e19fb0822308a630ca6e1122b9b97882a120a7.tar.xz mana-33e19fb0822308a630ca6e1122b9b97882a120a7.zip |
Fixed Linux compiling issues and merged update system fix for Windows.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/updatewindow.cpp | 11 | ||||
-rw-r--r-- | src/net/beinghandler.cpp | 2 | ||||
-rw-r--r-- | src/net/network.cpp | 8 |
3 files changed, 12 insertions, 9 deletions
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 8f43903f..3f5fe7bb 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -106,8 +106,7 @@ UpdaterWindow::~UpdaterWindow() free(mMemoryBuffer); } - // Remove downloaded files - remove((mBasePath + "/updates/news.txt").c_str()); + // Remove possibly leftover temporary download remove((mBasePath + "/updates/download.temp").c_str()); delete[] mCurlError; @@ -293,10 +292,14 @@ int UpdaterWindow::downloadThread(void *ptr) if (!uw->mStoreInMemory) { fclose(outfile); - // If the download was successful give the file the proper name - // else it will be deleted later + + // Give the file the proper name std::string newName(uw->mBasePath + "/updates/" + uw->mCurrentFile.c_str()); + + // Any existing file with this name is deleted first, otherwise the + // rename will fail on Windows. + remove(newName.c_str()); rename(outFilename.c_str(), newName.c_str()); } } diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index 68a46650..7730e9be 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -368,7 +368,7 @@ void BeingHandler::handleMessage(MessageIn *msg) case 0x0119: // Change in players look - printf("0x0119 %i %i %i %x %i\n", msg->readLong(), + printf("0x0119 %li %i %i %x %i\n", msg->readLong(), msg->readShort(), msg->readShort(), msg->readShort(), msg->readByte()); break; diff --git a/src/net/network.cpp b/src/net/network.cpp index 8278e266..aa18e888 100644 --- a/src/net/network.cpp +++ b/src/net/network.cpp @@ -40,13 +40,13 @@ Network::~Network() { clearHandlers(); - if (mState != IDLE && mState != ERROR) + if (mState != IDLE && mState != NET_ERROR) disconnect(); } bool Network::connect(const std::string &address, short port) { - if (mState != IDLE && mState != ERROR) + if (mState != IDLE && mState != NET_ERROR) { logger->log("Tried to connect an already connected socket!"); return false; @@ -55,7 +55,7 @@ bool Network::connect(const std::string &address, short port) if (address.empty()) { logger->log("Empty address given to Network::connect()!"); - mState = ERROR; + mState = NET_ERROR; return false; } @@ -84,7 +84,7 @@ bool Network::connect(const std::string &address, short port) if (mServer == 0) { logger->log("Unable to initiate connection to the server."); - mState = ERROR; + mState = NET_ERROR; return false; } |