-
Notifications
You must be signed in to change notification settings - Fork 11
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
Multistream support #89
Open
holy-jesus
wants to merge
3
commits into
Pinsplash:main
Choose a base branch
from
holy-jesus:multistream-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -437,29 +437,33 @@ CON_COMMAND(chaos_test_effect, "turn on a specific effect") | |
} | ||
CON_COMMAND(chaos_vote_internal_poll, "used by an external client. returns vote number and possible choices for this vote") | ||
{ | ||
ConMsg("%d;%s;%s;%s;%s", | ||
ConMsg("%d;%s:%d;%s:%d;%s:%d;%s:%d", | ||
g_iVoteNumber, | ||
STRING(g_ChaosEffects[g_arriVoteEffects[0]]->m_strHudName), | ||
g_arriVotes[0], | ||
STRING(g_ChaosEffects[g_arriVoteEffects[1]]->m_strHudName), | ||
g_arriVotes[1], | ||
STRING(g_ChaosEffects[g_arriVoteEffects[2]]->m_strHudName), | ||
STRING(g_ChaosEffects[g_arriVoteEffects[3]]->m_strHudName) | ||
g_arriVotes[2], | ||
STRING(g_ChaosEffects[g_arriVoteEffects[3]]->m_strHudName), | ||
g_arriVotes[3] | ||
); | ||
|
||
} | ||
CON_COMMAND(chaos_vote_internal_set, "used by an external client. sets current votes") | ||
CON_COMMAND(chaos_vote_internal_update, "used by an external client. updates current votes") | ||
{ | ||
// TODO: assumes vote number and 4 choices. | ||
if (args.ArgC() < 6) | ||
return; | ||
|
||
int givenVoteNumber = atoi(args[1]); | ||
|
||
if (givenVoteNumber != g_iVoteNumber) | ||
return; | ||
|
||
for (int i = 0; i < 4; ++i) | ||
{ | ||
g_arriVotes[i] = atoi(args[i+2]); | ||
|
||
// New vote | ||
if (args.ArgC() >= 3) { | ||
g_arriVotes[atoi(args[2])] = g_arriVotes[atoi(args[2])] + 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Memory corruption bug here. g_arriVotes is only 4 values long There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about that when was testing, but forgot 💀 |
||
} | ||
// Old vote | ||
if (args.ArgC() == 4) { | ||
g_arriVotes[atoi(args[3])] = g_arriVotes[atoi(args[3])] - 1; | ||
} | ||
} | ||
CON_COMMAND(chaos_vote_debug, "prints info about the votes") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
twitchAPI==3.11.0 | ||
rcon==2.4.2 | ||
rcon==2.4.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
pytchat | ||
rcon==2.4.4 | ||
rcon==2.4.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason i was setting instead of updating votes is so we don't have to maintain two separate states. I think doing it this way is error prone, leads to worse readability, and increases the amount of rcon calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You right, but what is alternatives? Set youtube and twitch votes in two separate arrays and then sum them when choosing effect? Or you can recommend something better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually wanted to mention this option, but completely forgot when writing lol. Something like a map of name:votes and you'd call
chaos_vote_internal_set youtube 42 1 2 3 4