|
From: <cn...@us...> - 2020-10-25 04:19:52
|
Revision: 1060
http://sourceforge.net/p/seq/svn/1060
Author: cn187
Date: 2020-10-25 04:19:50 +0000 (Sun, 25 Oct 2020)
Log Message:
-----------
Specify default values to return if QHash lookups fail
Modified Paths:
--------------
showeq/branches/pre_6_0_beta/src/packetinfo.cpp
showeq/branches/pre_6_0_beta/src/spawnmonitor.cpp
Modified: showeq/branches/pre_6_0_beta/src/packetinfo.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/packetinfo.cpp 2020-10-25 00:19:36 UTC (rev 1059)
+++ showeq/branches/pre_6_0_beta/src/packetinfo.cpp 2020-10-25 04:19:50 UTC (rev 1060)
@@ -103,20 +103,15 @@
size_t EQPacketTypeDB::size(const char* typeName) const
{
// attempt to find the item in the type size dictionary
- size_t size = m_typeSizeDict.value(typeName);
+ size_t size = m_typeSizeDict.value(typeName, 0);
- // if it was found, return its size
- if (size)
- return size;
-
- // return 0
- return 0;
+ return size;
}
bool EQPacketTypeDB::valid(const char* typeName) const
{
// attempt to find the item in the type size dictionary
- size_t size = m_typeSizeDict.value(typeName);
+ size_t size = m_typeSizeDict.value(typeName, 0);
return (size != 0);
}
Modified: showeq/branches/pre_6_0_beta/src/spawnmonitor.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/spawnmonitor.cpp 2020-10-25 00:19:36 UTC (rev 1059)
+++ showeq/branches/pre_6_0_beta/src/spawnmonitor.cpp 2020-10-25 04:19:50 UTC (rev 1060)
@@ -244,10 +244,10 @@
if ( ( spawn->NPC() != SPAWN_NPC ) || ( spawn->petOwnerID() != 0 ) || spawn->isMount() || spawn->isAura() || spawn->isMercenary() )
return;
- QString key = SpawnPoint::key( *spawn );
+ QString key = SpawnPoint::key( *spawn );
- SpawnPoint* sp;
- sp = m_points.value( key );
+ SpawnPoint* sp;
+ sp = m_points.value(key, nullptr);
if ( sp )
{
m_modified = true;
@@ -255,7 +255,7 @@
}
else
{
- sp = m_spawns.value( key );
+ sp = m_spawns.value(key, nullptr);
if ( sp )
{
sp->update(spawn);
@@ -403,7 +403,7 @@
{
QString key = p->key();
- if (!m_points.value(key))
+ if (!m_points.value(key, nullptr))
{
m_points.insert(key, p);
emit newSpawnPoint(p);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|