Check if RMXP script pack path was read from Game.ini

This commit is contained in:
Jonas Kulla 2013-09-01 16:36:11 +02:00
parent ec90458925
commit 88041a2395
2 changed files with 15 additions and 3 deletions

View File

@ -166,6 +166,12 @@ static void runRMXPScripts()
{ {
const QByteArray &scriptPack = gState->rtData().config.game.scripts; const QByteArray &scriptPack = gState->rtData().config.game.scripts;
if (scriptPack.isEmpty())
{
showMsg("No game scripts specified (missing Game.ini?)");
return;
}
if (!gState->fileSystem().exists(scriptPack.constData())) if (!gState->fileSystem().exists(scriptPack.constData()))
{ {
showMsg("Unable to open '" + scriptPack + "'"); showMsg("Unable to open '" + scriptPack + "'");

View File

@ -225,9 +225,15 @@ runCustomScript(mrb_state *mrb, mrbc_context *ctx, const char *filename)
static void static void
runRMXPScripts(mrb_state *mrb, mrbc_context *ctx) runRMXPScripts(mrb_state *mrb, mrbc_context *ctx)
{ {
const QByteArray &scriptLoc = gState->rtData().config.game.scripts; const QByteArray &scriptPack = gState->rtData().config.game.scripts;
if (!gState->fileSystem().exists(scriptLoc.constData())) if (scriptPack.isEmpty())
{
showError("No game scripts specified (missing Game.ini?)");
return;
}
if (!gState->fileSystem().exists(scriptPack.constData()))
{ {
showError("Unable to open '" + scriptLoc + "'"); showError("Unable to open '" + scriptLoc + "'");
return; return;
@ -237,7 +243,7 @@ runRMXPScripts(mrb_state *mrb, mrbc_context *ctx)
mrb_state *scriptMrb = mrb_open(); mrb_state *scriptMrb = mrb_open();
SDL_RWops ops; SDL_RWops ops;
gState->fileSystem().openRead(ops, scriptLoc.constData()); gState->fileSystem().openRead(ops, scriptPack.constData());
mrb_value scriptArray = marshalLoadInt(scriptMrb, &ops); mrb_value scriptArray = marshalLoadInt(scriptMrb, &ops);
SDL_RWclose(&ops); SDL_RWclose(&ops);