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