Page MenuHomeFeedback Tracker

VicinityObjects optimization
New, NormalPublic

Description

Because the objects are accessed from a map it might be more efficient to use the following implementation for GetVicinityObjects()

//! return simple array of Objects in Vicinity
array< Object > GetVicinityObjects()
{
    ref array<Object> vicinityObjects = new array<Object>;
    for( int i = 0; i < m_VicinityObjects.Count(); ++i )
    {
        //! filters out non-takeable items (won't be shown in vicinity)
        auto obj = GetObject( i );
        ItemBase ib = ItemBase.Cast( obj );
        if(ib && !ib.IsTakeable())
            continue;

        vicinityObjects.Insert( obj );
    }
    
    return vicinityObjects;
}

This saves an unnecessary call to GetKey

Also

private ref map<Object, Object> m_VicinityObjects;

could be changed to

protected ref map<Object, Object> m_VicinityObjects;

In order to make it moddable. Yes I know you can call the data using the Count and GetObjects functions but having it protected does not cause any harm really.

Details

Severity
Tweak
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General

Event Timeline

Arkensor created this task.Apr 17 2019, 1:54 PM
Arkensor updated the task description. (Show Details)
Arkensor updated the task description. (Show Details)