Laserlicht 2 недель назад
Родитель
Сommit
8a91fa6e90
1 измененных файлов с 6 добавлено и 11 удалено
  1. 6 11
      client/adventureMap/CInfoBar.cpp

+ 6 - 11
client/adventureMap/CInfoBar.cpp

@@ -33,6 +33,7 @@
 #include "../../lib/texts/CGeneralTextHandler.h"
 #include "../../lib/mapObjects/CGHeroInstance.h"
 #include "../../lib/mapObjects/CGTownInstance.h"
+#include "../../lib/filesystem/Filesystem.h"
 
 CInfoBar::CVisibleInfo::CVisibleInfo()
 	: CIntObject(0, Point(offset_x, offset_y))
@@ -99,19 +100,13 @@ AnimationPath CInfoBar::VisibleDateInfo::getNewDayName()
 		return AnimationPath::builtin("NEWDAY");
 
 	int week = GAME->interface()->cb->getDate(Date::WEEK);
-	int wrappedWeek = ((week - 1) % 4) + 1;
-	switch(wrappedWeek)
+	auto resourceName = AnimationPath::builtin("NEWWEEK" + std::to_string(week));
+	if(CResourceHandler::get()->existsResource(resourceName.addPrefix("SPRITES/")))
+		return resourceName;
+	else
 	{
-	case 1:
+		logGlobal->warn("NEWWEEK animation for week %d not found. Falling back to animation for week 1.", week);
 		return AnimationPath::builtin("NEWWEEK1");
-	case 2:
-		return AnimationPath::builtin("NEWWEEK2");
-	case 3:
-		return AnimationPath::builtin("NEWWEEK3");
-	case 4:
-		return AnimationPath::builtin("NEWWEEK4");
-	default:
-		return AnimationPath();
 	}
 }