| 02-18-2007, 08:57 PM | #1 |
Do passing groups/locations/handle derivatives actually create another groups/locs or just passing their location in memory? What if I destroy the groups/locs that has just passed, do the original get destroyed also? |
| 02-18-2007, 09:05 PM | #2 |
If, as I assume, you're converting the handle to an integer and then storing this for later retrieval, then it's just storing the location in memory. It's much like a certain style of C programming, which I have never had occasion to use myself. In whatever architecture, 32-bit or 64-bit or whatever, you can typically store a pointer as an integer. A handle is simply a pointer to a pointer. Messy, messy stuff. I've tried a few spells using the timers/game cache logic, and while I'm happy enough with what I created, the string leaks dissuade me from using it for more extensively timed effects. I just make some dedicated global arrays, including a global array of timers, and check to see which is the expiring timer in the global array (hence I get the particular instance of the spell) in the function that fires when the timer expires. It's probably MUCH faster than string conversions and whatever--all I'm doing is comparing pointers until I find the right one, and I limit it to about eight (or possibly sixteen) simultaneous instances of the same spell. You probably won't have more than that anyway. When it finds the right instance, it just sets the loop variable to the upper limit and exits on the next iteration, so in most cases, when there's only one instance of the spell firing, you're only going to have to go through one pointer comparison anyway. |
| 02-19-2007, 03:08 PM | #3 | |
Quote:
I see, what about if I pass a group to another function? Does JASS automatically create a copy of the group and pass it (so the function called have a separate group to work with) or does JASS just pass the location in memory? |
| 02-19-2007, 09:24 PM | #4 |
All types in JASS are integers, arguments are integers as well. No clones are created, what you pass is what you get. |
| 02-19-2007, 09:34 PM | #5 | |
Quote:
sort of that. |
