Page 1 of 1

[FIXED 075A] possible bug in new pawn attribute command

Posted: Mon Feb 06, 2006 1:37 pm
by pipboy12345
Just discover a possible bug in the new pawn scripting command - specifically the part that now let a pawn be adding/setting/modifying attributes.

The point is that when I add an attribute to a pawn in scirpts, and then later when I try to change it or setting to new value, the attributes is always setting to very large negative value. After some tracing into the source code, I found the reason may be due to low and high value not being set in AddNew method of PersistentAttribute.

After adding the following lines, the problem removed.

pNew->ValueLowLimit = 0;
pNew->ValueHighLimit = 100; // can be other value

The point is that if not being set, the CLAMPVALUE will set the value of attribute to some possible uninitialized value.

May be I'm wrong, anyway this is my observation.

Posted: Mon Feb 06, 2006 4:49 pm
by AndyCR
moved to bug reports.

this is an example of a nice, detailed bug report - not that other's aren't, simply an example of what's right. ty for taking time to describe the problem so thoroughly; i personally will not fix it, since i do not have a compiler that seems to compile the rf1 source. an rf developer with msvc++6 will come and check it.

Posted: Wed Feb 08, 2006 10:33 am
by QuestOfDreams
Note to myself:
FIX
CPersistentAttributes::AddNew(...)
{
...
// add
pNew->ValueLowLimit = 0;
pNew->ValueHighLimit = 100;
...
}

add optional arguments LowValue, HighValue to pawn command AddAttribute
(AddAttribute(char* AttributeName, int LowValue, int HighValue),
AddAttribute(char* AttributeName, int LowValue, int HighValue, char* EntityName))

add pawn command SetAttributeValueLimits
(SetAttributeValueLimits(char* AttributeName, int LowValue, int HighValue),
SetAttributeValueLimits(char* AttributeName, int LowValue, int HighValue, char* EntityName))