Skip to content

Commit

Permalink
add outdated map warning after map selection
Browse files Browse the repository at this point in the history
if an outdated map is selected, a popup is shown to warn the host and
ask him to update the map
fixes FAForever#2024
  • Loading branch information
CookieNoob authored and aeoncleanse committed Jun 19, 2017
1 parent 5f32e4d commit 5e90887
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 1 deletion.
1 change: 1 addition & 0 deletions loc/CZ/strings_db.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5325,6 +5325,7 @@ lobui_0769="Klikni levým na ikonu ACU pro přesunutí sebe nebo prohození hrá
lobui_0770="Klikni pravým na ikonu ACU pro zavření nebo otevření pozice."
lobui_0771="Klikni levým na ikonu ACU pro přesunutí sebe."
lobui_0772="Náhled Mapy"
lobui_0773="The currently selected map is outdated and/or unbalanced. Please download the latest version from the map vault."
main_menu_0000="Vytvořené spojenectví"
main_menu_0001="Více hráčů přes LAN"
main_menu_0002="Návrat do hry"
Expand Down
1 change: 1 addition & 0 deletions loc/DE/strings_db.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5090,6 +5090,7 @@ lobui_0769="Linksklick auf ACU Symbol um deine Position zu bestimmen oder mit ei
lobui_0770="Rechtsklick auf ACU Symbol zum öffnen oder schließen der Startpositionen."
lobui_0771="Linksklick auf ACU Symbol um deine Position zu bestimmen."
lobui_0772="Kartenvorschau"
lobui_0773="Die ausgewählte Karte ist veraltet und/oder unausgeglichen. Bitte aktualisieren!"
main_menu_0000="Forged Alliance"
main_menu_0001="Mehrspieler-LAN"
main_menu_0002="Zurück ins Spiel"
Expand Down
1 change: 1 addition & 0 deletions loc/ES/strings_db.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5255,6 +5255,7 @@ lobui_0769="Left click ACU icon to move yourself or swap players."
lobui_0770="Right click ACU icon to close or open the slot."
lobui_0771="Left click ACU icon to move yourself."
lobui_0772="Map Preview"
lobui_0773="The currently selected map is outdated and/or unbalanced. Please download the latest version from the map vault."
main_menu_0000="Forged Alliance"
main_menu_0001="LAN multijugador"
main_menu_0002="Reanudar partida"
Expand Down
1 change: 1 addition & 0 deletions loc/FR/strings_db.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7672,6 +7672,7 @@ lobui_0769="Faites un click gauche sur l'icone ACU pour vous déplacer ou echang
lobui_0770="Faites un click droit sur l'icone ACU pour ouvrir ou fermer l'emplacement."
lobui_0771="Faites un click droit sur l'icone ACU pour vous déplacer."
lobui_0772="Aperçu de la Carte"
lobui_0773="The currently selected map is outdated and/or unbalanced. Please download the latest version from the map vault."
lobui_0579="No Map Available"
lobui_0580="%d Map Available"
lobui_0581="%d Maps Available"
Expand Down
2 changes: 1 addition & 1 deletion loc/IT/strings_db.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7685,7 +7685,7 @@ lobui_0769="Left click ACU icon to move yourself or swap players."
lobui_0770="Right click ACU icon to close or open the slot."
lobui_0771="Left click ACU icon to move yourself."
lobui_0772="Map Preview"

lobui_0773="The currently selected map is outdated and/or unbalanced. Please download the latest version from the map vault."
lobui_0592="Permetti osservatori"
lobui_0593="Gli osservatori sono permessi dopo che il gioco e iniziato?"
lobui_0594="Osservatori permessi"
Expand Down
1 change: 1 addition & 0 deletions loc/PL/strings_db.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5324,6 +5324,7 @@ lobui_0769="Left click ACU icon to move yourself or swap players."
lobui_0770="Right click ACU icon to close or open the slot."
lobui_0771="Left click ACU icon to move yourself."
lobui_0772="Map Preview"
lobui_0773="The currently selected map is outdated and/or unbalanced. Please download the latest version from the map vault."
main_menu_0000="W obliczu wroga"
main_menu_0001="Gra wieloosobowa"
main_menu_0002="Wróć do gry"
Expand Down
1 change: 1 addition & 0 deletions loc/RU/strings_db.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7883,6 +7883,7 @@ lobui_0769="ЛКМ по иконке БМК чтобы переместить с
lobui_0770="ПКМ по иконке БМК чтобы открыть или закрыть слот"
lobui_0771="ЛКМ по иконке БМК чтобы переместить себя"
lobui_0772="Пред. просмотр карты"
lobui_0773="The currently selected map is outdated and/or unbalanced. Please download the latest version from the map vault."

# uimod_0010 in earlier but not sure if it should be changed
uimod_0016="Включен игровой мод"
Expand Down
1 change: 1 addition & 0 deletions loc/TZM/strings_db.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7667,6 +7667,7 @@ lobui_0769="Left click ACU icon to move yourself or swap players."
lobui_0770="Right click ACU icon to close or open the slot."
lobui_0771="Left click ACU icon to move yourself."
lobui_0772="Map Preview"
lobui_0773="The currently selected map is outdated and/or unbalanced. Please download the latest version from the map vault."
lobui_0585="AI Markers"
lobui_0586="Select maps with AI Markers"
lobui_0748="Number of Games"
Expand Down
1 change: 1 addition & 0 deletions loc/US/strings_db.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7150,6 +7150,7 @@ lobui_0769="Left click ACU icon to move yourself or swap players."
lobui_0770="Right click ACU icon to close or open the slot."
lobui_0771="Left click ACU icon to move yourself."
lobui_0772="Map Preview"
lobui_0773="The currently selected map is outdated and/or unbalanced. Please download the latest version from the map vault."
aisettings_0001="AIx Cheat Multiplier"
aisettings_0002="Set the cheat multiplier for the cheating AIs."
aisettings_0003="Cheat multiplier of %s"
Expand Down
44 changes: 44 additions & 0 deletions lua/ui/dialogs/mapselect.lua
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,14 @@ function CreateDialog(selectBehavior, exitBehavior, over, singlePlayer, defaultS
SetupOptionsPanel(OptionGroup, curOptions)

selectButton.OnClick = function(self, modifiers)
local obsoleteFilterFactory = mapFilters[GetFilterIndex('map_obsolete')].FilterFactory
obsoleteFilterFactory.SelectedKey = 1
local obsoleteFilter = obsoleteFilterFactory:Build()
if obsoleteFilter ~= nil then
if not obsoleteFilter(selectedScenario) then
GUI_OldMap(over)
end
end
selectBehavior(selectedScenario, changedOptions, restrictedCategories)
ResetFilters()
end
Expand All @@ -683,6 +691,14 @@ function CreateDialog(selectBehavior, exitBehavior, over, singlePlayer, defaultS
mapList.OnKeySelect = OnMapChanged
mapList.OnClick = OnMapChanged
mapList.OnDoubleClick = function(self, row)
local obsoleteFilterFactory = mapFilters[GetFilterIndex('map_obsolete')].FilterFactory
obsoleteFilterFactory.SelectedKey = 1
local obsoleteFilter = obsoleteFilterFactory:Build()
if obsoleteFilter ~= nil then
if not obsoleteFilter(selectedScenario) then
GUI_OldMap(over)
end
end
mapList:SetSelection(row)
PreloadMap(row)
local scen = scenarios[scenarioKeymap[row+1]]
Expand All @@ -697,6 +713,7 @@ function CreateDialog(selectBehavior, exitBehavior, over, singlePlayer, defaultS
return popup
end


function RefreshOptions(skipRefresh)
-- a little weird, but the "skip refresh" is set to prevent calc visible from being called before the control is properly setup
-- it also means it's a flag that tells you this is the first time the dialog has been opened
Expand Down Expand Up @@ -1065,3 +1082,30 @@ function PopulateMapList()
mapList:ShowItem(reselectRow -1)
end
end


function GUI_OldMap(over)
local GUI = UIUtil.CreateScreenGroup(over, "CreateMapPopup ScreenGroup")
local dialogContent = Group(GUI)
dialogContent.Width:Set(900)
dialogContent.Height:Set(100)

local Changelog = import('/lua/ui/lobby/changelog.lua')
local OldMapPopup = Popup(GUI, dialogContent)
OldMapPopup.OnClosed = function()
Prefs.SetToCurrentProfile('LobbyChangelog', Changelog.last_version)
end

-- Title --
local text0 = UIUtil.CreateText(dialogContent, LOC("<LOC lobui_0773>The currently selected map is outdated and/or unbalanced. Please download the latest version from the map vault."), 17, 'Arial Gras', true)
LayoutHelpers.AtHorizontalCenterIn(text0, dialogContent, 0)
LayoutHelpers.AtTopIn(text0, dialogContent, 10)

-- OK button --
local OkButton = UIUtil.CreateButtonWithDropshadow(dialogContent, '/BUTTON/medium/', "Ok")
LayoutHelpers.AtCenterIn(OkButton, dialogContent, 20)
LayoutHelpers.AtBottomIn(OkButton, dialogContent, 10)
OkButton.OnClick = function()
OldMapPopup:Close()
end
end

0 comments on commit 5e90887

Please sign in to comment.