Skip to content

Commit

Permalink
Fixed crashes that occurred when NPC did not have animations
Browse files Browse the repository at this point in the history
  • Loading branch information
dorkster committed Aug 28, 2018
1 parent 672b234 commit f0037e1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Engine fixes:
* Improved performance when dealing with campaign statuses.
* Fix NPCs/enemies not begin affected by statuses set in on_load events until the player re-entered the map.
* Various fixes to MenuPowers, including better handling of when powers no longer meet their requirements.
* Fixed crashes that occurred when NPC did not have animations.
* Lots of code cleanup.

New translations:
Expand Down
8 changes: 6 additions & 2 deletions src/NPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ int NPC::loadSound(const std::string& fname, int vox_type) {
}

void NPC::logic() {
activeAnimation->advanceFrame();
if (activeAnimation)
activeAnimation->advanceFrame();
}

bool NPC::playSoundIntro() {
Expand Down Expand Up @@ -528,7 +529,10 @@ void NPC::processEvent(unsigned int dialog_node, unsigned int cursor) {
}

Renderable NPC::getRender() {
Renderable r = activeAnimation->getCurrentFrame(direction);
Renderable r;
if (activeAnimation) {
r = activeAnimation->getCurrentFrame(direction);
}
r.map_pos.x = pos.x;
r.map_pos.y = pos.y;

Expand Down
2 changes: 1 addition & 1 deletion src/Version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ FLARE. If not, see https://www.gnu.org/licenses/

#include <SDL.h>

Version VersionInfo::ENGINE(1, 6, 43);
Version VersionInfo::ENGINE(1, 6, 44);
Version VersionInfo::MIN(0, 0, 0);
Version VersionInfo::MAX(USHRT_MAX, USHRT_MAX, USHRT_MAX);

Expand Down

0 comments on commit f0037e1

Please sign in to comment.