LUADOC - Farming Simulator 19

SellingStation

Parent
UnloadingStation
Functions

loadFromXMLFile

Description
Loading from attributes and nodes
Definition
loadFromXMLFile(integer xmlFile, string key)
Arguments
integerxmlFileid of xml object
stringkeykey
Return Values
booleansuccesssuccess
Code
229function SellingStation:loadFromXMLFile(xmlFile, key)
230 local i=0
231 while true do
232 local statsKey = string.format(key..".stats(%d)", i)
233 if not hasXMLProperty(xmlFile, statsKey) then
234 break
235 end
236 local fillTypeStr = getXMLString(xmlFile, statsKey.."#fillType")
237 local fillType = g_fillTypeManager:getFillTypeIndexByName(fillTypeStr)
238 if fillType ~= nil and self.acceptedFillTypes[fillType] then
239 self.totalReceived[fillType] = Utils.getNoNil(getXMLFloat(xmlFile, statsKey.."#received"), 0)
240 self.totalPaid[fillType] = Utils.getNoNil(getXMLFloat(xmlFile, statsKey.."#paid"), 0)
241 self.pricingDynamics[fillType]:loadFromXMLFile(xmlFile, statsKey)
242 end
243 i = i + 1
244 end
245
246 return true
247end