added some performance tuning for "autotest" and warp mode
[rocksndiamonds.git] / src / game.c
index ee6de4e8fd13b2ee20f78413c8c628b648c6e118..e159b96ef2183c7d6c73aed8c0f709872fefe5d6 100644 (file)
@@ -2702,6 +2702,9 @@ static void InitGameEngine()
   game_em.use_single_button =
     (game.engine_version > VERSION_IDENT(4,0,0,2));
 
+  game_em.use_snap_key_bug =
+    (game.engine_version < VERSION_IDENT(4,0,1,0));
+
   /* ---------------------------------------------------------------------- */
 
   /* set maximal allowed number of custom element changes per game frame */
@@ -4596,6 +4599,10 @@ void InitPlayerGfxAnimation(struct PlayerInfo *player, int action, int dir)
 
 static void ResetGfxFrame(int x, int y)
 {
+  // profiling showed that "autotest" spends 10~20% of its time in this function
+  if (DrawingDeactivatedField())
+    return;
+
   int element = Feld[x][y];
   int graphic = el_act_dir2img(element, GfxAction[x][y], GfxDir[x][y]);
 
@@ -14250,7 +14257,7 @@ static void FadeLevelMusic()
 {
   int music_nr = getLevelMusicNr();
   char *curr_music = getCurrentlyPlayingMusicFilename();
-  char *next_music = getMusicListEntry(music_nr)->filename;
+  char *next_music = getMusicInfoEntryFilename(music_nr);
 
   if (!strEqual(curr_music, next_music))
     FadeMusic();
@@ -14266,7 +14273,7 @@ static void PlayLevelMusic()
 {
   int music_nr = getLevelMusicNr();
   char *curr_music = getCurrentlyPlayingMusicFilename();
-  char *next_music = getMusicListEntry(music_nr)->filename;
+  char *next_music = getMusicInfoEntryFilename(music_nr);
 
   if (!strEqual(curr_music, next_music))
     PlayMusic(music_nr);