wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 01-08-2018, 03:15 PM   #1
Yrth
User
 
Yrth's Avatar
 
Join Date: Jul 2010
Posts: 76

Yrth has little to show at this moment (4)

Default Extend array and _

I sorta get why you can't extend multiple objects in warcraft's engine, but I was wondering if you can extend array and another object? Extending array seems to alter the structs generated functionality, so it seems like it may not have the same restriction as extending 2+ 0-8191 ID'd objects
Yrth is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 05-09-2018, 10:09 PM   #2
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,189

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

The "extends array" basically just removes instance allocation functionality (the allocate and deallocate methods as well as some internal values used by those methods) from the struct, essentially making it a dumb array, hence the syntax "extends array".

If you make a struct extend another struct, it uses the original struct's allocation functionality (among other things) and expands upon it. It doesn't make sense to also use "extends array" in this case, since that removes the very functionality that you are trying to expand on by extending another struct.

Think of structs that extend an array as not really structs at all, just arrays with struct-like syntax.
__________________
Anitarf is offline   Reply With Quote
Old 11-03-2018, 05:11 PM   #3
Yrth
User
 
Yrth's Avatar
 
Join Date: Jul 2010
Posts: 76

Yrth has little to show at this moment (4)

Default

lol a conversation across time and space. at least its all the same year... thanks for the reply, that makes a lot of sense, especially the bit
Quote:
since that removes the very functionality that you are trying to expand on by extending another struct

i'm slightly expanding this topic to multiple inheritance in general. i'm making a larger scale game and i want to be able to describe different types of complex enemies (each type represented as their own struct) in terms of an interface ILoadable, so they all can be stored in a list of ILoadable instances that exists in a Level struct and then loaded and unloaded as that Level needs. i'd also like to describe only some of these enemies with another interface, say IRespawnable or something like that, but can't via multiple inheritance. to use inheritance of a single object here, i'd need to expand the scope of my inherited thing to include all properties, relevant or not for its children

do you have a recommendation for designs that could handle this best?

now that wc3's array size limit is quadrupled, would you be at all willing to expand vjass to allowing structs to inherit from more objects? i really like multiple inheritance as a tool for controlling the scope of inheritance relationships, though i'm interested in any alternative approaches to it
Yrth is offline   Reply With Quote
Old 11-06-2018, 07:15 PM   #4
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,189

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Well, can't you just make IRespawnable a child of ILoadable?

I don't really use all that much inheritance when coding. I generally lean more towards using modules. Inheritance is more dynamic than modules but in most cases that extra bit of flexibility is not really needed. Can't really comment on your specific case since I don't know what you're trying to do.
__________________
Anitarf is offline   Reply With Quote
Old 11-07-2018, 10:13 PM   #5
Yrth
User
 
Yrth's Avatar
 
Join Date: Jul 2010
Posts: 76

Yrth has little to show at this moment (4)

Default

that works until i want something to be described as IRespawnable but not ILoadable, which i actually do -- static, un-moving units in my map aren't loaded and unloaded but left as-is, you can still kill some of them though, and ask them to respawn. chaining inheritance just for the compiler's sake contradicts the perk you mentioned, you lose the flexibility that you want from an inheritance relationship, and some of the meaning of the "is-a" description
Yrth is offline   Reply With Quote
Old 11-08-2018, 09:11 PM   #6
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,189

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Like I said, you may want the flexibility of an inheritance relationship, but that doesn't mean that you really need the flexibility of an inheritance relationship.

Technically, even static units get loaded when a map starts and unloaded when it ends. So there's nothing really wrong with using ILoadable for them.
__________________
Anitarf is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 02:47 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2018, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services