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.
[FIXED 075A] possible bug in new pawn attribute command
-
- Posts: 1
- Joined: Mon Feb 06, 2006 1:27 pm
- Contact:
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.
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.
RF2 site: http://realityfactory2.sourceforge.net/
RF2 tasks: http://sourceforge.net/pm/?group_id=179085
RF2 tasks: http://sourceforge.net/pm/?group_id=179085
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
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))
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))