diff --git a/system/libs/pot/OTS_Monster.php b/system/libs/pot/OTS_Monster.php index 6c2e05b3..a8079890 100644 --- a/system/libs/pot/OTS_Monster.php +++ b/system/libs/pot/OTS_Monster.php @@ -39,6 +39,16 @@ */ class OTS_Monster extends DOMDocument { + private $loaded = false; + public function loadXML($source , $options = 0) + { + $this->loaded = parent::loadXML($source, $options); + } + + public function loaded() + { + return $this->loaded; + } /** * Returns monster name. * diff --git a/system/libs/pot/OTS_MonstersList.php b/system/libs/pot/OTS_MonstersList.php index e1fdef1f..5e9a424c 100644 --- a/system/libs/pot/OTS_MonstersList.php +++ b/system/libs/pot/OTS_MonstersList.php @@ -117,7 +117,8 @@ class OTS_MonstersList implements Iterator, Countable, ArrayAccess { // loads file $monster = new OTS_Monster(); - $monster->load($this->monstersPath . $this->monsters[$name]); + //echo $this->monstersPath . $this->monsters[$name]; + $monster->loadXML(trim(file_get_contents($this->monstersPath . $this->monsters[$name]))); return $monster; } diff --git a/system/pages/creatures.php b/system/pages/creatures.php index 108e0c93..f80954c9 100644 --- a/system/pages/creatures.php +++ b/system/pages/creatures.php @@ -72,6 +72,10 @@ if(isset($_POST['reload_monsters']) && $canEdit) //add monsters foreach($allmonsters as $lol) { $monster = $allmonsters->current(); + if(!$monster->loaded()) { + warning('Error while adding monster: ' . $allmonsters->currentFile()); + continue; + } //load monster mana needed to summon/convince $mana = $monster->getManaCost(); //load monster experience