Reconcile the concept of Edict & Networkable across the codebase (#1903)
* Reconcile the concept of Edict & Networkable across the codebase * There's no need to check this, it's done elsewhere. Also could be null (segfault) * This was never needed * Pseudo review changes Re-added removed null checks, and added new ones. Changed the error messages in Get/SetProp natives to better reflect reality. * Don't change the behaviour of GetEntityNetClass * Overload IGameHelpers::FindServerClass * Make error messages more accurate * Fix a dev comment * Rename FindServerClass --------- Co-authored-by: Kenzzer <[email protected]>
This commit is contained in:
@@ -435,23 +435,19 @@ int FindEntityByNetClass(int start, const char *classname)
|
||||
|
||||
for (int i = ((start != -1) ? start : 0); i < gpGlobals->maxEntities; i++)
|
||||
{
|
||||
current = engine->PEntityOfEntIndex(i);
|
||||
if (current == NULL || current->IsFree())
|
||||
CBaseEntity *pEntity = gamehelpers->ReferenceToEntity(i);
|
||||
if (pEntity == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
IServerNetworkable *network = current->GetNetworkable();
|
||||
|
||||
if (network == NULL)
|
||||
ServerClass *pServerClass = gamehelpers->FindEntityServerClass(pEntity);
|
||||
if (pServerClass == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ServerClass *sClass = network->GetServerClass();
|
||||
const char *name = sClass->GetName();
|
||||
|
||||
|
||||
const char *name = pServerClass->GetName();
|
||||
if (strcmp(name, classname) == 0)
|
||||
{
|
||||
return i;
|
||||
|
||||
Reference in New Issue
Block a user