Because the post didn't mention it, and i didn't read all 9 pages of comments I shall say something (very short) on macros
Macros rock. Basically a really quick way of writing a static (as in nothing in it will change) one-line function. To make calculations easier to read, easier to put into your code, and even grab parts of code required to be used many times.
If you are using a macro with more than one parameter you cannot separate them with commas
(my main point) And each parameter will be prefixed with a % followed by an identifier. I'm not sure if this convention can change....but it seems to be accepted, so i'm going with it.
For instance....you have three arrays. One holds indexes to each of the two other arrays. You can combine these two array indexes using a macro with some simple math in it. Then two other macros to retrieve them. See my code....
#define PRECISION 10000 // this makes sure the numbers don't run together
#define SET_DATA(%1 %2) %1 * PRECISION + %2
#define GET_INDEX1(%1) %1 / PRECISION
#define GET_INDEX2(%1) %1 % PRECISION
// type and size are indexes to the playerType/Size arrays
public doPlayerThing(id, type, size)
g_PlayersData[id] = SET_DATA(type size)
public getPlayerData(id, &type, &size)
new data = g_PlayersData[id]
type = GET_INDEX1(data)
size = GET_INDEX2(data)
As you can see to combine the two numbers i used a macro to multiply the first index by a large number (i used 10000 for the easy math) any number greater than that of the second will do, really, then add the second. Then to retrieve each number i used another macro for each. To get the first you do some simple integer division (which will leave off the remainder, returning all whole numbers in the division) this gives you that first index. Then for the second i used modulus (%) to get the remainder of the division. This gives you that second index you added on. All combined successfully give you a sleek, efficient way of storing two numbers into one cell.
Hope i helped.