summaryrefslogtreecommitdiff
path: root/src/network/core
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-01-18 13:12:57 +0000
committerrubidium <rubidium@openttd.org>2009-01-18 13:12:57 +0000
commit1bc8e3f536276bf37a246f1e747cb7563c7e20dc (patch)
tree6d76af52262054593ff7eea5e0e4a6d516cc0935 /src/network/core
parent2ce42873d1c8f259f1bed70ace5d52ce66e5d852 (diff)
downloadopenttd-1bc8e3f536276bf37a246f1e747cb7563c7e20dc.tar.xz
(svn r15135) -Fix/Change: allow str_validate (part of receiving strings from the network) to pass newlines instead of replacing them with question marks, but only when asked to do so.
Diffstat (limited to 'src/network/core')
-rw-r--r--src/network/core/packet.cpp4
-rw-r--r--src/network/core/packet.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/network/core/packet.cpp b/src/network/core/packet.cpp
index 21d8cf5df..5c06ab488 100644
--- a/src/network/core/packet.cpp
+++ b/src/network/core/packet.cpp
@@ -233,7 +233,7 @@ uint64 Packet::Recv_uint64()
}
/** Reads a string till it finds a '\0' in the stream */
-void Packet::Recv_string(char *buffer, size_t size)
+void Packet::Recv_string(char *buffer, size_t size, bool allow_newlines)
{
PacketSize pos;
char *bufp = buffer;
@@ -253,7 +253,7 @@ void Packet::Recv_string(char *buffer, size_t size)
}
this->pos = pos;
- str_validate(bufp);
+ str_validate(bufp, allow_newlines);
}
#endif /* ENABLE_NETWORK */
diff --git a/src/network/core/packet.h b/src/network/core/packet.h
index 1dd35a70d..f0202eee6 100644
--- a/src/network/core/packet.h
+++ b/src/network/core/packet.h
@@ -62,7 +62,7 @@ public:
uint16 Recv_uint16();
uint32 Recv_uint32();
uint64 Recv_uint64();
- void Recv_string(char *buffer, size_t size);
+ void Recv_string(char *buffer, size_t size, bool allow_newlines = false);
};
Packet *NetworkSend_Init(PacketType type);