Originally posted by [b]theultramage[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=858
I always thought the way eathena does player item bonus variables zeroing was a joke, but only now did I find out how bad it really is...
Here are the key points:
- Arrays and variables, separated into long blocks. Some are zeroed, some are not.
The exact ordering of entries must be preserved otherwise everything screws up. - Usage of memset(), with size equal to a sum of a multiple-page-long list of individual variable sizeof()'s.
Each new variable needs to be manually added here, otherwise it won't get zeroed. - The memset() calls are keyed by addresses of some delimiting variables. Place your new var in an inappropriate place, and it messes up.
...
Wouldn't it be easier to just zero out the entire thing, then re-add values that are supposed to be nonzero? It's pages and pages of error-prone C code, can't this be done in some more intelligent way?
This post has been edited by theultramage: Jan 21 2008, 07:01 PM