• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Andromeda - Galaxy Extension

Status
Not open for further replies.
Level 16
Joined
Oct 12, 2008
Messages
1,570
I have two simple questions.
I know OOP from C++, but I've never heard the word "enrichment" when reading or hearing about OOP, what do you mean by it?
And you also mention generic, does this mean templates? Templates is a difficult subject to implement. I'm skeptic about this project, but I hope it'll work out :)
Also, I've never used Java or studied any of it, but I've heard it lacks speed. If this is true, then don't you think it's a problem?

How I see enrichment is this: (But I am just a simple mind, with close to zero knowledge of coding)
You can see every type in Galaxy as a class. We cannot acces it's members directly, only through functions..
Now an enrichtment would be like a class extending the type. You can add members (maybe even functions, haven't read through the manual THAT thoroughly yet) and make them have their own behaviour.

So, in vJass, when you wanted a unit to have another thing besides HP and MP, for instance, something that keeps track of how sleepy a unit is (irrelevant to alot of things, I know, but I had to come up with something), you would do something like this:

JASS:
struct Unit
    unit theUnit
    integer sleepyness
    method SetSleepyness takes integer i returns nothing
        set sleepyness = i
    endmethod
endstruct
Now with Andromeda, we can do something like this:
Code:
enrich unit{
    int sleepyness
    void SetSleepyness(int i){
        sleepyness=i;
    }
}
(Please correct the syntax if I am wrong, I only just found out about the whole Andromeda Concept..)

Quite a step forward, if you ask me.
 
Last edited:
Level 9
Joined
Nov 28, 2008
Messages
704
As long as sleepyness was static, you could do something close to that.

But it wont be a class variable, units will not have an individual sleepyness variable.

If you wanted it to be, you could enrich a unit with your function, and make it get/set the custom value of your unit.

JASS:
enrich unit
{
	private const int SLEEPY_INDEX = 1337;
	
	public int sleepiness
	{
		get
		{
			return this.getCustomValue(SLEEPY_INDEX);
		}
		
		set
		{
			this.setCustomValue(SLEEPY_INDEX, value);
		}
	}
}

We need [galaxy] tags. :(

Also, not 100% that example will work yet. I havent looked at the standard unit enrichment in detail yet (even though I was the one that generated it with a script, :p) and I don't even know if geX is including it in the standard library yet.

On top of that, Im not sure if the function is GetCustomValue or not. SetCustomValue is right, though.
 
Status
Not open for further replies.
Top