- Joined
- Dec 31, 2005
- Messages
- 712
Hello people 
I've got a problem I just can't figure out how to fix it.
Take a look at this structure:
The idea is an item type with several attributes like resistances, damage bonus etc (for varius elements). My problem is with the "Applies" member.
See this declaration:
If I use a debug message to show "true" or "false" depending on x.Applies[...] value, it only shows correctly for Diamond. It shows false for all indexes for Topaz.
However, if I invert the order, those things also invert. Moreover, if I just put anoter IDATA.create in front of Diamond, it stops working too.
Note that if I remove the "set it.Applies = false" line in the struct create method, this problem is solved. But I'd still like to know what's causing this =/
I've thought about struct quantity limit due to the number of arrays in the structure. But even if I divide 8100 by 7 there will still be more than 1000 usable struct - and I have no more than 10 created structs.
Can someone help me?
Thanks in advance
Hossomi
I've got a problem I just can't figure out how to fix it.
Take a look at this structure:
JASS:
struct IDATA
integer array Resistances [7]
integer array DamageBonus [7]
integer array PassiveBonus [6]
integer array StatBonus [6]
integer array SkillBonus [6]
integer array SkillLevel [6]
// -- Used for gems only --
boolean array Applies [6]
boolean Common = true
integer id = 0
integer Skills = 0
integer MaxGems = 0
static method create takes integer Item, boolean c returns IDATA
local IDATA it = IDATA.allocate()
local integer i = 0
set it.id = Item
if c then
// -- HT_ITEMTYPES is a constant key --
call SaveInteger( TheHashtable, HT_ITEMTYPES, Item, it )
endif
loop
exitwhen i >= 6
set it.Resistances[i] = 0
set it.DamageBonus[i] = 0
set it.PassiveBonus[i] = 0
set it.StatBonus[i] = 0
set it.SkillBonus[i] = 0
set it.SkillLevel[i] = 0
set it.Applies[i] = false
set i = i + 1
endloop
return it
endmethod
endstruct
The idea is an item type with several attributes like resistances, damage bonus etc (for varius elements). My problem is with the "Applies" member.
See this declaration:
JASS:
// -- ARMOR is a constant integer (= 6)
// -- Topaz --
set x = IDATA.create('G003', true)
set x.Applies[ARMOR] = true
// -- Diamond --
set x = IDATA.create('G000', true)
set x.Applies[ARMOR] = true
If I use a debug message to show "true" or "false" depending on x.Applies[...] value, it only shows correctly for Diamond. It shows false for all indexes for Topaz.
However, if I invert the order, those things also invert. Moreover, if I just put anoter IDATA.create in front of Diamond, it stops working too.
JASS:
// -- Diamond --
set x = IDATA.create('G000', true)
set x.Applies[ARMOR] = true
set x = IDATA.create('G000', true)
// -- Diamond does not work anymore --
Note that if I remove the "set it.Applies = false" line in the struct create method, this problem is solved. But I'd still like to know what's causing this =/
I've thought about struct quantity limit due to the number of arrays in the structure. But even if I divide 8100 by 7 there will still be more than 1000 usable struct - and I have no more than 10 created structs.
Can someone help me?
Thanks in advance
Hossomi