| 08-28-2008, 02:47 AM | #1 |
I'm sure I'll figure something out, but I wanted to know if anyone had any ideas first. Basically, I'm trying to make a ability tree and I'm looking for methods to organize this. First, I thought of using structs. One struct for each ability which would store its parent and sub-abilities. Second, I thought of making a matrix (an array of arrays), but I might be a little messy. |
| 08-28-2008, 03:37 AM | #2 |
A matrix would be your best best. You can store each "spell level" as a row and then add the spells in the row to the columns. Give each spell a requirement spell, and then to check, just loop down the requirements until all are met. |
| 08-28-2008, 04:14 AM | #3 |
Use game cache and dont care about leaks, cos this data is static. |
| 08-28-2008, 10:23 AM | #4 | |
Quote:
Not necessarily: JASS://! textmacro Matrix takes NAME, TYPE, SCOPE, WIDTH $SCOPE$ struct $NAME$ private static $TYPE$ array a method operator [] takes integer i returns $TYPE$ return .a[this+i] endmethod method operator []= takes integer i, $TYPE$ t returns nothing set .a[this+i] = t endmethod static method operator [] takes integer i returns $NAME$ return i*$WIDTH$ endmethod endstruct //! endtextmacro I do not think a matrix is the best way of representing a tree structure in this case. I'd probably go with structs and lists. |
