rnd-20070901-1-src
authorHolger Schemel <info@artsoft.org>
Sat, 1 Sep 2007 08:58:49 +0000 (10:58 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:56:01 +0000 (10:56 +0200)
* 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"

ChangeLog
src/conftime.h
src/game.c
src/main.h

index bc427113468cb46aebee1f229fb860461fa15b70..b01037e4124484145f748a845a0176c8b4fa0b60 100644 (file)
--- 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
 
index a006f968b03bafc5a8f18499f76973f569ec49db..bffffdba7991c683c41f8ca4f9bd52dbdf416bfc 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2007-08-26 13:07"
+#define COMPILE_DATE_STRING "2007-09-01 10:49"
index 1079966e2d26079c20bbf2dbc6bda86a0c212009..7d83c63f8800dca7c19354af58e6c83de955348f 100644 (file)
@@ -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);
index c191f6ac3e3a685889700bcfffed32211914c62d..6190a1e4111bf4a7993921736bdc5534a761a75a 100644 (file)
@@ -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 */