Skip to content

Commit 50c6377

Browse files
committed
fix(zq): import maps was unhelpfully clearing everything
The map import tool was checking if the first screen's `valid` field was a special value denoting it was "cleared" by the user. It's unclear why `valid` holds this information, but presently it's not useful and breaks map imports randomly.
1 parent b1e6584 commit 50c6377

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

src/zq/zq_class.cpp

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -758,8 +758,6 @@ const char *loaderror[] =
758758

759759
int32_t zmap::load(const char *path)
760760
{
761-
// int32_t size=file_size(path);
762-
763761
PACKFILE *f=pack_fopen_password(path,F_READ, "");
764762

765763
if(!f)
@@ -790,28 +788,24 @@ int32_t zmap::load(const char *path)
790788
al_trace("failed zmap::load\n");
791789
goto file_error;
792790
}
793-
bool copied = false;
794791

795792
switch(ImportMapBias)
796793
{
797794
case 0:
798795
*(screens+i) = tmpimportscr;
799-
copied = true;
800796
break;
801797

802798
case 1:
803799
if(!(screens[i].valid&mVALID))
804800
{
805801
*(screens+i) = tmpimportscr;
806-
copied = true;
807802
}
808803
break;
809804

810805
case 2:
811806
if(tmpimportscr.valid&mVALID)
812807
{
813808
*(screens+i) = tmpimportscr;
814-
copied = true;
815809
}
816810
break;
817811
}
@@ -820,13 +814,6 @@ int32_t zmap::load(const char *path)
820814

821815
pack_fclose(f);
822816

823-
if(!(screens[0].valid&mVERSION))
824-
{
825-
jwin_alert("Confirm Clear All","Clear all?",NULL,NULL,"O&K",NULL,'k',0,get_zc_font(font_lfont));
826-
clearmap(false);
827-
return 3;
828-
}
829-
830817
setCurrScr(0);
831818
mmap_mark_dirty();
832819
return 0;
@@ -843,17 +830,16 @@ int32_t zmap::save(const char *path)
843830

844831
if(!f)
845832
return 1;
846-
847-
int16_t version=ZELDA_VERSION;
848-
byte build=VERSION_BUILD;
849833

850-
if(!p_iputw(version,f))
834+
if(!p_iputw(V_MAPS,f))
851835
{
852836
pack_fclose(f);
853837
return 3;
854838
}
855839

856-
if(!p_putc(build,f))
840+
// This was the "build number", but that's totally useless here. Keep this junk byte
841+
// so as not to totally break exports between ZC versions.
842+
if(!p_putc(0,f))
857843
{
858844
pack_fclose(f);
859845
return 3;

0 commit comments

Comments
 (0)