Added a CheckAttribute here to prevent error.log entries:
Also added "l"+ for the sake of having this in line with more "normal" code.
Code:
void AddGeometryToLocation(string LocationID, string ModelName)
{
ref LocationRef;
int n = 1;
string str;
locationRef = &locations[FindLocation(LocationID)];
for(n = 1; n < 10; n++)
{
str = "l" + n; // PB: Elsewhere this uses "l1" and not just "1"; now this does too
if(!CheckAttribute(LocationRef, "models.always." + str))
{
LocationRef.models.always.(str) = ModelName;
LocationRef.models.always.(str).tech = "dLightModel";
break;
}
}
}
void RemoveGeometryFromLocation(string LocationID, string ModelName)
{
ref LocationRef;
int n = 1;
string str;
if(FindLocation(LocationID) != -1)
{
locationRef = &locations[FindLocation(LocationID)];
}
else
{
return;
}
for(n = 1; n < 10; n++)
{
str = "l" + n; // PB: Elsewhere this uses "l1" and not just "1"; now this does too
if(CheckAttribute(LocationRef, "models.always." + str)) // PB: Add CheckAttribute to avoid error logs
{
if(LocationRef.models.always.(str) == ModelName)
{
DeleteAttribute(LocationRef, "models.always." + str);
break;
}
}
}
}