Create an object holding the handling of all netmessage types.
Display private messages sent by moderators.
Details:
Switch back the second and third argument of CreateSimpleMessage, so it
relates again to the switch/object.
Reduce the dimension/nesting of the object/switch from three to two.
Hence remove the useless "standard" and "internal" value send in the
text field.
Rename CreateSimpleMessage to CreateGUIMessage
Use the property "level" instead of "text" for "connect" and
"disconnect".
Remove the handling of the "connect" event in lobby.js, since it is
never called.
Translate the disconnect event.
Add comments and explicit checks to handleMessage and handleMUCMessage
to make obvious where they differ.
Remove the "message" property from those GUI messages, since it should
just use "text".
Move the login-fail handling to JS.
Remove useless sprintf calls from warning messages.
Inline some variables.
Add missing semicolons.
This was SVN commit r17581.
Rename ratio to rate.
Simplify translation.
Round in GUI, not simulation.
Check for div/0.
Fix wrong variable name in test_GuiInterface.js.
This was SVN commit r17580.
It can only be built while ashoka is alive.
Previously the structure was selectable from the panel but not placable
while he was absent.
This was SVN commit r17577.
Transform switch-statements into objects.
Make them more consistent, in particular the kick/ban and
ready-messages.
Also colorizes the playername in disconnect messages.
Fix a wrong comment in the network code and remove a duplicate check
(AIs).
This was SVN commit r17568.
Transform trivial switch-statements to objects.
Move removeOldChatMessage right below addChatMessage, since it is only
used there.
This was SVN commit r17566.
Unify switch-statement using objects.
Do not parse recursively, but do a linear 2-step process. Remove msg.me
property and move "/me" parsing out of that function.
Early return instead of using msg.hide.
Add observer-checks for private messages to impede abuse and fix#3270.
Remove the "/all" command, since it doesn't add functionality but
complexity.
Remove a TODO as displaying multiple contexts ("/team /allies text"?) is
not useful currently and made the previous code error-prone.
This was SVN commit r17565.
Move formating of resource-amounts to new function
translateResourceAmounts.
Rename player/player1 to sourcePlayer/targetPlayer.
Inline colorizedPlayername.
This was SVN commit r17556.
Move new objects to globals, which makes the code easier to read,
changable for mods and saves performance.
Move cheat functions below variable declarations.
Remove old function formatClientList, which for any reason didn't make
it into last commit.
This was SVN commit r17555.
Add two missing semicolons and remove an unnecessary one.
Eliminate formatClientList, message, formattedUsername and
formattedUsernamePrefix.
Move four hardcoded colors to globals.
This was SVN commit r17554.
Move the code to update the idle-traders text to two new simplified
functions.
Eliminate all if-statements (including quadruple-nested ones).
This was SVN commit r17553.
Replace for-each with for-of.
Remove duplicate code from updateMenuPosition.
Eliminate three unneeded globals.
Rename savedGameData to g_SavedGameData.
Remove unneeded braces.
This was SVN commit r17549.
Rename globals to g_Foo.
Remove unused variable playerID from updateTimeNotifications which
became obsolete in fe9eeedd66.
Use let instead of var.
Add some missing semicolons.
Fix whitespace, quote object keys.
This was SVN commit r17548.
Transform switch-statement in handleNetMessage to object of fat-arrow
functions.
Also add missing check to colorizePlayernameByGUID.
This was SVN commit r17547.
Move code from switch-statement to handlePlayerAssignmentsMessage.
Inline updatePlayerDataAdd and updatePlayerDataRemove as they are tiny
and only used here.
Remove comments, early return, eliminate for-each.
This was SVN commit r17546.
Remove duplicate code by transforming getUsernameAndColor to
colorizePlayername.
Notice the previous function getUsernameAndColorByGUID didn't work with
unassigned players.
This was SVN commit r17544.
Remove g_PlayerAssignments from calls to findGuidForPlayerID, since the
argument was removed in ae92736b02.
Simplify formatChatMessage by moving playercolor-detection to
formatDefeatMessage and formatChatCommand.
This was SVN commit r17541.
Use .property instead of ["property"].
Use if (object.property) instead of if ("property" in object).
Use array- and fat-arrow functions.
This was SVN commit r17537.
Remove duplicate call to parseChatCommands.
Rename msg.action to msg.me, as it only applies to the "/me" chat
command.
Remove some duplicate checks.
Remove unused variable userTag.
Also fix a wrong space in the loading screen.
This was SVN commit r17528.