I've found myself reusing some cookie & menu int/bool functions recently.
Example with cookies and ints:
Code:
/**
* Sets a cookie to an integer value by converting it to a string.
*/
public void SetCookieInt(int client, Handle cookie, int value) {
char buffer[INTEGER_STRING_LENGTH];
IntToString(value, buffer, sizeof(buffer));
SetClientCookie(client, cookie, buffer);
}
/**
* Fetches the value of a cookie that is an integer.
*/
public int GetCookieInt(int client, Handle cookie) {
char buffer[INTEGER_STRING_LENGTH];
GetClientCookie(client, cookie, buffer, sizeof(buffer));
return StringToInt(buffer);
}
My question is: there is a way to get around doing things like this? The lack of something like this makes me thing I'm doing something wrong.
If not, would something like this be accepted into smlib? (with better naming and not-1.7 syntax of course)
__________________