<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.wolfire.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=69.181.125.170</id>
	<title>Wolfire Games Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.wolfire.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=69.181.125.170"/>
	<link rel="alternate" type="text/html" href="https://wiki.wolfire.com/index.php?title=Special:Contributions/69.181.125.170"/>
	<updated>2026-05-04T22:57:32Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://wiki.wolfire.com/index.php?title=MapFix&amp;diff=116</id>
		<title>MapFix</title>
		<link rel="alternate" type="text/html" href="https://wiki.wolfire.com/index.php?title=MapFix&amp;diff=116"/>
		<updated>2008-08-24T12:13:22Z</updated>

		<summary type="html">&lt;p&gt;69.181.125.170: New page: This is the source for the MapFix program. Check the dialogue editing section.     #include &amp;lt;stdio.h&amp;gt;        #define SKIP(i,n)      fseek(f[i], n, SEEK_CUR)        int quit() {       print...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is the source for the MapFix program. Check the dialogue editing section.&lt;br /&gt;
&lt;br /&gt;
   #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   #define SKIP(i,n)      fseek(f[i], n, SEEK_CUR)&lt;br /&gt;
   &lt;br /&gt;
   int quit() {&lt;br /&gt;
      printf(&amp;quot;(You can close this window.)\n&amp;quot;);&lt;br /&gt;
      exit(0);&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   int exeunt(FILE *f, FILE *g) {&lt;br /&gt;
      fclose(f);&lt;br /&gt;
      fclose(g);&lt;br /&gt;
      quit();&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   FILE *fopenpath(char *path, char *name, char mode[]) {&lt;br /&gt;
      char pathname[250];&lt;br /&gt;
      strcpy(pathname, path);&lt;br /&gt;
      strcat(pathname, name);&lt;br /&gt;
      return( fopen(pathname, mode) );&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   int main (int argc, char *argv[]) {&lt;br /&gt;
   //-----------------------------------------------OPEN&lt;br /&gt;
      char answer[50], path[200];&lt;br /&gt;
      FILE *f[2];&lt;br /&gt;
   &lt;br /&gt;
      char x, goal[] = &amp;quot;:Data:&amp;quot;;&lt;br /&gt;
      int goallen = 6;&lt;br /&gt;
      int i,j,k, okay = 0, length[2];&lt;br /&gt;
   &lt;br /&gt;
      strcpy(path, argv[0]);&lt;br /&gt;
      path[strlen(path)-6] = (char) 0;&lt;br /&gt;
         &lt;br /&gt;
      printf(&amp;quot;\nWhat map needs to be repaired?\n\n&amp;quot;);&lt;br /&gt;
      printf(&amp;quot;Enter map name: &amp;quot;);&lt;br /&gt;
      scanf(&amp;quot;%s&amp;quot;,answer);&lt;br /&gt;
      &lt;br /&gt;
      f[0] = fopenpath(path, answer, &amp;quot;r+&amp;quot;);&lt;br /&gt;
      &lt;br /&gt;
      if (f[0] == 0) {&lt;br /&gt;
         printf( &amp;quot;Can&#039;t see any file named \&amp;quot;%s\&amp;quot; in this folder.\n&amp;quot;, answer);&lt;br /&gt;
         quit();&lt;br /&gt;
      }&lt;br /&gt;
   &lt;br /&gt;
      printf(&amp;quot;\nWhat&#039;s your backup?\n\n&amp;quot;);&lt;br /&gt;
      printf(&amp;quot;Enter backup name: &amp;quot;);&lt;br /&gt;
      scanf(&amp;quot;%s&amp;quot;,answer);&lt;br /&gt;
      &lt;br /&gt;
      f[1] = fopenpath(path, answer, &amp;quot;r&amp;quot;);&lt;br /&gt;
      &lt;br /&gt;
      if (f[1] == 0) {&lt;br /&gt;
         printf( &amp;quot;Can&#039;t see any file named \&amp;quot;%s\&amp;quot; in this folder.\n&amp;quot;, answer);&lt;br /&gt;
         fclose(f[0]);&lt;br /&gt;
         quit();&lt;br /&gt;
      }&lt;br /&gt;
   &lt;br /&gt;
      printf(&amp;quot;\nDo you want to repair the map or just the dialogue?\n\n&amp;quot;);&lt;br /&gt;
      printf(&amp;quot;m) Map. If the map crashes when you try to load it in Lugaru.\n&amp;quot;);&lt;br /&gt;
      printf(&amp;quot;d) Dialogue. If the dialogue is not showing up anymore.\n\n&amp;quot;);&lt;br /&gt;
      printf(&amp;quot;Pick one: &amp;quot;);   &lt;br /&gt;
      scanf(&amp;quot;%s&amp;quot;,answer);&lt;br /&gt;
      &lt;br /&gt;
      if (answer[0] != &#039;d&#039;) {&lt;br /&gt;
   //-----------------------------------------------REPAIR MAP&lt;br /&gt;
      &lt;br /&gt;
         for (i=0; i&amp;lt;2; i++) {   &lt;br /&gt;
            do {&lt;br /&gt;
            &lt;br /&gt;
               do x = fgetc( f[i] );&lt;br /&gt;
               while (x != goal[0]);&lt;br /&gt;
   &lt;br /&gt;
               okay = 1;&lt;br /&gt;
               for (k=1; k&amp;lt;goallen; k++)&lt;br /&gt;
                  if (fgetc(f[i]) != goal[k])&lt;br /&gt;
                     okay = 0;&lt;br /&gt;
               SKIP(i,-goallen+1);&lt;br /&gt;
   &lt;br /&gt;
            } while(okay == 0);&lt;br /&gt;
            &lt;br /&gt;
            SKIP(i,-4);&lt;br /&gt;
            length[i] = ftell(f[i]);&lt;br /&gt;
            &lt;br /&gt;
         }&lt;br /&gt;
      &lt;br /&gt;
         if (length[0] != length[1]) {&lt;br /&gt;
            printf(&amp;quot;Looks like the backup file is too old. You lose.\n&amp;quot;);&lt;br /&gt;
            exeunt(f[0],f[1]);&lt;br /&gt;
         } else {&lt;br /&gt;
            char *c;&lt;br /&gt;
            &lt;br /&gt;
            c = (char *)malloc( length[0] * sizeof(char) );&lt;br /&gt;
            fseek(f[0], 0, SEEK_SET);&lt;br /&gt;
            fseek(f[1], 0, SEEK_SET);&lt;br /&gt;
            fread(c, sizeof(char), length[0], f[1]);&lt;br /&gt;
            fwrite(c, sizeof(char), length[0], f[0]);&lt;br /&gt;
            &lt;br /&gt;
            printf(&amp;quot;&amp;gt; The map has been successfully repaired (supposedly).\n&amp;quot;);&lt;br /&gt;
            &lt;br /&gt;
            exeunt(f[0],f[1]);&lt;br /&gt;
         }&lt;br /&gt;
         &lt;br /&gt;
   //-----------------------------------------------REPAIR DIALOGUE&lt;br /&gt;
      } else {&lt;br /&gt;
         &lt;br /&gt;
         fseek(f[1], 11, SEEK_SET);&lt;br /&gt;
         &lt;br /&gt;
         if (fgetc(f[1]) ==  0) {&lt;br /&gt;
            fseek(f[0], 11, SEEK_SET);&lt;br /&gt;
            fputc(0, f[0]);&lt;br /&gt;
         }&lt;br /&gt;
         &lt;br /&gt;
         fseek(f[0], 0x2F, SEEK_SET);&lt;br /&gt;
         fseek(f[1], 0x2F, SEEK_SET);&lt;br /&gt;
         for (i=0x2F; i&amp;lt;0x41; i++)&lt;br /&gt;
            fputc(fgetc(f[1]), f[0]);&lt;br /&gt;
         &lt;br /&gt;
         printf(&amp;quot;&amp;gt; The dialogue has been repaired (supposedly).\n&amp;quot;);&lt;br /&gt;
         &lt;br /&gt;
         exeunt(f[0],f[1]);&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;/div&gt;</summary>
		<author><name>69.181.125.170</name></author>
	</entry>
</feed>