Fix long map name bug
This commit is contained in:
parent
01bb187aba
commit
23c17bf0f2
2 changed files with 11 additions and 6 deletions
2
assets.h
2
assets.h
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
#define LCR_MODULE_NAME "asset"
|
#define LCR_MODULE_NAME "asset"
|
||||||
|
|
||||||
#define LCR_VERSION "1.0"
|
#define LCR_VERSION "1.0d"
|
||||||
|
|
||||||
static const char *LCR_texts[] =
|
static const char *LCR_texts[] =
|
||||||
{
|
{
|
||||||
|
|
15
game.h
15
game.h
|
@ -853,16 +853,21 @@ uint8_t LCR_gameLoadMap(unsigned int mapIndex)
|
||||||
|
|
||||||
LCR_seekDataByIndex(mapIndex,'M');
|
LCR_seekDataByIndex(mapIndex,'M');
|
||||||
|
|
||||||
for (int i = 0; i < LCR_MAP_NAME_MAX_LEN; ++i)
|
int i = 0;
|
||||||
|
|
||||||
|
while (1)
|
||||||
{
|
{
|
||||||
char c = LCR_gameGetNextDataFileChar();
|
char c = LCR_gameGetNextDataFileChar();
|
||||||
|
|
||||||
if (c == LCR_DATA_FILE_SEPARATOR2 ||
|
if (c == LCR_DATA_FILE_SEPARATOR2 || c == LCR_DATA_FILE_SEPARATOR || c == 0)
|
||||||
c == LCR_DATA_FILE_SEPARATOR || c == 0)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
name[i] = c;
|
if (i <= LCR_MAP_NAME_MAX_LEN)
|
||||||
name[i + 1] = 0;
|
{
|
||||||
|
name[i] = c;
|
||||||
|
name[i + 1] = 0;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = LCR_mapLoadFromStr(LCR_gameGetNextDataStrChar,name);
|
result = LCR_mapLoadFromStr(LCR_gameGetNextDataStrChar,name);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue