Struct arrays
Posted: Thu Jun 29, 2017 7:22 am
what are the consequences if i set the array length to lets say 5
and then set the array data as seen below for
and then go back and change the array length back to 4
does it wipe the 0 to 3 data i already put in or does it just change the array count
I would only be making the array smaller not larger if this is possible
the reasoning behind this is if you have an item with potency on it in the stat list and there are 5 stats, the 5 is the array size
but if you are using DOV client or another client that the stat is not in, i dont want that stat in the array and would skip adding it to the packet, but then would need to change the array size
i could work around this by reading all the stats for that item and placing them in a temp array, then reading that temp array to determine what stat number to send to the client based on the client version but that seems like double work
Code: Select all
packet->setSubstructArrayLengthByName("header_info", "stat_count", 5);Code: Select all
packet->setArrayDataByName("stat_type", stat->stat_type, 0);
packet->setArrayDataByName("stat_subtype", tmp_subtype, 0);
packet->setArrayDataByName("stat_type", stat->stat_type, 1);
packet->setArrayDataByName("stat_subtype", tmp_subtype, 1);
packet->setArrayDataByName("stat_type", stat->stat_type, 2);
packet->setArrayDataByName("stat_subtype", tmp_subtype, 2);
packet->setArrayDataByName("stat_type", stat->stat_type, 3);
packet->setArrayDataByName("stat_subtype", tmp_subtype, 3);Code: Select all
packet->setSubstructArrayLengthByName("header_info", "stat_count", 4);I would only be making the array smaller not larger if this is possible
the reasoning behind this is if you have an item with potency on it in the stat list and there are 5 stats, the 5 is the array size
but if you are using DOV client or another client that the stat is not in, i dont want that stat in the array and would skip adding it to the packet, but then would need to change the array size
i could work around this by reading all the stats for that item and placing them in a temp array, then reading that temp array to determine what stat number to send to the client based on the client version but that seems like double work