@@ -19404,11 +19404,9 @@ int32_t readcomboaliasfile(PACKFILE *f)
1940419404 return 0 ;
1940519405 }
1940619406 // These values are flexible, and may differ in size, so we delete them
19407- // and recreate them at the correct size on the pointer.
19408- delete[] temp_alias.combos ;
19409- temp_alias.combos = new word[count2];
19410- delete[] temp_alias.csets ;
19411- temp_alias.csets = new byte[count2];
19407+ // and recreate them at the correct size on the pointer.
19408+ temp_alias.combos .clear ();
19409+ temp_alias.csets .clear ();
1941219410 for (int32_t k=0 ; k<count2; k++)
1941319411 {
1941419412 if (!p_igetw (&tempword,f))
@@ -19486,7 +19484,6 @@ int32_t readcomboaliasfile_to_location(PACKFILE *f, int32_t start)
1948619484 al_trace (" Cannot read .zalias packfile made in ZC version (%x) in this version of ZC (%x)\n " , zversion, ZELDA_VERSION);
1948719485 return 0 ;
1948819486 }
19489-
1949019487 else if ( ( section_version > V_COMBOALIASES ) || ( section_version == V_COMBOALIASES && section_cversion > CV_COMBOALIASES ) )
1949119488 {
1949219489 al_trace (" Cannot read .zalias packfile made using V_COMBOALIASES (%d) subversion (%d)\n " , section_version, section_cversion);
@@ -19527,80 +19524,71 @@ int32_t readcomboaliasfile_to_location(PACKFILE *f, int32_t start)
1952719524 {
1952819525 memset (&temp_alias, 0 , sizeof (temp_alias));
1952919526 if (!p_igetw (&temp_alias.combo ,f))
19530- {
19531- return 0 ;
19532- }
19527+ {
19528+ return 0 ;
19529+ }
1953319530
19534- if (!p_getc (&temp_alias.cset ,f))
19535- {
19536- return 0 ;
19537- }
19531+ if (!p_getc (&temp_alias.cset ,f))
19532+ {
19533+ return 0 ;
19534+ }
1953819535
19539- int32_t count2 = 0 ;
19536+ int32_t count2 = 0 ;
1954019537
1954119538 if (!p_igetl (&count2,f))
19542- {
19543- return 0 ;
19544- }
19539+ {
19540+ return 0 ;
19541+ }
1954519542
19546- if (!p_getc (&temp_alias.width ,f))
19543+ if (!p_getc (&temp_alias.width ,f))
19544+ {
19545+ return 0 ;
19546+ }
19547+
19548+ if (!p_getc (&temp_alias.height ,f))
19549+ {
19550+ return 0 ;
19551+ }
19552+
19553+ if (!p_getc (&temp_alias.layermask ,f))
19554+ {
19555+ return 0 ;
19556+ }
19557+ // These values are flexible, and may differ in size, so we delete them
19558+ // and recreate them at the correct size on the pointer.
19559+ temp_alias.combos .clear ();
19560+ temp_alias.csets .clear ();
19561+
19562+ for (int32_t k=0 ; k<count2; k++)
19563+ {
19564+ if (!p_igetw (&tempword,f))
1954719565 {
1954819566 return 0 ;
1954919567 }
19550-
19551- if (!p_getc (&temp_alias.height ,f))
19568+ else
1955219569 {
19553- return 0 ;
19570+ temp_alias. combos [k] = tempword ;
1955419571 }
19572+ }
1955519573
19556- if (!p_getc (&temp_alias.layermask ,f))
19574+ for (int32_t k=0 ; k<count2; k++)
19575+ {
19576+ if (!p_getc (&tempcset,f))
1955719577 {
1955819578 return 0 ;
1955919579 }
19560- // These values are flexible, and may differ in size, so we delete them
19561- // and recreate them at the correct size on the pointer.
19562- delete[] temp_alias.combos ;
19563- temp_alias.combos = new word[count2];
19564- delete[] temp_alias.csets ;
19565- temp_alias.csets = new byte[count2];
19566-
19567- for (int32_t k=0 ; k<count2; k++)
19580+ else
1956819581 {
19569- if (!p_igetw (&tempword,f))
19570- {
19571- return 0 ;
19572- }
19573- else
19574- {
19575- temp_alias.combos [k] = tempword;
19576- }
19582+ temp_alias.csets [k] = tempcset;
1957719583 }
19578-
19579- for (int32_t k=0 ; k<count2; k++)
19580- {
19581- if (!p_getc (&tempcset,f))
19582- {
19583- return 0 ;
19584- }
19585- else
19586- {
19587- temp_alias.csets [k] = tempcset;
1958819584 }
19589- }
19590-
1959119585
1959219586 if ( start+(tilect) < MAXCOMBOALIASES )
1959319587 {
1959419588 memcpy (&combo_aliases[start+(tilect)],&temp_alias,sizeof (temp_alias));
1959519589 }
1959619590 }
19597-
19598-
19599- // ::memcpy(&(newtilebuf[tile_index]),&temptile,sizeof(tiledata));
19600-
19601-
1960219591 return 1 ;
19603-
1960419592}
1960519593int32_t writecomboaliasfile (PACKFILE *f, int32_t index, int32_t count)
1960619594{
0 commit comments