send_items + flags (now I understand...)

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5653 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Rafael Barreto
2010-08-17 18:51:01 +00:00
parent d81747fe29
commit 950c056cff
2 changed files with 12 additions and 16 deletions
-2
View File
@@ -877,8 +877,6 @@ void startmap(const char *name, bool reset) // called just after a map load
}
}
resetspawns(); // double check
// run once
if(firstrun)
{
+12 -14
View File
@@ -681,8 +681,6 @@ void readdemo()
}
}
//
struct sflaginfo
{
int state;
@@ -712,6 +710,14 @@ void putflaginfo(packetbuf &p, int flag)
}
}
inline void send_item_list(packetbuf &p)
{
putint(p, SV_ITEMLIST);
loopv(sents) if(sents[i].spawned) putint(p, i);
putint(p, -1);
if(m_flags) loopi(2) putflaginfo(p, i);
}
#include "serverchecks.h"
bool flagdistance(sflaginfo &f, int cn)
@@ -1745,13 +1751,6 @@ void startdemoplayback(const char *newname)
setupdemoplayback();
}
inline void send_item_list(packetbuf &p)
{
putint(p, SV_ITEMLIST);
loopv(sents) if(sents[i].spawned) putint(p, i);
putint(p, -1);
}
void startgame(const char *newname, int newmode, int newtime, bool notify)
{
if(!newname || !*newname || (newmode == GMODE_DEMO && isdedicated)) fatal("startgame() abused");
@@ -1813,10 +1812,10 @@ void startgame(const char *newname, int newmode, int newtime, bool notify)
// change map
sendf(-1, 1, "risiii", SV_MAPCHANGE, smapname, smode, mapbuffer.available(), mapbuffer.revision);
if(smode>1 || (smode==0 && numnonlocalclients()>0)) sendf(-1, 1, "ri2", SV_TIMEUP, minremain);
packetbuf q(MAXTRANS, ENET_PACKET_FLAG_RELIABLE);
send_item_list(q);
sendpacket(-1, 1, q.finalize());
}
packetbuf q(MAXTRANS, ENET_PACKET_FLAG_RELIABLE);
send_item_list(q); // always send the item list when a game starts
sendpacket(-1, 1, q.finalize());
defformatstring(gsmsg)("Game start: %s on %s, %d players, %d minutes, mastermode %d, ", modestr(smode), smapname, numclients(), minremain, mastermode);
if(mastermode == MM_MATCH) concatformatstring(gsmsg, "teamsize %d, ", matchteamsize);
if(ms) concatformatstring(gsmsg, "(map rev %d/%d, %s, 'getmap' %sprepared)", smapstats.hdr.maprevision, smapstats.cgzsize, maplocstr[maploc], mapbuffer.available() ? "" : "not ");
@@ -2344,8 +2343,7 @@ void welcomepacket(packetbuf &p, int n)
putint(p, SV_TIMEUP);
putint(p, minremain);
}
send_item_list(p);
if(m_flags) loopi(2) putflaginfo(p, i);
send_item_list(p); // this includes the flags
}
savedscore *sc = NULL;
if(c)