changeset 244:d36abace2ce4

Fix bug in *_goto_scene() - Wrong type casting in *_goto_scene() of mb_c_source.m5. Once again! - Change examples/dynamic/main.c that scene is numbered started from zero.
author Thinker K.F. Li <thinker@branda.to>
date Wed, 31 Dec 2008 23:50:53 +0800
parents 6c6b62d342ee
children 81458bb0bf34
files examples/dynamic/main.c tools/mb_c_source.m4
diffstat 2 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/examples/dynamic/main.c	Wed Dec 31 22:39:28 2008 +0800
+++ b/examples/dynamic/main.c	Wed Dec 31 23:50:53 2008 +0800
@@ -304,9 +304,10 @@
     MB_TIMEVAL_ADD(&timer, &interval);
     mb_tman_timeout( MBApp_getTimer(myApp), &timer, switch_scene, myApp);
 
-    en->currentscene = (en->currentscene+1) %2;
-    printf("switch to scene %d\n", en->currentscene);
-    MB_SPRITE_GOTO_SCENE(myApp->rootsprite,en->currentscene);
+    en->currentscene = (en->currentscene + 1) % 2;
+    printf("switch to scene %d\n", en->currentscene + 1);
+    MB_SPRITE_GOTO_SCENE(myApp->rootsprite,en->currentscene + 1);
+    rdman_redraw_all(myApp->rdman);
 }
 
 int main(int argc, char * const argv[]) {
--- a/tools/mb_c_source.m4	Wed Dec 31 22:39:28 2008 +0800
+++ b/tools/mb_c_source.m4	Wed Dec 31 23:50:53 2008 +0800
@@ -392,7 +392,7 @@
     if(sprite->last_scene) {
         p = sprite->last_scene;
     	while(*p != 0) {
-	    coord = (coord_t *)MB_SPRITE_OFF_2_PTR(sprite, *p);
+	    coord = *(coord_t **)MB_SPRITE_OFF_2_PTR(sprite, *p);
 	    coord_hide(coord);
 	    rdman_coord_changed(sprite->rdman, coord);
 	    p++;
@@ -407,7 +407,7 @@
     scene = $1_scenes[scene_no];
     p = scene;
     while(*p != 0) {
-	coord = (coord_t *)MB_SPRITE_OFF_2_PTR(sprite, *p);
+	coord = *(coord_t **)MB_SPRITE_OFF_2_PTR(sprite, *p);
 	coord_show(coord);
 	rdman_coord_changed(sprite->rdman, coord);
 	p++;