From 5b39a07ad443c591bf1acbe2b190dbd543a1689e Mon Sep 17 00:00:00 2001 From: tn4799 Date: Tue, 20 Sep 2022 11:06:54 +0200 Subject: [PATCH 01/12] added filltype Unknown to ignore list --- ChallengeModConfig.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/ChallengeModConfig.xml b/ChallengeModConfig.xml index 2519416..a63f798 100644 --- a/ChallengeModConfig.xml +++ b/ChallengeModConfig.xml @@ -62,6 +62,7 @@ HORSE_DUN CHICKEN CHICKEN_ROOSTER + UNKNOWN From f3f496d5f8d20b283c9488f7898d6e2326907e50 Mon Sep 17 00:00:00 2001 From: tn4799 Date: Tue, 20 Sep 2022 11:07:26 +0200 Subject: [PATCH 02/12] synchronized factor of fillTypes between categories --- gui/ScoreBoardFrame.lua | 9 ++++++++- scripts/ScoreBoardCategory.lua | 24 +++++++++++------------- scripts/ScoreBoardList.lua | 4 ++-- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/gui/ScoreBoardFrame.lua b/gui/ScoreBoardFrame.lua index 75dd5f4..09e49bb 100644 --- a/gui/ScoreBoardFrame.lua +++ b/gui/ScoreBoardFrame.lua @@ -450,7 +450,14 @@ end function ScoreBoardFrame:onTextInputChangeValue(text, clickOk, element) if clickOk then if text ~= nil and element ~= nil then - element:onTextInput(text) + local sx, ix = self.leftList:getSelectedPath() + local list = self.managers[sx]() + for _, category in pairs(list:getElements()) do + local elementToUpdate = category:getElementByName(element:getName()) + if elementToUpdate ~= nil then + elementToUpdate:onTextInput(text) + end + end self:updateLists() end end diff --git a/scripts/ScoreBoardCategory.lua b/scripts/ScoreBoardCategory.lua index 7274098..06f56c2 100644 --- a/scripts/ScoreBoardCategory.lua +++ b/scripts/ScoreBoardCategory.lua @@ -21,11 +21,11 @@ function ScoreBoardCategory:getTitle() end function ScoreBoardCategory:getName() - return self.name + return self.name end function ScoreBoardCategory:setParent(parent, id) - self.parent = parent + self.parent = parent self.id = id end @@ -47,11 +47,11 @@ function ScoreBoardCategory:getElement(index) end function ScoreBoardCategory:getElementByName(name) - if name == nil then + if name == nil then return self end - for _, element in pairs(self.elements) do - if element:getName() == name then + for _, element in pairs(self.elements) do + if element:getName() == name then return element end end @@ -70,7 +70,6 @@ function ScoreBoardCategory:clear() end function ScoreBoardCategory:onTextInput(value) - end function ScoreBoardCategory:isTextInputAllowed() @@ -78,7 +77,6 @@ function ScoreBoardCategory:isTextInputAllowed() end function ScoreBoardCategory:onClick() - end function ScoreBoardCategory:saveToXMLFile(xmlFile, baseXmlKey, ix) @@ -103,7 +101,7 @@ end function ScoreBoardCategory:count() local value = 0 - for _, element in pairs(self.elements) do + for _, element in pairs(self.elements) do value = value + element:count() end return value @@ -129,23 +127,23 @@ end function ScoreBoardCategory:applyValues(staticList) local element = staticList:getElementByName(self.name) - if element then - for i, e in ipairs(self.elements) do + if element then + for i, e in ipairs(self.elements) do e:applyValues(element) - end + end end end function ScoreBoardCategory:writeStream(streamId, ...) streamWriteUInt8(streamId, #self.elements) - for i, element in ipairs(self.elements) do + for i, element in ipairs(self.elements) do streamWriteString(streamId, element:getName()) element:writeJoinStream(streamId, ...) end end function ScoreBoardCategory:readStream(streamId, ...) - for i= 1, streamReadUInt8(streamId) do + for i= 1, streamReadUInt8(streamId) do local elementName = streamReadString(streamId) local e = self:getElementByName(elementName) e:readJoinStream(streamId, ...) diff --git a/scripts/ScoreBoardList.lua b/scripts/ScoreBoardList.lua index dd97f64..47d452d 100644 --- a/scripts/ScoreBoardList.lua +++ b/scripts/ScoreBoardList.lua @@ -70,7 +70,7 @@ function ScoreBoardList:getElement(index, ...) end function ScoreBoardList:getElementByName(name, ...) - for _, element in pairs(self.elements) do + for _, element in pairs(self.elements) do if element:getName() == name then return element:getElementByName(...) end @@ -95,7 +95,7 @@ end function ScoreBoardList:count() local value = 0 - for _, element in pairs(self.elements) do + for _, element in pairs(self.elements) do value = value + element:count() end return value From 03ffa8dca53ca1123fed382f46cff4c790341ac9 Mon Sep 17 00:00:00 2001 From: tn4799 Date: Wed, 21 Sep 2022 15:28:44 +0200 Subject: [PATCH 03/12] added function to combine categories into one --- scripts/ScoreBoardList.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/scripts/ScoreBoardList.lua b/scripts/ScoreBoardList.lua index dd97f64..18f8464 100644 --- a/scripts/ScoreBoardList.lua +++ b/scripts/ScoreBoardList.lua @@ -8,6 +8,8 @@ function ScoreBoardList.new(name, titles, elements, custom_mt) self.titles = titles self.name = name self.elements = elements or {} + self.nameToIndex = {} + return self end @@ -59,8 +61,10 @@ end function ScoreBoardList:addElement(element, ix) if ix ~= nil then table.insert(self.elements, ix, element) + self.nameToIndex[element:getName()] = ix else table.insert(self.elements, element) + self.nameToIndex[element:getName()] = #self.elements end element:setParent(self, ix or #self.elements) end @@ -77,6 +81,10 @@ function ScoreBoardList:getElementByName(name, ...) end end +function ScoreBoardList:getElementIndexByName(name) + return self.nameToIndex[name] +end + function ScoreBoardList:setElementByName(name, newCategory) for ix, element in pairs(self.elements) do if element:getName() == name then @@ -106,3 +114,24 @@ function ScoreBoardList:applyValues(staticList) element:applyValues(staticList) end end + +--- Combines all specified elements into newElement and add newElement to self.elements +--- @param newElement ScoreBoardCategory +--- @param ... string names of all elements to combine +function ScoreBoardList:mergeElements(newElement, ...) + for _, name in pairs(...) do + local idx = self:getElementIndexByName(name) + local element = self:getElementByName(name) + for _, elem in pairs(element:getElements()) do + newElement:addElement(elem) + end + + self.elements[idx] = nil + self.nameToIndex[name] = nil + end + self:addElement(newElement) + + for _, element in pairs(newElement) do + element:setParent(self, #self.elements) + end +end \ No newline at end of file From fddcfb9e492178c7c33ed9918732efbd9625b15f Mon Sep 17 00:00:00 2001 From: tn4799 Date: Wed, 21 Sep 2022 15:29:13 +0200 Subject: [PATCH 04/12] merge storage, bales and pallets for admin point settings --- scripts/VictoryPointManager.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/VictoryPointManager.lua b/scripts/VictoryPointManager.lua index 560b9de..96fb912 100644 --- a/scripts/VictoryPointManager.lua +++ b/scripts/VictoryPointManager.lua @@ -53,6 +53,8 @@ function VictoryPointManager:loadConfigData(xmlFile, baseXmlKey) end) self.staticPointList = self:getNewPointList() + local storageCategory = self.staticPointList:getElementByName("storage"):clone() + self.staticPointList:mergeElements(storageCategory, "storage", "bales", "pallets") end function VictoryPointManager:saveToXMLFile(xmlFile, baseXmlKey) From 8b80ac23a6d81aaac0e0b4e2d3534bf80475a1a1 Mon Sep 17 00:00:00 2001 From: tn4799 Date: Thu, 22 Sep 2022 11:15:54 +0200 Subject: [PATCH 05/12] fixed errors from list-merging --- scripts/ScoreBoardCategory.lua | 14 +++++++------- scripts/ScoreBoardList.lua | 16 ++++++---------- scripts/VictoryPointManager.lua | 3 ++- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/scripts/ScoreBoardCategory.lua b/scripts/ScoreBoardCategory.lua index 7274098..bb5ab14 100644 --- a/scripts/ScoreBoardCategory.lua +++ b/scripts/ScoreBoardCategory.lua @@ -21,11 +21,11 @@ function ScoreBoardCategory:getTitle() end function ScoreBoardCategory:getName() - return self.name + return self.name end function ScoreBoardCategory:setParent(parent, id) - self.parent = parent + self.parent = parent self.id = id end @@ -34,7 +34,7 @@ function ScoreBoardCategory:getParent() end function ScoreBoardCategory:addElement(element, ix) - if ix ~= nil then + if ix ~= nil then table.insert(self.elements, ix, element) else table.insert(self.elements, element) @@ -47,11 +47,11 @@ function ScoreBoardCategory:getElement(index) end function ScoreBoardCategory:getElementByName(name) - if name == nil then + if name == nil then return self end - for _, element in pairs(self.elements) do - if element:getName() == name then + for _, element in pairs(self.elements) do + if element:getName() == name then return element end end @@ -111,7 +111,7 @@ end function ScoreBoardCategory:clone(...) local category = ScoreBoardCategory.new(self.name, self.title) - for i, element in ipairs(self.elements) do + for i, element in ipairs(self.elements) do local e = element:clone(...) category:addElement(e) end diff --git a/scripts/ScoreBoardList.lua b/scripts/ScoreBoardList.lua index 18f8464..a7d72a3 100644 --- a/scripts/ScoreBoardList.lua +++ b/scripts/ScoreBoardList.lua @@ -86,8 +86,8 @@ function ScoreBoardList:getElementIndexByName(name) end function ScoreBoardList:setElementByName(name, newCategory) - for ix, element in pairs(self.elements) do - if element:getName() == name then + for ix, element in pairs(self.elements) do + if element:getName() == name then self.elements[ix] = newCategory end end @@ -103,23 +103,23 @@ end function ScoreBoardList:count() local value = 0 - for _, element in pairs(self.elements) do + for _, element in pairs(self.elements) do value = value + element:count() end return value end function ScoreBoardList:applyValues(staticList) - for i, element in ipairs(self.elements) do + for i, element in ipairs(self.elements) do element:applyValues(staticList) - end + end end --- Combines all specified elements into newElement and add newElement to self.elements --- @param newElement ScoreBoardCategory --- @param ... string names of all elements to combine function ScoreBoardList:mergeElements(newElement, ...) - for _, name in pairs(...) do + for _, name in pairs({...}) do local idx = self:getElementIndexByName(name) local element = self:getElementByName(name) for _, elem in pairs(element:getElements()) do @@ -130,8 +130,4 @@ function ScoreBoardList:mergeElements(newElement, ...) self.nameToIndex[name] = nil end self:addElement(newElement) - - for _, element in pairs(newElement) do - element:setParent(self, #self.elements) - end end \ No newline at end of file diff --git a/scripts/VictoryPointManager.lua b/scripts/VictoryPointManager.lua index 96fb912..4a3b897 100644 --- a/scripts/VictoryPointManager.lua +++ b/scripts/VictoryPointManager.lua @@ -53,7 +53,8 @@ function VictoryPointManager:loadConfigData(xmlFile, baseXmlKey) end) self.staticPointList = self:getNewPointList() - local storageCategory = self.staticPointList:getElementByName("storage"):clone() + local storageCategory = self.staticPointList:getElementByName("storage") + storageCategory = ScoreBoardCategory.new(storageCategory:getName(), storageCategory:getTitle()) self.staticPointList:mergeElements(storageCategory, "storage", "bales", "pallets") end From 602fb047edda327232f17957130fbc6c777b08cc Mon Sep 17 00:00:00 2001 From: tn4799 Date: Thu, 22 Sep 2022 12:32:47 +0200 Subject: [PATCH 06/12] implemented clone-function --- scripts/Rules.lua | 16 +++++++++++++++- scripts/ScoreBoardElement.lua | 4 ++++ scripts/ScoreBoardList.lua | 11 +++++++++++ scripts/VictoryPoint.lua | 9 ++++----- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/scripts/Rules.lua b/scripts/Rules.lua index c2e67f8..9479eb3 100644 --- a/scripts/Rules.lua +++ b/scripts/Rules.lua @@ -4,7 +4,6 @@ local Rule_mt = Class(Rule, ScoreBoardElement) function Rule.new(name, default, title, valuesData, custom_mt) local self = ScoreBoardElement.new(name, title, custom_mt or Rule_mt) self.currentIx = default or 1 - self.title = title self.values = {} self.texts = {} if valuesData then @@ -27,6 +26,21 @@ function Rule.createFromXml(data) return Rule.new(data.name, data.default, data.title, data.values) end +function Rule:clone() + local data = {} + + assert(#self.values == #self.texts) + for i = 1, #self.self.values do + data:insert({ + value = self.values[i], + text = self.texts[i] + } + ) + end + + return Rule.new(self.name, self.currentIx, self.title, data) +end + function Rule:getText() if next(self.texts) ~= nil and self.texts[self.currentIx] then return self.texts[self.currentIx] diff --git a/scripts/ScoreBoardElement.lua b/scripts/ScoreBoardElement.lua index 5d604d2..de1938e 100644 --- a/scripts/ScoreBoardElement.lua +++ b/scripts/ScoreBoardElement.lua @@ -83,6 +83,10 @@ function ScoreBoardElement.loadFromXMLFile(category, xmlFile, baseXmlKey) end) end +function ScoreBoardElement:clone() + return ScoreBoardElement.new(self.name, self.title) +end + function ScoreBoardElement:applyValues() end diff --git a/scripts/ScoreBoardList.lua b/scripts/ScoreBoardList.lua index 710e057..46b6af9 100644 --- a/scripts/ScoreBoardList.lua +++ b/scripts/ScoreBoardList.lua @@ -115,6 +115,17 @@ function ScoreBoardList:applyValues(staticList) end end +function ScoreBoardList:clone() + local list = ScoreBoardList.new(self.name, self.title) + + for _, element in pairs(self.elements) do + local e = element:clone() + list:addElement(e) + end + + return list +end + --- Combines all specified elements into newElement and add newElement to self.elements --- @param newElement ScoreBoardCategory --- @param ... string names of all elements to combine diff --git a/scripts/VictoryPoint.lua b/scripts/VictoryPoint.lua index 713e3fb..74af449 100644 --- a/scripts/VictoryPoint.lua +++ b/scripts/VictoryPoint.lua @@ -19,7 +19,6 @@ function VictoryPoint.new(name, value, factor, title, inputText, unitTextFunc, d local self = ScoreBoardElement.new(name, title, custom_mt or VictoryPoint_mt) self.value = value self.factor = factor - self.title = title self.inputText = inputText self.dependency = dependency self.unitTextFunc = unitTextFunc @@ -34,6 +33,10 @@ function VictoryPoint.createFromXml(data, value) return VictoryPoint.new(data.name, value, data.default, data.title, data.inputText, data.unitTextFunc, data.dependency) end +function VictoryPoint:clone() + return VictoryPoint.new(self.name, self.value, self.factor, self.title, self.inputText, self.unitTextFunc, self.dependency) +end + function VictoryPoint:getValue() if self.staticElement == nil and not self.dependency then return 0 @@ -104,10 +107,6 @@ function VictoryPoint:isTextInputAllowed() return not self.dependency end -function VictoryPoint:clone(farmId, farm) - -end - function VictoryPoint:__tostring() return string.format("title: %s, value/factor: %.1f", self.title, self.value / self.factor) end From 5c97bbbe04dd950cb35b6d38179836cd1cb4c6e5 Mon Sep 17 00:00:00 2001 From: tn4799 Date: Thu, 22 Sep 2022 12:59:59 +0200 Subject: [PATCH 07/12] implemented removing an element at index --- scripts/ScoreBoardCategory.lua | 4 ++++ scripts/ScoreBoardList.lua | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/scripts/ScoreBoardCategory.lua b/scripts/ScoreBoardCategory.lua index caf7004..b8c8fec 100644 --- a/scripts/ScoreBoardCategory.lua +++ b/scripts/ScoreBoardCategory.lua @@ -42,6 +42,10 @@ function ScoreBoardCategory:addElement(element, ix) element:setParent(self, ix or #self.elements) end +function ScoreBoardCategory:removeElement(idx) + return table.remove(self.elements, idx) +end + function ScoreBoardCategory:getElement(index) return index ~= nil and self.elements[index] or self end diff --git a/scripts/ScoreBoardList.lua b/scripts/ScoreBoardList.lua index 46b6af9..f13e2e9 100644 --- a/scripts/ScoreBoardList.lua +++ b/scripts/ScoreBoardList.lua @@ -69,6 +69,10 @@ function ScoreBoardList:addElement(element, ix) element:setParent(self, ix or #self.elements) end +function ScoreBoardList:removeElement(idx) + return table.remove(self.elements, idx) +end + function ScoreBoardList:getElement(index, ...) return self.elements[index]:getElement(...) end From c1912692a44f827c824a9b7f322c24721e4ef970 Mon Sep 17 00:00:00 2001 From: tn4799 Date: Thu, 22 Sep 2022 13:00:57 +0200 Subject: [PATCH 08/12] combine all fillTypes into one list for admin settings and sync factors for all VictoryPoints --- gui/ScoreBoardFrame.lua | 5 +---- scripts/VictoryPointManager.lua | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/gui/ScoreBoardFrame.lua b/gui/ScoreBoardFrame.lua index 29b200a..01307db 100644 --- a/gui/ScoreBoardFrame.lua +++ b/gui/ScoreBoardFrame.lua @@ -683,10 +683,7 @@ function ScoreBoardFrame:onTextInputChangeValue(text, clickOk, element) local sx, ix = self.leftList:getSelectedPath() local list = self.managers[sx]() for _, category in pairs(list:getElements()) do - local elementToUpdate = category:getElementByName(element:getName()) - if elementToUpdate ~= nil then - elementToUpdate:onTextInput(text) - end + self.victoryPointManager:updateVictoryPoint(category:getName(), element:getName(), tonumber(text)) end self:updateLists() end diff --git a/scripts/VictoryPointManager.lua b/scripts/VictoryPointManager.lua index 4a3b897..aa93b28 100644 --- a/scripts/VictoryPointManager.lua +++ b/scripts/VictoryPointManager.lua @@ -53,9 +53,11 @@ function VictoryPointManager:loadConfigData(xmlFile, baseXmlKey) end) self.staticPointList = self:getNewPointList() - local storageCategory = self.staticPointList:getElementByName("storage") + self.fillTypePointList = self.staticPointList:clone() + local storageCategory = self.fillTypePointList:getElementByName("storage") storageCategory = ScoreBoardCategory.new(storageCategory:getName(), storageCategory:getTitle()) - self.staticPointList:mergeElements(storageCategory, "storage", "bales", "pallets") + self.fillTypePointList:mergeElements(storageCategory, "storage", "bales", "pallets") + self.fillTypePointList:removeElement(1) end function VictoryPointManager:saveToXMLFile(xmlFile, baseXmlKey) @@ -238,8 +240,21 @@ function VictoryPointManager:update() end end +function VictoryPointManager:updateVictoryPoint(categoryName, pointName, factor) + assert(type(factor) == "number", "Error: Only numbers are allowed as factors") + local point = self.staticPointList:getElementByName(categoryName, pointName) + if point ~= nil then + point:setFactor(factor) + end + + point = self.fillTypePointList:getElementByName(categoryName, pointName) + if point ~= nil then + point:setFactor(factor) + end +end + function VictoryPointManager:getList(farmId) - return farmId ~= nil and self.pointList[farmId] or self.staticPointList + return farmId ~= nil and self.pointList[farmId] or self.fillTypePointList end function VictoryPointManager:getListByName() From 533fac6cd1cca2ff292a064da2761ecf99c6d482 Mon Sep 17 00:00:00 2001 From: tn4799 Date: Thu, 22 Sep 2022 13:03:29 +0200 Subject: [PATCH 09/12] removed unrechable code --- scripts/VictoryPoint.lua | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/VictoryPoint.lua b/scripts/VictoryPoint.lua index 74af449..57e4f69 100644 --- a/scripts/VictoryPoint.lua +++ b/scripts/VictoryPoint.lua @@ -139,7 +139,4 @@ function VictoryPoint.readStream(categoryName, categoryId, name, value, ix) local element = g_victoryPointManager:getList():getElementByName(categoryName, name) element:setFactor(value) return element - print("getList: " .. tostring(g_victoryPointManager:getList())) - print("get element: " .. tostring(g_victoryPointManager:getList():getElementByName(categoryName, name))) - print("setFactor: " .. tostring(g_victoryPointManager:getList():getElementByName(categoryName, name):setFactor(value))) end From 83794438ab7b62f8e1e97dc1450f31cc0906a10e Mon Sep 17 00:00:00 2001 From: tn4799 Date: Thu, 22 Sep 2022 13:06:30 +0200 Subject: [PATCH 10/12] fixed typo variable name --- scripts/ScoreBoardList.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ScoreBoardList.lua b/scripts/ScoreBoardList.lua index f13e2e9..5e0ffbd 100644 --- a/scripts/ScoreBoardList.lua +++ b/scripts/ScoreBoardList.lua @@ -120,7 +120,7 @@ function ScoreBoardList:applyValues(staticList) end function ScoreBoardList:clone() - local list = ScoreBoardList.new(self.name, self.title) + local list = ScoreBoardList.new(self.name, self.titles) for _, element in pairs(self.elements) do local e = element:clone() From a620d6e7a6ac24071d10db8a201baa5328fbe681 Mon Sep 17 00:00:00 2001 From: tn4799 Date: Thu, 22 Sep 2022 13:08:20 +0200 Subject: [PATCH 11/12] removed removal of general category --- scripts/VictoryPointManager.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/VictoryPointManager.lua b/scripts/VictoryPointManager.lua index aa93b28..bc56da7 100644 --- a/scripts/VictoryPointManager.lua +++ b/scripts/VictoryPointManager.lua @@ -57,7 +57,6 @@ function VictoryPointManager:loadConfigData(xmlFile, baseXmlKey) local storageCategory = self.fillTypePointList:getElementByName("storage") storageCategory = ScoreBoardCategory.new(storageCategory:getName(), storageCategory:getTitle()) self.fillTypePointList:mergeElements(storageCategory, "storage", "bales", "pallets") - self.fillTypePointList:removeElement(1) end function VictoryPointManager:saveToXMLFile(xmlFile, baseXmlKey) From d37f379185b070659778c4aa481f2f12de84f22a Mon Sep 17 00:00:00 2001 From: tn4799 Date: Thu, 22 Sep 2022 13:57:19 +0200 Subject: [PATCH 12/12] tests to get it back working --- gui/ScoreBoardFrame.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gui/ScoreBoardFrame.lua b/gui/ScoreBoardFrame.lua index 01307db..6d4b678 100644 --- a/gui/ScoreBoardFrame.lua +++ b/gui/ScoreBoardFrame.lua @@ -216,12 +216,12 @@ function ScoreBoardFrame:onGuiSetupFinished() } } self.managers = { - function(...) + function(detailed, ...) return self.victoryPointManager:getList(...) end, - function(...) + function(detailed, ...) local sx, ix = self.leftList:getSelectedPath() - return ix == 1 and self.ruleManager:getList() or self.victoryPointManager:getList() + return ix == 1 and self.ruleManager:getList() or self.victoryPointManager:getList(detailed or false) end, } @@ -229,7 +229,7 @@ function ScoreBoardFrame:onGuiSetupFinished() [self.leftList] = function() return self.NUM_LEFT_SECTIONS end, [self.rightList] = function() local sx, ix = self.leftList:getSelectedPath() - return self.managers[sx]():getNumberOfElements() + return self.managers[sx](true):getNumberOfElements() end, [self.changelogList] = function () return 1 @@ -298,6 +298,7 @@ function ScoreBoardFrame:updateMenuButtons() end function ScoreBoardFrame:getNumberOfSections(list) + print("number of sections: " .. tostring(self.numSections[list]())) return self.numSections[list]() end @@ -320,7 +321,7 @@ function ScoreBoardFrame:getNumberOfItemsInSection(list, section) if list:getIsVisible() then local farmId = self:getCurrentFarmId() local sx, ix = self.leftList:getSelectedPath() - local l = self.managers[sx](farmId) + local l = self.managers[sx](nil, farmId) if l == nil then CmUtil.debug("Categories for not found %d", section) @@ -329,6 +330,7 @@ function ScoreBoardFrame:getNumberOfItemsInSection(list, section) return 0 end + print("number of items in section " .. tostring(section) .. ": " .. tostring(l:getNumberOfElements(section))) return l:getNumberOfElements(section) else return 0 @@ -451,7 +453,7 @@ function ScoreBoardFrame:getElement(section, index) end local sx, ix = self.leftList:getSelectedPath() local farmId = self:getCurrentFarmId() - local list = self.managers[sx](farmId) + local list = self.managers[sx](nil, farmId) if list == nil then CmUtil.debug("Element not found for (%s|%s).", tostring(section), tostring(index)) printCallstack()