no message

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@620 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2006-11-12 20:59:49 +00:00
parent ce52427b4f
commit a838e5c0ce
4 changed files with 12 additions and 38 deletions
+4 -17
View File
@@ -70,12 +70,14 @@ COMMANDN(team, newteam, ARG_1STR);
COMMANDN(name, newname, ARG_1STR);
COMMANDN(skin, newskin, ARG_1INT);
void connects(char *servername)
void connects(char *servername, char *password)
{
disconnect(1); // reset state
ENetAddress address;
address.port = CUBE_SERVER_PORT;
addmsg(SV_PWD, "rs", !password ? " " : password);
if(servername)
{
@@ -169,7 +171,7 @@ void lanconnect()
COMMAND(echo, ARG_VARI);
COMMANDN(say, toserver, ARG_VARI);
COMMANDN(connect, connects, ARG_1STR);
COMMANDN(connect, connects, ARG_2STR);
COMMAND(lanconnect, ARG_NONE);
COMMANDN(disconnect, trydisconnect, ARG_NONE);
@@ -214,16 +216,10 @@ 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;
void password(char *p) { s_strcpy(clientpassword, p); };
COMMAND(password, ARG_1STR);
bool netmapstart() { senditemstoserver = true; return clienthost!=NULL; };
void initclientnet()
{
clientpassword[0] = 0;
newname("unnamed");
ctf_team("cube");
};
@@ -250,15 +246,6 @@ 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