1

Topic: Simple question

I was reading the e_datafile.c's sourcecode and wondering, about that:

typedef struct
{
        int type_and_id;
        int size;
} DATAFILE_ITEM;

Why do you create an int "type_and_id", and mess with bitwise in the following of the code, instead of simply do:

typedef struct
{
        short type;
        short id;
        int size;
} DATAFILE_ITEM;

smile

2

Re: Simple question

because that way is silly, and games are silly, and teewars is a game

makes very little sence, but neither does george bush and hes the president of the usa

hello, my names jack, i love making new skins and i have a rubber duck for a gun!

why not...

3

Re: Simple question

goldtrayler wrote:

because that way is silly, and games are silly, and teewars is a game

makes very little sence, but neither does george bush and hes the president of the usa

Well, what I think is rather silly is to complain, someone is trying to propose something to the code to make it smaller and maybe faster, why are you complaining?

Official Teeworlds map developer and community moderator
Administrator for the Teeworlds community Teesites

4

Re: Simple question

It has to do with platform independence. All the data in the file is stored as 32 bit integers. That makes it easy to swap the data between little and big endian.