Opened 9 years ago

Last modified 8 years ago

#3355 closed defect

[PATCH] Move gamesetup strings to simulation/data/settings/ — at Version 12

Reported by: elexis Owned by:
Priority: Should Have Milestone: Alpha 20
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description (last modified by elexis)

Many strings are hardcoded in the gamesetup and used in other places like the lobby, session and summary screen and will also be used in the visual replay menu (#3258).

The affected settings are:

  • AI Difficulties
  • Ceasefire
  • GameSpeeds
  • GameTypes
  • MapTypes
  • MapSizes
  • PlayerDefaults
  • PopulationCapacity
  • StartingResources

The strings should be moved to simulation/data/settings/ and treated consistently, so that redundant code can be removed.

Notice: For visual replay menu, MapSizes and PlayerDefaults are not required to be moved, as they are present in functions_utility.js

Refs #3049

Change History (38)

comment:1 by elexis, 9 years ago

Keywords: patch review added
Milestone: BacklogAlpha 19
Summary: Move gamesetup strings to simulation/data/settings/[PATCH] Move gamesetup strings to simulation/data/settings/

Moves all the hardcoded values from lobby/gamesetup/session/summary to simulation/data. Doesn't break atlas. Notice that the AI difficulties, ceasefire times, starting resources and maptypes have their translation context removed. Includes some more ceasefire times desired by the community.

Reintroduces the code that was removed in r16840 for non-random maps, so that both #3001 and #3209 are covered. That code was necessary for a bug that was explained in IRC on 2015-01-27 at 4pm: < niektb> Pick a skirmish map, set the conditions to None and then change to a scenario that has a Conquest condition. You'll see that when you load the map no victory conditions are set.

You can test that all settings are accepted correctly by starting a game and comparing the settings in the commands.txt (improve json readability with http://jsonlint.com/)

comment:2 by elexis, 9 years ago

# 1. After applying the patch make sure the old files are actually removed
rm binaries/data/mods/public/simulation/data/game_speeds.json
rm binaries/data/mods/public/simulation/data/map_sizes.json
rm binaries/data/mods/public/simulation/data/player_defaults.json
rm -R binaries/data/mods/public/gui/gamesetup/victory_conditions

# AI difficulties were hardcoded in aiconfig.js
# Map types were hardcoded in gamesetup.js and lobby.js
# Ceasefire, starting resources, population capacity were hardcoded in gamesetup.js

# 2. Make sure the removed files are unrevisioned too
svn rm binaries/data/mods/public/simulation/data/game_speeds.json
svn rm binaries/data/mods/public/simulation/data/map_sizes.json
svn rm binaries/data/mods/public/simulation/data/player_defaults.json
svn rm binaries/data/mods/public/gui/gamesetup/victory_conditions/

# 3. Make sure the new files are all revisioned
svn add binaries/data/mods/public/gui/common/settings.js
svn add binaries/data/mods/public/simulation/data/settings/

Also "map_sizes.json" and "player_defaults.json" in http://trac.wildfiregames.com/wiki/Random_Map_Generator_Internals should be updated.

by elexis, 9 years ago

Doesn't remove the context of existing translation.

by elexis, 9 years ago

Updates the translation extractor to support context for json files (to correctly extract the translated strings of our new files). To quickly verify the function, insert if templateSettings["output"] != "public-simulation-other.pot": continue; to L74 of updateTemplates.py.

by elexis, 9 years ago

Now saves each GameType as an individual json file (better for mods). Atlas now properly recognizes MapSizes. Uses find and findIndex. More cleanup in aiconfig.js. Some issues leper noticed in irc thir morning.

by elexis, 9 years ago

Fixes wrong TranslatedKeys entry in the GameTypes json files.

by elexis, 9 years ago

Splitting the patch into many parts now. This patch allows translating JSON files with context. It tells the translation extractor to add the context, which is given as a parameter in the binaries/data/mods/mod/l10n/messages.json file.

comment:3 by leper, 9 years ago

In 16942:

Enhance i18n extractor to support a single context for a json file. Patch by elexis. Refs #3355.

by elexis, 9 years ago

Moves "MaxPlayers": 8 and MaxTeams": 4 and creates the settings.js file needed for all further patches.

by elexis, 9 years ago

Doesn't create player_limit.json but moves the constant to settings.js. Doesn't show a popup anymore, but returns immediatel on error. Needs to wait one onTick in session.js, otherwise it segfaults.

by elexis, 9 years ago

Renamed variables, changed comments, added newlines.

by elexis, 9 years ago

Split once more. This is the smallest patch possible to move the player limits.

by elexis, 9 years ago

Rebased.

comment:4 by Itms, 9 years ago

In 16975:

Move player and team number limits to a centralized file which will also eventually hold various kinds of settings.
Patch by elexis, refs #3355

comment:5 by Itms, 9 years ago

In 16979:

Apparently SVN messed up when I applied the patch for r16975, so fix it.
Also include some fixes to elexis's oversights, refs #3355.

by elexis, 9 years ago

Also includes the 1-4min ceasefire options the community wished for.

by elexis, 9 years ago

Makes the translation context coherent for the case unknown.

by elexis, 9 years ago

Removes unused function translateCeasefire.

by elexis, 9 years ago

Broke uniform loading of files to remove redundant ceasefire translations. Also a simplification in gamesetup error handling and made g_Ceasefire const.

by elexis, 9 years ago

Alternative version where undefined instead of false is returned in case of error.

by elexis, 9 years ago

Uses lowercase filename dammit.

comment:6 by Itms, 9 years ago

In 17006:

Add the ceasefire settings to the new simulation settings system.
Patch by elexis, refs #3355.

by elexis, 9 years ago

After a review by mimo: Renamed loadAvailableSettings and in case of error, print all erroneous files.

comment:7 by mimo, 9 years ago

In 17007:

Add the starting resources to the new simulation settings system, refs #3355, patch by elexis

comment:8 by leper, 9 years ago

In 17012:

Move the population cap to the new simulation settings system. Patch by elexis. Refs #3355.

by elexis, 9 years ago

by elexis, 9 years ago

Simplifies that changed line in settings.js, renames m_IsReplay to m_IsVisualReplay and CGame::StartReplay to CGame::StartVisualReplay so that it's clear that this code is not run in non-visual replaymode (after a review by mimo).

comment:9 by mimo, 9 years ago

In 17017:

Rename some variables to point out that they are only used in visual replay. Add script function IsVisualReplay. Refs #9 #3355, patch by elexis

comment:10 by mimo, 9 years ago

In 17019:

Move the game speeds to the new simulation settings system. Patch by elexis. Refs #3355

by elexis, 9 years ago

Don't forget to delete gui/gamesetup/victory_conditions/

by elexis, 9 years ago

Derives the name element from the filename and changes variable names to "victory conditions", as we might support having multiple of them simultaneously in the future.

by elexis, 9 years ago

Corrects the entries in atlas and finds a solution to both r16238 and r16840

comment:11 by mimo, 9 years ago

In 17026:

Move the victory conditions to the new simulation settings system. Patch by elexis. Refs #3355,#3001

by elexis, 9 years ago

comment:12 by elexis, 9 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.