| 11-06-2005, 06:00 PM | #1 |
How would I go about making a 2d array (in GUI, not JASS)? I'm trying to make a hero building system, and it's getting a lot more complicated than I had hoped. |
| 11-06-2005, 06:36 PM | #2 |
You can simulate a 2D array by using the normal 1D array and using the following equation as the index: ( A + ( B * maxA ) ) However, with multidimensional arrays, you can quickly reach the array index limit which is around 8000. Array indexes can't go above that. |
| 11-07-2005, 06:34 PM | #3 |
or... you could just use game cache. |
| 11-09-2005, 05:11 PM | #4 |
He wants an array for easy use and reference, most likely. Game cache would still require the same ammount of work, if not more, as using a large 1d array. |
| 11-10-2005, 02:07 PM | #5 |
Game caches are much easier to work with than simulated 2d arrays, from my experiance. It is much easier to: JASS:GetStoredInteger(udg_Cache, I2S(h), I2S(k)) Than it is to calculate the correct index, and hope you choosed a max value that was high enough. Storing a subset of handles into the gamecache isn't fun, but it is extremely versitile. You can have 2d arrays with both indexes named as strings, which is very useful when you get into more complex data structures. Probally the best use of the gamecache, which is almost impossible to replicate another way, is the ability to "attach" values to a handle. Personally, I use a self-coded API for this, although Lord Vexorian has something very similar (And most likely better |
