From 5ab1ab8b4654fb1098a79fd0e456a90ddec5dfa5 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Wed, 26 Oct 2011 21:34:24 +0100 Subject: [PATCH] Fix FIGH loading and bad variable names --- src/main.c | 15 +++++++++++++++ src/powder.c | 14 +++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/main.c b/src/main.c index 998cc40c4..bdccf1d99 100644 --- a/src/main.c +++ b/src/main.c @@ -985,11 +985,26 @@ int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char { STKM_init_legs(&player, i-1); player.spwn = 1; + player.elem = PT_DUST; } else if (parts[i-1].type == PT_STKM2) { STKM_init_legs(&player2, i-1); player2.spwn = 1; + player2.elem = PT_DUST; + } + else if (parts[i-1].type == PT_FIGH) + { + unsigned char fcount = 0; + while (fcount < 100 && fcount < (fighcount+1) && fighters[fcount].spwn==1) fcount++; + if (fcount < 100 && fighters[fcount].spwn==0) + { + parts[i-1].tmp = fcount; + fighters[fcount].spwn = 1; + fighters[fcount].elem = PT_DUST; + fighcount++; + STKM_init_legs(&(fighters[fcount]), i-1); + } } if (ver<48 && (ty==OLD_PT_WIND || (ty==PT_BRAY&&parts[i-1].life==0))) diff --git a/src/powder.c b/src/powder.c index 3343825e9..59a805353 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1029,9 +1029,9 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a } if (t==PT_FIGH) { - unsigned char cunt = 0; - while (cunt < 100 && cunt < (fighcount+1) && fighters[cunt].spwn==1) cunt++; - if (cunt < 100 && fighters[cunt].spwn==0) + unsigned char fcount = 0; + while (fcount < 100 && fcount < (fighcount+1) && fighters[fcount].spwn==1) fcount++; + if (fcount < 100 && fighters[fcount].spwn==0) { parts[i].x = (float)x; parts[i].y = (float)y; @@ -1040,11 +1040,11 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a parts[i].vy = 0; parts[i].life = 100; parts[i].ctype = 0; - parts[i].tmp = cunt; + parts[i].tmp = fcount; parts[i].temp = ptypes[t].heat; - STKM_init_legs(&fighters[cunt], i); - fighters[cunt].spwn = 1; - fighters[cunt].elem = PT_DUST; + STKM_init_legs(&fighters[fcount], i); + fighters[fcount].spwn = 1; + fighters[fcount].elem = PT_DUST; fighcount++; return i;