summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/download.cpp2
-rw-r--r--src/net/manaserv/messagehandler.h2
-rw-r--r--src/net/manaserv/messagein.h5
-rw-r--r--src/net/tmwa/loginhandler.cpp2
-rw-r--r--src/net/tmwa/messagehandler.h2
-rw-r--r--src/net/tmwa/messagein.h5
-rw-r--r--src/net/tmwa/network.cpp4
-rw-r--r--src/net/tmwa/tradehandler.cpp5
8 files changed, 19 insertions, 8 deletions
diff --git a/src/net/download.cpp b/src/net/download.cpp
index bccba7a3..61cdf114 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -124,7 +124,7 @@ bool Download::start()
{
logger->log("Starting download: %s", mUrl.c_str());
- mThread = SDL_CreateThread(downloadThread, this);
+ mThread = SDL_CreateThread(downloadThread, "Download", this);
if (!mThread)
{
diff --git a/src/net/manaserv/messagehandler.h b/src/net/manaserv/messagehandler.h
index 6e0221cb..8949d34e 100644
--- a/src/net/manaserv/messagehandler.h
+++ b/src/net/manaserv/messagehandler.h
@@ -41,7 +41,7 @@ class MessageHandler : public Net::MessageHandler
virtual void handleMessage(MessageIn &msg) = 0;
};
-typedef const std::auto_ptr<MessageHandler> MessageHandlerPtr;
+typedef const std::unique_ptr<MessageHandler> MessageHandlerPtr;
} // namespace ManaServ
diff --git a/src/net/manaserv/messagein.h b/src/net/manaserv/messagein.h
index 89ae5ed8..1edc4fe7 100644
--- a/src/net/manaserv/messagein.h
+++ b/src/net/manaserv/messagein.h
@@ -52,7 +52,10 @@ class MessageIn
/**
* Returns the length of unread data.
*/
- unsigned int getUnreadLength() const { return mLength - mPos; }
+ unsigned int getUnreadLength() const
+ {
+ return (mPos < mLength) ? mLength - mPos : 0;
+ }
/**
* Reads an unsigned 8-bit integer from the message.
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp
index 51c757cc..77b545fd 100644
--- a/src/net/tmwa/loginhandler.cpp
+++ b/src/net/tmwa/loginhandler.cpp
@@ -298,7 +298,7 @@ void LoginHandler::sendLoginRegister(const std::string &username,
const std::string &password)
{
MessageOut outMsg(0x0064);
- outMsg.writeInt32(0); // client version
+ outMsg.writeInt32(20); // client version
outMsg.writeString(username, 24);
outMsg.writeString(password, 24);
diff --git a/src/net/tmwa/messagehandler.h b/src/net/tmwa/messagehandler.h
index 2b1f5b7e..b598f896 100644
--- a/src/net/tmwa/messagehandler.h
+++ b/src/net/tmwa/messagehandler.h
@@ -49,7 +49,7 @@ class MessageHandler : public Net::MessageHandler
Network *mNetwork;
};
-typedef const std::auto_ptr<MessageHandler> MessageHandlerPtr;
+typedef const std::unique_ptr<MessageHandler> MessageHandlerPtr;
}
diff --git a/src/net/tmwa/messagein.h b/src/net/tmwa/messagein.h
index 48121187..2f66ca28 100644
--- a/src/net/tmwa/messagein.h
+++ b/src/net/tmwa/messagein.h
@@ -50,7 +50,10 @@ class MessageIn
/**
* Returns the length of unread data.
*/
- unsigned int getUnreadLength() const { return mLength - mPos; }
+ unsigned int getUnreadLength() const
+ {
+ return (mPos < mLength) ? mLength - mPos : 0;
+ }
/**
* Reads an unsigned 8-bit integer from the message.
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index 3a02deba..ed564b46 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -77,7 +77,7 @@ uint16_t packet_lengths[0x220] = {
11, 7,VAR, 67, 12, 18,114, 6, 3, 6, 26, 26, 26, 26, 2, 3,
// #0x01C0
2, 14, 10,VAR, 22, 22, 4, 2, 13, 97, 0, 9, 9, 29, 6, 28,
- 8, 14, 10, 35, 6, 8, 4, 11, 54, 53, 60, 2,VAR, 47, 33, 6,
+ 8, 14, 10, 35, 6,VAR, 4, 11, 54, 53, 60, 2,VAR, 47, 33, 6,
30, 8, 34, 14, 2, 6, 26, 2, 28, 81, 6, 10, 26, 2,VAR,VAR,
VAR,VAR, 20, 10, 32, 9, 34, 14, 2, 6, 48, 56,VAR, 4, 5, 10,
// #0x0200
@@ -159,7 +159,7 @@ bool Network::connect(ServerInfo server)
mToSkip = 0;
mState = CONNECTING;
- mWorkerThread = SDL_CreateThread(networkThread, this);
+ mWorkerThread = SDL_CreateThread(networkThread, "Network", this);
if (!mWorkerThread)
{
setError("Unable to create network worker thread");
diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp
index 40e37594..a02056a4 100644
--- a/src/net/tmwa/tradehandler.cpp
+++ b/src/net/tmwa/tradehandler.cpp
@@ -207,6 +207,11 @@ void TradeHandler::handleMessage(MessageIn &msg)
SERVER_NOTICE(_("Failed adding item. Trade "
"partner has no free slot."))
break;
+ case 3:
+ // Add item failed - non tradable item
+ SERVER_NOTICE(_("Failed adding item. You "
+ "cant trade this item."))
+ break;
default:
SERVER_NOTICE(_("Failed adding item for "
"unknown reason."))