瀏覽代碼

Resolves an issue with mob avail options (#4651)

* Fixes #4647.
* Resolves an issue with mob avail options not properly checking the state of the option label.
Thanks to @Litro!
Aleos 5 年之前
父節點
當前提交
b13bc7402c
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      src/map/mob.cpp

+ 5 - 4
src/map/mob.cpp

@@ -4621,9 +4621,10 @@ uint64 MobAvailDatabase::parseBodyNode(const YAML::Node &node) {
 	}
 
 	if (this->nodeExists(node, "Options")) {
-		for (const auto &optionNode : node["Options"]) {
-			std::string option = optionNode.first.as<std::string>();
-			std::string option_constant = "OPTION_" + option;
+		const YAML::Node &optionNode = node["Options"];
+
+		for (const auto &it : optionNode) {
+			std::string option = it.first.as<std::string>(), option_constant = "OPTION_" + option;
 			int64 constant;
 
 			if (!script_get_constant(option_constant.c_str(), &constant)) {
@@ -4633,7 +4634,7 @@ uint64 MobAvailDatabase::parseBodyNode(const YAML::Node &node) {
 
 			bool active;
 
-			if (!this->asBool(node, option, active))
+			if (!this->asBool(optionNode, option, active))
 				continue;
 
 #ifdef NEW_CARTS