fixed copying level from native R'n'D to MM engine
authorHolger Schemel <info@artsoft.org>
Wed, 22 Feb 2017 18:48:20 +0000 (19:48 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 23 Mar 2018 22:21:09 +0000 (23:21 +0100)
src/files.c
src/game_mm/export.h

index 795aeda2befb595fc04508083404fd91e729275f..0f478eb10164b241c93a980ce86c35f44e007a8a 100644 (file)
@@ -3917,7 +3917,8 @@ void CopyNativeLevel_RND_to_MM(struct LevelInfo *level)
 
   for (x = 0; x < level->fieldx; x++)
     for (y = 0; y < level->fieldy; y++)
-      level_mm->field[x][y] = map_element_RND_to_MM(level->field[x][y]);
+      Ur[x][y] =
+       level_mm->field[x][y] = map_element_RND_to_MM(level->field[x][y]);
 }
 
 void CopyNativeLevel_MM_to_RND(struct LevelInfo *level)
@@ -3947,6 +3948,17 @@ void CopyNativeLevel_MM_to_RND(struct LevelInfo *level)
   for (x = 0; x < level->fieldx; x++)
     for (y = 0; y < level->fieldy; y++)
       level->field[x][y] = map_element_MM_to_RND(level_mm->field[x][y]);
+
+  if (level_mm->auto_count_kettles)
+  {
+    level->gems_needed = 0;
+
+    for (x = 0; x < level->fieldx; x++)
+      for (y = 0; y < level->fieldy; y++)
+       if (level->field[x][y] == EL_MM_KETTLE ||
+           level->field[x][y] == EL_DF_CELL)
+         level->gems_needed++;
+  }
 }
 
 
index eb6a6aa712059f51cd16583544956529dd96148f..07417cee825c1930be9ec088cf685b6a5bc201b1 100644 (file)
@@ -187,6 +187,8 @@ extern struct GameInfo_MM game_mm;
 extern struct LevelInfo_MM native_mm_level;
 extern struct EngineSnapshotInfo_MM engine_snapshot_mm;
 
+extern short Ur[MM_MAX_PLAYFIELD_WIDTH][MM_MAX_PLAYFIELD_HEIGHT];
+
 extern void mm_open_all();
 extern void mm_close_all();