diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-10-30 09:47:48 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-10-30 09:47:48 +0000 |
commit | b6127cd95e70fcac2b6c790bac7b14871aaf3bf4 (patch) | |
tree | 51ef127afdbebb93191acaf1814b8a5b286bb57e | |
parent | f4b6c99b98c62f48b0726decaf65caec828169ef (diff) | |
download | crawl-ref-b6127cd95e70fcac2b6c790bac7b14871aaf3bf4.tar.gz crawl-ref-b6127cd95e70fcac2b6c790bac7b14871aaf3bf4.zip |
Fixed miscast beam segfaults.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup@310 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/spl-cast.cc | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index e8677c76fe..2792966e76 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -2151,7 +2151,9 @@ bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, beam.colour = random_colour(); beam.beam_source = NON_MONSTER; beam.thrower = (cause) ? KILL_MISC : KILL_YOU; - beam.aux_source = cause; + beam.aux_source.clear(); + if (cause) + beam.aux_source = cause; beam.ex_size = 1; beam.is_explosion = true; @@ -2179,7 +2181,9 @@ bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, beam.colour = random_colour(); beam.beam_source = NON_MONSTER; beam.thrower = (cause) ? KILL_MISC : KILL_YOU; - beam.aux_source = cause; + beam.aux_source.clear(); + if (cause) + beam.aux_source = cause; beam.ex_size = coinflip()?1:2; beam.is_explosion = true; @@ -3070,7 +3074,9 @@ bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, beam.colour = RED; beam.beam_source = NON_MONSTER; beam.thrower = (cause) ? KILL_MISC : KILL_YOU; - beam.aux_source = cause; + beam.aux_source.clear(); + if (cause) + beam.aux_source = cause; beam.ex_size = 1; beam.is_explosion = true; @@ -3102,7 +3108,9 @@ bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, beam.colour = RED; beam.beam_source = NON_MONSTER; beam.thrower = (cause) ? KILL_MISC : KILL_YOU; - beam.aux_source = cause; + beam.aux_source.clear(); + if (cause) + beam.aux_source = cause; beam.ex_size = coinflip()?1:2; beam.is_explosion = true; @@ -3204,7 +3212,9 @@ bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, beam.colour = WHITE; beam.beam_source = NON_MONSTER; beam.thrower = (cause) ? KILL_MISC : KILL_YOU; - beam.aux_source = cause; + beam.aux_source.clear(); + if (cause) + beam.aux_source = cause; beam.ex_size = 1; beam.is_explosion = true; @@ -3333,7 +3343,9 @@ bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, beam.beam_source = NON_MONSTER; beam.thrower = (cause) ? KILL_MISC : KILL_YOU; - beam.aux_source = cause; + beam.aux_source.clear(); + if (cause) + beam.aux_source = cause; beam.ex_size = 1; beam.is_explosion = true; @@ -3443,7 +3455,9 @@ bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, beam.colour = LIGHTBLUE; beam.beam_source = NON_MONSTER; beam.thrower = (cause) ? KILL_MISC : KILL_YOU; - beam.aux_source = cause; + beam.aux_source.clear(); + if (cause) + beam.aux_source = cause; beam.ex_size = one_chance_in(4)?1:2; beam.is_explosion = true; |