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

[Snippet] RawCodeIndexer

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
I always view the outputwar4map.j file, I have it perpetually open on Notepad++ so it updates whenever I save the map ;)

I use the shortest module implementations possible for what I do. You should see how much I grill Nestharus about shortening his modules. Efficiency is his thing, so he'd rather have a huge module that gives a tiny efficiency boost than a short module that works insignificantly slower.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
While interfaces may generate some jargon, extending structs doesn't (I'm pretty sure it just uses the code you are extending from). Imagine I had my Projectile library as an implementable module and then users would have to implement that into their structs and declare a special method. If you had 8 types of projectiles, that would add roughly 8,000 lines of code where only 1,000 was necessary.

They're all the same thing, I just prefer using the OO side of things because it makes more complicated scripts easier to organize and debug and maintain.
 
Level 6
Joined
Jun 20, 2011
Messages
249
Reducing code leads to trigger evaluations.
Check my missile library, there I try to keep code implemented by modules as minimal as possible, and the best thing about the whole library, not a single trigger evaluation.
Don't get me wrong, i'm not a map size freak like Bribe is, not at all, but he is right sometimes, so we try to reach that moment where the code implemented is very short and almost no performance was lost (which should be the case every time).
Extending structs to array leads to complex OOP? I differ, it merely treats the struct as it is, a scope for arrays, by deleting the default code generated by the JH, sometimes it's a need like on the LinkedListModule
 
We need to decide on an ideal API for this.
No two people have agreed on the same API yet :/

I'm going to go with a struct API and a Jass API.
Personally, I think this:

JASS:
struct RawCode extends array
    static method raw2Id takes integer returns integer
    static method id2Raw takes integer returns integer
    static method getId takes integer returns integer
endstruct

function RawCode2Id takes integer returns integer
function Id2RawCode takes integer returns integer
function GetRawCodeId takes integer returns integer
 
Top