Add more animals/berries to "Ambush".
Improve placing of initial resources on all of _kali's maps.
* Increase distance from chickens to CC from `7` to `9` (to account for
roman CCs, refs #3836)
* Increase number of initial trees from `5` to `25` (ensuring players
have enough wood to build a new CC)
* Avoid resource collisions by increasing the minDistance from `2` to
`4` (when not using angles)
* Ensure that initial resources are placed (by first placing mines and
adding retry-loops for the other resources)
Notice The loop can't be moved to `createObjectGroup` since
* the parameters (like `mAngle`) also need to randomized again
* we need to place initial resources in range of the actual
playerbase
This was SVN commit r17920.
GUI fix in 17e6b316fa, simulation fix here.
Remove quadruplicated code!
Check in Commands.js as this one handles user input.
Don't check in Player.js as the function should be versatile enough to
change diplomacy from all components, even if teams are locked or
ceasefire active.
This was SVN commit r17896.
Add a unit (seconds) to the network-timeout warning.
Rename isChatAddressee to parseChatAddressee as it changes the message.
Early return for EnableOOSLog to avoid printing duplicate messages.
This was SVN commit r17895.
The host can change the number of allowed observers in running games.
Make sure that joining observers won't take the "slot" of disconnected
players, fixes#3671.
Send clients a new disconnect reason "Server full" instead of letting
them timeout.
This was SVN commit r17881.
Remove it from the game-attributes, since it is not used in the
simulation, nor are they supposed to change in running games.
This was SVN commit r17861.
Have it disabled by default to fix#3604.
Prevents players from rejoining as late-observers in case they timed-out
on the client-side but not on the server-side.
This was SVN commit r17851.
Eliminate deprecated for-each.
Remove unused variable auraNames.
Use array-filter instead of for-loop.
Fix whitespace.
Don't use affectedPlayers outside of scope.
This was SVN commit r17835.
Move the diplomatic stance button initialization to a custom function.
Always hide the button if locked-teams is enabled, refs #3702.
Inline setDiplomacy.
This was SVN commit r17818.
Split openDiplomacy into four smaller functions, starting with
diplomacyFormatAttackRequestButton in this commit.
Hide the button if the user has no allies and after defeat/win.
This was SVN commit r17816.
Wonder population bonus is now an aura (reverted when the wonder is
destroyed) with 10 pop (wonder) with an additionnal +40 with the tech
patch by fatherbushido
This was SVN commit r17809.
The new inscription fits better with the scene, set in Sparta, and is
the Greek original epitaph written on the Cenotaph of Thermopylae,
according to Herodotus:
"Go, tell the Spartans, stranger passing by, that here, obedient to
their laws, we lie."
The previous inscription was apparently a fraction of a sentence and was
about Spartan foreign policy in Ionia.
Suggestion and research by Danny, art by wowgetoffyourcellphone.
This was SVN commit r17805.
First place all starting entities before placing initial resources to
avoid placing them on each other.
Don't place initial mines near the territory of allies.
This was SVN commit r17788.
Add observer-only chat and allow private messages from observer to
observer.
Prevent defeated players from using the team-chat, fixes#3441.
This was SVN commit r17771.
Introduce isPlayerObserver to easily cover that case.
Move some checks and updates into selectViewPlayer and eliminate
setObserverMode.
Initialize the music before changing the perspective.
This was SVN commit r17758.
Move duplicate code of the area- and object-group placing methods to
retryPlacing and two coordinate-randomization functions.
Remove three unused functions (println obsolete since 0e0ed94926,
chooseRand and its helper argsToArray since before 34f1817869).
Inline local calls to GetMapSize() and IsCircularMap(). Keep unused
isCircularMap for API access. Cache variables when retrying.
Map-generation can finish 2% faster.
This was SVN commit r17728.
Disable the controls for observers (unless the developer-option is
enabled).
Don't check for g_IsObserver, since observers should be able to use the
developer overlay as well.
Update all GUI elements when changing the perspective using
onSimulationUpdate().
Enable observermode for defeated players.
This was SVN commit r17675.
Fix some problems when reloading saved options, refs #3511
Add the material quality option, refs #3737
Reload and Save buttons are only enabled when some options have changed.
This was SVN commit r17645.
Add an aura tooltip to the construction panel.
Remove duplicate tooltip code for the training panel.
Eliminate for-each and use the aura ID in GetTemplateDataHelper, since
only that is a unique identifier.
Change the name from "Hero Aura" to "Garrisoned Capture Aura" for that
aura that every hero has.
This was SVN commit r17644.
changes on text or number options are now detected without any need of
typing Return, fixes#2451
graphic options (using the renderer type) are now properly saved when
changed
sound options (using the function type) are still not saved
This was SVN commit r17625.
Rename PickFriendlyEntitiesInRect to PickPlayerEntitiesInRect.
Rename PickSimilarFriendlyEntities to PickSimilarPlayerEntities.
Add comment.
Refs #3215.
This was SVN commit r17622.
This allows observers to see the training queue, researched techs, unit
stance, constructable buildings, garrisoned units, market prices etc.
for all players without changing the perspective.
All buttons are disabled if the user isn't allowed to control the
affected player.
Notice updateUnitCommands() fills out the panel differently in case of
selecting an allied building.
Extends the GUIInterface methods "GetNeededResources",
"CheckTechnologyRequirements" and "IsTechnologyResearched" to optionally
take a different player-argument.
This was SVN commit r17617.
Do not construct objects if they only contain two atomic elements.
Revert getDisconnectReason so as to have a custom message for the error
case. Add a warning.
This was SVN commit r17601.
Based on existing code that was still around from an old(not working)
implementation.
Supports basic control from trigger scirpts (queue, start and stop
camera paths) and works in multiplayer.
This was SVN commit r17594.
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.
Remove the "Seed" attribute as it is a relict of Atlas and not used
anywhere.
Also remove the author-tag of Forest Battle (4) as it's the only map
that has it.
This was SVN commit r17522.
Simplify GetAverageRangeForBuildings and GetFormationInfoFromTemplate.
Use let instead of var.
Quote object keys.
Remove unneeded braces and variables.
Remove unused variable cmpMirage in L414 and numCleared in L1096.
Add missing semicolon in L637.
Use fat-arrow function.
This was SVN commit r17516.
Use let instead of var.
Quote object keys.
Prefix globals with g_.
Remove some unneeded variables.
Use ternary operator and fat arrow functions.
This was SVN commit r17515.
Use let instead of var.
Do not redeclare timeToTarget and cmpTimer.
Remove unused variable graphicalPosition.
Fix some whitespace issues.
This was SVN commit r17507.
Remove all remaining variables referencing GUI objects in
updateGUIObjects.
Do more simple checks and insert new calls at more coherent places.
This was SVN commit r17488.
Move GUI updates from loadPersistMatchSettings to updateGUIObjects.
Simplify updateGUIObjects and use setGUIBoolean.
Move SetRankedGame from updateGUIObjects to handleGamesetupMessage.
Early return in handleGamesetupMessage.
This was SVN commit r17485.
Remove duplicate GUI updates which are done in initMapNameList and
updateGUIObjects.
Remove the g_IsInGuiUpdate line as the variable will be overwritten with
the next statement.
This was SVN commit r17484.
Don't copy the label from the dropdownlist, but create it from
g_MapFilters.
Move placeholder items to g_RandomMap and g_RandomCiv.
This was SVN commit r17483.
Remove 4 duplicate GUI updates in updateGUIObjects.
mapSelectionBox is updated in initMapNameList, the other three are done
80 lines below.
Inline finding of the selected map.
This was SVN commit r17482.
Abort in case a client tries to update the gamesettings.
Rename onGameAttributesChange to updateGUIObjects.
Move a check to sendRegisterGameStanza().
This was SVN commit r17481.
Deobfuscate mapfilter code. Remove unneeded, peculiar functions.
Construct g_MapFilters in-place and mark as const.
In initMapNameList, load "all" maps if no mapfilter is specified.
This was SVN commit r17480.
The caption of mapSelectionText (mapname-label visible to clients)
showed "random" instead of a translated "Random".
Move hardcoded "orange" color to a global const.
Simplify loadMapData.
Rename saveGameAttributes() to savePersistMatchSettings().
This was SVN commit r17475.
Use hideControl for playerdropdowns.
Remove some superfluous checks and comments.
Simplify using logical or, math and ternary operator.
This was SVN commit r17472.
Use let in function scope too.
Though spider monkey doesn't support let fully yet, it might be able to
detect some more reference errors in the code with later versions.
For example if a let variable is referenced before being defined
(temporal dead zone).
Besides, it is an easier rule to follow (let in functions, var for
globals) and makes the code more coherent.
This was SVN commit r17471.
The usual suspects:
Move all constants to the top.
Rename all globals to g_Foo.
Use let for all local variables (except in the for-each parts which will
be updated later).
Quote object keys.
Ternary operator.
Fat-arrow functions.
Whitespace issues.
This was SVN commit r17468.
Move some shared color-code to color.js.
Remove shuffleArray() as it's unused since bbc325fb5a.
Add JSdoc comments and use let.
This was SVN commit r17466.
Moves cropping of the mappreview image to a common function
setMapPreviewImage.
Also avoids magic numbers by using the actual formula.
This was SVN commit r17459.
"color" can make use of the sprite's alpha texture, and the "add_color"
effect will now take the original image's alpha into account.
Remove the no longer needed "unaffordableMask" images on a variety of
panels.
Somewhat based on a patch by BoeseRaupe. Fixes#2421 and #3688.
This was SVN commit r17456.
Rename panelsData and teamMiscHelperData to g_Foo.
Use let instead of var everywhere except for globals.
Quote object keys, add some spaces.
This was SVN commit r17455.
Upgraded aleppo pines.
New Oaks and dead oaks variations.
New generic dead trees.
Upgraded grapes texture by Stanislas69. Thanks Stan!
This was SVN commit r17452.
Introduce a GUI function to set checkboxes and their label-counterpart
in one line.
Replace code that is duplicated for every maptype.
Fix a typo "ExporeMap" from e05c8263c5.
This was SVN commit r17450.
Make a hidden function globally available and use it everywhere to
simplify the hiding/showing of GUI elements.
Use strings instead of the references to the actual GUI objects, so that
the code doesn't rely on variables anymore.
Use a default argument so we can reuse it with regards to other
conditions like scenario maps or multiplayer.
Notice the JS variables have the same name as the GUIObjects, so the
replacement is simple.
This was SVN commit r17447.
The previous code failed at it as it looped over g_PlayerAssignments
instead of all slots.
Based on patch by Pilzschaf, fixes#3602.
This was SVN commit r17444.
Split handleNetMessage into five smaller functions.
Besides improving the readability a bit, it allows adding new variables
without declaring them in the scope of other messagetypes.
This was SVN commit r17442.
Split the 280-line function initGUIObjects (former initMain) into
sixteen short functions.
Do not correct indentation in this commit in order to have the smallest
changeset possible, highlighting the actual changes
[the only logic change being mapTypes.selected and mapFilters.selected
being set one function (initMoreOptions) earlier].
This was SVN commit r17435.
Rename initMain to initGUIObjects to clarify what the function does.
While init() sets globals without touching the GUI, initGUIObjects
updates all GUI controls after the first tick.
Rename loadGameAttributes to loadPersistMatchSettings as that's more
specific as to where the attributes are loaded from.
Add some JSDoc comments and a TODO for an annoying old bug.
Simplifiy to-boolean conversions by negating twice (!!)
This was SVN commit r17433.
Don't define variables inside switch-statements.
Move chat-font to global.
Rename host and an i to guid, newPlayer to newGUID to be more coherent.
Do early continues when finding joinings/leavings and swapping players.
This was SVN commit r17432.