scriptenv?

This commit is contained in:
MihailRis
2024-04-21 15:41:47 +03:00
parent d213902648
commit 635e512142
26 changed files with 128 additions and 158 deletions
+1 -2
View File
@@ -19,7 +19,6 @@
#include "ContentPack.h"
#include "../logic/scripting/scripting.h"
#include "../logic/scripting/Environment.h"
namespace fs = std::filesystem;
@@ -328,7 +327,7 @@ void ContentLoader::load(ContentBuilder& builder) {
auto runtime = new ContentPackRuntime(*pack, scripting::create_pack_environment(*pack));
builder.add(runtime);
env = runtime->getEnvironment()->getId();
env = runtime->getEnvironment();
ContentPackStats& stats = runtime->getStatsWriteable();
fixPackIndices();
+1 -1
View File
@@ -18,7 +18,7 @@ namespace dynamic {
class ContentLoader {
const ContentPack* pack;
int env = 0;
scriptenv env;
void loadBlock(Block& def, std::string full, std::string name);
void loadCustomBlockModel(Block& def, dynamic::Map* primitives);
+1 -2
View File
@@ -7,7 +7,6 @@
#include "../files/files.h"
#include "../files/engine_paths.h"
#include "../data/dynamic.h"
#include "../logic/scripting/Environment.h"
namespace fs = std::filesystem;
@@ -141,7 +140,7 @@ fs::path ContentPack::findPack(const EnginePaths* paths, fs::path worldDir, std:
ContentPackRuntime::ContentPackRuntime(
ContentPack info,
std::unique_ptr<scripting::Environment> env
scriptenv env
) : info(info), env(std::move(env))
{
}
+6 -4
View File
@@ -1,6 +1,8 @@
#ifndef CONTENT_CONTENT_PACK_H_
#define CONTENT_CONTENT_PACK_H_
#include "../typedefs.h"
#include <string>
#include <vector>
#include <stdexcept>
@@ -85,11 +87,11 @@ struct ContentPackStats {
class ContentPackRuntime {
ContentPack info;
ContentPackStats stats {};
std::unique_ptr<scripting::Environment> env;
scriptenv env;
public:
ContentPackRuntime(
ContentPack info,
std::unique_ptr<scripting::Environment> env
scriptenv env
);
~ContentPackRuntime();
@@ -109,8 +111,8 @@ public:
return info;
}
inline scripting::Environment* getEnvironment() const {
return env.get();
inline scriptenv getEnvironment() const {
return env;
}
};