#include #include #include #define G6_LONGEST_ROW 200 #define G6_TOX_NUM 8 /* paramaeters: pai_num = player number + ai number returns: 1 on success*/ int gamefile_copy(FILE *pgf,FILE *psf,int pnum,int aipp) { char s[G6_LONGEST_ROW+1]; rewind(pgf); while (fgets(s,G6_LONGEST_ROW,pgf)) { if (s[0]=='[' && strncmp("[map]",s,5)==0) break; if (strncmp("min_players",s,11)==0) fprintf(psf,"min_players=%d\n",pnum); else if (strncmp("max_players",s,11)==0) fprintf(psf,"max_players=%d\n",pnum*(1+aipp)); else if (strncmp("aifill",s,6)==0) fprintf(psf,"aifill=%d\n",pnum*(1+aipp)); else if (strncmp("server_state",s,12)==0) fprintf(psf,"server_state=0\n"); else if (strncmp("nplayers",s,8)==0) fprintf(psf,"nplayers=0\n"); else if (strncmp("options",s,7)==0) fprintf(psf,"options=\"1.7 startoptions spacerace rulesets startpos riversoverlay\"\n"); else fprintf(psf,"%s",s); } return 1; } int mapsettings_copy(FILE *pmf,FILE *psf,char *s,int pnum) { /* "width" MUST be the first string !!! , see later */ char tox[G6_TOX_NUM][15]={ "width","ritches","swampsize","deserts", "riverlength","mountains","forestsize","huts" }; int toxlen[G6_TOX_NUM]; int i,setted,width; for (i=0;i