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
This commit is contained in:
helixhorned 2013-06-29 12:15:44 +00:00
parent 6a33c2eec1
commit dea960d350
3 changed files with 6 additions and 10 deletions

View file

@ -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

View file

@ -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)
{

View file

@ -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); }