From 1f4113377f1f8efd1832c39689f61efe94cb1200 Mon Sep 17 00:00:00 2001 From: driAn Date: Sun, 12 Nov 2006 20:01:46 +0000 Subject: [PATCH] no message git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@616 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/client.cpp | 11 ++++++++++- source/src/clients2c.cpp | 4 ++-- source/src/cube.h | 10 +++++----- source/src/protos.h | 1 + source/src/server.cpp | 2 +- source/src/serverutil.cpp | 3 ++- 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/source/src/client.cpp b/source/src/client.cpp index 4b71fc53..2a8de28b 100644 --- a/source/src/client.cpp +++ b/source/src/client.cpp @@ -214,8 +214,8 @@ void addmsg(int type, const char *fmt, ...) int lastupdate = 0, lastping = 0; bool senditemstoserver = false; // after a map change, since server doesn't have map data +bool sendpwd = false; string clientpassword; -char *toserverpwd = NULL; void password(char *p) { s_strcpy(clientpassword, p); }; COMMAND(password, ARG_1STR); @@ -250,6 +250,15 @@ void c2sinfo(dynent *d) // send update to the server ENetPacket *packet = enet_packet_create(NULL, 100, 0); ucharbuf q(packet->data, packet->dataLength); + if(sendpwd && clientpassword[0]) + { + packet->flags = ENET_PACKET_FLAG_RELIABLE; + putint(q, SV_PWD); + sendstring(clientpassword, q); + clientpassword[0] = 0; // avoid sending pwd to other servers on connect + sendpwd = false; + }; + putint(q, SV_POS); putint(q, clientnum); putuint(q, (int)(d->o.x*DMF)); // quantize coordinates to 1/16th of a cube, between 1 and 3 bytes diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index 42ac9797..10ea3910 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -110,12 +110,12 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) disconnect(); return; }; - clientnum = mycn; // we are now fully connectedss + clientnum = mycn; // we are now fully connected bool firstplayer = !getint(p); if(getint(p) > 0) { conoutf("INFO: this server is password protected"); - addmsg(SV_PWD, "rs", clientpassword); + sendpwd = true; }; if(firstplayer && getclientmap()[0]) changemap(getclientmap()); // we are the first client on this server, set map break; diff --git a/source/src/cube.h b/source/src/cube.h index 520bcad8..cd7ea9d6 100644 --- a/source/src/cube.h +++ b/source/src/cube.h @@ -202,17 +202,17 @@ enum { MCMD_KICK = 0, MCMD_BAN, MCMD_REMBANS }; #define m_ctf (gamemode==5) #define m_pistol (gamemode==6) #define m_lss (gamemode==9) -#define m_osok (gamemode==10) +#define m_osok (gamemode==10 || gamemode==11) -#define m_noitems (gamemode==3 || gamemode==4 || gamemode==10) +#define m_noitems (gamemode==3 || gamemode==4 || gamemode==10 || gamemode==11) #define m_noitemsnade (gamemode==9) -#define m_nopistol (gamemode==10) +#define m_nopistol (gamemode==10 || gamemode==11) #define m_noprimary (m_pistol) #define m_noguns (m_nopistol && m_noprimary) #define m_noitemsrail (false) -#define m_arena (gamemode==3 || gamemode==4 || gamemode==9 || gamemode==10) +#define m_arena (gamemode==3 || gamemode==4 || gamemode==9 || gamemode==10 || gamemode==11) #define m_tarena (gamemode==4) -#define m_teammode (gamemode==0 || gamemode==4 || gamemode==5 || gamemode==7) +#define m_teammode (gamemode==0 || gamemode==4 || gamemode==5 || gamemode==7 || gamemode==11) #define m_botmode (gamemode==7 || gamemode == 8) #define isteam(a,b) (m_teammode && strcmp(a, b)==0) diff --git a/source/src/protos.h b/source/src/protos.h index 579eb07e..3e247800 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -85,6 +85,7 @@ extern bool netmapstart(); extern int getclientnum(); extern void changemapserv(char *name, int mode); extern void newteam(char *name); +extern bool sendpwd; // clientgame extern flaginfo flaginfos[2]; diff --git a/source/src/server.cpp b/source/src/server.cpp index b2a43773..61fb5d13 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -238,7 +238,7 @@ void restoreserverstate(vector &ents) // hack: called from savegame co int interm = 0, minremain = 0, mapend = 0; bool mapreload = false; -char *serverpassword = ""; +char *serverpassword; bool isdedicated; ENetHost *serverhost = NULL; diff --git a/source/src/serverutil.cpp b/source/src/serverutil.cpp index 59dbfe0c..8513d1c0 100644 --- a/source/src/serverutil.cpp +++ b/source/src/serverutil.cpp @@ -77,7 +77,8 @@ void getstring(char *text, ucharbuf &p, int len) const char *modenames[] = { "team deathmatch", "coopedit", "deathmatch", "survior", - "team survior", "ctf", "pistols frenzy", "bot team deathmatch", "bot deathmatch", "last swiss standing", "one shot, one kill" + "team survior", "ctf", "pistols frenzy", "bot team deathmatch", "bot deathmatch", "last swiss standing", + "one shot, one kill", "team sniper insta" }; const char *modestr(int n) { return (n>=0 && (size_t)n < sizeof(modenames)/sizeof(modenames[0])) ? modenames[n] : "unknown"; };