Skip to content

Commit

Permalink
[.travis.yml] Small fix. [entt] Updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
Unarelith committed Apr 29, 2020
1 parent c1097d4 commit 3272c3c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ before_install:
- cd ..

script:
- cmake .
- mkdir build
- cd build
- cmake ..
- make -j8

notifications:
Expand Down
10 changes: 5 additions & 5 deletions source/client/network/ClientCommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ void ClientCommandHandler::setupCallbacks() {
if (it == m_entityMap.end()) {
entt::entity entity = registry.create();
m_entityMap.emplace(entityID, entity);
registry.assign<NetworkComponent>(entity, entityID);
registry.emplace<NetworkComponent>(entity, entityID);
}
else if (registry.get<NetworkComponent>(it->second).entityID != entityID) {
gkError() << "EntitySpawn: Entity ID" << entityID << "is invalid";
Expand All @@ -283,7 +283,7 @@ void ClientCommandHandler::setupCallbacks() {

auto it = m_entityMap.find(entityID);
if (it != m_entityMap.end()) {
auto &position = m_world.scene().registry().get_or_assign<PositionComponent>(it->second);
auto &position = m_world.scene().registry().get_or_emplace<PositionComponent>(it->second);
packet >> position.x >> position.y >> position.z;
}
else
Expand All @@ -299,7 +299,7 @@ void ClientCommandHandler::setupCallbacks() {
float w, x, y, z;
packet >> w >> x >> y >> z;

auto &rotation = m_world.scene().registry().get_or_assign<RotationComponent>(it->second);
auto &rotation = m_world.scene().registry().get_or_emplace<RotationComponent>(it->second);
rotation.quat = glm::quat(w, x, y, z);
}
else
Expand All @@ -312,7 +312,7 @@ void ClientCommandHandler::setupCallbacks() {

auto it = m_entityMap.find(entityID);
if (it != m_entityMap.end()) {
auto &animation = m_world.scene().registry().get_or_assign<AnimationComponent>(it->second);
auto &animation = m_world.scene().registry().get_or_emplace<AnimationComponent>(it->second);
animation.deserialize(packet);
}
else
Expand All @@ -325,7 +325,7 @@ void ClientCommandHandler::setupCallbacks() {

auto it = m_entityMap.find(entityID);
if (it != m_entityMap.end()) {
packet >> m_world.scene().registry().get_or_assign<DrawableDef>(it->second);
packet >> m_world.scene().registry().get_or_emplace<DrawableDef>(it->second);
}
else
gkError() << "EntityDrawableDef: Entity ID" << entityID << "is invalid";
Expand Down
2 changes: 1 addition & 1 deletion source/client/scene/RenderingController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void RenderingController::update(entt::registry &registry) {
registry.view<DrawableDef>(entt::exclude<DrawableComponent>).each([&](auto entity, auto &drawableDef) {
const InventoryCubeDef &cubeDef = drawableDef.getInventoryCubeDef();

DrawableComponent &drawable = registry.get_or_assign<DrawableComponent>(entity);
DrawableComponent &drawable = registry.get_or_emplace<DrawableComponent>(entity);

InventoryCube &cube = drawable.setDrawable<InventoryCube>(cubeDef.size, true);
cube.setOrigin(cubeDef.origin);
Expand Down
14 changes: 7 additions & 7 deletions source/server/scene/ItemDropFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ static u32 counter = 0; // FIXME: TEMPORARY

void ItemDropFactory::create(entt::registry &registry, double x, double y, double z, const std::string &itemID, u16 amount) {
auto entity = registry.create();
registry.assign<PositionComponent>(entity, x, y, z);
registry.assign<RotationComponent>(entity);
registry.assign<NetworkComponent>(entity, counter++);
registry.emplace<PositionComponent>(entity, x, y, z);
registry.emplace<RotationComponent>(entity);
registry.emplace<NetworkComponent>(entity, counter++);

auto &drawableDef = registry.assign<DrawableDef>(entity);
auto &drawableDef = registry.emplace<DrawableDef>(entity);
auto &cube = drawableDef.addInventoryCube();
cube.size = 0.25f;
cube.origin = gk::Vector3f{cube.size / 2.f, cube.size / 2.f, cube.size / 2.f};
cube.blockID = itemID;

auto &animationComponent = registry.assign<AnimationComponent>(entity);
auto &animationComponent = registry.emplace<AnimationComponent>(entity);
animationComponent.addRotation(0.f, 0.f, 1.f, 0.5f);
animationComponent.addTranslation(0.f, 0.f, -0.0005f, -0.2f, 0.f, true);

registry.assign<gk::DoubleBox>(entity, 0., 0., 0., cube.size, cube.size, cube.size);
registry.assign<ItemStack>(entity, itemID, amount);
registry.emplace<gk::DoubleBox>(entity, 0., 0., 0., cube.size, cube.size, cube.size);
registry.emplace<ItemStack>(entity, itemID, amount);
}

0 comments on commit 3272c3c

Please sign in to comment.