From: Christian Heller Date: Sun, 1 Dec 2013 02:42:29 +0000 (+0100) Subject: Small refactoring of read_map_objects(). X-Git-Tag: tce~901 X-Git-Url: https://plomlompom.com/repos/te"st.html?a=commitdiff_plain;h=67bcb0339e09a67fe1685cf81e35ccac18eba0c5;p=plomrogue Small refactoring of read_map_objects(). --- diff --git a/src/map_objects.c b/src/map_objects.c index fd4bd16..a60395c 100644 --- a/src/map_objects.c +++ b/src/map_objects.c @@ -125,12 +125,11 @@ extern void read_map_objects(FILE * file, char * line, int linemax) char * f_name = "read_map_objects()"; struct MapObj ** mo_ptr_ptr = &world.map_objs; char * delim = " "; - struct MapObj * mo; fpos_t pos; exit_err(-1 == fgetpos(file, &pos), f_name); while (try_fgets(line, linemax + 1, file, f_name)) { - mo = try_malloc(sizeof(struct MapObj), f_name); + struct MapObj * mo = try_malloc(sizeof(struct MapObj), f_name); mo->next = NULL; mo->id = atoi(strtok(line, delim)); mo->type = atoi(strtok(NULL, delim)); @@ -153,7 +152,7 @@ extern void read_map_objects(FILE * file, char * line, int linemax) char * owned = strtok(NULL, "\n"); if (NULL != owned) { - mo = get_map_object(world.map_objs, id); + struct MapObj * mo = get_map_object(world.map_objs, id); char * owned_id = ""; owned_id = strtok(owned, delim); while (NULL != owned_id)