diff --git a/README.md b/README.md index ae59822..91a541f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# War3 Lua - 1.1.8 (Outland) +# War3 Lua - 1.1.9 (Outland) [![build](https://github.com/Ev3nt/war3_lua/actions/workflows/build.yml/badge.svg)](https://github.com/Ev3nt/war3_lua/actions/workflows/build.yml) ![lua](https://img.shields.io/badge/lua-v5.4.4-blue) diff --git a/Src/EasyStormLib/EasyStormLib.cpp b/Src/EasyStormLib/EasyStormLib.cpp index 84db052..a1a1fa3 100644 --- a/Src/EasyStormLib/EasyStormLib.cpp +++ b/Src/EasyStormLib/EasyStormLib.cpp @@ -2,6 +2,8 @@ #include "EasyStormLib.h" #include "StormLib.h" +#define SFILE_OPEN_FROM_MPQ 0 + namespace Storm { Archive::Archive() { m_handle = NULL; @@ -51,7 +53,7 @@ namespace Storm { FillMemory(name, sizeof(name), 0); HANDLE _handle; - if (StormOpenFile(fileName.c_str(), &_handle)) { + if (StormOpenFileEx(NULL, fileName.c_str(), SFILE_OPEN_FROM_MPQ, &_handle)) { HANDLE _archive; if (StormGetFileArchive(_handle, &_archive)) { StormGetArchiveName(_archive, name, sizeof(name)); @@ -68,12 +70,7 @@ namespace Storm { HANDLE _handle = NULL; - if (m_handle) { - StormOpenFileEx(m_handle, name.c_str(), 0, &_handle); - } - else { - StormOpenFile(name.c_str(), &_handle); - } + StormOpenFileEx(m_handle ? m_handle : NULL, name.c_str(), SFILE_OPEN_FROM_MPQ, &_handle); if (_handle) { SIZE_T high; // Idk how i can use it on x32, so maximum size limit is 4gb diff --git a/Src/LuaHooks.cpp b/Src/LuaHooks.cpp index 445f1f7..57269d0 100644 --- a/Src/LuaHooks.cpp +++ b/Src/LuaHooks.cpp @@ -20,6 +20,12 @@ namespace LuaHooks { int searcher_Lua(lua_State* l) { Storm::Archive map; std::string scriptName = luaL_checkstring(l, 1); + + size_t it; + while ((it = scriptName.find('.')) != std::string::npos) { + scriptName.replace(it, 1, "\\"); + } + if (scriptName == "war3map") { map.Connect(*pMapMpq); } diff --git a/Src/pch.h b/Src/pch.h index da0baa3..2f1edaa 100644 --- a/Src/pch.h +++ b/Src/pch.h @@ -23,7 +23,7 @@ #define WAR3_LUA_MAJOR "1" #define WAR3_LUA_MINOR "1" -#define WAR3_LUA_RELEASE "8" +#define WAR3_LUA_RELEASE "9" #define WAR3_LUA_VERSION_NAME ANSI_COLOR_YELLOW "Outland" ANSI_COLOR_RESET #define WAR3_LUA_VERSION WAR3_LUA_MAJOR "." WAR3_LUA_MINOR "." WAR3_LUA_RELEASE