]> git.jsancho.org Git - guile-irrlicht.git/blobdiff - src/animated-mesh-md2.cpp
free strings previously allocated for conversions
[guile-irrlicht.git] / src / animated-mesh-md2.cpp
index 141a634b486df0220ac7c1e51a611deda2086568..844665fad7dc0969e16185b4d6c70a095825c5ed 100644 (file)
@@ -28,94 +28,99 @@ using namespace irr;
 scene::EMD2_ANIMATION_TYPE
 scm_to_md2_animation_type (SCM md2_animation_type)
 {
-  char* flag = scm_to_utf8_string (scm_symbol_to_string (md2_animation_type));
-  if (!strcmp (flag, "stand"))
+  char* type_name = scm_to_utf8_string (scm_symbol_to_string (md2_animation_type));
+  scene::EMD2_ANIMATION_TYPE type;
+
+  if (!strcmp (type_name, "stand"))
     {
-      return scene::EMAT_STAND;
+      type = scene::EMAT_STAND;
     }
-  else if (!strcmp (flag, "run"))
+  else if (!strcmp (type_name, "run"))
     {
-      return scene::EMAT_RUN;
+      type = scene::EMAT_RUN;
     }
-  else if (!strcmp (flag, "attack"))
+  else if (!strcmp (type_name, "attack"))
     {
-      return scene::EMAT_ATTACK;
+      type = scene::EMAT_ATTACK;
     }
-  else if (!strcmp (flag, "pain-a"))
+  else if (!strcmp (type_name, "pain-a"))
     {
-      return scene::EMAT_PAIN_A;
+      type = scene::EMAT_PAIN_A;
     }
-  else if (!strcmp (flag, "pain-b"))
+  else if (!strcmp (type_name, "pain-b"))
     {
-      return scene::EMAT_PAIN_B;
+      type = scene::EMAT_PAIN_B;
     }
-  else if (!strcmp (flag, "pain-c"))
+  else if (!strcmp (type_name, "pain-c"))
     {
-      return scene::EMAT_PAIN_C;
+      type = scene::EMAT_PAIN_C;
     }
-  else if (!strcmp (flag, "jump"))
+  else if (!strcmp (type_name, "jump"))
     {
-      return scene::EMAT_JUMP;
+      type = scene::EMAT_JUMP;
     }
-  else if (!strcmp (flag, "flip"))
+  else if (!strcmp (type_name, "flip"))
     {
-      return scene::EMAT_FLIP;
+      type = scene::EMAT_FLIP;
     }
-  else if (!strcmp (flag, "salute"))
+  else if (!strcmp (type_name, "salute"))
     {
-      return scene::EMAT_SALUTE;
+      type = scene::EMAT_SALUTE;
     }
-  else if (!strcmp (flag, "fallback"))
+  else if (!strcmp (type_name, "fallback"))
     {
-      return scene::EMAT_FALLBACK;
+      type = scene::EMAT_FALLBACK;
     }
-  else if (!strcmp (flag, "wave"))
+  else if (!strcmp (type_name, "wave"))
     {
-      return scene::EMAT_WAVE;
+      type = scene::EMAT_WAVE;
     }
-  else if (!strcmp (flag, "point"))
+  else if (!strcmp (type_name, "point"))
     {
-      return scene::EMAT_POINT;
+      type = scene::EMAT_POINT;
     }
-  else if (!strcmp (flag, "crouch-stand"))
+  else if (!strcmp (type_name, "crouch-stand"))
     {
-      return scene::EMAT_CROUCH_STAND;
+      type = scene::EMAT_CROUCH_STAND;
     }
-  else if (!strcmp (flag, "crouch-walk"))
+  else if (!strcmp (type_name, "crouch-walk"))
     {
-      return scene::EMAT_CROUCH_WALK;
+      type = scene::EMAT_CROUCH_WALK;
     }
-  else if (!strcmp (flag, "crouch-attack"))
+  else if (!strcmp (type_name, "crouch-attack"))
     {
-      return scene::EMAT_CROUCH_ATTACK;
+      type = scene::EMAT_CROUCH_ATTACK;
     }
-  else if (!strcmp (flag, "crouch-pain"))
+  else if (!strcmp (type_name, "crouch-pain"))
     {
-      return scene::EMAT_CROUCH_PAIN;
+      type = scene::EMAT_CROUCH_PAIN;
     }
-  else if (!strcmp (flag, "crouch-death"))
+  else if (!strcmp (type_name, "crouch-death"))
     {
-      return scene::EMAT_CROUCH_DEATH;
+      type = scene::EMAT_CROUCH_DEATH;
     }
-  else if (!strcmp (flag, "death-fallback"))
+  else if (!strcmp (type_name, "death-fallback"))
     {
-      return scene::EMAT_DEATH_FALLBACK;
+      type = scene::EMAT_DEATH_FALLBACK;
     }
-  else if (!strcmp (flag, "death-fallforward"))
+  else if (!strcmp (type_name, "death-fallforward"))
     {
-      return scene::EMAT_DEATH_FALLFORWARD;
+      type = scene::EMAT_DEATH_FALLFORWARD;
     }
-  else if (!strcmp (flag, "death-fallbackslow"))
+  else if (!strcmp (type_name, "death-fallbackslow"))
     {
-      return scene::EMAT_DEATH_FALLBACKSLOW;
+      type = scene::EMAT_DEATH_FALLBACKSLOW;
     }
-  else if (!strcmp (flag, "boom"))
+  else if (!strcmp (type_name, "boom"))
     {
-      return scene::EMAT_BOOM;
+      type = scene::EMAT_BOOM;
     }
   else
     {
       scm_error (scm_arg_type_key, NULL, "Wrong MD2 animation type: ~S",
                  scm_list_1 (md2_animation_type), scm_list_1 (md2_animation_type));
     }
+
+  free (type_name);
+  return type;
 }