• 🏆 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!

[Wurst] SmartTrack

This is the Wurst version of my vJASS library SmartTrack.


PS: Would you rather I upload this to wurstbin and link it here instead?
PS2: What tags am I supposed to use for Wurst submissions? Doesn't say anywhere.
 
Last edited:
Lol almost 3 years later. I had forgotten this was even here.

I do have a more recent version but it's using all abstract classes that you need to extend. No closures, so I don't know if I discovered there was something wrong with this version along the way and had to change it...

Do you have a github repository in wurst dependency format?
Nope. How do I do that?
 

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,534

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,534
I think the MUI part was the reason I moved away from closures and use extended classes instead.

To answer a few of your questions:

A SmartTrack instance wasn't meant to be a thing. Only the closures are supposed to do anything.

The ignoreOrder variable is used if you want to issue an order that doesn't break tracking, so were meant to:
JASS:
ignoreOrder = true
// issue order
ignoreOrder = false

I found '.getSource' inside of the EventHelper package:
JASS:
public function trigger.getSource() returns unit
    return triggerData.loadUnit(GetHandleId(this))

Also why should I not use handle ids inside of HashMaps? Is that a coding convention thing or is there a safety reason behind it?

As for updating the package itself, I've sort of moved away from Warcraft 3 in general so I can't really say when I'll have the time to look into fixing this. If you have a solution ready I'll gladly update the OP with credits to you.
 

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,534
Thanks @Spellbound . Given the MUI bug, can you upload your newer version? I would review that separately.

Also why should I not use handle ids inside of HashMaps? Is that a coding convention thing or is there a safety reason behind it?

Generics in general are a type constraint tool which aids in correctness. When you type your hashmap as "int" then you expose yourself to accidentally using any other integer-derivable keys. For example, you could accidentally store an item and then try to loadUnit.

You are circumventing the wurst type checker and exposing yourself, yes.
 
Thanks @Spellbound . Given the MUI bug, can you upload your newer version? I would review that separately.



Generics in general are a type constraint tool which aids in correctness. When you type your hashmap as "int" then you expose yourself to accidentally using any other integer-derivable keys. For example, you could accidentally store an item and then try to loadUnit.

You are circumventing the wurst type checker and exposing yourself, yes.

I'll upload it to the bin because the bb code here is removing my linebreaks
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
I'll upload it to the bin because the bb code here is removing my linebreaks
It does that to me, too, when I paste in code from vsCode.

It also adds twice the number of spaces when I copy code while editing a HiveWorkshop post and paste it somewhere else, but thankfully doesn't have this issue when copying outside of edit mode (on the static post itself).

@Ralle not sure if this is already on your radar.
 

Ralle

Owner
Level 77
Joined
Oct 6, 2004
Messages
10,098
Does it do the same if you disable WYSIWYG?, the
1668626285557.png
button.
 

Ralle

Owner
Level 77
Joined
Oct 6, 2004
Messages
10,098
That's really annoying. It's a XenForo thing and not easy for me to fix.

Which browser are you pasting into?

Could you perhaps record a video?

I'm reminded of this, but that got fixed:

What if you paste from Notepad?
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
I'm using Edge on Win10. I've just tested it on Firefox and the behavior is the same. If it's a XenForo thing, then I guess there isn't much that can be done about it aside from using Ctrl+Shift+V or toggling the BBcode brackets (though Ctrl+Shift+V only works when pasting into Hive, but not when pasting copied Hive text into a text editor).
 

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,534
I'll upload it to the bin because the bb code here is removing my linebreaks
I didn't spot any major issues with this one -- can you update the original post and I will approve it?
 
Top