From: NHOrus Date: Wed, 13 Sep 2017 16:34:35 +0000 (+0300) Subject: Unlike objects, player doesn't go to -1 when destroyed. X-Git-Tag: 1.5~15 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=5ff7592a51292856a05a47778e6c3c17b3df3258;p=open-adventure.git Unlike objects, player doesn't go to -1 when destroyed. Tighten bounds check. --- diff --git a/saveresume.c b/saveresume.c index 8bd4418..d494015 100644 --- a/saveresume.c +++ b/saveresume.c @@ -153,10 +153,10 @@ bool is_valid(struct game_t* valgame) /* Bounds check for locations */ if ( valgame->chloc < -1 || valgame->chloc > NLOCATIONS || valgame->chloc2 < -1 || valgame->chloc2 > NLOCATIONS || - valgame->loc < -1 || valgame->loc > NLOCATIONS || - valgame->newloc < -1 || valgame->newloc > NLOCATIONS || - valgame->oldloc < -1 || valgame->oldloc > NLOCATIONS || - valgame->oldlc2 < -1 || valgame->oldlc2 > NLOCATIONS) { + valgame->loc < 0 || valgame->loc > NLOCATIONS || + valgame->newloc < 0 || valgame->newloc > NLOCATIONS || + valgame->oldloc < 0 || valgame->oldloc > NLOCATIONS || + valgame->oldlc2 < 0 || valgame->oldlc2 > NLOCATIONS) { return false; } /* Bounds check for location arrays */