Changes

Jump to navigation Jump to search
5,799 bytes added ,  00:44, 3 October 2009
m
no edit summary
^^^^
[[User:Ncc-1701|Ncc-1701]] 18:17, 2 October 2009 (UTC)
* Great, and since the application will read the rvforest.dat file again after you submitting the change request (that LONG time process), then if you see the prices change as you expect, then you could reinstall rvforest.dat, otherwise try to fix the setting/input file first (so no need to check the prices in the game). And let me know if you still find issues/problems. --[[User:Conanac|Conanac]] 22:44, 2 October 2009 (UTC)
 
== Source code ==
Your app says it's released under the GPL, but I see no source download link. I would really like to see how you did the XML parsing --[[User:Yossi|Yossi]] 09:13, 2 October 2009 (UTC)
* Since I am in the process of cleaning the codes, here is the example taken from the codes that shows how to parse xml file (a brute force method, but it works, and there are definitely better ways to reduce this long section of codes).
 
<pre>
 
void readsettingxml()
{
// for mxml structure
mxml_node_t *tree;
mxml_node_t *node;
char *nodecontent;
int price;
FILE *ft;
 
// test for uploading setting from xml file
tree = NULL;
chdir("/");
ft = fopen("turnipsetting.xml", "r");
if (ft == NULL) {
fclose(ft);
}
else {
tree = mxmlLoadFile(NULL,ft,MXML_TEXT_CALLBACK);
node = mxmlFindElement(tree,tree,"sdirname",NULL,NULL,MXML_DESCEND);
if (node) {
nodecontent = node->child->value.text.string;
strfcpy(dirwiisave,nodecontent,MAXPATHLEN);
}
node = mxmlFindElement(tree,tree,"sfilename",NULL,NULL,MXML_DESCEND);
if (node) {
nodecontent = node->child->value.text.string;
strfcpy(rvforestname,nodecontent,MAXPATHLEN);
}
node = mxmlFindElement(tree,tree,"tdirname",NULL,NULL,MXML_DESCEND);
if (node) {
nodecontent = node->child->value.text.string;
strfcpy(dirturnip,nodecontent,MAXPATHLEN);
}
node = mxmlFindElement(tree,tree,"tfilename",NULL,NULL,MXML_DESCEND);
if (node) {
nodecontent = node->child->value.text.string;
strfcpy(turnipname,nodecontent,MAXPATHLEN);
}
node = mxmlFindElement(tree,tree,"sunam",NULL,NULL,MXML_DESCEND);
if (node) {
price = atoi(node->child->value.text.string);
if (price > 0 && price <= 999) {
usunam = price; }
else {
usunam = 0; }
}
node = mxmlFindElement(tree,tree,"monam",NULL,NULL,MXML_DESCEND);
if (node) {
price = atoi(node->child->value.text.string);
if (price > 0 && price <= 999) {
umonam = price; }
else {
umonam = 0; }
}
node = mxmlFindElement(tree,tree,"monpm",NULL,NULL,MXML_DESCEND);
if (node) {
price = atoi(node->child->value.text.string);
if (price > 0 && price <= 999) {
umonpm = price; }
else {
umonpm = 0; }
}
node = mxmlFindElement(tree,tree,"tueam",NULL,NULL,MXML_DESCEND);
if (node) {
price = atoi(node->child->value.text.string);
if (price > 0 && price <= 999) {
utueam = price; }
else {
utueam = 0; }
}
node = mxmlFindElement(tree,tree,"tuepm",NULL,NULL,MXML_DESCEND);
if (node) {
price = atoi(node->child->value.text.string);
if (price > 0 && price <= 999) {
utuepm = price; }
else {
utuepm = 0; }
}
node = mxmlFindElement(tree,tree,"wedam",NULL,NULL,MXML_DESCEND);
if (node) {
price = atoi(node->child->value.text.string);
if (price > 0 && price <= 999) {
uwedam = price; }
else {
uwedam = 0; }
}
node = mxmlFindElement(tree,tree,"wedpm",NULL,NULL,MXML_DESCEND);
if (node) {
price = atoi(node->child->value.text.string);
if (price > 0 && price <= 999) {
uwedpm = price; }
else {
uwedpm = 0; }
}
node = mxmlFindElement(tree,tree,"thuam",NULL,NULL,MXML_DESCEND);
if (node) {
price = atoi(node->child->value.text.string);
if (price > 0 && price <= 999) {
uthuam = price; }
else {
uthuam = 0; }
}
node = mxmlFindElement(tree,tree,"thupm",NULL,NULL,MXML_DESCEND);
if (node) {
price = atoi(node->child->value.text.string);
if (price > 0 && price <= 999) {
uthupm = price; }
else {
uthupm = 0; }
}
node = mxmlFindElement(tree,tree,"friam",NULL,NULL,MXML_DESCEND);
if (node) {
price = atoi(node->child->value.text.string);
if (price > 0 && price <= 999) {
ufriam = price; }
else {
ufriam = 0; }
}
node = mxmlFindElement(tree,tree,"fripm",NULL,NULL,MXML_DESCEND);
if (node) {
price = atoi(node->child->value.text.string);
if (price > 0 && price <= 999) {
ufripm = price; }
else {
ufripm = 0; }
}
node = mxmlFindElement(tree,tree,"satam",NULL,NULL,MXML_DESCEND);
if (node) {
price = atoi(node->child->value.text.string);
if (price > 0 && price <= 999) {
usatam = price; }
else {
usatam = 0; }
}
node = mxmlFindElement(tree,tree,"satpm",NULL,NULL,MXML_DESCEND);
if (node) {
price = atoi(node->child->value.text.string);
if (price > 0 && price <= 999) {
usatpm = price; }
else {
usatpm = 0; }
}
fclose(ft);
mxmlDelete(node);
mxmlDelete(tree);
}
}
 
</pre>
 
Hope this helps, and let me know if you need further assistance. --[[User:Conanac|Conanac]] 22:44, 2 October 2009 (UTC)
165

edits

Navigation menu