Mercurial > hg > Members > kono > Cerium
comparison Renderer/Test/dynamic_create.cc @ 847:8c78d15ea999
replace rd() to wait_rd(). and if reply of wait_rd() is NULL, client request one more rd(). for wait_rd() cannot get last changed tuple.
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 05 Jun 2010 21:23:25 +0900 |
parents | 61bfd8e246fc |
children |
comparison
equal
deleted
inserted
replaced
846:dbcfa04ee4db | 847:8c78d15ea999 |
---|---|
92 static void | 92 static void |
93 moon_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) | 93 moon_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) |
94 { | 94 { |
95 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; | 95 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; |
96 // LindaServerから座標データを取得してオブジェクトに反映させる。 | 96 // LindaServerから座標データを取得してオブジェクトに反映させる。 |
97 | |
98 if (!node->resend_flag || node->seq_rd != node->seq) { | |
99 unsigned char *reply_rd = psx_reply(node->seq_rd); | |
100 if (reply_rd != NULL) { | |
101 set_position(node, reply_rd); | |
102 free(reply_rd); | |
103 return; | |
104 } | |
105 } | |
97 unsigned char *reply = psx_reply(node->seq); | 106 unsigned char *reply = psx_reply(node->seq); |
98 if (reply != NULL) { | 107 if (reply != NULL) { |
99 set_position(node, reply); | 108 set_position(node, reply); |
100 free(reply); | 109 free(reply); |
101 // node->seq = psx_wait_rd(sgroot->tid, node->id * 10 + 1); | 110 node->seq = psx_wait_rd(sgroot->tid, node->id * 10 + 1); |
102 node->seq = psx_rd(sgroot->tid, node->id * 10 + 1); | 111 node->resend_flag = true; |
112 } else if (node->resend_flag) { | |
113 node->seq_rd = psx_rd(sgroot->tid, node->id * 10 + 1); | |
114 node->resend_flag = false; | |
103 } | 115 } |
104 } | 116 } |
105 | 117 |
106 static void | 118 static void |
107 earth_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) | 119 earth_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) |
117 parent->addChild(child); | 129 parent->addChild(child); |
118 // 読み込んだオブジェクトは、すべて、child の child になる。 | 130 // 読み込んだオブジェクトは、すべて、child の child になる。 |
119 sgroot->createFromXMLmemory(sgroot->tmanager, child, (char *)data, len); | 131 sgroot->createFromXMLmemory(sgroot->tmanager, child, (char *)data, len); |
120 child->set_move_collision(moon_move, moon_collision); | 132 child->set_move_collision(moon_move, moon_collision); |
121 child->id = serial_id; | 133 child->id = serial_id; |
122 // child->seq = psx_wait_rd(sgroot->tid, serial_id * 10 + 1); | 134 child->seq = psx_wait_rd(sgroot->tid, serial_id * 10 + 1); |
123 child->seq = psx_rd(sgroot->tid, serial_id * 10 + 1); | 135 child->seq_rd = psx_rd(sgroot->tid, serial_id * 10 + 1); |
124 | 136 child->resend_flag = false; |
125 return child; | 137 return child; |
126 } | 138 } |
127 | 139 |
128 | 140 |
129 static void | 141 static void |