/* Write representation of "mo" and all of the map objects it owns to "file". */
static void write_map_object(FILE * file, struct MapObj * mo);
/* Write representation of "mo" and all of the map objects it owns to "file". */
static void write_map_object(FILE * file, struct MapObj * mo);
/* Return pointer to map object of "id" in chain starting at "ptr". */
static struct MapObj * get_map_object(struct MapObj * ptr, uint8_t id);
/* Return pointer to map object of "id" in chain starting at "ptr". */
static struct MapObj * get_map_object(struct MapObj * ptr, uint8_t id);
for (; NULL != mo_ptr; mo_ptr = mo_ptr->next, i++);
uint8_t size = 3+1 + 3+1 + 3+1 + 5+1 + 5 + ((1+3)*i) + 1 + 1;
char line[size];
for (; NULL != mo_ptr; mo_ptr = mo_ptr->next, i++);
uint8_t size = 3+1 + 3+1 + 3+1 + 5+1 + 5 + ((1+3)*i) + 1 + 1;
char line[size];
- sprintf(line, "%d %d %d %d %d",
- mo->id, mo->type, mo->lifepoints, mo->pos.y, mo->pos.x);
+ sprintf(line, "%d %d %d %d %d %d %d %d",
+ mo->id, mo->type, mo->lifepoints, mo->pos.y, mo->pos.x,
+ mo->progress, mo->command, mo->arg);
for (mo_ptr = mo->owns; NULL != mo_ptr; mo_ptr = mo_ptr->next)
{
sprintf(line + strlen(line), " %d", mo_ptr->id);
for (mo_ptr = mo->owns; NULL != mo_ptr; mo_ptr = mo_ptr->next)
{
sprintf(line + strlen(line), " %d", mo_ptr->id);
exit_err(-1 == fgetpos(file, &pos), f_name);
while (try_fgets(line, linemax + 1, file, f_name))
{
exit_err(-1 == fgetpos(file, &pos), f_name);
while (try_fgets(line, linemax + 1, file, f_name))
{
mo->next = NULL;
mo->id = atoi(strtok(line, delim));
mo->type = atoi(strtok(NULL, delim));
mo->lifepoints = atoi(strtok(NULL, delim));
mo->pos.y = atoi(strtok(NULL, delim));
mo->pos.x = atoi(strtok(NULL, delim));
mo->next = NULL;
mo->id = atoi(strtok(line, delim));
mo->type = atoi(strtok(NULL, delim));
mo->lifepoints = atoi(strtok(NULL, delim));
mo->pos.y = atoi(strtok(NULL, delim));
mo->pos.x = atoi(strtok(NULL, delim));
+ mo->progress = atoi(strtok(NULL, delim));;
+ mo->command = atoi(strtok(NULL, delim));;
+ mo->arg = atoi(strtok(NULL, delim));;
while (try_fgets(line, linemax + 1, file, f_name))
{
uint8_t id = atoi(strtok(line, delim));
while (try_fgets(line, linemax + 1, file, f_name))
{
uint8_t id = atoi(strtok(line, delim));