* better error handling for monsters and spells loader

* check if file exist before loading
* save errors to system/logs/error.log
This commit is contained in:
slawkens1
2017-10-16 23:31:28 +02:00
parent c914a73352
commit 66a3c46aaf
9 changed files with 119 additions and 22 deletions

View File

@@ -65,7 +65,12 @@ $canEdit = hasFlag(FLAG_CONTENT_MONSTERS) || admin();
if(isset($_POST['reload_monsters']) && $canEdit)
{
require LIBS . 'creatures.php';
Creatures::loadFromXML(true);
if(Creatures::loadFromXML(true))
if(Creatures::getMonstersList()->hasErrors())
error('There were some problems loading your monsters.xml file. Please check system/logs/error.log for more info.');
else {
error(Creatures::getLastError());
}
}
if($canEdit)