Merge branch 'main' into heightmaps

This commit is contained in:
MihailRis 2024-08-20 22:01:36 +03:00
commit 9eea7243d5
5 changed files with 7 additions and 7 deletions

View File

@ -106,14 +106,14 @@ public:
ContentUnitDefs(UptrsMap<std::string, T> defs) : defs(std::move(defs)) {
}
T* find(const std::string& id) const {
const T* find(const std::string& id) const {
const auto& found = defs.find(id);
if (found == defs.end()) {
return nullptr;
}
return found->second.get();
}
T& require(const std::string& id) const {
const T& require(const std::string& id) const {
const auto& found = defs.find(id);
if (found == defs.end()) {
throw std::runtime_error("missing content unit " + id);

View File

@ -360,7 +360,7 @@ static int l_raycast(lua::State* L) {
for (int i = 0; i < addLen; i++) {
lua::rawgeti(L, i + 1, 5);
auto blockName = std::string(lua::tostring(L, -1));
Block* block = content->blocks.find(blockName);
const Block* block = content->blocks.find(blockName);
if (block != nullptr) {
filteredBlocks.insert(block->rt.id);
}

View File

@ -127,7 +127,7 @@ static int l_raycast(lua::State* L) {
for (int i = 0; i < addLen; i++) {
lua::rawgeti(L, i + 1, 6);
auto blockName = std::string(lua::tostring(L, -1));
Block* block = content->blocks.find(blockName);
const Block* block = content->blocks.find(blockName);
if (block != nullptr) {
filteredBlocks.insert(block->rt.id);
}

View File

@ -75,7 +75,7 @@ static sensorcallback create_sensor_callback(Entities* entities) {
}
static void initialize_body(
EntityDef& def, Rigidbody& body, entityid_t id, Entities* entities
const EntityDef& def, Rigidbody& body, entityid_t id, Entities* entities
) {
body.sensors.resize(def.radialSensors.size() + def.boxSensors.size());
for (auto& [i, box] : def.boxSensors) {
@ -111,7 +111,7 @@ static void initialize_body(
}
entityid_t Entities::spawn(
EntityDef& def,
const EntityDef& def,
glm::vec3 position,
dynamic::Map_sptr args,
dynamic::Map_sptr saved,

View File

@ -202,7 +202,7 @@ public:
);
entityid_t spawn(
EntityDef& def,
const EntityDef& def,
glm::vec3 position,
dynamic::Map_sptr args = nullptr,
dynamic::Map_sptr saved = nullptr,