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:
Benoist
2024-06-01 14:07:55 +00:00
committed by GitHub
co-authored by Kenzzer
parent 9f3584a056
commit 7df2f8e045
13 changed files with 152 additions and 118 deletions
+5 -9
View File
@@ -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;