diff options
author | truebrain <truebrain@openttd.org> | 2011-11-29 23:21:52 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2011-11-29 23:21:52 +0000 |
commit | e37149a1def6a0e63dda8e0964abf1b82316761a (patch) | |
tree | d8f80cee8a3b1eb60feb883796e43300fb50cfb1 /src/script/squirrel.cpp | |
parent | ae8540f5e080adebca3e54c69aa7cd85a87e550b (diff) | |
download | openttd-e37149a1def6a0e63dda8e0964abf1b82316761a.tar.xz |
(svn r23362) -Codechange: refactor AIScanner, splitting it in AIScannerInfo and AIScannerLibrary
Diffstat (limited to 'src/script/squirrel.cpp')
-rw-r--r-- | src/script/squirrel.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp index 837e86987..9388c45b4 100644 --- a/src/script/squirrel.cpp +++ b/src/script/squirrel.cpp @@ -440,13 +440,19 @@ static SQInteger _io_file_read(SQUserPointer file, SQUserPointer buf, SQInteger SQRESULT Squirrel::LoadFile(HSQUIRRELVM vm, const char *filename, SQBool printerror) { size_t size; - FILE *file = FioFOpenFile(filename, "rb", AI_DIR, &size); - if (file == NULL) file = FioFOpenFile(filename, "rb", AI_LIBRARY_DIR, &size); + FILE *file; SQInteger ret; unsigned short us; unsigned char uc; SQLEXREADFUNC func; + if (strncmp(this->GetAPIName(), "AI", 2) == 0) { + file = FioFOpenFile(filename, "rb", AI_DIR, &size); + if (file == NULL) file = FioFOpenFile(filename, "rb", AI_LIBRARY_DIR, &size); + } else { + NOT_REACHED(); + } + if (file != NULL) { SQFile f(file, size); ret = fread(&us, 1, sizeof(us), file); |