Fixed the NelNet chat sample

This commit is contained in:
Sit Melai 2019-03-30 19:30:20 +01:00
parent 6c94e3ad92
commit 3fa6700408
4 changed files with 5 additions and 4 deletions

View file

@ -2,7 +2,7 @@ ADD_EXECUTABLE(nl_sample_chatclient client.cpp kbhit.cpp kbhit.h)
ADD_EXECUTABLE(nl_sample_chatserver WIN32 server.cpp) ADD_EXECUTABLE(nl_sample_chatserver WIN32 server.cpp)
ADD_DEFINITIONS(-DCHAT_DIR="\\"${NL_SHARE_ABSOLUTE_PREFIX}/nl_sample_chat/\\"") ADD_DEFINITIONS(-DCHAT_DIR="${NL_SHARE_ABSOLUTE_PREFIX}/nl_sample_chat/")
TARGET_LINK_LIBRARIES(nl_sample_chatclient nelmisc nelnet) TARGET_LINK_LIBRARIES(nl_sample_chatclient nelmisc nelnet)
NL_DEFAULT_PROPS(nl_sample_chatclient "NeL, Samples, Net, Chat: Chat Client") NL_DEFAULT_PROPS(nl_sample_chatclient "NeL, Samples, Net, Chat: Chat Client")

View file

@ -1,4 +1,4 @@
//NSHost = "localhost"; NSHost = "localhost";
DontUseNS = 1; DontUseNS = 1;
DontUseAES = 1; DontUseAES = 1;
ServerPort = "3333";

View file

@ -61,7 +61,7 @@ using namespace NLNET;
#endif #endif
#ifndef CHAT_DIR #ifndef CHAT_DIR
# define CHAT_DIR "." # define CHAT_DIR ""
#endif #endif
string CurrentEditString; string CurrentEditString;

View file

@ -71,6 +71,7 @@ void clientSentChat (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
// Called when a client sent a CHAT message // Called when a client sent a CHAT message
string text; string text;
msgin.serial(text); msgin.serial(text);
nldebug("%s", text.c_str());
CMessage msgout; CMessage msgout;
msgout.setType("CHAT"); msgout.setType("CHAT");
msgout.serial(text); msgout.serial(text);