static void SCRIPT_recursivewrite (scriptnode_t *node, FILE *fp) { if (node == NULL) return; SCRIPT_writenode (node, fp); /* Free dependant nodes first */ if (node->child) { SCRIPT_recursivewrite (node->child, fp); } if (node->sibling) { SCRIPT_recursivewrite (node->sibling, fp); } }
/* ============== = = SCRIPT_Save = ============== */ void SCRIPT_Save (int32 scripthandle, char* filename) { FILE *fp; scriptnode_t *head; if(scripthandle >= MAX_SCRIPTS || scripthandle < 0) return; fp = fopen (filename, "w"); if (fp == NULL) return; head = script_headnode[scripthandle]; SCRIPT_recursivewrite (head, fp); fclose (fp); }
/* ============== = = SCRIPT_Save = ============== */ void SCRIPT_Save (int32 scripthandle, char* filename) { LOGF("Script_Save(%s)", filename); FILE *fp; scriptnode_t *head; if(scripthandle >= MAX_SCRIPTS || scripthandle < 0) return; fp = fopen (filename, "w"); if (fp == NULL) { rb->splashf(HZ, "Failed to write %s", filename); return; } head = script_headnode[scripthandle]; SCRIPT_recursivewrite (head, fp); fclose (fp); }