Merge branch 'main' into heightmaps

This commit is contained in:
MihailRis
2024-08-20 22:01:36 +03:00
5 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -106,14 +106,14 @@ public:
ContentUnitDefs(UptrsMap<std::string, T> defs) : defs(std::move(defs)) { 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); const auto& found = defs.find(id);
if (found == defs.end()) { if (found == defs.end()) {
return nullptr; return nullptr;
} }
return found->second.get(); 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); const auto& found = defs.find(id);
if (found == defs.end()) { if (found == defs.end()) {
throw std::runtime_error("missing content unit " + id); throw std::runtime_error("missing content unit " + id);
+1 -1
View File
@@ -360,7 +360,7 @@ static int l_raycast(lua::State* L) {
for (int i = 0; i < addLen; i++) { for (int i = 0; i < addLen; i++) {
lua::rawgeti(L, i + 1, 5); lua::rawgeti(L, i + 1, 5);
auto blockName = std::string(lua::tostring(L, -1)); auto blockName = std::string(lua::tostring(L, -1));
Block* block = content->blocks.find(blockName); const Block* block = content->blocks.find(blockName);
if (block != nullptr) { if (block != nullptr) {
filteredBlocks.insert(block->rt.id); filteredBlocks.insert(block->rt.id);
} }
+1 -1
View File
@@ -127,7 +127,7 @@ static int l_raycast(lua::State* L) {
for (int i = 0; i < addLen; i++) { for (int i = 0; i < addLen; i++) {
lua::rawgeti(L, i + 1, 6); lua::rawgeti(L, i + 1, 6);
auto blockName = std::string(lua::tostring(L, -1)); auto blockName = std::string(lua::tostring(L, -1));
Block* block = content->blocks.find(blockName); const Block* block = content->blocks.find(blockName);
if (block != nullptr) { if (block != nullptr) {
filteredBlocks.insert(block->rt.id); filteredBlocks.insert(block->rt.id);
} }
+2 -2
View File
@@ -75,7 +75,7 @@ static sensorcallback create_sensor_callback(Entities* entities) {
} }
static void initialize_body( 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()); body.sensors.resize(def.radialSensors.size() + def.boxSensors.size());
for (auto& [i, box] : def.boxSensors) { for (auto& [i, box] : def.boxSensors) {
@@ -111,7 +111,7 @@ static void initialize_body(
} }
entityid_t Entities::spawn( entityid_t Entities::spawn(
EntityDef& def, const EntityDef& def,
glm::vec3 position, glm::vec3 position,
dynamic::Map_sptr args, dynamic::Map_sptr args,
dynamic::Map_sptr saved, dynamic::Map_sptr saved,
+1 -1
View File
@@ -202,7 +202,7 @@ public:
); );
entityid_t spawn( entityid_t spawn(
EntityDef& def, const EntityDef& def,
glm::vec3 position, glm::vec3 position,
dynamic::Map_sptr args = nullptr, dynamic::Map_sptr args = nullptr,
dynamic::Map_sptr saved = nullptr, dynamic::Map_sptr saved = nullptr,