From d5f01363cabb5bb664059a1546806bc3a1cdd9a3 Mon Sep 17 00:00:00 2001 From: NotAdam Date: Sat, 6 Apr 2019 11:44:06 +1100 Subject: [PATCH] remove unused header, fix monsternote crashing world if class has none --- src/world/Action/Action.h | 1 - src/world/Actor/Player.cpp | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/world/Action/Action.h b/src/world/Action/Action.h index d31fe7b4..0d7f7e71 100644 --- a/src/world/Action/Action.h +++ b/src/world/Action/Action.h @@ -3,7 +3,6 @@ #include #include "ForwardsZone.h" -#include namespace Sapphire::Data { diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index e0354f84..8315bb84 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -2051,6 +2051,11 @@ void Sapphire::Entity::Player::updateHuntingLog( uint16_t id ) bool sectionChanged = false; uint32_t monsterNoteId = static_cast< uint32_t >( ( static_cast< uint8_t >( getClass() ) ) * 10000 + logEntry.rank * 10 + i ); auto note = pExdData->get< Sapphire::Data::MonsterNote >( monsterNoteId ); + + // for classes that don't have entries, if the first fails the rest will fail + if( !note ) + break; + for( auto x = 0; x < 4; ++x ) { auto note1 = pExdData->get< Sapphire::Data::MonsterNoteTarget >( note->monsterNoteTarget[ x ] ); @@ -2086,6 +2091,10 @@ void Sapphire::Entity::Player::updateHuntingLog( uint16_t id ) static_cast< uint8_t >( getClass() ), logEntry.rank + 1, 0 ) ); } } - sendHuntingLog(); + + if( logChanged ) + { + sendHuntingLog(); + } }