- Fixed string format warnings

- "N" in editor will now select better level numbers
This commit is contained in:
Rob Pearce 2009-03-26 23:46:40 +00:00
parent ace244678b
commit 8dee5433c6
6 changed files with 15 additions and 11 deletions

View File

@ -88,5 +88,5 @@
88,factory.dat,Factory 88,factory.dat,Factory
89,theendsofar.dat,THE END SO FAR 89,theendsofar.dat,THE END SO FAR
90,level9.5.dat,unknown 90,level9.5.dat,unknown
99,testlevel.dat,TEST LEVEL 102,testlevel.dat,TEST LEVEL
0,intro.dat,INTRO 101,intro.dat,INTRO

1
defs.h
View File

@ -105,6 +105,7 @@
// intro variables // intro variables
#define INTRO_RATSPEED 12 #define INTRO_RATSPEED 12
#define INTRO_LEVELNUM 101 #define INTRO_LEVELNUM 101
#define TEST_LEVELNUM 102
#define GAMEOVERWAIT 3 // # of seconds to wait before going back to title #define GAMEOVERWAIT 3 // # of seconds to wait before going back to title

6
edit.c
View File

@ -776,7 +776,7 @@ void drawstatus(void) {
SDL_FillRect(screen, &area, SDL_MapRGB(screen->format, 0, 0, 0)); SDL_FillRect(screen, &area, SDL_MapRGB(screen->format, 0, 0, 0));
// show level num // show level num
sprintf(temps, "Level %d",curlevelnum); sprintf(temps, "Level %d",curlevel->id);
wid = writetext(screen, area.x, area.y, temps, EDITTEXT, &white); wid = writetext(screen, area.x, area.y, temps, EDITTEXT, &white);
area.x += (wid + STATUSPAD); area.x += (wid + STATUSPAD);
// show level filename // show level filename
@ -1412,10 +1412,10 @@ void newlevel(void) {
maxlevid++; maxlevid++;
sprintf(tempbuf,"level%d.dat",maxlevid); sprintf(tempbuf,"level%d.dat",maxlevid);
sprintf(curlevel->filename, tempbuf); strncpy(curlevel->filename, tempbuf, BUFLEN);
strncpy(levelentry[curlevelnum].filename, tempbuf, MIDBUFLEN); strncpy(levelentry[curlevelnum].filename, tempbuf, MIDBUFLEN);
sprintf(tempbuf,"NEW LEVEL"); sprintf(tempbuf,"NEW LEVEL");
sprintf(curlevel->name, tempbuf); strncpy(curlevel->name, tempbuf, BUFLEN);
strncpy(levelentry[curlevelnum].desc, tempbuf, MIDBUFLEN); strncpy(levelentry[curlevelnum].desc, tempbuf, MIDBUFLEN);
curlevel->id = maxlevid; curlevel->id = maxlevid;
levelentry[curlevelnum].id = maxlevid; levelentry[curlevelnum].id = maxlevid;

4
rc.c
View File

@ -2248,7 +2248,7 @@ void checkcollide(sprite_t *s) {
s2->willbecome = P_DIAMOND; s2->willbecome = P_DIAMOND;
playfx(FX_KILL); playfx(FX_KILL);
sprintf(tempm, bifftext[rand() % MAXBIFFTEXT]); strncpy(tempm, bifftext[rand() % MAXBIFFTEXT], BUFLEN);
addoutlinetext(s2->x,s2->y - s->img->h/2, TEXTSIZE_BIFF, tempm,&red,&yellow,POINTSDELAY, TT_NORM); addoutlinetext(s2->x,s2->y - s->img->h/2, TEXTSIZE_BIFF, tempm,&red,&yellow,POINTSDELAY, TT_NORM);
keepchecking = B_FALSE; keepchecking = B_FALSE;
} else if (s2->iced) { } else if (s2->iced) {
@ -9575,7 +9575,7 @@ int dofruiteffect(sprite_t *pp, sprite_t *s) {
playfx(FX_CARD); playfx(FX_CARD);
// show text // show text
sprintf(tempm, getcardname(s->id)); sprintf(tempm, getcardname(s->id), BUFLEN);
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY,TT_NORM); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY,TT_NORM);
// add a "card" effect. it will move slowly towards the corner. // add a "card" effect. it will move slowly towards the corner.

View File

@ -82,7 +82,7 @@ int loadlevel(int lnum, int wantmonsters) {
level->l3tiles = NULL; level->l3tiles = NULL;
} }
sprintf(level->filename, levelentry[lnum].filename); strncpy(level->filename, levelentry[lnum].filename, BUFLEN);
/* set current level pointer */ /* set current level pointer */
curlevel = level; curlevel = level;
@ -3538,7 +3538,10 @@ int loadlevellist(void) {
// track max levelid // track max levelid
if (levelentry[lev].id > maxlevid) { if (levelentry[lev].id > maxlevid) {
maxlevid = levelentry[lev].id; if ((levelentry[lev].id != INTRO_LEVELNUM) &&
(levelentry[lev].id != TEST_LEVELNUM)) {
maxlevid = levelentry[lev].id;
}
} }

View File

@ -88,5 +88,5 @@
88,factory.dat,Factory 88,factory.dat,Factory
89,theendsofar.dat,THE END SO FAR 89,theendsofar.dat,THE END SO FAR
90,level9.5.dat,unknown 90,level9.5.dat,unknown
99,testlevel.dat,TEST LEVEL 102,testlevel.dat,TEST LEVEL
0,intro.dat,INTRO 101,intro.dat,INTRO