vs2022 build

This commit is contained in:
Federico Cecchetto 2022-02-17 20:22:28 +01:00
parent 841c26762a
commit 6f9cb89b54
6 changed files with 45 additions and 22 deletions

View File

@ -1,3 +1,4 @@
@echo off
git submodule update --init --recursive
tools\premake5 %* vs2019
tools\premake5 %* vs2022
pause

View File

@ -248,25 +248,23 @@ end
flags {"NoIncrementalLink", "NoMinimalRebuild", "MultiProcessorCompile", "No64BitChecks"}
filter "platforms:x64"
defines {"_WINDOWS", "WIN32"}
filter {}
configuration "windows"
defines {"_WINDOWS", "WIN32"}
filter "configurations:Release"
optimize "Size"
buildoptions {"/GL"}
linkoptions { "/IGNORE:4702", "/LTCG" }
defines {"NDEBUG"}
flags {"FatalCompileWarnings"}
filter {}
configuration "Release"
optimize "Size"
buildoptions {"/GL"}
linkoptions { "/IGNORE:4702", "/LTCG" }
defines {"NDEBUG"}
flags {"FatalCompileWarnings"}
configuration "Debug"
optimize "Debug"
buildoptions {"/bigobj"}
defines {"DEBUG", "_DEBUG"}
configuration {}
filter "configurations:Debug"
optimize "Debug"
buildoptions {"/bigobj"}
defines {"DEBUG", "_DEBUG"}
filter {}
project "common"
kind "StaticLib"

View File

@ -264,8 +264,6 @@ namespace scripting
void array::set(const std::string& key, const script_value& _value) const
{
const auto value = _value.get_raw();
const auto string_value = game::SL_GetString(key.data(), 0);
const auto variable_id = this->get_value_id(key);
if (!variable_id)

View File

@ -30,7 +30,20 @@ namespace scripting::lua
);
}
void setup_entity_type(sol::state& state, event_handler& handler, scheduler& scheduler)
void setup_io(sol::state& state)
{
state["io"]["fileexists"] = utils::io::file_exists;
state["io"]["writefile"] = utils::io::write_file;
state["io"]["filesize"] = utils::io::file_size;
state["io"]["createdirectory"] = utils::io::create_directory;
state["io"]["directoryexists"] = utils::io::directory_exists;
state["io"]["directoryisempty"] = utils::io::directory_is_empty;
state["io"]["listfiles"] = utils::io::list_files;
state["io"]["copyfolder"] = utils::io::copy_folder;
state["io"]["readfile"] = static_cast<std::string(*)(const std::string&)>(utils::io::read_file);
}
void setup_vector_type(sol::state& state)
{
state["level"] = entity{*::game::levelEntityId};
state["player"] = call("getentbynum", {0}).as<entity>();
@ -181,6 +194,12 @@ namespace scripting::lua
{
return call("anglestoforward", {a}).as<vector>();
};
}
void setup_entity_type(sol::state& state, event_handler& handler, scheduler& scheduler)
{
state["level"] = entity{ *::game::levelEntityId };
state["player"] = call("getentbynum", { 0 }).as<entity>();
auto entity_type = state.new_usertype<entity>("entity");
@ -307,7 +326,10 @@ namespace scripting::lua
std::vector<unsigned int> returns = {entref.entnum, entref.classnum};
return sol::as_returns(returns);
};
}
void setup_game_type(sol::state& state, event_handler& handler, scheduler& scheduler)
{
struct game
{
};
@ -407,7 +429,7 @@ namespace scripting::lua
return detour;
};
game_type["getfunctions"] = [entity_type](const game&, const sol::this_state s, const std::string& filename)
game_type["getfunctions"] = [](const game&, const sol::this_state s, const std::string& filename)
{
if (scripting::script_function_table.find(filename) == scripting::script_function_table.end())
{
@ -611,7 +633,10 @@ namespace scripting::lua
return this->folder_;
};
setup_io(this->state_);
setup_vector_type(this->state_);
setup_entity_type(this->state_, this->event_handler_, this->scheduler_);
setup_game_type(this->state_, this->event_handler_, this->scheduler_);
printf("Loading script '%s'\n", this->folder_.data());
this->load_script("__init__");

View File

@ -10,6 +10,7 @@
#pragma warning(disable: 4702)
#pragma warning(disable: 4996)
#pragma warning(disable: 5054)
#pragma warning(disable: 5056)
#pragma warning(disable: 6011)
#pragma warning(disable: 6297)
#pragma warning(disable: 6385)

Binary file not shown.