Skip to content

Conversation

@stickz
Copy link
Contributor

@stickz stickz commented Aug 9, 2020

This commit allows the user to have a consistent minimum number of maps in the vote, regardless how many previous maps are excluded. It also improves the handling of the situation, when the number of previous maps to exclude is set higher than the number of available maps. Instead of excluding no previous maps, it will exclude until the minimum include count is reached.

stickz added 2 commits August 9, 2020 15:16
This commit allows the user to have a consistent minimum number of maps in the vote, regardless how many previous maps are excluded. It also improves the handling of the situation, when the number of previous maps to exclude is set higher than the number of available maps. Instead of excluding no previous maps, it will exclude until the minimum include count is reached.
Copy link
Member

@KyleSanderson KyleSanderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other quantity checks seem okay, but fundamentally this is dangerous and not correct. We should have indexes that need to be removed if needed and this provides the expected fast path for basic programming.

break;
}

g_OldMapList.GetString(i, map, sizeof(map));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct. There's no reason to triple scan the array.

@stickz
Copy link
Contributor Author

stickz commented Oct 3, 2020

There are 2 ArrayList classes being worked with here. I don't see a "fast path" to just remove an index.

g_OldMapList is an array ordered from least to most recently played.
tempMaps is a working array from g_MapList which is a random order.

I think it's required to search for the string that needs to be removed in tempMaps.

The code gets the string at index i from g_OldMapList. Then gets the index of the string in tempMaps. Afterwards, it erases the index from tempMaps if the string was found in the ArrayList.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants