Looping Proc in Developer Help
|
|
Code:
proc/GameEnd() if(Entries.len) world << "<center><font color = red><big>Game over! your winner is:" for(var/mob/A in Entries) world << A A.Move(locate(10,14,2)) A.cantshoot = abs(1) A.wins++ A.hit = abs(0) A.upgradepoints += 2 A << "You gained two upgrade points!" Entries.Remove(A) for(var/obj/powerup/P in world) del(P) for(var/obj/Mine/M in world) del(M) for(var/mob/M in world) M.movement = 1 M.cantshoot = 1 M.tourny = 0 Gameon = abs(0)
mob/proc/Eliminate() if(src.hit >= 10) world << "[src] has been hit 10 times and is therefor eliminated!" Entries -= src src.loc = locate(10,14,2) src.cantshoot = abs(1) src.losses += 1 src.hit = abs(0) src.scores() GameEnd()
|
Problem description: My problem is GameEnd() is called in a really fast loop until it cant call anymore. I cant find the problem myself. Also any Constructive criticism would be appreciated.
|
Second, if it is already being looped then why are you calling it in the Eliminate() proc? Wouldn't that result in two loops running at once?
Third, what is the point of
as well as your other uses of the abs() proc.
I think you need to read up on what an absolute value is before you just start throwing around unnecessary abs().
Can you give a little more clarification on how GameEnd is looping and when exactly your infinite loop (which is what "a really fast loop until it cant call anymore" usually is) is occurring? Does it happen the second you run the server or when the first player joins, or is it at some other time?
Just need a little more info to help you out.