Weird

Have a question, suggestion, or comment about Aleph One's features and functionality (Lua, MML, the engine itself, etc)? Post such topics here.
Post Reply
Redocc
Spazeroid
Posts: 2
Joined: Jul 4th '11, 09:53
Location: /dev/null
Contact:

Code: Select all

struct damage_kick_definition damage_kick_definitions[NUMBER_OF_DAMAGE_TYPES] =
{
        {0, 1, true}, // _damage_explosion,
        {0, 3, true}, // _damage_electrical_staff,
        {0, 1, false}, // _damage_projectile,
        {0, 1, false}, // _damage_absorbed,
        {0, 1, false}, // _damage_flame,
        {0, 1, false}, // _damage_hound_claws,
        {0, 1, false}, // _damage_alien_projectile,
        {0, 1, false}, // _damage_hulk_slap,
        {0, 3, true}, // _damage_compiler_bolt,
        {0, 0, false}, // _damage_fusion_bolt,
        {0, 1, false}, // _damage_hunter_bolt,
        {0, 1, false}, // _damage_fist,
        {250, 0, false}, // _damage_teleporter,
        {0, 1, false}, // _damage_defender,
        {0, 3, true}, // _damage_yeti_claws,
        {0, 1, false}, // _damage_yeti_projectile,
        {0, 1, false}, // _damage_crushing,
        {0, 1, false}, // _damage_lava,
        {0, 1, false}, // _damage_suffocation,
        {0, 1, false}, // _damage_goo,
        {0, 1, false}, // _damage_energy_drain,
        {0, 1, false}, // _damage_oxygen_drain,
        {0, 1, false}, // _damage_hummer_bolt,
        {0, 0, true} // _damage_shotgun_projectile,
};
Wow just wow and I thought I've seen some weird code.
From what I can tell its a struct that passes values to an array of functions?

Can some one please explain this to me I am definitely interested in how that works I don't even know if I was anywhere in the ballpark on this one.
User avatar
Switch
Vidmaster
Posts: 1005
Joined: Jan 22nd '06, 05:01
Location: NYC
Contact:

I approved your account, Redocc. Welcome to the Pfhorums.
User avatar
treellama
Vidmaster
Posts: 6107
Joined: Jun 2nd '06, 02:05
Location: Pittsburgh
Contact:

Redocc wrote:Can some one please explain this to me I am definitely interested in how that works I don't even know if I was anywhere in the ballpark on this one.
It's just an array of structs. Those are used everywhere in C code!
Last edited by treellama on Jul 4th '11, 16:59, edited 1 time in total.
User avatar
thermoplyae
Mjolnir Mark IV
Posts: 735
Joined: Sep 10th '06, 17:35
Contact:

nothing's being passed anywhere. there's little structural difference between that block and this line:

Code: Select all

int a = 3;
dude, seriously. dude.
Post Reply