refactor: change pointer parameters to references for Level and Content in various classes
This commit is contained in:
@@ -133,7 +133,7 @@ static int l_get_x(lua::State* L) {
|
||||
if (vox == nullptr) {
|
||||
return lua::pushivec_stack(L, glm::ivec3(1, 0, 0));
|
||||
}
|
||||
const auto& def = level->content->getIndices()->blocks.require(vox->id);
|
||||
const auto& def = level->content.getIndices()->blocks.require(vox->id);
|
||||
if (!def.rotatable) {
|
||||
return lua::pushivec_stack(L, glm::ivec3(1, 0, 0));
|
||||
} else {
|
||||
@@ -150,7 +150,7 @@ static int l_get_y(lua::State* L) {
|
||||
if (vox == nullptr) {
|
||||
return lua::pushivec_stack(L, glm::ivec3(0, 1, 0));
|
||||
}
|
||||
const auto& def = level->content->getIndices()->blocks.require(vox->id);
|
||||
const auto& def = level->content.getIndices()->blocks.require(vox->id);
|
||||
if (!def.rotatable) {
|
||||
return lua::pushivec_stack(L, glm::ivec3(0, 1, 0));
|
||||
} else {
|
||||
@@ -167,7 +167,7 @@ static int l_get_z(lua::State* L) {
|
||||
if (vox == nullptr) {
|
||||
return lua::pushivec_stack(L, glm::ivec3(0, 0, 1));
|
||||
}
|
||||
const auto& def = level->content->getIndices()->blocks.require(vox->id);
|
||||
const auto& def = level->content.getIndices()->blocks.require(vox->id);
|
||||
if (!def.rotatable) {
|
||||
return lua::pushivec_stack(L, glm::ivec3(0, 0, 1));
|
||||
} else {
|
||||
@@ -367,7 +367,7 @@ static int l_place(lua::State* L) {
|
||||
if (!blocks_agent::get(*level->chunks, x, y, z)) {
|
||||
return 0;
|
||||
}
|
||||
const auto def = level->content->getIndices()->blocks.get(id);
|
||||
const auto def = level->content.getIndices()->blocks.get(id);
|
||||
if (def == nullptr) {
|
||||
throw std::runtime_error(
|
||||
"there is no block with index " + std::to_string(id)
|
||||
@@ -389,7 +389,7 @@ static int l_destruct(lua::State* L) {
|
||||
if (vox == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
auto& def = level->content->getIndices()->blocks.require(vox->id);
|
||||
auto& def = level->content.getIndices()->blocks.require(vox->id);
|
||||
auto player = level->players->get(playerid);
|
||||
controller->getBlocksController()->breakBlock(player, def, x, y, z);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user