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

Post any Bug Reports here
Post Reply
pipboy12345
Posts: 1
Joined: Mon Feb 06, 2006 1:27 pm
Contact:

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

Post by pipboy12345 » Mon Feb 06, 2006 1:37 pm

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.

User avatar
AndyCR
Posts: 1449
Joined: Wed Jul 06, 2005 5:08 pm
Location: Colorado, USA
Contact:

Post by AndyCR » Mon Feb 06, 2006 4:49 pm

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.

User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Post by QuestOfDreams » Wed Feb 08, 2006 10:33 am

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))

Post Reply