Mercurial > hg > Members > kono > Cerium
changeset 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 | dbcfa04ee4db |
children | 1221a142640d |
files | Renderer/Engine/SceneGraph.h Renderer/Test/dynamic_create.cc |
diffstat | 2 files changed, 18 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraph.h Fri Jun 04 09:01:00 2010 +0900 +++ b/Renderer/Engine/SceneGraph.h Sat Jun 05 21:23:25 2010 +0900 @@ -32,7 +32,7 @@ int id; // Objectのシーケンス番号(Linda) // とりあえず動かしたいので追加 - int seq, resend_flag; + int seq, seq_rd, resend_flag; int property_size; void *propertyptr;
--- a/Renderer/Test/dynamic_create.cc Fri Jun 04 09:01:00 2010 +0900 +++ b/Renderer/Test/dynamic_create.cc Sat Jun 05 21:23:25 2010 +0900 @@ -94,12 +94,24 @@ { SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; // LindaServerから座標データを取得してオブジェクトに反映させる。 + + if (!node->resend_flag || node->seq_rd != node->seq) { + unsigned char *reply_rd = psx_reply(node->seq_rd); + if (reply_rd != NULL) { + set_position(node, reply_rd); + free(reply_rd); + return; + } + } unsigned char *reply = psx_reply(node->seq); if (reply != NULL) { set_position(node, reply); free(reply); -// node->seq = psx_wait_rd(sgroot->tid, node->id * 10 + 1); - node->seq = psx_rd(sgroot->tid, node->id * 10 + 1); + node->seq = psx_wait_rd(sgroot->tid, node->id * 10 + 1); + node->resend_flag = true; + } else if (node->resend_flag) { + node->seq_rd = psx_rd(sgroot->tid, node->id * 10 + 1); + node->resend_flag = false; } } @@ -119,9 +131,9 @@ sgroot->createFromXMLmemory(sgroot->tmanager, child, (char *)data, len); child->set_move_collision(moon_move, moon_collision); child->id = serial_id; -// child->seq = psx_wait_rd(sgroot->tid, serial_id * 10 + 1); - child->seq = psx_rd(sgroot->tid, serial_id * 10 + 1); - + child->seq = psx_wait_rd(sgroot->tid, serial_id * 10 + 1); + child->seq_rd = psx_rd(sgroot->tid, serial_id * 10 + 1); + child->resend_flag = false; return child; }