no message

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@616 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2006-11-12 20:01:46 +00:00
parent 2a0dc62900
commit 1f4113377f
6 changed files with 21 additions and 10 deletions
+10 -1
View File
@@ -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
+2 -2
View File
@@ -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;
+5 -5
View File
@@ -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)
+1
View File
@@ -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];
+1 -1
View File
@@ -238,7 +238,7 @@ void restoreserverstate(vector<entity> &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;
+2 -1
View File
@@ -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"; };