dialog log server ?
#1

Hi everyone is a newbie I want to ask #define many server dialogs are lag behind and how to set the correct dialog?

Reply
#2

Better use enums
PHP код:
enums
{
yourdialog0,
yourdialog1,
yourdialog2
}; 
Reply
#3

Quote:
Originally Posted by Debjit
Посмотреть сообщение
Better use enums
PHP код:
enums
{
yourdialog0,
yourdialog1,
yourdialog2
}; 
Enums are stored in the memory, you don't want to use that much memory for something so simple, I recommend you to keep the #define way you're using, It will increase the compilation time, however, dialog ids won't be stored in the memory.
Reply
#4

Are you sure about that? Enum specifiers are constants, not variables. They also have the added benefit that an ID is never used twice and that you can reorder the specifiers without having to change the IDs manually. And even if you had 5000 specifiers you'd be looking at a mere 20 kilobytes. Wow, so much memory! /s
Reply
#5

It won't lag in game, it might lag the compiler, although, You are defining it the right way, and if you want to not have this lag problem, You can delete that define and just use its ID in ShowPlayerDialog, And store the ID in a notepad on your pc or something.
Reply
#6

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
It won't lag in game, it might lag the compiler, although, You are defining it the right way, and if you want to not have this lag problem, You can delete that define and just use its ID in ShowPlayerDialog, And store the ID in a notepad on your pc or something.
That is the worst thing I've ever read on here. Okay kidding, not that bad, but still...

Just use defines if you're cool with re-ordering them once in a while (or leave some free ids between each, either way that's totally cool and will not "lag" anything).

Use enums if you want to make it simple (because it really is the most simple thing regarding this - and it will not "lag" your server or compiler).


Neither is going to influence the speed of the server, and the compile time difference between actual numbers, defines and enumerations is negligible.

As Vince said, enums are constants.

Код:
enum
{
test
};
and

Код:
#define test 0
are exactly the same after compiling. Even using enumerations for arrays is nothing else than a constant number replaced with a word which is easier for us humans to read (tags (or data types) also aren't neccessary to declare in enums, but it's just easier for us)...

An enum as suchs doesn't even exist after compiling.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)