如果你要从配置里面取一个属性,需要修改这个属性,注意不要把配置的属性修改掉了。取的是配置的指针属性,需要弄个临时属性来修改计算。
int nLuckValue = WingsAngelCfg.m_Config.nWing[nLevel].nLuck;
double percentage = (double)nLuckPoint/nLuckValue;
nCount = WingsAngelCfg.m_Config.nWing[nLevel].nCount;
if(nCount == 0)
return calc;
GAMEATTR* tmpValueProp = WingsAngelCfg.m_Config.nWing[nLevel].PropList;
if(tmpValueProp == NULL)
return calc;
for (int i = 0; i < nCount; i++)
{
//if(tmpValueProp[i].reserve[0] == 0)
{
GAMEATTR Prop;
INT_PTR nValue = tmpValueProp[i].value.nValue * percentage;
if(nValue <1)
{
nValue = 1;
}
Prop.type = tmpValueProp->type;
Prop.value.nValue = nValue;
calc << Prop;
}
}