Fix python AIs, they never worked properly...
...since their path got moved, due to a lack of trailing slash.
This commit is contained in:
parent
f281d58fe2
commit
1db74585f9
2 changed files with 13 additions and 2 deletions
|
@ -12,8 +12,14 @@ def include(matchob):
|
|||
names = [x.strip() for x in matchob.group(1).split(",")]
|
||||
r = ""
|
||||
for name in names:
|
||||
alias = None
|
||||
if " as " in name:
|
||||
(name, ignored, alias) = name.split(' ')
|
||||
if name in whitelisted:
|
||||
modules[name] = __import__(name)
|
||||
if alias:
|
||||
modules[alias] = __import__(name)
|
||||
else:
|
||||
modules[name] = __import__(name)
|
||||
continue
|
||||
for path in pathes:
|
||||
includefile = os.path.join(path, name)
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
#include <marshal.h>
|
||||
|
||||
#define LOG_AI LOG_STREAM(info, ai)
|
||||
#define ERR_AI LOG_STREAM(err, ai)
|
||||
|
||||
#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 4
|
||||
#define Py_ssize_t int
|
||||
|
@ -2206,7 +2207,11 @@ void python_ai::play_turn()
|
|||
std::cerr << "\"" << script_name << "\" is not a valid script name.\n";
|
||||
return;
|
||||
}
|
||||
std::string script = get_binary_file_location("data", "ai/python" + script_name);
|
||||
std::string script = get_binary_file_location("data", "ai/python/" + script_name);
|
||||
if (script == "") {
|
||||
ERR_AI << "Python AI script '" << script_name << "' not found.\n";
|
||||
throw exception;
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue