1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 05:57:45 +00:00

More static_cast

- expand some types
- gnarly std::pair issue with short to int8_t
- getLinkshellById now uses uint32_t
This commit is contained in:
ShelbyZ 2017-10-22 20:51:25 -07:00
parent 09d565a854
commit 05e5221f2e
5 changed files with 10 additions and 10 deletions

View file

@ -74,7 +74,7 @@ bool Core::Entity::Player::loadActiveQuests()
void Core::Entity::Player::finishQuest( uint16_t questId ) void Core::Entity::Player::finishQuest( uint16_t questId )
{ {
int16_t idx = getQuestIndex( questId ); auto idx = static_cast< uint8_t >( getQuestIndex( questId ) );
if( ( idx != -1 ) && ( m_activeQuests[idx] != nullptr ) ) if( ( idx != -1 ) && ( m_activeQuests[idx] != nullptr ) )
{ {
@ -123,7 +123,7 @@ void Core::Entity::Player::unfinishQuest( uint16_t questId )
void Core::Entity::Player::removeQuest( uint16_t questId ) void Core::Entity::Player::removeQuest( uint16_t questId )
{ {
int16_t idx = getQuestIndex( questId ); auto idx = static_cast< uint8_t >( getQuestIndex( questId ) );
if( ( idx != -1 ) && ( m_activeQuests[idx] != nullptr ) ) if( ( idx != -1 ) && ( m_activeQuests[idx] != nullptr ) )
{ {
@ -978,7 +978,7 @@ void Core::Entity::Player::updateQuest( uint16_t questId, uint8_t sequence )
if( hasQuest( questId ) ) if( hasQuest( questId ) )
{ {
GamePacketNew< FFXIVIpcQuestUpdate, ServerZoneIpcType > pe_qa( getId() ); GamePacketNew< FFXIVIpcQuestUpdate, ServerZoneIpcType > pe_qa( getId() );
int16_t index = getQuestIndex( questId ); auto index = static_cast< uint8_t >( getQuestIndex( questId ) );
auto pNewQuest = m_activeQuests[index]; auto pNewQuest = m_activeQuests[index];
pe_qa.data().slot = index; pe_qa.data().slot = index;
pNewQuest->c.sequence = sequence; pNewQuest->c.sequence = sequence;
@ -1038,7 +1038,7 @@ void Core::Entity::Player::sendQuestTracker()
if( m_questTracking[ii] >= 0 ) if( m_questTracking[ii] >= 0 )
{ {
trackerPacket.data().entry[ii].active = 1; trackerPacket.data().entry[ii].active = 1;
trackerPacket.data().entry[ii].questIndex = m_questTracking[ii]; trackerPacket.data().entry[ii].questIndex = static_cast< uint8_t >( m_questTracking[ii] );
} }
} }
queuePacket( trackerPacket ); queuePacket( trackerPacket );

View file

@ -108,7 +108,7 @@ Core::Inventory::InvSlotPairVec Core::Inventory::getSlotsOfItemsInInventory( uin
for( auto item : inv->getItemMap() ) for( auto item : inv->getItemMap() )
{ {
if( item.second && item.second->getId() == catalogId ) if( item.second && item.second->getId() == catalogId )
outVec.push_back( std::make_pair( i, item.first ) ); outVec.push_back( std::make_pair( i, static_cast< int8_t >( item.first ) ) );
} }
} }
return outVec; return outVec;
@ -118,7 +118,7 @@ Core::Inventory::InvSlotPair Core::Inventory::getFreeBagSlot()
{ {
for( auto i : { Bag0, Bag1, Bag2, Bag3 } ) for( auto i : { Bag0, Bag1, Bag2, Bag3 } )
{ {
int16_t freeSlot = m_inventoryMap[i]->getFreeSlot(); auto freeSlot = static_cast< int8_t >( m_inventoryMap[i]->getFreeSlot() );
if( freeSlot != -1 ) if( freeSlot != -1 )
return std::make_pair( i, freeSlot ); return std::make_pair( i, freeSlot );
@ -457,7 +457,7 @@ int16_t Core::Inventory::addItem( uint16_t inventoryId, int8_t slotId, uint32_t
return -1; return -1;
} }
int16_t rSlotId = -1; int8_t rSlotId = -1;
//if( itemInfo->stack_size > 1 ) //if( itemInfo->stack_size > 1 )
//{ //{

View file

@ -71,7 +71,7 @@ Core::LinkshellPtr Core::LinkshellMgr::getLinkshellByName( const std::string& na
return it->second; return it->second;
} }
Core::LinkshellPtr Core::LinkshellMgr::getLinkshellById( uint64_t lsId ) Core::LinkshellPtr Core::LinkshellMgr::getLinkshellById( uint32_t lsId )
{ {
auto it = m_linkshellIdMap.find( lsId ); auto it = m_linkshellIdMap.find( lsId );
if( it == m_linkshellIdMap.end() ) if( it == m_linkshellIdMap.end() )

View file

@ -16,7 +16,7 @@ private:
std::map< std::string, LinkshellPtr > m_linkshellNameMap; std::map< std::string, LinkshellPtr > m_linkshellNameMap;
LinkshellPtr getLinkshellByName( const std::string& name ); LinkshellPtr getLinkshellByName( const std::string& name );
LinkshellPtr getLinkshellById( uint64_t lsId ); LinkshellPtr getLinkshellById( uint32_t lsId );
public: public:
LinkshellMgr(); LinkshellMgr();

View file

@ -141,7 +141,7 @@ void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inP
GamePacketNew< FFXIVIpcEventLinkshell, ServerZoneIpcType > linkshellEvent( pPlayer->getId() ); GamePacketNew< FFXIVIpcEventLinkshell, ServerZoneIpcType > linkshellEvent( pPlayer->getId() );
linkshellEvent.data().eventId = eventId; linkshellEvent.data().eventId = eventId;
linkshellEvent.data().scene = subEvent; linkshellEvent.data().scene = static_cast< uint8_t >(subEvent);
linkshellEvent.data().param3 = 1; linkshellEvent.data().param3 = 1;
linkshellEvent.data().unknown1 = 0x15a; linkshellEvent.data().unknown1 = 0x15a;
pPlayer->queuePacket( linkshellEvent ); pPlayer->queuePacket( linkshellEvent );