From cf429d2e0f1c6b15bf78d1fc63b41d4530c80845 Mon Sep 17 00:00:00 2001 From: Greyscale Date: Mon, 6 Jul 2009 22:09:54 -0700 Subject: [PATCH] No longer checks if cookie exists before creation, because RegClientCookie does that for me. --- src/zr/playerclasses/clientoverlays.inc | 8 ++----- src/zr/weapons/zmarket.inc | 30 +++++++++++-------------- src/zr/zhp.inc | 8 ++----- 3 files changed, 17 insertions(+), 29 deletions(-) diff --git a/src/zr/playerclasses/clientoverlays.inc b/src/zr/playerclasses/clientoverlays.inc index 4c7a27a..1485cc8 100644 --- a/src/zr/playerclasses/clientoverlays.inc +++ b/src/zr/playerclasses/clientoverlays.inc @@ -73,12 +73,8 @@ ClassOverlayOnCommandsHook() */ ClassOverlayOnCookiesCreate() { - // If cookie doesn't already exist, then create it. - g_hOverlayEnabledCookie = FindClientCookie(CLASSOVERLAY_COOKIE_ENABLED); - if (g_hOverlayEnabledCookie == INVALID_HANDLE) - { - g_hOverlayEnabledCookie = RegClientCookie(CLASSOVERLAY_COOKIE_ENABLED, "The toggle state of the class overlay.", CookieAccess_Public); - } + // Create overlay cookie. + g_hOverlayEnabledCookie = RegClientCookie(CLASSOVERLAY_COOKIE_ENABLED, "The toggle state of the class overlay.", CookieAccess_Public); } /** diff --git a/src/zr/weapons/zmarket.inc b/src/zr/weapons/zmarket.inc index 8b7500e..22146fe 100644 --- a/src/zr/weapons/zmarket.inc +++ b/src/zr/weapons/zmarket.inc @@ -65,25 +65,21 @@ ZMarketOnCommandsCreate() ZMarketOnCookiesCreate() { - // If auto-rebuy cookie doesn't already exist, then create all ZMarket cookies. - g_hZMarketAutoRebuyCookie = FindClientCookie(ZMARKET_COOKIE_AUTOREBUY); - if (g_hZMarketAutoRebuyCookie == INVALID_HANDLE) + // Create all cookies. + g_hZMarketAutoRebuyCookie = RegClientCookie(ZMARKET_COOKIE_AUTOREBUY, "The toggle state of auto-rebuy.", CookieAccess_Public); + + decl String:rebuycookiename[32]; + decl String:rebuycookiedesc[64]; + + // x = Weapon slot. + for (new x = 0; x < WEAPONS_SLOTS_MAX + 1; x++) { - g_hZMarketAutoRebuyCookie = RegClientCookie(ZMARKET_COOKIE_AUTOREBUY, "The toggle state of auto-rebuy.", CookieAccess_Public); + // Format cookie name and description. + Format(rebuycookiename, sizeof(rebuycookiename), "%s_%d", ZMARKET_COOKIE_REBUY, x); + Format(rebuycookiedesc, sizeof(rebuycookiedesc), "Current loadout weapon for slot %d", x); - decl String:rebuycookiename[32]; - decl String:rebuycookiedesc[64]; - - // x = Weapon slot. - for (new x = 0; x < WEAPONS_SLOTS_MAX + 1; x++) - { - // Format cookie name and description. - Format(rebuycookiename, sizeof(rebuycookiename), "%s_%d", ZMARKET_COOKIE_REBUY, x); - Format(rebuycookiedesc, sizeof(rebuycookiedesc), "Current loadout weapon for slot %d", x); - - // Register client cookie. - RegClientCookie(rebuycookiename, rebuycookiedesc, CookieAccess_Public); - } + // Register client cookie. + RegClientCookie(rebuycookiename, rebuycookiedesc, CookieAccess_Public); } } diff --git a/src/zr/zhp.inc b/src/zr/zhp.inc index d6e5dfe..55fba8f 100644 --- a/src/zr/zhp.inc +++ b/src/zr/zhp.inc @@ -54,12 +54,8 @@ ZHPOnCommandsCreate() */ ZHPOnCookiesCreate() { - // If cookie doesn't already exist, then create it. - g_hZHPEnabledCookie = FindClientCookie(ZHP_COOKIE_ENABLED); - if (g_hZHPEnabledCookie == INVALID_HANDLE) - { - g_hZHPEnabledCookie = RegClientCookie(ZHP_COOKIE_ENABLED, "The toggle state of ZHP.", CookieAccess_Public); - } + // Create ZHP cookie. + g_hZHPEnabledCookie = RegClientCookie(ZHP_COOKIE_ENABLED, "The toggle state of ZHP.", CookieAccess_Public); } /**