From 3792cc7312a86e90a97e6e5859248e3a1b857501 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 21 Apr 2013 19:55:26 +0000 Subject: [PATCH] Mapster32: in quick tile selection [G], if tile is nonexistent, revert it. git-svn-id: https://svn.eduke32.com/eduke32@3698 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/astub.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 28675454b..0ab3faf5d 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -6258,14 +6258,20 @@ static void Keys3d(void) { if (ASSERT_AIMING) { - int32_t aiming_at_sprite = AIMING_AT_SPRITE, osearchwall=searchwall; - int16_t *picnumptr = AIMING_AT_WALL_OR_MASK ? &AIMED_SELOVR_PICNUM : &AIMED_CF_SEL(picnum); + int16_t *const picnumptr = AIMING_AT_WALL_OR_MASK ? &AIMED_SELOVR_PICNUM : &AIMED_CF_SEL(picnum); + const int32_t aiming_at_sprite = AIMING_AT_SPRITE; + const int32_t opicnum = *picnumptr, osearchwall = searchwall; static const char *Typestr_tmp[5] = { "Wall", "Sector ceiling", "Sector floor", "Sprite", "Masked wall" }; Bsprintf(tempbuf, "%s picnum: ", Typestr_tmp[searchstat]); getnumberptr256(tempbuf, picnumptr, sizeof(int16_t), MAXTILES-1, 0+2, NULL); - if (*picnumptr != AIMED_CF_SEL(picnum)) + + Bassert((unsigned)*picnumptr < MAXTILES); + if (!tile_exists(*picnumptr)) + *picnumptr = opicnum; + + if (*picnumptr != opicnum) asksave = 1; // need to use the old value because aiming might have changed in getnumberptr256