diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 7224b51a..1e5c1fbb 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -610,7 +610,7 @@ void startmap(char *name) // called just after a map load spawnplayer(player1, true); player1->frags = 0; player1->flagscore = 0; - loopv(players) if(players[i]) players[i]->frags = 0; + loopv(players) if(players[i]) players[i]->frags = players[i]->flagscore = 0; resetspawns(); s_strcpy(clientmap, name); if(editmode) toggleedit(); diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index d3598b56..8d96538e 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -349,12 +349,12 @@ void parsemessages(int cn, dynent *d, ucharbuf &p) case SV_RESUME: { - int cn = getint(p), frags = getint(p); - if(cn==clientnum) player1->frags = frags; - else + int cn = getint(p), frags = getint(p), flags = getint(p); + dynent *d = cn==clientnum ? player1 : getclient(cn); + if(d) { - dynent *d = getclient(cn); - if(d) d->frags = frags; + d->frags = frags; + d->flagscore = flags; }; break; }; @@ -568,7 +568,7 @@ void parsemessages(int cn, dynent *d, ucharbuf &p) if (!b) break; - conoutf("bot %s disconnected", b->name[0] ? b->name : "[incompatible client]"); + if(b->name[0]) conoutf("bot %s disconnected", b->name); delete b->pBot; zapdynent(bots[n]); bots.remove(n); diff --git a/source/src/main.cpp b/source/src/main.cpp index e4fd4066..f08d84bf 100644 --- a/source/src/main.cpp +++ b/source/src/main.cpp @@ -132,7 +132,6 @@ void setfullscreen(bool enable) { #ifdef WIN32 conoutf("\"fullscreen\" variable not supported on this platform. Use the -t command-line option."); - extern int fullscreen; fullscreen = !enable; #else SDL_WM_ToggleFullScreen(screen); diff --git a/source/src/server.cpp b/source/src/server.cpp index 58b1d893..7f549335 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -13,7 +13,12 @@ enum { ST_EMPTY, ST_LOCAL, ST_TCPIP }; struct clientscore { - int frags; + int frags, flags; + + void reset() + { + frags = flags = 0; + }; }; struct savedscore : clientscore @@ -51,7 +56,7 @@ struct client // server side version of "dynent" type void reset() { name[0] = 0; - score.frags = 0; + score.reset(); position.setsizenodelete(0); messages.setsizenodelete(0); }; @@ -207,9 +212,9 @@ clientscore *findscore(client &c, bool insert) }; if(!insert) return NULL; savedscore &sc = scores.add(); + sc.reset(); s_strcpy(sc.name, c.name); sc.ip = c.peer->address.host; - (clientscore &)sc = c.score; return ≻ }; @@ -217,7 +222,7 @@ void resetscores() { loopv(clients) if(clients[i]->type==ST_TCPIP) { - clients[i]->score.frags = 0; + clients[i]->score.reset(); }; scores.setsize(0); }; @@ -814,7 +819,7 @@ void process(ENetPacket *packet, int sender, int chan) // sender may be -1 if(newclient) { clientscore *sc = findscore(*clients[cn], false); - if(sc) sendf(-1, 1, "riii", SV_RESUME, cn, sc->frags); + if(sc) sendf(-1, 1, "ri4", SV_RESUME, cn, sc->frags, sc->flags); }; getstring(text, p); getint(p); @@ -992,12 +997,10 @@ void process(ENetPacket *packet, int sender, int chan) // sender may be -1 }; case SV_GETMASTER: - { SENDER_CHECK; getstring(text, p); getmaster(sender, text); break; - }; case SV_MASTERCMD: { @@ -1009,18 +1012,20 @@ void process(ENetPacket *packet, int sender, int chan) // sender may be -1 }; case SV_PWD: - { getstring(text, p); break; - }; case SV_FRAGS: - { CN_CHECK; cl->score.frags = getint(p); QUEUE_MSG; break; - }; + + case SV_FLAGS: + CN_CHECK; + cl->score.flags = getint(p); + QUEUE_MSG; + break; default: { @@ -1058,6 +1063,16 @@ void send_welcome(int n) putint(p, -1); }; }; + loopv(clients) + { + client &c = *clients[i]; + if(c.type!=ST_TCPIP || c.clientnum==n) continue; + if(!c.score.frags && !c.score.flags) continue; + putint(p, SV_RESUME); + putint(p, c.clientnum); + putint(p, c.score.frags); + putint(p, c.score.flags); + }; enet_packet_resize(packet, p.length()); sendpacket(n, 1, packet); if(smapname[0] && m_ctf_s) loopi(2) sendflaginfo(i, -1, n); // EDIT: AH