Questlog()
var/items = 0
if(!winexists(src,"Questlog"))
winclone(src,"questlog","Questlog")
winshow(src, "Questlog",1)
winset(src, "Questlog.questgrid","cells=null")
for(var/obj/Questholder/H in src.contents)
del H
for(var/obj/Questholder/X in src.Questlog)
var/obj/Questholder/Q = new X.type
Q.completed = X.completed
src.contents += Q
for(var/obj/Questholder/G in src.contents)
winset(src, "Questlog.questgrid","current-cell=1,[++items]")
src << output(G, "Questlog.questgrid")
if(usr.Questlog.len == 0)
usr.Fill_Quest_Window("Clear")
return
for(var/obj/Questholder/F in src.contents)
usr.view_quest = F
usr.Fill_Quest_Window(F)
break
winset(src,"Questlog.questgrid","cells=1x[items]")
Problem description:
Currently I'm working on revamping the quest system for my game. For some strange reason, whenever this proc is called the first time, if there's only one quest in the log, it won't display anything in the grid, yet it'll still load up the information is display it (via Fill_Quest_Window). That means that there most certainly is a quest in the contents. Why will the grid not fill properly? It does should there be more than one quest in the log, but not for a single.
And, on occasion, even when there is more than one, it doesn't fill properly. It makes the cells for the quests that are there, since the lines show up, but there is nothing put into those cells.
Also, try replacing
with this
Also might I just mention you've got a lot of redundant loops and checks there? No point checking all for() loops if the len is 0 in the first place, and a lot of those loops can be combined.
For example.
Also, if none of the above have any effect, you'll probably have to show yuor Fill_Quest_Window proc.