Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#2879 closed defect (fixed)

[PATCH] Errors upon spectators using team chat.

Reported by: scythetwirler Owned by: trompetin17
Priority: Nice to Have Milestone: Alpha 18
Component: UI & Simulation Keywords:
Cc: Patch:

Description

Spectators using team chat will trigger errors on the actual players screens, but not the spectators.

Attachments (2)

2879.diff (2.3 KB ) - added by trompetin17 9 years ago.
2879.2.diff (2.3 KB ) - added by trompetin17 9 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 by leper, 10 years ago

Keywords: simple added

comment:2 by Casey, 9 years ago

So the idea is to get the errors to show up for the spectators or to remove the errors?

comment:3 by leper, 9 years ago

How can hiding errors ever be a sensible solution?

in reply to:  3 comment:4 by trompetin17, 9 years ago

does Spectators use a team chat? even if you can use, who is going to recieve, because a spectator doesn't have a team, does it?

btw Im guessing the problem happen here

if (g_Players[Engine.GetPlayerID()].team != g_Players[sender].team)

can Spectators use chat?

Replying to leper:

How can hiding errors ever be a sensible solution?

by trompetin17, 9 years ago

Attachment: 2879.diff added

comment:5 by trompetin17, 9 years ago

Keywords: review patch added
Milestone: BacklogAlpha 18
Owner: set to trompetin17
Summary: Errors upon spectators using team chat.[PATCH] Errors upon spectators using team chat.

Observers only can use chat for global messages("message" or "/all message").

comment:6 by Itms, 9 years ago

Hi trompetin, the patch looks fine, however I don't like much the usage of your helper function without parameter (hideTeamOptionToObserver();). If you want to make the parameter "optional" you should check for it in the function to avoid strange behavior.

Also, as the function does not only hide the team to observers, but also toggles the checkbox, you should rename the function to something more general like updateTeamCheckbox.

Thanks for working on this!

by trompetin17, 9 years ago

Attachment: 2879.2.diff added

in reply to:  6 comment:7 by trompetin17, 9 years ago

Done :)

Replying to Itms:

Hi trompetin, the patch looks fine, however I don't like much the usage of your helper function without parameter (hideTeamOptionToObserver();). If you want to make the parameter "optional" you should check for it in the function to avoid strange behavior.

Also, as the function does not only hide the team to observers, but also toggles the checkbox, you should rename the function to something more general like updateTeamCheckbox.

Thanks for working on this!

comment:8 by Itms, 9 years ago

Resolution: fixed
Status: newclosed

In 16170:

Prevent observers from using the team chat. Patch by trompetin17, fixes #2879.

comment:9 by Itms, 9 years ago

I committed the patch with slight changes:

  • used let instead of var in updateTeamCheckbox
  • instead of handling the case where the parameter is undefined, I called the function with the parameter set to false
  • I added a comment in messages.js for clarity

Thanks for fixing the issue!

comment:10 by Itms, 9 years ago

Keywords: simple review patch removed

comment:11 by leper, 9 years ago

In 16953:

Prevent observers from using most chat commands. Refs #2879.

Chat prefixed with /all could circumvent the check. Fix this by only allowing /me.
(Note that this is not a full solution, see #3270.)

Refactors the cheat and chat input code based on changes in some of elexis' patches.

Note: See TracTickets for help on using tickets.