Skip to content
Snippets Groups Projects
Commit d17ed702 authored by dg's avatar dg
Browse files

Encumberance column on item lists is now showing the total for the stack

git-svn-id: http://svn.net-core.org/repos/t-engine4@2257 51575b47-30f0-44d4-a5cc-537603b46e54
parent 3aeae915
No related branches found
No related tags found
No related merge requests found
......@@ -165,7 +165,11 @@ function _M:generateList()
for item, o in ipairs(self.actor.inven[inven_id]) do
if not self.filter or self.filter(o) then
local char = self:makeKeyChar(i)
list[#list+1] = { id=#list+1, char=char, name=o:getName(), color=o:getDisplayColor(), object=o, inven=inven_id, item=item, cat=o.subtype, encumberance=o.encumber, desc=o:getDesc() }
local enc = 0
o:forAllStack(function(o) enc=enc+o.encumber end)
list[#list+1] = { id=#list+1, char=char, name=o:getName(), color=o:getDisplayColor(), object=o, inven=inven_id, item=item, cat=o.subtype, encumberance=enc, desc=o:getDesc() }
chars[char] = #list
i = i + 1
end
......@@ -183,7 +187,11 @@ function _M:generateList()
for item, o in ipairs(self.actor:getInven("INVEN")) do
if not self.filter or self.filter(o) then
local char = self:makeKeyChar(i)
list[#list+1] = { id=#list+1, char=char, name=o:getName(), color=o:getDisplayColor(), object=o, inven=self.actor.INVEN_INVEN, item=item, cat=o.subtype, encumberance=o.encumber, desc=o:getDesc() }
local enc = 0
o:forAllStack(function(o) enc=enc+o.encumber end)
list[#list+1] = { id=#list+1, char=char, name=o:getName(), color=o:getDisplayColor(), object=o, inven=self.actor.INVEN_INVEN, item=item, cat=o.subtype, encumberance=enc, desc=o:getDesc() }
chars[char] = #list
i = i + 1
end
......
......@@ -92,7 +92,11 @@ function _M:generateList()
for item, o in ipairs(self.actor.inven[inven_id]) do
if not self.filter or self.filter(o) then
local char = self:makeKeyChar(i)
list[#list+1] = { id=#list+1, char=char, name=o:getName(), color=o:getDisplayColor(), object=o, inven=inven_id, item=item, cat=o.subtype, encumberance=o.encumber, desc=o:getDesc() }
local enc = 0
o:forAllStack(function(o) enc=enc+o.encumber end)
list[#list+1] = { id=#list+1, char=char, name=o:getName(), color=o:getDisplayColor(), object=o, inven=inven_id, item=item, cat=o.subtype, encumberance=enc, desc=o:getDesc() }
chars[char] = #list
i = i + 1
end
......
......@@ -85,7 +85,11 @@ function _M:generateList()
for item, o in ipairs(self.inven) do
if not self.filter or self.filter(o) then
local char = self:makeKeyChar(i)
list[#list+1] = { id=i, char=char, name=o:getName(), color=o:getDisplayColor(), object=o, item=item, cat=o.subtype, encumberance=o.encumber, desc=o:getDesc() }
local enc = 0
o:forAllStack(function(o) enc=enc+o.encumber end)
list[#list+1] = { id=i, char=char, name=o:getName(), color=o:getDisplayColor(), object=o, item=item, cat=o.subtype, encumberance=enc, desc=o:getDesc() }
list.chars[char] = #list
i = i + 1
end
......
......@@ -113,7 +113,11 @@ function _M:generateList()
if not self.filter or self.filter(o) then
local char = self:makeKeyChar(i)
list.chars[char] = i
list[#list+1] = { char=char, name=o:getName(), color=o:getDisplayColor(), object=o, item=i, cat=o.subtype, encumberance=o.encumber, desc=o:getDesc() }
local enc = 0
o:forAllStack(function(o) enc=enc+o.encumber end)
list[#list+1] = { char=char, name=o:getName(), color=o:getDisplayColor(), object=o, item=i, cat=o.subtype, encumberance=enc, desc=o:getDesc() }
i = i + 1
end
idx = idx + 1
......
......@@ -100,7 +100,12 @@ function _M:drawItem(item)
if not col.direct_draw then
local fw, fh = col.fw, self.fh
local text = item[col.display_prop or col.sort]
local text
if type(col.display_prop) == "function" then
text = col.display_prop(item)
else
text = item[col.display_prop or col.sort]
end
if type(text) ~= "table" or not text.is_tstring then
text = util.getval(text, item)
if type(text) ~= "table" then text = tstring.from(tostring(text)) end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment