09.02.2013, 14:17
Quote:
I have this
Code:
new File:f = fopen("Nodes.txt",io_read); print("2"); new str[256]; new indexx; while(fread(f,str)){ new Float:x,Float:y,Float:z; sscanf(str, "p<|>fff", x, y, z); //sscanf plugin :) // printf("%f %f %f",x, y, z); SavedNodeIDS[indexx] = AddNode(x, y, z); if(SavedNodeIDS[indexx] == (-1)) { print("ERROR"); ++Errors[0]; } indexx++; } fclose(f); print("4"); //connect nodes for(new index = 1; index < MY_NODES; ++index) { if(SavedNodeIDS[index-1] != (-1) && SavedNodeIDS[index] != (-1)) { if(ConnectNodes(SavedNodeIDS[index-1],SavedNodeIDS[index]) < 0) { print("ERROR 2"); ++Errors[1]; } } } print("creating graph !!!!!!!!!!!"); //rebuild graph if(RebuildGraph())//server freezes until graph is rebuild, should take a few miliseconds { if(Errors[0] || Errors[1]) { printf("Graph rebuilded succesfully but failed adding %d nodes and failed to create %d connections.",Errors[0],Errors[1]); } else { printf("Graph rebuilded succesfully without errors."); } } else { if(Errors[0] || Errors[1]) { printf("Graph rebuild FAILED, %d nodes could not be added and creating %d connections failed.",Errors[0],Errors[1]); } else { printf("Graph rebuild FAILED but all nodes were added succesfully."); } } In Nodes.txt i have Code:
-892.458129|1273.021728|35.418518 -896.376647|1263.579833|34.825996 -893.042053|1248.275878|34.745880 -887.429809|1233.633300|35.088066 -883.389709|1216.690673|33.656955 -884.337829|1196.213745|31.959152 -890.417846|1175.161621|30.537527 -886.196411|1151.811767|28.928644 -879.719177|1127.689697|27.161552 |