}
else { me.nItems = gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT); }
- me.connectButton.disabled = ((me.nItems == 0) && (me.ipAddressBox.text == ""));
- me.infoButton.disabled = ((me.nItems == 0) || !owned);
- me.favoriteButton.disabled = ((me.nItems == 0) && (me.ipAddressBox.text == ""));
+ me.connectButton.disabled = (me.lockedSelectedItem || (me.nItems == 0 && me.ipAddressBox.text == ""));
+ me.infoButton.disabled = (me.lockedSelectedItem || me.nItems == 0 || !owned);
+ me.favoriteButton.disabled = (me.lockedSelectedItem || (me.nItems == 0 && me.ipAddressBox.text == ""));
if(me.lockedSelectedItem)
{
}
void ServerList_Connect_Click(entity btn, entity me)
{
- localcmd(sprintf("connect %s\n",
- ((me.ipAddressBox.text != "") ?
- me.ipAddressBox.text : me.selectedServer
- )
- ));
+ if (me.lockedSelectedItem)
+ return;
+ string sv = (me.ipAddressBox.text != "") ? me.ipAddressBox.text : me.selectedServer;
+ localcmd(sprintf("connect %s\n", sv));
}
void ServerList_Favorite_Click(entity btn, entity this)
{
}
}
- if(isSelected)
+ if(isSelected && !me.lockedSelectedItem)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
else if(isFocused)
{
ATTRIB(XonoticServerList, columnTypeSize, float, 0);
ATTRIB(XonoticServerList, columnPlayersOrigin, float, 0);
ATTRIB(XonoticServerList, columnPlayersSize, float, 0);
- ATTRIB(XonoticServerList, lockedSelectedItem, bool, true); // initially keep selected the first item of the list, avoiding an unwanted scrolling
+ ATTRIB(XonoticServerList, lockedSelectedItem, bool, true); // initially keep selected the first item of the list to avoid unwanted scrolling
ATTRIB(XonoticServerList, selectedServer, string); // to restore selected server when needed
METHOD(XonoticServerList, setSelected, void(entity, float));