Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Use counter for group macros #108

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

BrettMayson
Copy link
Contributor

@BrettMayson BrettMayson commented Jul 20, 2023

Personally I prefer this as you don't need to declare a macro for each, don't need to worry about calling them in the correct order, although you do need to call __COUNTER_RESET__ at the start

Depends on #107 because I was using a dev build of HEMTT that doesn't like the current master. Looks like current HEMTT also doesn't like __COUNTER_RESET__ for some reason.

(This PR will look better once #107 is on master)

@BrettMayson
Copy link
Contributor Author

@Mike-MF Are you interested in this? Do I update it?

@Mike-MF
Copy link
Member

Mike-MF commented Sep 20, 2023

eh, It's a lot of work I'd just close it

@BrettMayson
Copy link
Contributor Author

I mean, not really. just a preference thing

@jonpas
Copy link
Member

jonpas commented Sep 20, 2023

I like it, it simplifies things.

@Mike-MF
Copy link
Member

Mike-MF commented Sep 21, 2023

Feel free, might be placebo but using ranks more "correctly" seems to actually affect how quickly group leaders change with less downtime on AI actually doing stuff. Added it into the macro below how it is currently, hopefully it's right as I'm still mostly asleep.

// Group Macros
#define GROUP_UNIT(UNIT,SIDE) __GROUP_UNIT(__COUNTER__, UNIT, SIDE)

#define __GROUP_UNIT(COUNTER, UNIT, SIDE) \
    class unit##COUNTER { \
        vehicle = #UNIT; \
        side = SIDE; \
        #if COUNTER == 0 \
        rank = "SERGEANT"; \
        #else \
        #if COUNTER == 2 \
        rank = "SERGEANT"; \
        #else \
        #if COUNTER == 3 \
        rank = "CORPORAL"; \
        #else \
        #if COUNTER == 5 \
        rank = "SERGEANT"; \
        #else \
        #if COUNTER == 6 \
        rank = "CORPORAL"; \
        #else \
        rank = "PRIVATE"; \
        #endif \
        #endif \
        #endif \
        #endif \
        #endif \
        position[] = { \
            QUOTE(5 * floor ((COUNTER + 1) / 2) * (-1 ^ (COUNTER + 1))), \
            QUOTE(-5 * floor ((COUNTER + 1) / 2)), \
            0 \
        }; \
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants