Kaynağa Gözat

introduce `modScope` into `ObstacleInfo`

godric3 1 yıl önce
ebeveyn
işleme
0ef42a1d3d
2 değiştirilmiş dosya ile 4 ekleme ve 2 silme
  1. 3 2
      lib/ObstacleHandler.cpp
  2. 1 0
      lib/ObstacleHandler.h

+ 3 - 2
lib/ObstacleHandler.cpp

@@ -28,12 +28,12 @@ int32_t ObstacleInfo::getIconIndex() const
 
 std::string ObstacleInfo::getJsonKey() const
 {
-	return identifier;
+	return modScope + ':' + identifier;
 }
 
 std::string ObstacleInfo::getModScope() const
 {
-	return "core";
+	return modScope;
 }
 
 std::string ObstacleInfo::getNameTranslated() const
@@ -96,6 +96,7 @@ std::shared_ptr<ObstacleInfo> ObstacleHandler::loadFromJson(const std::string &
 
 	auto info = std::make_shared<ObstacleInfo>(Obstacle(index), identifier);
 	
+	info->modScope = scope;
 	info->animation = AnimationPath::fromJson(json["animation"]);
 	info->width = json["width"].Integer();
 	info->height = json["height"].Integer();

+ 1 - 0
lib/ObstacleHandler.h

@@ -31,6 +31,7 @@ public:
 	
 	Obstacle obstacle;
 	si32 iconIndex;
+	std::string modScope;
 	std::string identifier;
 	AudioPath appearSound;
 	AnimationPath appearAnimation;