Remove global var "gountil"

This commit is contained in:
Stefan Bühler 2009-08-10 22:06:54 +02:00
parent 8b614a8728
commit 1b3b3b3eb8
1 changed files with 11 additions and 12 deletions

23
game.c
View File

@ -35,7 +35,7 @@ static int framecount = 0;
char playername[16];
static int gountil, mycount;
static int mycount;
static int bonustotal;
static const int bonuschances[]= {
@ -106,7 +106,7 @@ static void initplayers(void) {
}
static void firstzero(void) {
gountil=mycount=mydatacount=0;
mycount = mydatacount = 0;
memset(latestactions,0,sizeof(latestactions));
memset(latestcounts,0,sizeof(latestcounts));
memset(actionblock,0,sizeof(actionblock));
@ -836,6 +836,7 @@ static int getaction(void) {
static int iterate(void) {
int i;
int gountil; /* destination tick */
static int deathcount = 0;
mypause();
@ -847,13 +848,13 @@ static int iterate(void) {
myaction = getaction();
if (NETWORK_NONE == network && myaction==ACT_QUIT) return CODE_QUIT;
i = networktraffic();
if(i<0)
gountil=mycount+1;
else
gountil=i;
if (NETWORK_NONE == network) {
gountil = mycount + 1; /* single step in singly player mode */
} else {
gountil = networktraffic(); /* as master single step, as slave as many as we can do */
}
while(mycount<gountil) {
while (mycount < gountil) { /* simulate ticks up to gountil */
++mycount;
if (NETWORK_NONE != network) {
i = gountil - mycount;
@ -890,14 +891,12 @@ static int iterate(void) {
if(!activegeneric.next) {
player *pl;
int deadplayers = 0;
pl=activeplayers.next;
i=0;
while(pl) {
i = 0;
for (pl = activeplayers.next; pl; pl = pl->next) {
if(!(pl->flags & FLG_DEAD))
++i;
else
deadplayers++;
pl=pl->next;
}
if (deadplayers > 0 && (!i || (NETWORK_NONE != network && i==1))) {
++deathcount;