From dea960d35058bbd5e0bea3d5fd73ac2e9ceeaacf Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 29 Jun 2013 12:15:44 +0000 Subject: [PATCH] Fix loading maps in Mapster32, introduced in r3911. Also, get rid of the strange filename[len]=255 hack in loadboard() and make its file name arg const char* at last. git-svn-id: https://svn.eduke32.com/eduke32@3913 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/build.h | 4 ++-- polymer/eduke32/build/src/build.c | 4 ++-- polymer/eduke32/build/src/engine.c | 8 ++------ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 7a3546514..00d0630bc 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -997,7 +997,7 @@ int32_t preinitengine(void); // a partial setup of the engine used for launch int32_t initengine(void); void uninitengine(void); void initspritelists(void); -int32_t loadboard(char *filename, char flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum); +int32_t loadboard(const char *filename, char flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum); int32_t loadmaphack(const char *filename); void delete_maphack_lights(); #ifdef HAVE_CLIPSHAPE_FEATURE @@ -1325,7 +1325,7 @@ int32_t loaddefinitionsfile(const char *fn); // if loadboard() fails with -2 return, try loadoldboard(). if it fails with // -2, board is dodgy -int32_t loadoldboard(char *filename, char fromwhere, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum); +int32_t loadoldboard(const char *filename, char fromwhere, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum); // Hash functions diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index a27e02af9..39bb3ebe3 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -8087,9 +8087,9 @@ int32_t LoadBoard(const char *filename, uint32_t flags) editorzrange[1] = INT32_MAX; ExtPreLoadMap(); - i = loadboard(boardfilename, (flags&4)|loadingflags, &pos, &ang, &cursectnum); + i = loadboard(filename, (flags&4)|loadingflags, &pos, &ang, &cursectnum); if (i == -2) - i = loadoldboard(boardfilename,loadingflags, &pos, &ang, &cursectnum); + i = loadoldboard(filename,loadingflags, &pos, &ang, &cursectnum); if (i < 0) { diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 1f7136092..dc3d94fd8 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -9870,7 +9870,7 @@ LUNATIC_CB int32_t (*loadboard_maptext)(int32_t fil, vec3_t *dapos, int16_t *daa // -2: invalid version // -3: invalid number of sectors, walls or sprites // <= -4: map-text error -int32_t loadboard(char *filename, char flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum) +int32_t loadboard(const char *filename, char flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum) { int32_t fil, i; int16_t numsprites; @@ -9878,8 +9878,6 @@ int32_t loadboard(char *filename, char flags, vec3_t *dapos, int16_t *daang, int flags &= 3; - i = Bstrlen(filename)-1; - if (filename[i] == 255) { filename[i] = 0; flags = 1; } // JBF 20040119: "compatibility" if ((fil = kopen4load(filename,flags)) == -1) { mapversion = 7; return -1; } @@ -10066,7 +10064,7 @@ skip_reading_mapbin: // Powerslave uses v6 // Witchaven 1 and TekWar and LameDuke use v5 -int32_t loadoldboard(char *filename, char fromwhere, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum) +int32_t loadoldboard(const char *filename, char fromwhere, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum) { int32_t fil, i; int16_t numsprites; @@ -10078,8 +10076,6 @@ int32_t loadoldboard(char *filename, char fromwhere, vec3_t *dapos, int16_t *daa struct walltypev6 v6wall; struct spritetypev6 v6spr; - i = Bstrlen(filename)-1; - if (filename[i] == 255) { filename[i] = 0; fromwhere = 1; } // JBF 20040119: "compatibility" if ((fil = kopen4load(filename,fromwhere)) == -1) { mapversion = 5L; return(-1); }