mob
BoatShop
icon = 'Turfs.dmi'
icon_state = "BoatShop"
verb
Buy_Boat()
set src in oview(1)
var/turf/PORTS/T = locate(src.x,src.y-2,src.z)
var/mob/Boats/A = new/mob/Boats/Sloop1(T)
var/E = 1
while(E<T.MaxSpaces)
if(T.Spaces[E])
E++
if(E>=T.MaxSpaces&&T.Spaces[E])
world<<"Sorry, the dock is already filled!"
else
break
if(!T.Spaces[E])
T.Spaces[E] = A
A.pixel_x = (19*T.Spaces[E])-19
A.icon_state = "2"
A.Owner = usr
BoatName(usr,A)
Now it appears obvious to me that because T.Spaces has no length it doesn't work (although T.Spaces is defined as a list) - but I don't know how to correct my code so that it will do the bit:
if(!T.Spaces[E])
T.Spaces[E] = A
A.pixel_x = (19*T.Spaces[E])-19
A.icon_state = "2"
A.Owner = usr
BoatName(usr,A)
even if the list has no length. Thank you!
~Ease~