-
Notifications
You must be signed in to change notification settings - Fork 8
Fix bug where unmade splits become 0 and unbeatable and unsaveable #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fix for wins1ey#81 on upstream. Thank you Des for the help
They weren't saving because they weren't being checked individually for not being 0 or llongmax
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have no idea whats happening but i guess its ok
by the way, the commit's email is not connected to your github account (they appear as anonymously named commits) |
// Only save the split if it's above 0. Otherwise it's impossible to beat 0 | ||
if (game->split_times[i] != 0 && game->split_times[i] != LLONG_MAX) { | ||
ls_time_string_serialized(str, game->split_times[i]); | ||
json_object_set_new(split, "time", json_string(str)); | ||
} | ||
if (game->best_splits[i] == 0 && game->best_splits[i] != LLONG_MAX) { | ||
ls_time_string_serialized(str, game->best_splits[i]); | ||
json_object_set_new(split, "best_time", json_string(str)); | ||
} | ||
if (game->best_segments[i] != 0 && game->best_segments[i] != LLONG_MAX) { | ||
ls_time_string_serialized(str, game->best_segments[i]); | ||
json_object_set_new(split, "best_segment", json_string(str)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your comment says you're checking if the split time is above zero but it only checks if the split time is not equal to zero (same with checking if it's below LLONG_MAX). Even if this is unlikely to cause any issues with use of the program, it would probably be better for this to be changed to a greater than >
and less than <
check to avoid issues in the future.
Fix for #81 on upstream. Thank you Des for the help