Merge from sourcemod-1.1 branch.

This commit is contained in:
David Anderson 2009-01-08 13:39:16 -05:00
commit d2ce50f989
7 changed files with 294 additions and 142 deletions

View File

@ -16,7 +16,7 @@
// "@Full Admins" // "@Full Admins"
// //
// You can also specify immunity values. Two examples: // 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" // "6:@Full Admins" //Immunity is 6, group is "Full Admins"
// //
// Immunity values can be any number. An admin cannot target an admin with // 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') // 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 // "!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
// //
//////////////////////////////// ////////////////////////////////

View File

@ -281,7 +281,7 @@ void AddFloat(char **buf_p, size_t &maxlen, double fval, int width, int prec, in
} }
// write the fraction part // write the fraction part
if (maxlen) if (maxlen && prec)
{ {
*buf++ = '.'; *buf++ = '.';
maxlen--; maxlen--;

View File

@ -248,6 +248,7 @@ unsigned int TopMenu::AddToMenu2(const char *name,
cat->serial = 1; cat->serial = 1;
/* Add it, then update our serial change number. */ /* Add it, then update our serial change number. */
obj->cat_id = m_Categories.size();
m_Categories.push_back(cat); m_Categories.push_back(cat);
m_SerialNo++; m_SerialNo++;
@ -257,6 +258,7 @@ unsigned int TopMenu::AddToMenu2(const char *name,
else if (obj->type == TopMenuObject_Item) else if (obj->type == TopMenuObject_Item)
{ {
/* Update the category, mark it as needing changes */ /* Update the category, mark it as needing changes */
obj->cat_id = 0;
parent_cat->obj_list.push_back(obj); parent_cat->obj_list.push_back(obj);
parent_cat->reorder = true; parent_cat->reorder = true;
parent_cat->serial++; parent_cat->serial++;
@ -407,6 +409,12 @@ bool TopMenu::DisplayMenu(int client, unsigned int hold_time, TopMenuPosition po
UpdateClientRoot(client, pPlayer); 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]; topmenu_player_t *pClient = &m_clients[client];
if (pClient->root == NULL) if (pClient->root == NULL)
{ {
@ -443,8 +451,7 @@ bool TopMenu::DisplayCategory(int client, unsigned int category, unsigned int ho
UpdateClientCategory(client, category); UpdateClientCategory(client, category);
topmenu_player_t *pClient = &m_clients[client]; topmenu_player_t *pClient = &m_clients[client];
if (category >= pClient->cat_count if (category >= pClient->cat_count || pClient->cats[category].menu == NULL)
|| pClient->cats[category].menu == NULL)
{ {
return false; return false;
} }
@ -488,18 +495,16 @@ void TopMenu::OnMenuSelect2(IBaseMenu *menu, int client, unsigned int item, unsi
if (obj->type == TopMenuObject_Category) if (obj->type == TopMenuObject_Category)
{ {
/* If it's a category, the user wants to view it.. */ /* 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) /* If we can't display the category, re-display the root menu.
{ * This code should be dead as of bug 3256, which disables categories
pClient->last_root_pos = item_on_page; * that cannot be displayed.
if (!DisplayCategory(client, (unsigned int)i, MENU_TIME_FOREVER, false)) */
{ DisplayMenu(client, MENU_TIME_FOREVER, TopMenuPosition_LastRoot);
/* If we can't display the category, re-display the root menu */
DisplayMenu(client, MENU_TIME_FOREVER, TopMenuPosition_LastRoot);
}
break;
}
} }
} }
else else
@ -535,6 +540,19 @@ void TopMenu::OnMenuDrawItem(IBaseMenu *menu, int client, unsigned int item, uns
obj = *pObject; 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); style = obj->callbacks->OnTopMenuDrawOption(this, client, obj->object_id);
if (style != ITEMDRAW_DEFAULT) if (style != ITEMDRAW_DEFAULT)
{ {
@ -701,13 +719,18 @@ void TopMenu::UpdateClientRoot(int client, IGamePlayer *pGamePlayer)
pClient->last_root_pos = 0; 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 /* 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 * will validate that we have both a valid client and a valid
* category structure for that client. * category structure for that client.
*/ */
UpdateClientRoot(client); if (!bSkipRootCheck)
{
UpdateClientRoot(client);
}
/* Now it's guaranteed that our category tables will be usable */ /* Now it's guaranteed that our category tables will be usable */
topmenu_player_t *pClient = &m_clients[client]; 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++) for (size_t i = 0; i < cat->sorted.size(); i++)
{ {
cat_menu->AppendItem(cat->sorted[i]->name, ItemDrawInfo("")); 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 */ /* Now handle unsorted items */
@ -761,20 +791,39 @@ void TopMenu::UpdateClientCategory(int client, unsigned int category)
item->name, item->name,
sizeof(item->name)); sizeof(item->name));
item->obj_index = (unsigned int)i; item->obj_index = (unsigned int)i;
if (!has_access && adminsys->CheckAccess(client, obj->cmdname, obj->flags, false))
{
has_access = true;
}
} }
/* Sort the names */ if (has_access)
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("")); /* 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; 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 */ /* Set the menu's title */
char renderbuf[128]; char renderbuf[128];
cat->obj->callbacks->OnTopMenuDisplayTitle(this, cat->obj->callbacks->OnTopMenuDisplayTitle(this,

View File

@ -71,6 +71,7 @@ struct topmenu_object_t
TopMenuObjectType type; /** Object Type */ TopMenuObjectType type; /** Object Type */
bool is_free; /** Free or not? */ bool is_free; /** Free or not? */
char info[255]; /** Info string */ char info[255]; /** Info string */
unsigned int cat_id; /** Set if a category */
}; };
struct topmenu_category_t struct topmenu_category_t
@ -157,7 +158,7 @@ private:
bool DisplayCategory(int client, unsigned int category, unsigned int hold_time, bool last_position); bool DisplayCategory(int client, unsigned int category, unsigned int hold_time, bool last_position);
void CreatePlayers(int max_clients); void CreatePlayers(int max_clients);
void UpdateClientRoot(int client, IGamePlayer *pGamePlayer=NULL); 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); void TearDownClient(topmenu_player_t *player);
private: private:
void OnClientConnected(int client); void OnClientConnected(int client);

View File

@ -58,6 +58,23 @@
} }
} }
"ageofchivalry"
{
"Keys"
{
"RadioMenuTimeout" "4"
}
"Offsets"
{
"GetDataDescMap"
{
"windows" "11"
"linux" "12"
}
}
}
"left4dead" "left4dead"
{ {
"Offsets" "Offsets"
@ -88,6 +105,8 @@
"game" "synergy" "game" "synergy"
"game" "FortressForever" "game" "FortressForever"
"game" "left4dead" "game" "left4dead"
"game" "ageofchivalry"
"game" "obsidian"
} }
"Keys" "Keys"
@ -106,6 +125,8 @@
"game" "hl2mp" "game" "hl2mp"
"game" "sourceforts" "game" "sourceforts"
"game" "tf" "game" "tf"
"game" "ageofchivalry"
"game" "obsidian"
} }
"Keys" "Keys"
@ -149,7 +170,7 @@
} }
} }
"synergy" "synergy"
{ {
"Keys" "Keys"
{ {

View File

@ -33,6 +33,7 @@
{ {
"game" "dod" "game" "dod"
"game" "tf" "game" "tf"
"game" "ageofchivalry"
} }
"Offsets" "Offsets"
@ -81,6 +82,7 @@
{ {
"game" "dod" "game" "dod"
"game" "tf" "game" "tf"
"game" "ageofchivalry"
} }
"Signatures" "Signatures"
@ -107,6 +109,7 @@
{ {
"game" "dod" "game" "dod"
"game" "tf" "game" "tf"
"game" "ageofchivalry"
} }
"Offsets" "Offsets"
@ -148,6 +151,7 @@
{ {
"game" "dod" "game" "dod"
"game" "tf" "game" "tf"
"game" "ageofchivalry"
} }
"Offsets" "Offsets"
@ -226,6 +230,7 @@
{ {
"game" "dod" "game" "dod"
"game" "tf" "game" "tf"
"game" "ageofchivalry"
} }
"Signatures" "Signatures"
{ {
@ -451,4 +456,180 @@
} }
} }
} }
/* 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"
}
}
}
/* 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"
}
}
}
} }

View File

@ -37,8 +37,7 @@
"game" "!Dystopia" "game" "!Dystopia"
"game" "!Insurgency" "game" "!Insurgency"
"game" "pvkii" "game" "pvkii"
"game" "!SourceForts v1.9.2" "game" "sourceforts"
"game" "$SourceForts v1.9.3"
"game" "FortressForever" "game" "FortressForever"
"game" "empires" "game" "empires"
"game" "synergy" "game" "synergy"
@ -97,8 +96,7 @@
"game" "!Dystopia" "game" "!Dystopia"
"game" "!Insurgency" "game" "!Insurgency"
"game" "pvkii" "game" "pvkii"
"game" "!SourceForts v1.9.2" "game" "sourceforts"
"game" "$SourceForts v1.9.3"
"game" "FortressForever" "game" "FortressForever"
"game" "empires" "game" "empires"
"game" "synergy" "game" "synergy"
@ -148,8 +146,7 @@
"game" "ship" "game" "ship"
"game" "!Insurgency" "game" "!Insurgency"
"game" "pvkii" "game" "pvkii"
"game" "!SourceForts v1.9.2" "game" "sourceforts"
"game" "$SourceForts v1.9.3"
"game" "FortressForever" "game" "FortressForever"
"game" "empires" "game" "empires"
"game" "synergy" "game" "synergy"
@ -198,7 +195,7 @@
"game" "hl2mp" "game" "hl2mp"
"game" "!Insurgency" "game" "!Insurgency"
"game" "pvkii" "game" "pvkii"
"game" "$SourceForts v1.9.3" "game" "sourceforts"
"game" "empires" "game" "empires"
"game" "synergy" "game" "synergy"
"game" "hidden" "game" "hidden"
@ -743,28 +740,28 @@
/* CBasePlayer */ /* CBasePlayer */
"Ignite" "Ignite"
{ {
"windows" "174" "windows" "176"
"linux" "175" "linux" "177"
} }
"Extinguish" "Extinguish"
{ {
"windows" "175" "windows" "176"
"linux" "176" "linux" "177"
} }
"Teleport" "Teleport"
{ {
"windows" "90" "windows" "91"
"linux" "91" "linux" "92"
} }
"GetVelocity" "GetVelocity"
{ {
"windows" "115" "windows" "116"
"linux" "116" "linux" "117"
} }
"EyeAngles" "EyeAngles"
{ {
"windows" "107" "windows" "108"
"linux" "108" "linux" "109"
} }
"AcceptInput" "AcceptInput"
{ {
@ -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 */ /* Fortress Forever */
"FortressForever" "FortressForever"
{ {
@ -1269,8 +1170,7 @@
} }
} }
/* SourceForts 1.9.3 */ "sourceforts"
"$SourceForts v1.9.3"
{ {
"Offsets" "Offsets"
{ {