Skip to content

Commit

Permalink
improve load times
Browse files Browse the repository at this point in the history
  • Loading branch information
GER-Space committed Nov 15, 2016
1 parent 79d577e commit c152f12
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/StaticObjects/StaticDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public class StaticDatabase
{
//Groups are stored by name within the body name
private Dictionary<string, Dictionary<string, StaticGroup>> groupList = new Dictionary<string,Dictionary<string,StaticGroup>>();
private List<StaticModel> modelList = new List<StaticModel>();
// private List<StaticModel> modelList = new List<StaticModel>();
private Dictionary<string, StaticModel> modelList = new Dictionary<string, StaticModel>();
private string activeBodyName = "";

public void changeGroup(StaticObject obj, string newGroup)
Expand Down Expand Up @@ -278,15 +279,23 @@ public List<StaticObject> getAllStatics()

public void registerModel(StaticModel model)
{
modelList.Add(model);
modelList.Add(GameDatabase.Instance.GetConfigNode(model.config).GetValue("name"),model);
}

public List<StaticModel> getModels()
{
return modelList;
return modelList.Values.ToList();
}

public List<StaticObject> getObjectsFromModel(StaticModel model)
public StaticModel GetModel(string name)
{
StaticModel myModel = null;
modelList.TryGetValue(name, out myModel);
return myModel;
}


public List<StaticObject> getObjectsFromModel(StaticModel model)
{
return (from obj in getAllStatics() where obj.model == model select obj).ToList();
}
Expand Down

0 comments on commit c152f12

Please sign in to comment.