Fixed saving and loading infinite files bug.

This commit is contained in:
Ryan "Lofenyy" Medeiros 2023-07-01 21:44:08 -06:00
parent e4b53727a1
commit ce154ff0f4
3 changed files with 1235 additions and 10 deletions

1225
Assets/error Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
\documentclass[draft]{book}
\documentclass[final]{book}
\begin{document}
\title{LibreWands}
\author{Ryan "Lofenyy" Medeiros}

View File

@ -404,12 +404,12 @@ int saveMap()
{
// Print out a header giving valuable info for memory allocation.
fprintf(fp,
"\t<map bases=\"%i\" infos=\"%i\" items=\"%i\" doors=\"%i\" "
"chars=\"%i\">\n",
"\t<map bases=\"%li\" infos=\"%li\" items=\"%li\" doors=\"%li\" "
"chars=\"%li\">\n",
map[C].nBase, map[C].nInfo, map[C].nItem, map[C].nDoor, map[C].nChar);
// for every active base
for (uint_fast8_t B = 0; B < map[C].nBase; B++)
for (uint_fast32_t B = 0; B < map[C].nBase; B++)
{
if (map[C].Base[B].active)
{
@ -422,7 +422,7 @@ int saveMap()
}
}
// for every active info
for (uint_fast8_t B = 0; B < map[C].nInfo; B++)
for (uint_fast32_t B = 0; B < map[C].nInfo; B++)
{
if (map[C].Info[B].active)
{
@ -435,7 +435,7 @@ int saveMap()
}
}
// for every active item
for (uint_fast8_t B = 0; B < map[C].nItem; B++)
for (uint_fast32_t B = 0; B < map[C].nItem; B++)
{
if (map[C].Item[B].active)
{
@ -448,7 +448,7 @@ int saveMap()
}
}
// for every active door
for (uint_fast8_t B = 0; B < map[C].nDoor; B++)
for (uint_fast32_t B = 0; B < map[C].nDoor; B++)
{
if (map[C].Door[B].active)
{
@ -463,7 +463,7 @@ int saveMap()
}
}
// for every active char
for (uint_fast8_t B = 0; B < map[C].nChar; B++)
for (uint_fast32_t B = 0; B < map[C].nChar; B++)
{
if (map[C].Char[B].active)
{
@ -546,8 +546,8 @@ int loadMap()
{
// Get our bases, infos, items etc.
sscanf(buffer,
"\t<map bases=\"%hhi\" infos=\"%hhi\" items=\"%hhi\" doors=\"%hhi\""
" chars=\"%hhi\">",
"\t<map bases=\"%li\" infos=\"%li\" items=\"%li\" doors=\"%li\""
" chars=\"%li\">",
&map[iMap].nBase, &map[iMap].nInfo, &map[iMap].nItem,
&map[iMap].nDoor, &map[iMap].nChar);