Changed sprite and character loaders to use the explicit paths passed into them, and to use relative paths for assets referenced inside of spritesheets
Unfortunately 3 tests are broken. Lots of stuff still expects the old behavior (automatic path computation from the binary location on the filesystem)
This commit is contained in:
@@ -169,15 +169,15 @@ ErrorContext *character_load_json(char *filename)
|
||||
json_t *json;
|
||||
json_error_t error;
|
||||
character *obj = NULL;
|
||||
string *tmpstr = NULL;
|
||||
//string *tmpstr = NULL;
|
||||
|
||||
FAIL_ZERO_RETURN(errctx, filename, ERR_NULLPOINTER, "Received null filename");
|
||||
ATTEMPT {
|
||||
CATCH(errctx, heap_next_character(&obj));
|
||||
CATCH(errctx, heap_next_string(&tmpstr));
|
||||
CATCH(errctx, string_initialize(tmpstr, NULL));
|
||||
SDL_snprintf((char *)&tmpstr->data, MAX_STRING_LENGTH, "%s%s", SDL_GetBasePath(), filename);
|
||||
json = (json_t *)json_load_file((char *)&tmpstr->data, 0, &error);
|
||||
//CATCH(errctx, heap_next_string(&tmpstr));
|
||||
//CATCH(errctx, string_initialize(tmpstr, NULL));
|
||||
//SDL_snprintf((char *)&tmpstr->data, MAX_STRING_LENGTH, "%s%s", SDL_GetBasePath(), filename);
|
||||
json = (json_t *)json_load_file(filename, 0, &error);
|
||||
FAIL_ZERO_BREAK(
|
||||
errctx,
|
||||
json,
|
||||
@@ -188,7 +188,7 @@ ErrorContext *character_load_json(char *filename)
|
||||
CATCH(errctx, get_json_number_value(json, "velocity_x", &obj->vx));
|
||||
CATCH(errctx, get_json_number_value(json, "velocity_y", &obj->vy));
|
||||
} CLEANUP {
|
||||
IGNORE(heap_release_string(tmpstr));
|
||||
//IGNORE(heap_release_string(tmpstr));
|
||||
if ( errctx != NULL ) {
|
||||
if ( errctx->status != 0 ) {
|
||||
IGNORE(heap_release_character(obj));
|
||||
|
||||
Reference in New Issue
Block a user