Code:
verb Create_Unit() var/Unit/NU = new() NU.Commander = src NU.ID = ++src.LastUnit src.ActiveUnit = NU
Save_Unit() src.EditMode = 0 src.ActiveUnit = null src.Units += src.ActiveUnit for(var/mob/M in src.client.screen) src.client.screen -= M
Delete_Unit(ID as num) for(var/Unit/A in src.Units) if(A.ID == ID) A.Disband() return
verb Edit_Units() if(length(usr.Units) <= 0) src.EditMode = 1 src.Create_Unit() src << output("Creating Unit","UnitForm.Chat")
else var/L = list() for(var/Unit/U in src.Units) L += "[U.ID]" L += "New Unit" var/X = input(src,"Which Unit would you like to edit?","EDIT UNIT") in L var/Unit/UNIT for(var/Unit/U in src.Units) if(U.ID == "[X]") UNIT = U break if(isnull(UNIT)) src.Create_Unit() else src.ActiveUnit = UNIT return
|
Problem description:
For some reason, the input list doesn't appear. Here are the steps I go through to get it up.
1. Run Edit_Unit() for the first time.
2. Save_Units()
3. Run Edit_Unit() again.
My debugging statement tells me that the else in Edit_Unit() is reached after the save. I figure at the very least, "New Unit" should be in the list but it doesn't appear at all.