PlayerVars abstraction using macros
#1

Hello,

I'm trying to make an abstraction on top of a PlayerVars array using macros.
I want to write something like this:

PHP код:
SET_VARS PlayerVars [
    
MAKE_PVAR(ID),
    
MAKE_PVAR(IsConnected),
    
MAKE_PVAR(Name[MAX_PLAYER_NAME]),
    
MAKE_PVAR(SkinID),
    
FloatMAKE_PVAR(Position[3]),

Which should be rewritten as this:

PHP код:
enum enum_PlayerVars {
    
MAKE_PVAR(ID),
    
MAKE_PVAR(IsConnected),
    
MAKE_PVAR(Name[MAX_PLAYER_NAME]),
    
MAKE_PVAR(SkinID),
    
FloatMAKE_PVAR(Position[3]),
}
new 
PlayerVars[MAX_PLAYERS][enum_PlayerVars]; 
Is it possible to do that? And how should I do it?
Reply
#2

The obscurity has a reason. It's part of a framework that I'm trying to make where the implementer does not have to know the underlying data structure to make these type of variables. So I would consider this as an abstraction in the situation that I'm using it in.


I tried this but it's wrong. Is it actually possible to make a macro like that? I don't have much experience with it.
PHP код:
#define SET_MODEL_VARS%0[%1] enum enum_%0 {%1}; new %0[MAX_MODEL_INSTANCES][enum_%0]; 
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)