actor_logic_changeframe was allowing frame counters to increment out of control leading to unpredictable behavior when changing state, animations would be outside their frame range

This commit is contained in:
2025-08-09 08:54:12 -04:00
parent e20752a97e
commit 93bc3addfe
3 changed files with 26 additions and 18 deletions

View File

@@ -367,7 +367,7 @@ ErrorContext *tilemap_load(char *fname, tilemap *dest)
{
PREPARE_ERROR(errctx);
json_t *json = NULL;
string *tmpstr = NULL;
//string *tmpstr = NULL;
json_error_t error;
FAIL_ZERO_RETURN(errctx, fname, ERR_NULLPOINTER, "load_tilemap received null filename");
@@ -377,16 +377,16 @@ ErrorContext *tilemap_load(char *fname, tilemap *dest)
ATTEMPT {
CATCH(errctx, heap_next_string(&tmpstr));
CATCH(errctx, string_initialize(tmpstr, NULL));
SDL_snprintf(tmpstr->data, MAX_STRING_LENGTH, "%s%s", SDL_GetBasePath(), fname);
json = json_load_file(tmpstr->data, 0, &error);
//CATCH(errctx, heap_next_string(&tmpstr));
//CATCH(errctx, string_initialize(tmpstr, NULL));
//SDL_snprintf(tmpstr->data, MAX_STRING_LENGTH, "%s%s", SDL_GetBasePath(), fname);
json = json_load_file(fname, 0, &error);
FAIL_ZERO_BREAK(
errctx,
json,
ERR_NULLPOINTER,
"Error while loading tilemap from %s on line %d: %s-",
tmpstr->data,
fname,
error.line,
error.text
);
@@ -403,7 +403,7 @@ ErrorContext *tilemap_load(char *fname, tilemap *dest)
CATCH(errctx, tilemap_load_layers((tilemap *)dest, (json_t *)json));
CATCH(errctx, tilemap_load_tilesets((tilemap *)dest, (json_t *)json));
} CLEANUP {
IGNORE(heap_release_string(tmpstr));
//IGNORE(heap_release_string(tmpstr));
} PROCESS(errctx) {
} FINISH(errctx, true);
SUCCEED_RETURN(errctx);