comparison pytouhou/network.py @ 480:d666856acb52

Hopefully improve performance
author Thibaut Girka <thib@sitedethib.com>
date Wed, 28 Dec 2011 19:47:29 +0100
parents 1de67f332f00
children ef2aca7738d5
comparison
equal deleted inserted replaced
479:1de67f332f00 480:d666856acb52
59 def run_iter(self, game, keystate): 59 def run_iter(self, game, keystate):
60 if self.frame < game.frame: 60 if self.frame < game.frame:
61 self.old_keystate, self.keystate = self.keystate, keystate 61 self.old_keystate, self.keystate = self.keystate, keystate
62 self.frame = game.frame 62 self.frame = game.frame
63 63
64 self.send_message()
65
64 for frame, keystate, old_keystate, checksum in self.read_messages(): 66 for frame, keystate, old_keystate, checksum in self.read_messages():
65 if frame == game.frame: 67 if frame == game.frame:
66 self.run_game_iter(game, self.keystate, keystate) 68 self.run_game_iter(game, self.keystate, keystate)
67 elif frame == game.frame + 1: 69 elif frame == game.frame + 1:
68 self.run_game_iter(game, self.old_keystate, keystate) 70 self.run_game_iter(game, self.old_keystate, keystate)
69 71
70 self.send_message()
71