Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some issues in map_votes #268

Open
xyzelt opened this issue Jul 29, 2024 · 3 comments
Open

some issues in map_votes #268

xyzelt opened this issue Jul 29, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@xyzelt
Copy link

xyzelt commented Jul 29, 2024

When is used setnexmap m_iForcedNextMapIndex will be != -1
but in FinishVote() :
at line 352 m_iForcedNextMapIndex = -1;
so next lines
359 bool bIsNextMapForced = m_iForcedNextMapIndex != -1;
if (bIsNextMapForced) {
iNextMapVoteIndex = 0;
g_pGameRules->m_nEndMatchMapGroupVoteOptions[0] = m_iForcedNextMapIndex;
g_pGameRules->m_nEndMatchMapVoteWinner = iNextMapVoteIndex;
}

don't have sens, maybe is better reset m_iForcedNextMapIndex after found iWinningMap and iWinningMap==m_iForcedNextMapIndex
otherwise m_iForcedNextMapIndex remain same unti cleanup with setnextmap

another issue in maplist.cfg maps order must be same as in gamemodes_server.txt if is used

@Vauff Vauff added the bug Something isn't working label Jul 29, 2024
@xyzelt
Copy link
Author

xyzelt commented Jul 30, 2024

Another issue is m_iMapCooldown = 10 with cvar cs2f_vote_maps_cooldown , by default is 10 but if maplist.cfg is under 10 maps
after played a cycle of all maps in vote will have that issue.
Tested scenario:
maplist.cfg:
"Maplist"
{
"de_dust2"
{
"enabled" "1"
}
"fy_pool_day"
{
"workshop_id" "3070923343"
"enabled" "1"
}
"fy_snow"
{
"workshop_id" "3158166079"
"enabled" "1"
}
}
gamesmode_server.txt:
"GameModes_Server.txt"
{
...
"mapgroups"
{
"mg_cs2"
{
"name" "mg_cs2"
"maps"
{
"de_dust2" ""
"fy_pool_day" ""
"fy_snow" ""
}
}
}
}
callvote will fit on gamemode
voteacall3maps
after play a cycle of all maps
badpictures
all 3 maps are in cooldown, so there are no valid pictures because g_pGameRules->m_nEndMatchMapGroupVoteOptions[0] = -1
and g_pGameRules->m_nEndMatchMapGroupVoteOptions[1] = -1

This is a missconfigured situation because cs2f_vote_maps_cooldown = 10 but a have only 3 maps => cs2f_vote_maps_cooldown must be 1 or 2

My suggestion is to check this at end of bool CMapVoteSystem::LoadMapList()
...
if( m_vecMapList.Count() <= m_iMapCooldown )m_iMapCooldown = m_vecMapList.Count() - 1;
m_bMapListLoaded = true;
...

Another issue in OnLevelInit at server start
...
int iLastCooldownIndex = GetMapsInCooldown() - 1; //this will be = -1
int iInitMapIndex = GetMapIndexFromSubstring(pMapName); //this will be a invalid index, at this moment don't have list loaded
if (iLastCooldownIndex >= 0 && iInitMapIndex >= 0 && GetCooldownMap(iLastCooldownIndex) != iInitMapIndex) {
PushMapIndexInCooldown(iInitMapIndex);
}
..
maybe is better to replace with
if( m_vecMapList.Count() > 0 ){
int iInitMapIndex = GetMapIndexFromSubstring(pMapName);
if( !m_vecLastPlayedMapIndexes.HasElement(iInitMapIndex))m_vecLastPlayedMapIndexes.AddToTail(iInitMapIndex);
if( m_vecLastPlayedMapIndexes.Count() > m_iMapCooldown)m_vecLastPlayedMapIndexes.Remove(0);
}
and for add first maps in cooldown at end of LoadMapList() before m_bMapListLoaded = true;;
...
const char* sCurrentMap = m_strCurrentMap.c_str();
int iIdxCurrentMap = GetMapIndexFromSubstring(sCurrentMap);
if( iIdxCurrentMap != -1 && !m_vecLastPlayedMapIndexes.HasElement(iIdxCurrentMap))m_vecLastPlayedMapIndexes.AddToTail(iIdxCurrentMap);
..

@Vauff
Copy link
Contributor

Vauff commented Aug 1, 2024

Yeah I'm also aware of that issue, I plan to do a larger rewrite of the cooldown system soon and will address it in the process.

@xyzelt
Copy link
Author

xyzelt commented Aug 2, 2024

If you do that i have 2 suggetions:

  • move cleanup player noms and votes to OnLevelInit(), if map are changed with c_map then FinishVote() will not be executed and ClearPlayerInfo are not called
  • at GetTotalNominations(int iMapIndex) don't need to check pController->IsConnected() because m_arrPlayerNominations[i] are cleared ( -1 ) or not, if ClientDisconnect from playermanager.cpp you have at OnClientDisconnect(CPlayerSlot slot) g_pMapVoteSystem->ClearPlayerInfo(slot.Get());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants