Commit 222f24f4 authored by Mikleo's avatar Mikleo

add hMin and hMax

parent 404e9c79
Pipeline #10974 passed with stages
in 16 seconds
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <SteamWorks> #include <SteamWorks>
#define PluginVersion "1.23" #define PluginVersion "1.24"
float pVersion; float pVersion;
// note linearmap field is unstable // note linearmap field is unstable
...@@ -4141,8 +4141,16 @@ bool LoadScenario(int client,char[] filename) ...@@ -4141,8 +4141,16 @@ bool LoadScenario(int client,char[] filename)
LoadCvars(kv); LoadCvars(kv);
int hLimit = kv.GetNum("hLimit",BASEHAMMERID -1 ); int hLimit = kv.GetNum("hLimit",BASEHAMMERID -1 );
int hMin = kv.GetNum("hMin",0 );
int hMax = kv.GetNum("hMax",0 );
if(hMax > 0)
hLimit = hMax;
kv.JumpToKey("Entities"); kv.JumpToKey("Entities");
LoadEntities(kv,version,hLimit); LoadEntities(kv,version,hMin,hLimit);
...@@ -4363,7 +4371,7 @@ void SaveEntities(KeyValues kv) ...@@ -4363,7 +4371,7 @@ void SaveEntities(KeyValues kv)
LoadEntities(KeyValues kv,float version,int hLimit) LoadEntities(KeyValues kv,float version,int hMin,int hLimit)
{ {
int max_hammer_id = BASEHAMMERID; int max_hammer_id = BASEHAMMERID;
...@@ -4405,7 +4413,7 @@ LoadEntities(KeyValues kv,float version,int hLimit) ...@@ -4405,7 +4413,7 @@ LoadEntities(KeyValues kv,float version,int hLimit)
int entity = -1; int entity = -1;
// if they are not a custom element just reload them regardless. // if they are not a custom element just reload them regardless.
if( hammer_id <= hLimit) if( hammer_id <= hLimit && hammer_id >= hMin)
entity = findEntityWithHammerID(hammer_id,className); entity = findEntityWithHammerID(hammer_id,className);
entity = RestoreEntity(entity,kv,classInfo,className); entity = RestoreEntity(entity,kv,classInfo,className);
...@@ -4427,7 +4435,7 @@ LoadEntities(KeyValues kv,float version,int hLimit) ...@@ -4427,7 +4435,7 @@ LoadEntities(KeyValues kv,float version,int hLimit)
kv.Rewind(); kv.Rewind();
RemoveSavableEntitiesExcept(includedEntities,version,hLimit); RemoveSavableEntitiesExcept(includedEntities,version,hMin,hLimit);
delete includedEntities; delete includedEntities;
...@@ -4839,7 +4847,7 @@ RestoreEntity(int entity,KeyValues kv,any[] classInfo ,char[] className) ...@@ -4839,7 +4847,7 @@ RestoreEntity(int entity,KeyValues kv,any[] classInfo ,char[] className)
return entity; return entity;
} }
RemoveSavableEntitiesExcept(ArrayList list,float version, int hLimit) RemoveSavableEntitiesExcept(ArrayList list,float version,int hMin, int hLimit)
{ {
// get logic entities as well. // get logic entities as well.
int maxEntities = GetMaxEntities() * 2; int maxEntities = GetMaxEntities() * 2;
...@@ -4853,7 +4861,7 @@ RemoveSavableEntitiesExcept(ArrayList list,float version, int hLimit) ...@@ -4853,7 +4861,7 @@ RemoveSavableEntitiesExcept(ArrayList list,float version, int hLimit)
GetEntityClassname(entity, className, sizeof(className)); GetEntityClassname(entity, className, sizeof(className));
int hammerID = GetEntProp(entity,Prop_Data,"m_iHammerID"); int hammerID = GetEntProp(entity,Prop_Data,"m_iHammerID");
if((hammerID <= hLimit || hammerID >= BASEHAMMERID) && GetEntitySavingKeys(className,version,classInfo) && list.FindValue(entity) == -1 && ShouldSave(entity,className,classInfo)) if( hammerID >= hMin && (hammerID <= hLimit || hammerID >= BASEHAMMERID) && GetEntitySavingKeys(className,version,classInfo) && list.FindValue(entity) == -1 && ShouldSave(entity,className,classInfo))
{ {
// remove this entity // remove this entity
ExecuteRemoveEntity(entity); ExecuteRemoveEntity(entity);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
{ {
"Version" "Version"
{ {
"Latest" "1.23" "Latest" "1.24"
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment