From 2dba0bc8dabe1f78fe9b9ce6214d5680fa33696a Mon Sep 17 00:00:00 2001 From: driAn Date: Sat, 31 May 2008 09:24:25 +0000 Subject: [PATCH] fixed sv_resume git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2129 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/clients2c.cpp | 16 ++++++++++------ source/src/server.cpp | 3 ++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index 77e25eeb..17043ab8 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -408,19 +408,23 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) { int cn = getint(p); if(cn<0) break; - int state = getint(p), lifesequence = getint(p), gunselect = getint(p), flagscore = getint(p), frags = getint(p), deaths = getint(p), health = getint(p), armour = getint(p); + int state = getint(p), lifesequence = getint(p), gunselect = getint(p), flagscore = getint(p), frags = getint(p), deaths = getint(p); + bool equip = getint(p) > 0; playerent *d = (cn == getclientnum() ? player1 : newclient(cn)); if(!d) continue; if(d!=player1) d->state = state; d->lifesequence = lifesequence; + d->selectweapon(gunselect); d->flagscore = flagscore; d->frags = frags; d->deaths = deaths; - d->selectweapon(gunselect); - d->health = health; - d->armour = armour; - loopi(NUMGUNS) d->ammo[i] = getint(p); - loopi(NUMGUNS) d->mag[i] = getint(p); + if(equip) + { + d->health = getint(p); + d->armour = getint(p); + loopi(NUMGUNS) d->ammo[i] = getint(p); + loopi(NUMGUNS) d->mag[i] = getint(p); + } } break; } diff --git a/source/src/server.cpp b/source/src/server.cpp index 7daa49ed..e73b17cc 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -1490,6 +1490,7 @@ void welcomepacket(ucharbuf &p, int n) putint(p, c.state.flagscore); putint(p, c.state.frags); putint(p, c.state.deaths); + putint(p, 1); putint(p, c.state.health); putint(p, c.state.armour); loopi(NUMGUNS) putint(p, c.state.ammo[i]); @@ -1626,7 +1627,7 @@ void process(ENetPacket *packet, int sender, int chan) // sender may be -1 if(sc) { sc->restore(cl->state); - sendf(-1, 1, "ri8", SV_RESUME, sender, cl->state.state, cl->state.lifesequence, cl->state.gunselect, sc->flagscore, sc->frags, sc->deaths, -1); + sendf(-1, 1, "ri8", SV_RESUME, sender, cl->state.state, cl->state.lifesequence, cl->state.gunselect, sc->flagscore, sc->frags, sc->deaths, 0, -1); } } getstring(text, p);