improved htf on maps without flag spawns
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2487 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -316,7 +316,11 @@ void c2sinfo(playerent *d) // send update to the server
|
||||
}
|
||||
putint(p, SV_SPAWNLIST);
|
||||
putint(p, maploaded);
|
||||
if(maploaded > 0) loopi(3) putint(p, numspawn[i]);
|
||||
if(maploaded > 0)
|
||||
{
|
||||
loopi(3) putint(p, numspawn[i]);
|
||||
loopi(2) putint(p, numflagspawn[i]);
|
||||
}
|
||||
senditemstoserver = false;
|
||||
}
|
||||
int i = 0;
|
||||
|
||||
@@ -235,7 +235,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
|
||||
|
||||
case SV_SPAWNLIST:
|
||||
{
|
||||
if(getint(p) > 0) loopi(3) getint(p);
|
||||
if(getint(p) > 0) loopi(5) getint(p);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ extern int maxclients;
|
||||
extern hashtable<char *, enet_uint32> mapinfo;
|
||||
extern bool hasTE, hasMT, hasMDA;
|
||||
extern int hwtexsize;
|
||||
extern int numspawn[3], maploaded;
|
||||
extern int numspawn[3], maploaded, numflagspawn[2];
|
||||
extern int verbose;
|
||||
|
||||
#include "protos.h" // external function decls
|
||||
|
||||
+16
-11
@@ -459,7 +459,7 @@ struct server_entity // server side version of "entity" type
|
||||
vector<server_entity> sents;
|
||||
|
||||
bool notgotitems = true; // true when map has changed and waiting for clients to send item
|
||||
int clnumspawn[3];
|
||||
int clnumspawn[3], clnumflagspawn[2];
|
||||
|
||||
// allows the gamemode macros to work with the server mode
|
||||
#define gamemode smode
|
||||
@@ -1682,6 +1682,7 @@ void resetmap(const char *newname, int newmode, int newtime, bool notify)
|
||||
resetvotes();
|
||||
resetitems();
|
||||
loopi(3) clnumspawn[i] = 0;
|
||||
loopi(2) clnumflagspawn[i] = 0;
|
||||
scores.setsize(0);
|
||||
ctfreset();
|
||||
if(notify)
|
||||
@@ -2337,7 +2338,11 @@ void process(ENetPacket *packet, int sender, int chan) // sender may be -1
|
||||
|
||||
case SV_SPAWNLIST:
|
||||
{
|
||||
if(getint(p) > 0) loopi(3) clnumspawn[i] = getint(p);
|
||||
if(getint(p) > 0)
|
||||
{
|
||||
loopi(3) clnumspawn[i] = getint(p);
|
||||
loopi(2) clnumflagspawn[i] = getint(p);
|
||||
}
|
||||
QUEUE_MSG;
|
||||
break;
|
||||
}
|
||||
@@ -2777,15 +2782,15 @@ void serverslice(uint timeout) // main server update, called from cube main lo
|
||||
if(m_flags) loopi(2)
|
||||
{
|
||||
sflaginfo &f = sflaginfos[i];
|
||||
if(f.state == CTFF_DROPPED && gamemillis-f.lastupdate > (m_ctf ? 30000 : 10000)) flagaction(i, SV_FLAGRESET, -1);
|
||||
if(m_htf && f.state == CTFF_INBASE && gamemillis-f.lastupdate > 10000)
|
||||
{
|
||||
htf_forceflag(i);
|
||||
}
|
||||
if(m_ktf && f.state == CTFF_STOLEN && gamemillis-f.lastupdate > 15000)
|
||||
{
|
||||
flagaction(i, SV_FLAGSCORE, f.actor_cn);
|
||||
}
|
||||
if(f.state == CTFF_DROPPED && gamemillis-f.lastupdate > (m_ctf ? 30000 : 10000)) flagaction(i, SV_FLAGRESET, -1);
|
||||
if(m_htf && f.state == CTFF_INBASE && gamemillis-f.lastupdate > (clnumflagspawn[0] && clnumflagspawn[1] ? 10000 : 1000))
|
||||
{
|
||||
htf_forceflag(i);
|
||||
}
|
||||
if(m_ktf && f.state == CTFF_STOLEN && gamemillis-f.lastupdate > 15000)
|
||||
{
|
||||
flagaction(i, SV_FLAGSCORE, f.actor_cn);
|
||||
}
|
||||
}
|
||||
if(m_arena) arenacheck();
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ void save_world(char *mname)
|
||||
}
|
||||
|
||||
extern void preparectf(bool cleanonly = false);
|
||||
int numspawn[3], maploaded = 0;
|
||||
int numspawn[3], maploaded = 0, numflagspawn[2];
|
||||
|
||||
bool load_world(char *mname) // still supports all map formats that have existed since the earliest cube betas!
|
||||
{
|
||||
@@ -287,6 +287,7 @@ bool load_world(char *mname) // still supports all map formats that have
|
||||
}
|
||||
ents.setsize(0);
|
||||
loopi(3) numspawn[i] = 0;
|
||||
loopi(2) numflagspawn[i] = 0;
|
||||
loopi(hdr.numents)
|
||||
{
|
||||
entity &e = ents.add();
|
||||
@@ -342,6 +343,7 @@ bool load_world(char *mname) // still supports all map formats that have
|
||||
else
|
||||
numspawn[e.attr2]++;
|
||||
}
|
||||
if(e.type == CTF_FLAG && (e.attr2 == 0 || e.attr2 == 1)) numflagspawn[e.attr2]++;
|
||||
}
|
||||
delete[] world;
|
||||
setupworld(hdr.sfactor);
|
||||
|
||||
Reference in New Issue
Block a user