Battlefield.java

I'm just curious about this method:

public void requestAndWaitForSwitch(int party)

After it waits for the user, where does this continue into.
I can't find where this is called from.

Thanks for any help in advance.
 
It is called when using a move which forces pokemon replacement, thus Baton Pass, U-Turn, Healing Wish and Lunar Dance. After sending a change request to the client, it waits until the dispatcher gets informed about the switch. Then further queued moves are processed.
 
Ahh. Thank you, this helps a lot.

Btw, the dispatcher thread is only launched when the server receives a battle message from the client? Am I correct?
 
A new thread is started as both trainers have sent their selection (move/switch) and a turn round can be executed. Before that moment turns are kept in m_turn, you can cancel and choose something different, and thereby overwrite a preceding one.
 
Would that not become memory heavy when there are a couple of hundred players? In past experience, the garbage collector ain't the quickest.
 

Cathy

Banned deucer.
Thread objects in Java do not have a one to one correspondence with native threads; the Java Virtual Machine essentially rolls its own lightweight "threads". Spawning new Java threads is cheap. There is no problem with how turn execution is implemented.
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top