Jump to content

[epoque] map_session_data design


Ind

Recommended Posts


  • Group:  Members
  • Topic Count:  169
  • Topics Per Day:  0.04
  • Content Count:  1260
  • Reputation:   750
  • Joined:  11/19/11
  • Last Seen:  

I found the following in a old bug tracker issue, moving it to developers chat so it is not lost (again).

In all honesty, I'd like to see some areas of the struct map_session_data; object being re-written or re-organized. The whole thing is one big lump of confused and mixed-up values.

IE:

unsigned int canlog_tick;

unsigned int canuseitem_tick; // [skotlex]

unsigned int canusecashfood_tick;

unsigned int canequip_tick; // [inkfish]

unsigned int cantalk_tick;

unsigned int canskill_tick; // used to prevent abuse from no-delay ACT files

unsigned int cansendmail_tick; // [Mail System Flood Protection]

unsigned int ks_floodprotect_tick; // [Kill Steal Protection]

Could be condensed down to:

struct {

unsigned int logout;

unsigned int item;

unsigned int cashfood;

unsigned int equip;

unsigned int talk;

unsigned int skill;

unsigned int mail;

unsigned int ks_floodprotect;

} tick;

That's only an example, there's likely to be a better way to write that block, however the point I'm making is that storing these values in an inline struct makes no difference to performance, it still points to the same memory address. This is definitely something worth looking into.

I'd also consider removing a lot of the static types in the structure, such as 'unsigned int' for time tick values, replacing them with system specific 'time_t' values (I believe some operating systems handle this type differently (ulong vs. uint) and it also adds structure/definition to the entire file header).

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  303
  • Reputation:   101
  • Joined:  11/13/11
  • Last Seen:  

Totally agree, and not only the MSD can be rewritten. Honestly the entire emulator is a messy(mainly the scripting engine).

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  633
  • Reputation:   78
  • Joined:  11/14/11
  • Last Seen:  

I say +1 seems much cleaner to me

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  427
  • Reputation:   123
  • Joined:  11/17/11
  • Last Seen:  

Agreed.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  554
  • Reputation:   70
  • Joined:  04/04/12
  • Last Seen:  

I second the motion....

Link to comment
Share on other sites

  • 6 months later...

  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

Heya.. Let's break some diffs and get this implemented xD

Did I break something with this?

diff only: http://upaste.me/raw/5d73694142303f85

pc.h: http://upaste.me/raw/537769422cc7caf2

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  351
  • Reputation:   52
  • Joined:  11/15/11
  • Last Seen:  

In favor of this change, go for it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...