Skip to content

Commit

Permalink
Add some nice little logging
Browse files Browse the repository at this point in the history
  • Loading branch information
drawbu committed Dec 11, 2023
1 parent a25a1bb commit 20ba785
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/parser/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ int get_command(char *line, anthill_t *anthill)
if (line[1] != '#')
return RET_VALID;
if (my_strcmp(line, "##start") == 0) {
DEBUG_MSG("ENTRANCE");
my_putstr("##start\n");
anthill->step = ST_ROOM_ENTRANCE;
return RET_VALID;
}
if (my_strcmp(line, "##end") == 0) {
DEBUG_MSG("EXIT");
my_putstr("##end\n");
anthill->step = ST_ROOM_EXIT;
return RET_VALID;
}
Expand All @@ -41,11 +41,12 @@ int get_ants_num(char *line, anthill_t *anthill)
{
long value = str_to_int(line);

my_putstr("#number_of_ants\n");
if (value == INT64_MAX)
return RET_ERROR;
anthill->ants = value;
anthill->step = ST_ROOMS;
DEBUG("%d ants.", value);
my_printf("%d\n#rooms\n", value);
return RET_VALID;
}

Expand Down
2 changes: 1 addition & 1 deletion src/parser/room.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ int get_room(char *line, anthill_t *anthill)
resize_anthill(&anthill->rooms);
anthill->rooms.rooms[anthill->rooms.count] = *room;
anthill->rooms.count += 1;
DEBUG("ROOM: `%s`, x: %d, y: %d", room->name, room->x, room->y);
my_printf("%s %d %d\n", room->name, room->x, room->y);
return RET_VALID;
}

0 comments on commit 20ba785

Please sign in to comment.