From e1d2b88c23ec491ac8b7ab29242ad6016a7e3589 Mon Sep 17 00:00:00 2001 From: Scott Ehlert Date: Fri, 2 Jan 2009 00:31:23 -0600 Subject: [PATCH 1/7] Fixed some inconsistencies in admins_simple.ini (bug 3540). --- configs/admins_simple.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/admins_simple.ini b/configs/admins_simple.ini index 9c88bbe6..cb4bc255 100644 --- a/configs/admins_simple.ini +++ b/configs/admins_simple.ini @@ -16,7 +16,7 @@ // "@Full Admins" // // You can also specify immunity values. Two examples: -// "83:abcdefg" //Immunity is 83, flags are abcefgh +// "83:abcdefgh" //Immunity is 83, flags are abcdefgh // "6:@Full Admins" //Immunity is 6, group is "Full Admins" // // Immunity values can be any number. An admin cannot target an admin with @@ -37,9 +37,9 @@ //////////////////////////////// // Examples: (do not put // in front of real lines, as // means 'comment') // -// "STEAM_0:1:16" "bce" //kick, ban, slay for this steam ID, no immunity +// "STEAM_0:1:16" "bce" //generic, kick, unban for this steam ID, no immunity // "!127.0.0.1" "99:z" //all permissions for this ip, immunity value is 99 -// "BAILOPAN" "abc" "Gab3n" //name BAILOPAN, password "Gab3n": gets reservation, kick, ban +// "BAILOPAN" "abc" "Gab3n" //name BAILOPAN, password "Gab3n": gets reservation, generic, kick // //////////////////////////////// From a34a27be654b1e6397f992f6b5caac5def894611 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 7 Jan 2009 02:08:14 -0500 Subject: [PATCH 2/7] Fixed top menu categories being available even if not usable (bug 3256, r=me). --- extensions/topmenus/TopMenu.cpp | 91 +++++++++++++++++++++++++-------- extensions/topmenus/TopMenu.h | 3 +- 2 files changed, 72 insertions(+), 22 deletions(-) diff --git a/extensions/topmenus/TopMenu.cpp b/extensions/topmenus/TopMenu.cpp index a4b97187..0a514856 100644 --- a/extensions/topmenus/TopMenu.cpp +++ b/extensions/topmenus/TopMenu.cpp @@ -248,6 +248,7 @@ unsigned int TopMenu::AddToMenu2(const char *name, cat->serial = 1; /* Add it, then update our serial change number. */ + obj->cat_id = m_Categories.size(); m_Categories.push_back(cat); m_SerialNo++; @@ -257,6 +258,7 @@ unsigned int TopMenu::AddToMenu2(const char *name, else if (obj->type == TopMenuObject_Item) { /* Update the category, mark it as needing changes */ + obj->cat_id = 0; parent_cat->obj_list.push_back(obj); parent_cat->reorder = true; parent_cat->serial++; @@ -407,6 +409,12 @@ bool TopMenu::DisplayMenu(int client, unsigned int hold_time, TopMenuPosition po UpdateClientRoot(client, pPlayer); + /* This is unfortunate but it's the best solution. */ + for (size_t i = 0; i < m_Categories.size(); i++) + { + UpdateClientCategory(client, i, true); + } + topmenu_player_t *pClient = &m_clients[client]; if (pClient->root == NULL) { @@ -443,8 +451,7 @@ bool TopMenu::DisplayCategory(int client, unsigned int category, unsigned int ho UpdateClientCategory(client, category); topmenu_player_t *pClient = &m_clients[client]; - if (category >= pClient->cat_count - || pClient->cats[category].menu == NULL) + if (category >= pClient->cat_count || pClient->cats[category].menu == NULL) { return false; } @@ -488,18 +495,16 @@ void TopMenu::OnMenuSelect2(IBaseMenu *menu, int client, unsigned int item, unsi if (obj->type == TopMenuObject_Category) { /* If it's a category, the user wants to view it.. */ - for (size_t i = 0; i < m_Categories.size(); i++) + assert(obj->cat_id < m_Categories.size()); + assert(m_Categories[obj->cat_id]->obj == obj); + pClient->last_root_pos = item_on_page; + if (!DisplayCategory(client, obj->cat_id, MENU_TIME_FOREVER, false)) { - if (m_Categories[i]->obj == obj) - { - pClient->last_root_pos = item_on_page; - if (!DisplayCategory(client, (unsigned int)i, MENU_TIME_FOREVER, false)) - { - /* If we can't display the category, re-display the root menu */ - DisplayMenu(client, MENU_TIME_FOREVER, TopMenuPosition_LastRoot); - } - break; - } + /* If we can't display the category, re-display the root menu. + * This code should be dead as of bug 3256, which disables categories + * that cannot be displayed. + */ + DisplayMenu(client, MENU_TIME_FOREVER, TopMenuPosition_LastRoot); } } else @@ -535,6 +540,19 @@ void TopMenu::OnMenuDrawItem(IBaseMenu *menu, int client, unsigned int item, uns obj = *pObject; + /* If the category has nothing to display, disable it. */ + if (obj->type == TopMenuObject_Category) + { + assert(obj->cat_id < m_Categories.size()); + assert(m_Categories[obj->cat_id]->obj == obj); + topmenu_player_t *pClient = &m_clients[client]; + if (obj->cat_id >= pClient->cat_count || pClient->cats[obj->cat_id].menu == NULL) + { + style = ITEMDRAW_IGNORE; + return; + } + } + style = obj->callbacks->OnTopMenuDrawOption(this, client, obj->object_id); if (style != ITEMDRAW_DEFAULT) { @@ -701,13 +719,18 @@ void TopMenu::UpdateClientRoot(int client, IGamePlayer *pGamePlayer) pClient->last_root_pos = 0; } -void TopMenu::UpdateClientCategory(int client, unsigned int category) +void TopMenu::UpdateClientCategory(int client, unsigned int category, bool bSkipRootCheck) { + bool has_access = false; + /* Update the client's root menu just in case it needs it. This * will validate that we have both a valid client and a valid * category structure for that client. */ - UpdateClientRoot(client); + if (!bSkipRootCheck) + { + UpdateClientRoot(client); + } /* Now it's guaranteed that our category tables will be usable */ topmenu_player_t *pClient = &m_clients[client]; @@ -744,6 +767,13 @@ void TopMenu::UpdateClientCategory(int client, unsigned int category) for (size_t i = 0; i < cat->sorted.size(); i++) { cat_menu->AppendItem(cat->sorted[i]->name, ItemDrawInfo("")); + if (!has_access && adminsys->CheckAccess(client, + cat->sorted[i]->cmdname, + cat->sorted[i]->flags, + false)) + { + has_access = true; + } } /* Now handle unsorted items */ @@ -761,20 +791,39 @@ void TopMenu::UpdateClientCategory(int client, unsigned int category) item->name, sizeof(item->name)); item->obj_index = (unsigned int)i; + if (!has_access && adminsys->CheckAccess(client, obj->cmdname, obj->flags, false)) + { + has_access = true; + } } - /* Sort the names */ - qsort(item_list, cat->unsorted.size(), sizeof(obj_by_name_t), _SortObjectNamesDescending); - - /* Add to the menu */ - for (size_t i = 0; i < cat->unsorted.size(); i++) + if (has_access) { - cat_menu->AppendItem(cat->unsorted[item_list[i].obj_index]->name, ItemDrawInfo("")); + /* Sort the names */ + qsort(item_list, + cat->unsorted.size(), + sizeof(obj_by_name_t), + _SortObjectNamesDescending); + + /* Add to the menu */ + for (size_t i = 0; i < cat->unsorted.size(); i++) + { + cat_menu->AppendItem(cat->unsorted[item_list[i].obj_index]->name, ItemDrawInfo("")); + } } delete [] item_list; } + /* If the player has access to no items, don't draw a menu. */ + if (!has_access) + { + cat_menu->Destroy(); + player_cat->menu = NULL; + player_cat->serial = cat->serial; + return; + } + /* Set the menu's title */ char renderbuf[128]; cat->obj->callbacks->OnTopMenuDisplayTitle(this, diff --git a/extensions/topmenus/TopMenu.h b/extensions/topmenus/TopMenu.h index 60989e29..a20695c9 100644 --- a/extensions/topmenus/TopMenu.h +++ b/extensions/topmenus/TopMenu.h @@ -71,6 +71,7 @@ struct topmenu_object_t TopMenuObjectType type; /** Object Type */ bool is_free; /** Free or not? */ char info[255]; /** Info string */ + unsigned int cat_id; /** Set if a category */ }; struct topmenu_category_t @@ -157,7 +158,7 @@ private: bool DisplayCategory(int client, unsigned int category, unsigned int hold_time, bool last_position); void CreatePlayers(int max_clients); void UpdateClientRoot(int client, IGamePlayer *pGamePlayer=NULL); - void UpdateClientCategory(int client, unsigned int category); + void UpdateClientCategory(int client, unsigned int category, bool bSkipRootCheck=false); void TearDownClient(topmenu_player_t *player); private: void OnClientConnected(int client); From e246d14a6b6351d9f3343eabedd48c136fcce421 Mon Sep 17 00:00:00 2001 From: IceMatrix Date: Wed, 7 Jan 2009 03:25:53 -0500 Subject: [PATCH 3/7] Added Age of Chivalry offsets (bug 3366). --- gamedata/core.games.txt | 21 +++++++- gamedata/sdktools.games.ep2.txt | 93 +++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+), 1 deletion(-) diff --git a/gamedata/core.games.txt b/gamedata/core.games.txt index 50c41a65..b6438822 100644 --- a/gamedata/core.games.txt +++ b/gamedata/core.games.txt @@ -58,6 +58,23 @@ } } + "ageofchivalry" + { + "Keys" + { + "RadioMenuTimeout" "4" + } + + "Offsets" + { + "GetDataDescMap" + { + "windows" "11" + "linux" "12" + } + } + } + /** * Which games support ShowMenu? */ @@ -75,6 +92,7 @@ "game" "diprip" "game" "synergy" "game" "FortressForever" + "game" "ageofchivalry" } "Keys" @@ -93,6 +111,7 @@ "game" "hl2mp" "game" "sourceforts" "game" "tf" + "game" "ageofchivalry" } "Keys" @@ -136,7 +155,7 @@ } } - "synergy" + "synergy" { "Keys" { diff --git a/gamedata/sdktools.games.ep2.txt b/gamedata/sdktools.games.ep2.txt index 7765c897..7b6189f1 100644 --- a/gamedata/sdktools.games.ep2.txt +++ b/gamedata/sdktools.games.ep2.txt @@ -33,6 +33,7 @@ { "game" "dod" "game" "tf" + "game" "ageofchivalry" } "Offsets" @@ -81,6 +82,7 @@ { "game" "dod" "game" "tf" + "game" "ageofchivalry" } "Signatures" @@ -107,6 +109,7 @@ { "game" "dod" "game" "tf" + "game" "ageofchivalry" } "Offsets" @@ -148,6 +151,7 @@ { "game" "dod" "game" "tf" + "game" "ageofchivalry" } "Offsets" @@ -226,6 +230,7 @@ { "game" "dod" "game" "tf" + "game" "ageofchivalry" } "Signatures" { @@ -451,4 +456,92 @@ } } } + + /* Afe of Chivalry */ + "ageofchivalry" + { + "Offsets" + { + "GiveNamedItem" + { + "windows" "351" + "linux" "352" + } + "RemovePlayerItem" + { + "windows" "239" + "linux" "240" + } + "Weapon_GetSlot" + { + "windows" "237" + "linux" "238" + } + "Ignite" + { + "windows" "194" + "linux" "195" + } + "Extinguish" + { + "windows" "198" + "linux" "199" + } + "Teleport" + { + "windows" "101" + "linux" "102" + } + "CommitSuicide" + { + "windows" "389" + "linux" "389" + } + "GetVelocity" + { + "windows" "130" + "linux" "131" + } + "EyeAngles" + { + "windows" "122" + "linux" "123" + } + "AcceptInput" + { + "windows" "34" + "linux" "35" + } + "DispatchKeyValue" + { + "windows" "29" + "linux" "28" + } + "DispatchKeyValueFloat" + { + "windows" "28" + "linux" "29" + } + "DispatchKeyValueVector" + { + "windows" "27" + "linux" "30" + } + "SetEntityModel" + { + "windows" "23" + "linux" "24" + } + "WeaponEquip" + { + "windows" "230" + "linux" "231" + } + "Activate" + { + "windows" "31" + "linux" "32" + } + } + } } From 7807f3e31a2a41caaf0e753c0cafdc5fea264421 Mon Sep 17 00:00:00 2001 From: The DOO Date: Wed, 7 Jan 2009 03:33:45 -0500 Subject: [PATCH 4/7] Added basic SDKTools/core support for Obsidian Conflict (bug 2699). --- gamedata/core.games.txt | 2 + gamedata/sdktools.games.ep2.txt | 88 +++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) diff --git a/gamedata/core.games.txt b/gamedata/core.games.txt index b6438822..56d6eeae 100644 --- a/gamedata/core.games.txt +++ b/gamedata/core.games.txt @@ -93,6 +93,7 @@ "game" "synergy" "game" "FortressForever" "game" "ageofchivalry" + "game" "obsidian" } "Keys" @@ -112,6 +113,7 @@ "game" "sourceforts" "game" "tf" "game" "ageofchivalry" + "game" "obsidian" } "Keys" diff --git a/gamedata/sdktools.games.ep2.txt b/gamedata/sdktools.games.ep2.txt index 7b6189f1..e9a2cbb4 100644 --- a/gamedata/sdktools.games.ep2.txt +++ b/gamedata/sdktools.games.ep2.txt @@ -544,4 +544,92 @@ } } } + + /* Obsidian Conflict 1.3 */ + "obsidian" + { + "Offsets" + { + "GiveNamedItem" + { + "windows" "350" + "linux" "351" + } + "RemovePlayerItem" + { + "windows" "237" + "linux" "238" + } + "Weapon_GetSlot" + { + "windows" "235" + "linux" "236" + } + "Ignite" + { + "windows" "190" + "linux" "191" + } + "Extinguish" + { + "windows" "194" + "linux" "195" + } + "Teleport" + { + "windows" "100" + "linux" "101" + } + "CommitSuicide" + { + "windows" "393" + "linux" "393" + } + "GetVelocity" + { + "windows" "127" + "linux" "128" + } + "EyeAngles" + { + "windows" "119" + "linux" "120" + } + "AcceptInput" + { + "windows" "34" + "linux" "35" + } + "DispatchKeyValue" + { + "windows" "29" + "linux" "28" + } + "DispatchKeyValueFloat" + { + "windows" "28" + "linux" "29" + } + "DispatchKeyValueVector" + { + "windows" "27" + "linux" "30" + } + "SetEntityModel" + { + "windows" "23" + "linux" "24" + } + "WeaponEquip" + { + "windows" "228" + "linux" "229" + } + "Activate" + { + "windows" "31" + "linux" "32" + } + } + } } From 29996d0133dfff12283885faa575506411a9d07b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 7 Jan 2009 04:06:18 -0500 Subject: [PATCH 5/7] Cleaned up SourceForts entries in sdktools.games.txt (bug 3492). --- gamedata/sdktools.games.txt | 110 ++---------------------------------- 1 file changed, 5 insertions(+), 105 deletions(-) diff --git a/gamedata/sdktools.games.txt b/gamedata/sdktools.games.txt index 9a72ce3a..d863afa5 100644 --- a/gamedata/sdktools.games.txt +++ b/gamedata/sdktools.games.txt @@ -37,8 +37,7 @@ "game" "!Dystopia" "game" "!Insurgency" "game" "pvkii" - "game" "!SourceForts v1.9.2" - "game" "$SourceForts v1.9.3" + "game" "sourceforts" "game" "FortressForever" "game" "empires" "game" "synergy" @@ -97,8 +96,7 @@ "game" "!Dystopia" "game" "!Insurgency" "game" "pvkii" - "game" "!SourceForts v1.9.2" - "game" "$SourceForts v1.9.3" + "game" "sourceforts" "game" "FortressForever" "game" "empires" "game" "synergy" @@ -148,8 +146,7 @@ "game" "ship" "game" "!Insurgency" "game" "pvkii" - "game" "!SourceForts v1.9.2" - "game" "$SourceForts v1.9.3" + "game" "sourceforts" "game" "FortressForever" "game" "empires" "game" "synergy" @@ -198,7 +195,7 @@ "game" "hl2mp" "game" "!Insurgency" "game" "pvkii" - "game" "$SourceForts v1.9.3" + "game" "sourceforts" "game" "empires" "game" "synergy" "game" "hidden" @@ -893,102 +890,6 @@ } } - /* SourceForts 1.9.2 */ - "!SourceForts v1.9.2" - { - "Offsets" - { - /* CBasePlayer */ - "GiveNamedItem" - { - "windows" "294" - "linux" "295" - } - "RemovePlayerItem" - { - "windows" "207" - "linux" "208" - } - "Weapon_GetSlot" - { - "windows" "205" - "linux" "206" - } - "Ignite" - { - "windows" "170" - "linux" "171" - } - "Extinguish" - { - "windows" "171" - "linux" "172" - } - "Teleport" - { - "windows" "90" - "linux" "91" - } - "GetVelocity" - { - "windows" "114" - "linux" "115" - } - "EyeAngles" - { - "windows" "106" - "linux" "107" - } - "DispatchKeyValue" - { - "windows" "30" - "linux" "29" - } - "DispatchKeyValueFloat" - { - "windows" "29" - "linux" "30" - } - "DispatchKeyValueVector" - { - "windows" "28" - "linux" "31" - } - "AcceptInput" - { - "windows" "34" - "linux" "35" - } - "SetEntityModel" - { - "windows" "25" - "linux" "26" - } - - "TE_GetServerClass" - { - "windows" "0" - "linux" "0" - } - } - - "Signatures" - { - "DispatchSpawn" - { - "library" "server" - "linux" "@_Z13DispatchSpawnP11CBaseEntity" - "windows" "\x53\x56\x8B\x74\x24\x0C\x85\xF6\x57\x0F\x84\x2A\x2A\x2A\x2A\x8B\x1D\x2A\x2A\x2A\x2A\x8B\x03\x8B\xCB\xFF\x50\x14\x8B\x16\x8B\xCE" - } - "CreateEntityByName" - { - "library" "server" - "linux" "@_Z18CreateEntityByNamePKci" - "windows" "\x56\x8B\x74\x24\x0C\x83\xFE\xFF\x57\x8B\x7C\x24\x0C\x74\x25\x8B\x0D\x2A\x2A\x2A\x2A\x8B\x01\x56\xFF\x50\x54\x85\xC0" - } - } - } - /* Fortress Forever */ "FortressForever" { @@ -1269,8 +1170,7 @@ } } - /* SourceForts 1.9.3 */ - "$SourceForts v1.9.3" + "sourceforts" { "Offsets" { From 0fbb87e3b2145a05a578df51027dd243f0444f86 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 7 Jan 2009 16:43:23 -0500 Subject: [PATCH 6/7] Fixed various wrong offsets in Insurgency (bug 3544, r=me). --- gamedata/sdktools.games.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gamedata/sdktools.games.txt b/gamedata/sdktools.games.txt index d863afa5..39e76c47 100644 --- a/gamedata/sdktools.games.txt +++ b/gamedata/sdktools.games.txt @@ -740,28 +740,28 @@ /* CBasePlayer */ "Ignite" { - "windows" "174" - "linux" "175" + "windows" "176" + "linux" "177" } "Extinguish" { - "windows" "175" - "linux" "176" + "windows" "176" + "linux" "177" } "Teleport" { - "windows" "90" - "linux" "91" + "windows" "91" + "linux" "92" } "GetVelocity" { - "windows" "115" - "linux" "116" + "windows" "116" + "linux" "117" } "EyeAngles" { - "windows" "107" - "linux" "108" + "windows" "108" + "linux" "109" } "AcceptInput" { From c676ecc0267a1cee8b23d58c97e5b85fdf0c44a6 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 7 Jan 2009 19:23:24 -0500 Subject: [PATCH 7/7] Fixed regression in printing floats with no precision (bug 3447, r=ds). --- core/sm_stringutil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/sm_stringutil.cpp b/core/sm_stringutil.cpp index 26539e4b..2cb3bfef 100644 --- a/core/sm_stringutil.cpp +++ b/core/sm_stringutil.cpp @@ -281,7 +281,7 @@ void AddFloat(char **buf_p, size_t &maxlen, double fval, int width, int prec, in } // write the fraction part - if (maxlen) + if (maxlen && prec) { *buf++ = '.'; maxlen--;