Biobob
Chieftain
- Joined
- Jan 4, 2017
- Messages
- 11
Hello folks!
As you may be aware, recently, a "Map search" feature was added to the game. It highlights specified tiles on the map. It can be found in the bottom left corner, in the panel above the minimap.
On to my problem:
I am having the problem that the map search function breaks as soon as I activate any mod and any mod is loaded upon startup of Civ6.exe. It then gets stuck at "searching". The only way to get it to work with mods is by ending the game after every mod has been disabled. It will then work for the next instance of Civ6.exe. After starting any game with mods enabled (in which map search will work), it will stop working again after restarting Civ6.exe again (= stuck at "searching").
As soon as this "broken" state is entered, nothing will change the outcome until the game is ended with all mods unloaded.
I am running Win7 Ultimate x64, game is on newest update (Sep2019 - 1.0.0.341). It seems not too many people are having this problem, based on my searches. Not a single solution seems to have been found. For some people it works, for some it does not. I would really lile to fix it.
Possible fix was found, but clunky:
Start the game with every mod unloaded (=disable all mods, start a map, exit game once loaded). It will then work on next startup. This has to be done every time however and is annoying.
The (cropped) lua.log gives me this: (before that, only map creation info is given that is not suspicious)
Lua.log:
[...]
Runtime Error: PATH\Base\Assets\UI\Popups\MapSearchPanel.lua:1036: function expected instead of nil
stack traceback:
PATH\Base\Assets\UI\Popups\MapSearchPanel.lua:1036: in function 'OnSearchCommit'
[C]: in function '(anonymous)'
Lua callstack:
Runtime Error: PATH\Base\Assets\UI\Popups\MapSearchPanel.lua:718: function expected instead of nil
stack traceback:
PATH\Base\Assets\UI\Popups\MapSearchPanel.lua:718: in function 'IncrementalSearch'
Lua callstack:
[...]
(after this, only the error concerning line 718 is repeated)
I have added to this the lines in question (for quick reference. The full file is found in PATH\Base\Assets\UI\Popups\MapSearchPanel.lua)
Line 1036 of MapSearchPanel.lua:
-> Corresponding function:
Line 718 of MapSearchPanel.lua:
-> Corresponding function:
All the best!
As you may be aware, recently, a "Map search" feature was added to the game. It highlights specified tiles on the map. It can be found in the bottom left corner, in the panel above the minimap.
On to my problem:
I am having the problem that the map search function breaks as soon as I activate any mod and any mod is loaded upon startup of Civ6.exe. It then gets stuck at "searching". The only way to get it to work with mods is by ending the game after every mod has been disabled. It will then work for the next instance of Civ6.exe. After starting any game with mods enabled (in which map search will work), it will stop working again after restarting Civ6.exe again (= stuck at "searching").
As soon as this "broken" state is entered, nothing will change the outcome until the game is ended with all mods unloaded.
I am running Win7 Ultimate x64, game is on newest update (Sep2019 - 1.0.0.341). It seems not too many people are having this problem, based on my searches. Not a single solution seems to have been found. For some people it works, for some it does not. I would really lile to fix it.
Possible fix was found, but clunky:
Start the game with every mod unloaded (=disable all mods, start a map, exit game once loaded). It will then work on next startup. This has to be done every time however and is annoying.
The (cropped) lua.log gives me this: (before that, only map creation info is given that is not suspicious)
Lua.log:
[...]
Runtime Error: PATH\Base\Assets\UI\Popups\MapSearchPanel.lua:1036: function expected instead of nil
stack traceback:
PATH\Base\Assets\UI\Popups\MapSearchPanel.lua:1036: in function 'OnSearchCommit'
[C]: in function '(anonymous)'
Lua callstack:
Runtime Error: PATH\Base\Assets\UI\Popups\MapSearchPanel.lua:718: function expected instead of nil
stack traceback:
PATH\Base\Assets\UI\Popups\MapSearchPanel.lua:718: in function 'IncrementalSearch'
Lua callstack:
[...]
(after this, only the error concerning line 718 is repeated)
I have added to this the lines in question (for quick reference. The full file is found in PATH\Base\Assets\UI\Popups\MapSearchPanel.lua)
Line 1036 of MapSearchPanel.lua:
Code:
pOverlay:ShowHighlights(true);
-> Corresponding function:
Spoiler :
Code:
function OnSearchCommit()
ClearSearch(true);
local szSearchString = Controls.MapSearchBox:GetText();
local szFilterString = Controls.MapSearchFilterBox:GetText();
m_Search.Whitelist = szSearchString and Locale.SplitString(szSearchString) or { };
m_Search.Blacklist = szFilterString and Locale.SplitString(szFilterString) or { };
Controls.MapSearchBox:DropFocus();
Controls.MapSearchFilterBox:DropFocus();
if ValidateSearchTerms() and g_bMapSearchInitialized then
UpdateHistory(m_SearchHistory, szSearchString);
UpdateHistory(m_FilterHistory, szFilterString);
Controls.ProgressBar:SetPercent(0.0);
Controls.ResultsLabel:SetText( Locale.Lookup("LOC_HUD_MAP_SEARCH_IN_PROGRESS") );
UI.MapSearch_LogBegin(m_Search.Whitelist, m_Search.Blacklist);
ContextPtr:SetUpdate(IncrementalSearch);
local pOverlaybject = UILens.GetOverlay("MapSearch");
if (pOverlay ~= nil) then
pOverlay:SetVisible(true);
pOverlay:ShowHighlights(true);
pOverlay:SetBorderColors(0, COLOR_WHITE, COLOR_WHITE);
pOverlay:SetHighlightColor(0, COLOR_GREEN);
end
end
end
Code:
pOverlay:SetPlotChannel(m_ResultPlots, 0);
-> Corresponding function:
Spoiler :
Code:
function IncrementalSearch()
local eObserverID = Game.GetLocalObserver();
local pPlayerVis = PlayersVisibility[eObserverID];
local nPlotsCheckedThisFrame = 0;
-- Clear the previous frame's search data
Search.ClearData(SEARCHCONTEXT_MAPSEARCH);
local nPlots = Map.GetPlotCount();
for iPlot = m_nLastPlotSearched + 1, nPlots - 1 do
if pPlayerVis:IsRevealed(iPlot) then
local szPlotString = tostring(iPlot);
local pInfo = GetPlotInfo(iPlot);
if (pInfo) then
-- repopulate the search context
Search.AddData(SEARCHCONTEXT_MAPSEARCH, szPlotString, "", "", pInfo);
end
nPlotsCheckedThisFrame = nPlotsCheckedThisFrame + 1;
if (nPlotsCheckedThisFrame == PLOTS_CHECKED_PER_FRAME) then
-- We will continue where we left off next frame
CheckForMatches();
Controls.ProgressBar:SetPercent(iPlot / (nPlots - 1));
m_nLastPlotSearched = iPlot;
return;
end
end
end
-- Check if the last few remaining plots were a match
CheckForMatches();
-- If we made it this far, we have searched the whole map :)
-- Highlight the matching results
local pOverlay:object = UILens.GetOverlay("MapSearch");
if (pOverlay ~= nil) then
pOverlay:ClearAll();
pOverlay:SetPlotChannel(m_ResultPlots, 0);
end
-- Group adjacent results together so the next/previous buttons are more practical
m_ResultGroups = { };
local pGroups = UI.PartitionRegions( m_ResultPlots );
for _,pGroup in pairs(pGroups) do
local x, y = UI.GetRegionCenter(pGroup);
table.insert(m_ResultGroups, { Plots=pGroup, CenterX=x, CenterY=y });
end
Controls.ProgressBar:SetPercent(1.0);
Controls.ResultsLabel:SetText( Locale.Lookup("LOC_HUD_MAP_SEARCH_RESULTS", #m_ResultPlots) );
local bDisableButtons = not (#m_ResultPlots > 0);
Controls.NextResultButton:SetDisabled(bDisableButtons);
Controls.PrevResultButton:SetDisabled(bDisableButtons);
StopSearch();
-- what was searched for and how long it took in MapSearch.log
UI.MapSearch_LogEnd("Complete with " .. tostring(#m_ResultPlots) .. " results");
end
All the best!
Last edited: