HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Property Attachment Modules

04-22-2009, 05:40 PM#1
Strilanc
These modules can be used to turn any struct into augmented hash tables. There are 5 basic module types available, for the various uses you might have. Some are for integer keys, some are for handles, some support automated allocation, and some support automated cleanup.

The exact details are in the code header. The example map shows off some simple potential applications. Automated cleanup is only supported for some handle types (unit, item, destructable, trigger, and timer).

Expand JASS:
Attached Files
File type: w3xPropAtch Modules.w3x (33.5 KB)
04-25-2009, 12:35 PM#2
Strilanc
I was expecting a bit more commentary.

For example:
Collapse JASS:
private constant integer STATE_EPAMTY = 0
How the heck did that typo happen, and stay in there?
04-25-2009, 02:10 PM#3
Alevice
Quote:
Originally Posted by Strilanc
I was expecting a bit more commentary.

It seems official reviwers are all missing in action.



I may want to take a peek on this later.
04-25-2009, 10:37 PM#4
grim001
My view is that we need more concrete examples of what this is useful for.
04-25-2009, 10:54 PM#5
Strilanc
I assume you mean in addition to the example map? Let me give a real-world example: the physics and vehicle systems in my lordaeron grand prix map, which I work on now and then.

There are three places I use the system:
- Each unit being handled by the physics system has Particle struct. The first line of the Particle struct is "implement Property", which allows me to use Particle[u] to retrieve a unit's particle. (I'm not using an auto property because currently particles don't map 1-1 with units).
Expand JASS:

- Cars should have more traction on roads, and they should slide easily on dirt. So I have a TileData class, containing things like friction and bounciness, which implements RawProperty. I can then use TileData[GetEnvironmentType(x, y)] to retrieve the struct containing the tile's properties. I do a sortof dirty hack here by assigning default values to the struct at index 0 instead of using a RawAutoProperty to ensure I always get a valid struct.
Expand JASS:

- The cars themselves have stats, so I do the same thing as I did with tile data, except with unit types.
Expand JASS:
04-29-2009, 12:21 AM#6
Vexorian
not that bad.

It seems all right, not that great for handle attachment but raw data is cute enough.

/approved
08-01-2009, 07:46 PM#7
Archmage Owenalacaster
The Rough Dirt's name is typoed as "Rought Dirt".