added variables to prevent repeating expression
authorHolger Schemel <info@artsoft.org>
Mon, 12 Jun 2023 18:31:05 +0000 (20:31 +0200)
committerHolger Schemel <info@artsoft.org>
Mon, 12 Jun 2023 19:04:32 +0000 (21:04 +0200)
src/game.c

index 9b890f49d94f0cbf49d1a2f146dc5b116e70abf8..42b5d79998f076c190d9670a6fe70a34e4cfe6e7 100644 (file)
@@ -3260,12 +3260,14 @@ static void InitGameEngine(void)
 
     for (j = 0; j < ei->num_change_pages; j++)
     {
-      ei->change_page[j].actual_trigger_element = EL_EMPTY;
-      ei->change_page[j].actual_trigger_player = EL_EMPTY;
-      ei->change_page[j].actual_trigger_player_bits = CH_PLAYER_NONE;
-      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;
+      struct ElementChangeInfo *change = &ei->change_page[j];
+
+      change->actual_trigger_element = EL_EMPTY;
+      change->actual_trigger_player = EL_EMPTY;
+      change->actual_trigger_player_bits = CH_PLAYER_NONE;
+      change->actual_trigger_side = CH_SIDE_NONE;
+      change->actual_trigger_ce_value = 0;
+      change->actual_trigger_ce_score = 0;
     }
   }
 
@@ -3283,16 +3285,18 @@ static void InitGameEngine(void)
 
     for (j = 0; j < ei->num_change_pages; j++)
     {
-      if (!ei->change_page[j].can_change_or_has_action)
+      struct ElementChangeInfo *change = &ei->change_page[j];
+
+      if (!change->can_change_or_has_action)
        continue;
 
-      if (ei->change_page[j].has_event[CE_BY_OTHER_ACTION])
+      if (change->has_event[CE_BY_OTHER_ACTION])
       {
-       int trigger_element = ei->change_page[j].trigger_element;
+       int trigger_element = change->trigger_element;
 
        for (k = 0; k < NUM_CHANGE_EVENTS; k++)
        {
-         if (ei->change_page[j].has_event[k])
+         if (change->has_event[k])
          {
            if (IS_GROUP_ELEMENT(trigger_element))
            {