Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
1.6.5更新,修复explode的fire参数失效问题
Browse files Browse the repository at this point in the history
  • Loading branch information
twoone3 committed Aug 8, 2021
1 parent 52aece3 commit bead89a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
1 change: 0 additions & 1 deletion BDSpyrunner/BDSpyrunner.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="json.hpp" />
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
Expand Down
3 changes: 0 additions & 3 deletions BDSpyrunner/BDSpyrunner.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
<ClInclude Include="pch.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="json.hpp">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />
Expand Down
8 changes: 5 additions & 3 deletions BDSpyrunner/mod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1599,7 +1599,7 @@ static PyObject* PyAPI_explode(PyObject*, PyObject* args) {
BlockSource* bs = _level->getBlockSource(did);
if (!bs)
Py_RETURN_ERROR("Unknown dimension ID");
onLevelExplode::original(_level, bs, nullptr, pos, power, true, destroy, range, true);
onLevelExplode::original(_level, bs, nullptr, pos, power, fire, destroy, range, true);
}
Py_RETURN_NONE;
}
Expand Down Expand Up @@ -1649,7 +1649,9 @@ void init() {
if (!exists(PLUGIN_PATH))
create_directories(PLUGIN_PATH);
//将plugins/py加入模块搜索路径
Py_SetPath((PLUGIN_PATH L";" + wstring(Py_GetPath())).c_str());
wstring py_path(PLUGIN_PATH L";");
py_path += Py_GetPath();
Py_SetPath(py_path.c_str());
#pragma region 预初始化3.8+
//PyPreConfig cfg;
//PyPreConfig_InitPythonConfig(&cfg);
Expand All @@ -1667,7 +1669,7 @@ void init() {
if (path.extension() == ".py" || path.extension() == ".pyd") {
const string& name = path.stem().u8string();
INFO("loading " << name);
PyImport_ImportModule(name.c_str());
PyImport_Import(PyUnicode_FromStringAndSize(name.c_str(), name.length()));
PyErr_Print();
}
}
Expand Down
5 changes: 2 additions & 3 deletions BDSpyrunner/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ using std::map;
using std::unordered_map;
using std::function;
using std::unique_ptr;
using std::exception;
using std::ostream;
using std::cout;
using std::cerr;
Expand Down Expand Up @@ -71,14 +70,14 @@ constexpr size_t Hash(const char* s) {
unsigned h = 0;
for (; *s; ++s)
h = 5 * h + *s;
return size_t(h);
return static_cast<size_t>(h);
}
//转换字符串为json
static json StringtoJson(string_view str) {
try {
return json::parse(str);
}
catch (const exception& e) {
catch (const json::exception& e) {
ERR(e.what());
return nullptr;
}
Expand Down

0 comments on commit bead89a

Please sign in to comment.