Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/libs/game/action/opencontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,22 @@

#include "reone/game/di/services.h"
#include "reone/game/game.h"
#include "reone/game/object/placeable.h"
#include "reone/game/object/creature.h"

namespace reone {

namespace game {

void OpenContainerAction::execute(std::shared_ptr<Action> self, Object &actor, float dt) {
auto creatureActor = _game.getObjectById<Creature>(actor.id());
auto placeable = std::static_pointer_cast<Placeable>(_object);
bool reached = creatureActor->navigateTo(placeable->position(), true, kDefaultMaxObjectDistance, dt);
if (!_object || actor.type() != ObjectType::Creature) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!_object || actor.type() != ObjectType::Creature) {
if (!_object || !isa<Creature>(actor)) {

complete();
return;
}

auto &creatureActor = static_cast<Creature &>(actor);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auto &creatureActor = static_cast<Creature &>(actor);
auto &creatureActor = cast<Creature>(actor);

bool reached = creatureActor.navigateTo(_object->position(), true, kDefaultMaxObjectDistance, dt);
if (reached) {
_game.openContainer(placeable);
_game.openContainer(_object);
complete();
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/libs/gui/control/imagebutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ static const char kIconFontResRef[] = "dialogfont10x10a";
void ImageButton::load(const resource::generated::GUI_BASECONTROL &gui, bool protoItem) {
Control::load(gui, protoItem);
_iconFont = _resourceSvc.fonts.get(kIconFontResRef);
if (!_iconFont) {
_iconFont = _text.font;
}
}

void ImageButton::render(
Expand Down Expand Up @@ -106,7 +109,7 @@ void ImageButton::renderIcon(
{_extent.height, _extent.height});
}

if (!iconText.empty()) {
if (!iconText.empty() && _iconFont) {
glm::vec3 position(0.0f);
position.x = static_cast<float>(offset.x + _extent.left + _extent.height);
position.y = static_cast<float>(offset.y + _extent.top + _extent.height - 0.5f * _iconFont->height());
Expand Down
Loading