From: Holger Schemel Date: Sat, 1 Sep 2007 08:58:49 +0000 (+0200) Subject: rnd-20070901-1-src X-Git-Tag: 3.2.4^2~13 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=7e7bea870822b12f26c2266d0bcc23db6a1684f4;p=rocksndiamonds.git rnd-20070901-1-src * fixed bug with CE action "move player" always resulting in player 4 if there was a CE action with no trigger player (because the player element was calculated by using log_2() from trigger player bits with the value PLAYER_BITS_ANY) -- this is now fixed by also storing the triggering player bit mask and handling all players in "move player" --- diff --git a/ChangeLog b/ChangeLog index bc427113..b01037e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-09-01 + * fixed bug with CE action "move player" always resulting in player 4 + if there was a CE action with no trigger player (because the player + element was calculated by using log_2() from trigger player bits with + the value PLAYER_BITS_ANY) -- this is now fixed by also storing the + triggering player bit mask and handling all players in "move player" + 2007-08-26 * fixed broken editor copy and paste for custom elements between levels diff --git a/src/conftime.h b/src/conftime.h index a006f968..bffffdba 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-08-26 13:07" +#define COMPILE_DATE_STRING "2007-09-01 10:49" diff --git a/src/game.c b/src/game.c index 1079966e..7d83c63f 100644 --- a/src/game.c +++ b/src/game.c @@ -896,6 +896,9 @@ static struct GamePanelControlInfo game_panel_controls[] = (be) + (e) - EL_SELF > EL_CUSTOM_END ? EL_CUSTOM_END : \ (be) + (e) - EL_SELF) +#define GET_PLAYER_FROM_BITS(p) \ + (EL_PLAYER_1 + ((p) != PLAYER_BITS_ANY ? log_2(p) : 0)) + #define GET_TARGET_ELEMENT(be, e, ch, cv, cs) \ ((e) == EL_TRIGGER_PLAYER ? (ch)->actual_trigger_player : \ (e) == EL_TRIGGER_ELEMENT ? (ch)->actual_trigger_element : \ @@ -3334,6 +3337,7 @@ static void InitGameEngine() { ei->change_page[j].actual_trigger_element = EL_EMPTY; ei->change_page[j].actual_trigger_player = EL_PLAYER_1; + ei->change_page[j].actual_trigger_player_bits = CH_PLAYER_1; ei->change_page[j].actual_trigger_side = CH_SIDE_NONE; ei->change_page[j].actual_trigger_ce_value = 0; ei->change_page[j].actual_trigger_ce_score = 0; @@ -10017,11 +10021,15 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) action_mode, action_arg_number, action_arg_number_min, action_arg_number_max); +#if 1 + int trigger_player_bits = change->actual_trigger_player_bits; +#else int trigger_player_bits = (change->actual_trigger_player >= EL_PLAYER_1 && change->actual_trigger_player <= EL_PLAYER_4 ? (1 << (change->actual_trigger_player - EL_PLAYER_1)) : PLAYER_BITS_ANY); +#endif int action_arg_player_bits = (action_arg >= CA_ARG_PLAYER_1 && @@ -10527,6 +10535,7 @@ static boolean ChangeElement(int x, int y, int element, int page) /* reset actual trigger element, trigger player and action element */ change->actual_trigger_element = EL_EMPTY; change->actual_trigger_player = EL_PLAYER_1; + change->actual_trigger_player_bits = CH_PLAYER_1; change->actual_trigger_side = CH_SIDE_NONE; change->actual_trigger_ce_value = 0; change->actual_trigger_ce_score = 0; @@ -10907,7 +10916,8 @@ static boolean CheckTriggeredElementChangeExt(int trigger_x, int trigger_y, IS_EQUAL_OR_IN_GROUP(trigger_element, change->trigger_element)) { change->actual_trigger_element = trigger_element; - change->actual_trigger_player = EL_PLAYER_1 + log_2(trigger_player); + change->actual_trigger_player = GET_PLAYER_FROM_BITS(trigger_player); + change->actual_trigger_player_bits = trigger_player; change->actual_trigger_side = trigger_side; change->actual_trigger_ce_value = CustomValue[trigger_x][trigger_y]; change->actual_trigger_ce_score = GET_CE_SCORE(trigger_element); @@ -11026,7 +11036,8 @@ static boolean CheckElementChangeExt(int x, int y, IS_EQUAL_OR_IN_GROUP(trigger_element, change->trigger_element))) { change->actual_trigger_element = trigger_element; - change->actual_trigger_player = EL_PLAYER_1 + log_2(trigger_player); + change->actual_trigger_player = GET_PLAYER_FROM_BITS(trigger_player); + change->actual_trigger_player_bits = trigger_player; change->actual_trigger_side = trigger_side; change->actual_trigger_ce_value = CustomValue[x][y]; change->actual_trigger_ce_score = GET_CE_SCORE(trigger_element); diff --git a/src/main.h b/src/main.h index c191f6ac..6190a1e4 100644 --- a/src/main.h +++ b/src/main.h @@ -2403,6 +2403,7 @@ struct ElementChangeInfo short actual_trigger_element; /* element that actually triggered change */ int actual_trigger_side; /* element side that triggered the change */ int actual_trigger_player; /* player which actually triggered change */ + int actual_trigger_player_bits; /* player bits of triggering players */ int actual_trigger_ce_value; /* CE value of element that triggered change */ int actual_trigger_ce_score; /* CE score of element that triggered change */