world.score = 0;
world.log = calloc(1, sizeof(char));
set_cleanup_flag(CLEANUP_LOG);
- update_log (&world, " ");
+ update_log(&world, " ");
struct Player player;
player.hitpoints = 5;
world.player = &player;
err = "Trouble in init_win_from_file() with fgets().";
exit_err(NULL == fgets(line, linemax, file), world, err);
char * title = malloc(strlen(line));
- memcpy(title, line, strlen(line) - 1);
+ memcpy(title, line, strlen(line) - 1); /* Eliminate newline char at end */
+ title[strlen(line) - 1] = '\0'; /* of string. */
exit_err(NULL == fgets(line, linemax, file), world, err);
int16_t height = atoi(line);
exit_err(NULL == fgets(line, linemax, file), world, err);
{
return 1;
}
- sprintf(w->_title, title, strlen(title));
+ sprintf(w->_title, "%s", title);
w->data = data;
w->_draw = func;
if (0 < width)