View Single Post
splewis
Veteran Member
Join Date: Feb 2014
Location: United States
Old 08-22-2014 , 15:56   Re: SMLIB 0.11 BETA (over 300 Function Stocks) | updated 15.07.2011
Reply With Quote #371

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)
__________________

Last edited by splewis; 08-23-2014 at 00:07.
splewis is offline