Explorar o código

Banned arts and skills cannot be randomly rewarded

nordsoft %!s(int64=2) %!d(string=hai) anos
pai
achega
b40a3a1b14
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      lib/mapObjects/JsonRandom.cpp

+ 8 - 0
lib/mapObjects/JsonRandom.cpp

@@ -21,6 +21,8 @@
 #include "../CCreatureSet.h"
 #include "../spells/CSpellHandler.h"
 #include "../CSkillHandler.h"
+#include "../mapObjects/CObjectHandler.h"
+#include "../IGameCallback.h"
 
 VCMI_LIB_NAMESPACE_BEGIN
 
@@ -132,7 +134,10 @@ namespace JsonRandom
 		{
 			std::set<std::string> defaultSkills;
 			for(const auto & skill : VLC->skillh->objects)
+			{
+				IObjectInterface::cb->isAllowed(2, skill->getIndex());
 				defaultSkills.insert(skill->getNameTextID());
+			}
 			
 			for(const auto & element : value.Vector())
 			{
@@ -177,6 +182,9 @@ namespace JsonRandom
 
 			if(!allowedClasses.empty() && !allowedClasses.count(art->aClass))
 				return false;
+			
+			if(!IObjectInterface::cb->isAllowed(1, art->getIndex()))
+				return false;
 
 			if(!allowedPositions.empty())
 			{