[Tux4kids-commits] [SCM] tuxhistory - Educational history game branch, master, updated. f61230bd8848924754b2e094ca82e3aae7931f77
julio (none)
julio at julio-desktop.
Fri Jun 25 06:49:26 UTC 2010
The following commit has been merged in the master branch:
commit f61230bd8848924754b2e094ca82e3aae7931f77
Author: julio <julio at julio-desktop.(none)>
Date: Fri Jun 25 01:46:19 2010 -0500
advancing the XML read functions...
diff --git a/src/map.c b/src/map.c
index 7f1c3d5..916b510 100644
--- a/src/map.c
+++ b/src/map.c
@@ -1,3 +1,75 @@
+#include "tuxhistory.h"
+
+#include<ctype.h>
+#include<mxml.h>
+
#include "map.h"
+int get_terrain_enum(char *);
+void str_upper(char *string);
+
+int map_xml(FILE *fp)
+{
+ char *text;
+ mxml_node_t *tree;
+ mxml_node_t *node;
+ mxml_node_t *inode;
+ mxml_node_t *jnode;
+
+ tree = mxmlLoadFile(NULL, fp, MXML_TEXT_CALLBACK);
+
+ for(inode = mxmlFindElement(tree, tree, "row",
+ NULL, NULL, MXML_DESCEND);
+ inode != NULL;
+ inode = mxmlFindElement(inode, tree, "row",
+ NULL, NULL, MXML_DESCEND))
+ {
+ for(jnode = mxmlFindElement(inode, inode, "tilde",
+ NULL, NULL, MXML_DESCEND);
+ jnode != NULL;
+ jnode = mxmlFindElement(jnode, inode, "tilde",
+ NULL, NULL, MXML_DESCEND))
+ {
+ node = mxmlFindElement(jnode, jnode, "terrain",
+ NULL, NULL, MXML_DESCEND);
+ printf("%s",node->child->value.text.string);
+
+ node = mxmlFindElement(jnode, jnode, "height",
+ NULL, NULL, MXML_DESCEND);
+ printf("%d",node->child->value.integer);
+ }
+ printf("\n");
+ }
+
+ str_upper(text);
+
+ printf("%s\n",text);
+
+
+ mxmlDelete(jnode);
+ mxmlDelete(inode);
+ mxmlDelete(node);
+
+ fclose(fp);
+}
+
+int get_terrain_enum(char *terrain_string)
+{
+ if(strcmp(terrain, "GRASSLAND"))
+ {
+ return 1;
+ }
+}
+
+void str_upper(char *string)
+{
+ char c;
+ while(*string)
+ {
+ c = *string;
+ *string = toupper(c);
+ string++;
+ }
+}
+
diff --git a/src/tuxhistory.h b/src/tuxhistory.h
index 7b44c1b..dd4fe14 100644
--- a/src/tuxhistory.h
+++ b/src/tuxhistory.h
@@ -1,11 +1,12 @@
/*
- tuxmath.h
+ tuxhistory.h
- For TuxMath
- Contains global data for configuration of math questions and
- for general game options, as well as constants and defaults.
+ For tuxhistory
+ Contains global data for configuration
Author: David Bruce <davidstuartbruce at gmail.com>, (C) 2006
+
+ Modified by Jesús Mager <fongog at gmail.com> 2010
Part of "Tux4Kids" Project
@@ -19,8 +20,8 @@
-#ifndef TUXMATH_H
-#define TUXMATH_H
+#ifndef TUXHISTORY_H
+#define TUXHISTORY_H
#include "globals.h"
--
tuxhistory - Educational history game
More information about the Tux4kids-commits
mailing list