Commit Graph

15395 Commits

Author SHA1 Message Date
ccb534259d Major lobby cleanup.
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.
2015-12-31 17:08:23 +00:00
2bf194134b Repairrate cleanup. Refs #3395, patch by bb.
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.
2015-12-31 15:20:12 +00:00
75eed7cc79 Missing semicolons, two wrong commata, jshint ftw.
This was SVN commit r17579.
2015-12-31 14:02:59 +00:00
a144ec7e08 Indentation corrections and other code style fixes in preparation for the cinematic camera patch.
Refs #3301

This was SVN commit r17578.
2015-12-31 13:40:56 +00:00
460f17e6f7 Fix mauryan pillar of ashoka GUI panel bug. Refs #3639.
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.
2015-12-31 12:19:45 +00:00
f7a262fa4a Remove trailing whitespace. Based on patch by otero, refs #3268.
This was SVN commit r17576.
2015-12-31 11:45:13 +00:00
8d9cfd66b8 Reorganize code in different files in prepartion for the cinematic camera patch (by Vladislav Belov).
Refs #3301

This was SVN commit r17575.
2015-12-30 21:16:35 +00:00
969008befd Add shebang to ease running the script as a program.
Update replay command adding needed -mod=public.

This was SVN commit r17574.
2015-12-30 14:29:28 +00:00
36c08193ba optimizes range queries, fixes #3717
This was SVN commit r17573.
2015-12-30 13:44:51 +00:00
082a32802b Refresh the diplomacy and trade window in case the playerselection (change perspective) has changed.
This was SVN commit r17572.
2015-12-30 12:10:11 +00:00
aa8e0159a0 Only regain health while idle (Battlefield Medicine tech). Fixes #3606, patch by Guuts.
This was SVN commit r17571.
2015-12-30 11:37:50 +00:00
6cdd99474a Fix fail.
This was SVN commit r17570.
2015-12-30 11:17:50 +00:00
7648b4f482 Gamesetup and session cleanup.
Convert network commands to an object and simplify the formating of
system chat messages.

This was SVN commit r17569.
2015-12-29 15:29:24 +00:00
46a42c04ef Gamesetup message cleanup.
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.
2015-12-29 14:45:53 +00:00
9f65e90b60 Fix wrong errormessage in case of encountering a broken replay.
This was SVN commit r17567.
2015-12-29 14:00:30 +00:00
f8ec158116 Session cleanup.
Transform trivial switch-statements to objects.
Move removeOldChatMessage right below addChatMessage, since it is only
used there.

This was SVN commit r17566.
2015-12-28 23:16:33 +00:00
2e8d5aa2c8 Session chat cleanup.
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.
2015-12-28 22:16:21 +00:00
2a0d403b4b let promotion improve a bit the capture strength of citizen
This was SVN commit r17564.
2015-12-28 18:51:49 +00:00
6182385626 Session cleanup.
Remove variable action.
Close diplomacy and trade window on disconnect.

This was SVN commit r17563.
2015-12-28 17:19:29 +00:00
543472b77b Optimization of isBoxVisible + cleanup, fixes #3712
This was SVN commit r17561.
2015-12-28 16:27:31 +00:00
82c215de49 prevent thousands of calls per turn of calculeTerritories which would exit immediately
This was SVN commit r17560.
2015-12-28 16:23:06 +00:00
704c08d2b0 petra: fixes placement of dock when on the border of the map
fixes attack path computation when change of target during
preparation
       fixes #3710

This was SVN commit r17557.
2015-12-26 13:14:13 +00:00
0d41806e99 Session cleanup.
Move formating of resource-amounts to new function
translateResourceAmounts.
Rename player/player1 to sourcePlayer/targetPlayer.
Inline colorizedPlayername.

This was SVN commit r17556.
2015-12-26 01:40:50 +00:00
5d56ee0449 Session cleanup.
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.
2015-12-26 00:42:52 +00:00
a280cb87db Colorize playernames when using the /list command in the gamesetup/session.
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.
2015-12-25 23:49:28 +00:00
5f95bca6b0 Session cleanup (trading dialog text).
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.
2015-12-25 19:35:14 +00:00
0fb87496e7 Display the correct AI name instead of "Unknown Player" in case an AI sends a formatted chat message (introduced in 03adf0111a).
Thanks Evulant (AlThePhoenix) for reporting.

This was SVN commit r17552.
2015-12-25 18:07:16 +00:00
b154056266 Those globals were removed in 5aae5ee55a.
This was SVN commit r17550.
2015-12-24 20:54:47 +00:00
5aae5ee55a Session menu cleanup.
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.
2015-12-24 14:59:03 +00:00
39ffb0a6bd Session menu cleanup.
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.
2015-12-24 02:53:18 +00:00
7a75f22f9f Session cleanup.
Transform switch-statement in handleNetMessage to object of fat-arrow
functions.

Also add missing check to colorizePlayernameByGUID.

This was SVN commit r17547.
2015-12-24 01:46:06 +00:00
7caaa278d6 Session cleanup.
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.
2015-12-24 01:06:01 +00:00
f276791069 Session cleanup.
Transform netstatus switch-statement to an object consisting of a
fat-arrow function per message type.

This was SVN commit r17545.
2015-12-23 23:51:18 +00:00
3dcf51c466 Session chat cleanup.
Remove duplicate code by transforming getUsernameAndColor to
colorizePlayername.
Notice the previous function getUsernameAndColorByGUID didn't work with
unassigned players.

This was SVN commit r17544.
2015-12-23 19:06:48 +00:00
48f72aacc9 petra: some defense tweaks + cleanup
This was SVN commit r17543.
2015-12-23 16:17:05 +00:00
4eedfac0ca Refactor session chat.
Show chatmessages for diplomacy-changes and tributed resources to
observers/in replays. Fixes #3379.

This was SVN commit r17542.
2015-12-23 15:48:06 +00:00
03adf0111a Session chat cleanup
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.
2015-12-22 21:45:09 +00:00
cf7b8329fb Use var instead of let, since this variable is defined with var in this function already.
This was SVN commit r17540.
2015-12-22 20:43:17 +00:00
3fd4d07ca1 Test \0 in object property names for serializing.
This was SVN commit r17539.
2015-12-22 19:01:18 +00:00
67b7366528 petra: remove hyphen in file names
This was SVN commit r17538.
2015-12-22 18:21:37 +00:00
ae92736b02 Session chat cleanup.
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.
2015-12-22 17:37:22 +00:00
3ba50b4ed4 decrease the repair rate of walls, refs #3707
This was SVN commit r17536.
2015-12-22 17:37:00 +00:00
6970ebba16 Test non-ASCII string conversions.
This was SVN commit r17535.
2015-12-22 17:30:05 +00:00
ef7c01ee4c Don't error out when selecting maps with non-existent civs.
This was SVN commit r17534.
2015-12-22 17:04:57 +00:00
385101bbe7 petra: cleanup of defenseManager
This was SVN commit r17533.
2015-12-22 16:58:53 +00:00
dca07f9ddd Fix e9bc3e2089.
This was SVN commit r17532.
2015-12-22 16:44:27 +00:00
4212777334 Session chat cleanup.
Correct indentation.

This was SVN commit r17531.
2015-12-22 16:05:27 +00:00
e9bc3e2089 Session chat cleanup.
Split formatChatMessage into smaller functions.
Correct the indentation with the next commit.

This was SVN commit r17530.
2015-12-22 16:02:25 +00:00
0e40273c28 Session chat cleanup.
Move code from addChatMessage to a new function formatChatMessage.

This was SVN commit r17529.
2015-12-22 15:29:03 +00:00
57af0ac8b4 Session chat cleanup.
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.
2015-12-22 14:56:30 +00:00