• R/O
  • SSH
  • HTTPS

hyakutyping: コミット


コミットメタ情報

リビジョン404 (tree)
日時2010-05-06 21:13:41
作者satofumi

ログメッセージ

Scheduler.lua の間違いを修正

変更サマリ

差分

--- trunk/cpp_lua/scripts/db_local.lua (revision 403)
+++ trunk/cpp_lua/scripts/db_local.lua (revision 404)
@@ -135,9 +135,12 @@
135135
136136 local where_condition = ""
137137 for i = 1, #id_array do
138- where_condition = where_condition .. " and waka_id <> " .. id_array[i]
138+ if i ~= 1 then
139+ where_condition = where_condition .. " and"
140+ end
141+ where_condition = where_condition .. " waka_id <> " .. id_array[i]
139142 end
140143
141- local sql = "update start_delay set start_sec = start_sec + 0.05 where true" .. where_condition
144+ local sql = "update start_delay set start_sec = start_sec + 0.05 where" .. where_condition
142145 db_:exec(sql)
143146 end
--- trunk/cpp_lua/scripts/wait_enter.lua (revision 403)
+++ trunk/cpp_lua/scripts/wait_enter.lua (revision 404)
@@ -12,13 +12,15 @@
1212
1313 local message_ = nil
1414 local message_label_ = nil
15-local scheduler_blink_id_ = -1
15+local scheduler_blink_id_ = nil
1616
1717
1818 function wait_enter_display_message()
1919
2020 -- 決められた時間が経過したら "hit return key" を画面の左下に表示する
21- Scheduler:wait(3000)
21+ -- !!! debug
22+ --Scheduler:wait(3000)
23+ Scheduler:wait(100)
2224 layer_:push_front(message_label_)
2325
2426 -- Enter 画像を振動させる
@@ -90,9 +92,9 @@
9092 function(state)
9193 layer_:remove(enter_label_)
9294 layer_:remove(message_label_)
95+ message_label_ = nil
96+ message_ = nil
9397
9498 scheduler_:remove(scheduler_blink_id_)
95-
96- message_label_ = nil
97- message_ = nil
99+ scheduler_blink_id_ = nil
98100 end
--- trunk/cpp_lua/scripts/display_waka.lua (revision 403)
+++ trunk/cpp_lua/scripts/display_waka.lua (revision 404)
@@ -41,8 +41,8 @@
4141 local bs_position_ = nil
4242 local cursor_label_draw_ = nil
4343
44-local scheduler_blink_cursor_id_ = -1
45-local scheduler_vibrate_bs_id_ = -1
44+local scheduler_blink_cursor_id_ = nil
45+local scheduler_vibrate_bs_id_ = nil
4646
4747
4848 -- カーソルの点滅用
@@ -59,7 +59,7 @@
5959
6060 -- BS の振動用
6161 function vibrateBs()
62- while bs_position_ ~= nil do
62+ while scheduler_vibrate_bs_id_ ~= nil do
6363 bs_label_:setPosition(Point(bs_position_.x , bs_position_.y - 3))
6464 Scheduler:wait(100)
6565
@@ -98,6 +98,9 @@
9898
9999 scheduler_:remove(scheduler_blink_cursor_id_)
100100 scheduler_:remove(scheduler_vibrate_bs_id_)
101+ scheduler_blink_cursor_id_ = nil
102+ scheduler_vibrate_bs_id_ = nil
103+
101104 bs_position_ = nil
102105
103106 current_waka_id_ = InvalidId
@@ -251,7 +254,7 @@
251254 function display_waka_input_sample(waka_id, input_ku, current_text,
252255 is_roman, view_ku)
253256
254- if bs_position_ == nil then
257+ if scheduler_vibrate_bs_id_ == nil then
255258 -- リソースがなければ作成する
256259 scheduler_vibrate_bs_id_ = scheduler_:insert(vibrateBs)
257260 bs_position_ = Point(0, 0)
@@ -352,6 +355,7 @@
352355 input_border_ = nil
353356
354357 scheduler_:remove(scheduler_blink_cursor_id_)
358+ scheduler_blink_cursor_id_ = nil
355359 end
356360
357361
--- trunk/cpp_lua/scripts/first_menu.lua (revision 403)
+++ trunk/cpp_lua/scripts/first_menu.lua (revision 404)
@@ -20,8 +20,8 @@
2020
2121 local selected_index_ = -1
2222
23-local scheduler_fadein_menu_id_ = -1
24-local scheduler_fadein_id_ = -1
23+local scheduler_fadein_menu_id_ = nil
24+local scheduler_fadein_id_ = nil
2525
2626
2727 function first_menu_fadein()
@@ -160,6 +160,8 @@
160160
161161 scheduler_:remove(scheduler_fadein_menu_id_)
162162 scheduler_:remove(scheduler_fadein_id_)
163+ scheduler_fadein_menu_id_ = nil
164+ scheduler_fadein_id_ = nil
163165
164166 buttons_ = nil
165167 surfaces_ = nil
--- trunk/cpp_lua/scripts/practice_menu.lua (revision 403)
+++ trunk/cpp_lua/scripts/practice_menu.lua (revision 404)
@@ -25,8 +25,7 @@
2525
2626 function practice_menu_set_waka_weak()
2727 -- 入力開始が遅い順に和歌 ID を格納し、シャッフルする
28- --waka_id_array_ = waka_handler_shuffle(waka_handler_slow_waka(waka_id_size_))
29- waka_id_array_ = waka_handler_shuffle(waka_handler_slow_waka(1))
28+ waka_id_array_ = waka_handler_shuffle(waka_handler_slow_waka(waka_id_size_))
3029 end
3130
3231
--- trunk/cpp_lua/scripts/Scheduler.lua (revision 403)
+++ trunk/cpp_lua/scripts/Scheduler.lua (revision 404)
@@ -62,12 +62,9 @@
6262 return
6363 end
6464
65- local remove_id = self.id_table_[id]
66-
67- -- !!! 移動させてよいのかを、サンプルで確認すべき
68- -- !!! 使わない場所は、nil にしておくべきかもしれない
65+ local remove_index = self.id_table_[id]
6966 local from = self.coroutines_[self.size_]
70- local to = self.coroutines_[remove_id]
67+ local to = self.coroutines_[remove_index]
7168 to.func_ = from.func_
7269 to.arg_ = from.arg_
7370 to.id_ = from.id_
@@ -74,6 +71,16 @@
7471 to.wakeup_ticks_ = from.wakeup_ticks_
7572 to.co_ = from.co_
7673
74+ -- self.size_ 位置を示す id を探索して変更する
75+ self.id_table_[from.id_] = remove_index
76+
77+ from.func_ = nil
78+ from.arg_ = nil
79+ from.id_ = nil
80+ from.wakeup_ticks_ = nil
81+ from.co_ = nil
82+ from = nil
83+
7784 self.size_ = self.size_ - 1
7885
7986 self.id_table_[id] = nil
@@ -142,7 +149,7 @@
142149 -- 指定した ID のコルーチンが有効かを返す
143150 function Scheduler:isActive(id)
144151
145- if self.id_table_[id] == nil then
152+ if id == nil or self.id_table_[id] == nil then
146153 return false
147154 else
148155 return true
旧リポジトリブラウザで表示