package uk.co.alynn.games.suchrobot;

import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;

import com.badlogic.gdx.Gdx;

public abstract class NodeSetReader {
    public static NodeSet readNodeSet(String file) throws IOException {
        InputStream rdr = Gdx.files.internal(file).read();
        NodeSet nodes = new NodeSet();

        Scanner scan = new Scanner(rdr);

        while (scan.hasNext()) {
            String command = scan.next();
            if (command.equals("node")) {
                String type = scan.next();
                String name = scan.next();
                int x = scan.nextInt();
                int y = scan.nextInt();
                int reserves = scan.nextInt();
                nodes.addNode(type, name, x, y, reserves);
            } else if (command.equals("conn")) {
                String source = scan.next();
                String dest = scan.next();
                nodes.addConnection(source, dest);
            }
        }

        scan.close();

        nodes.compile();
        return nodes;
    }
}

@@ -142,16 +142,58 @@
 gdx.Gdx;
+%0Aimport com.badlogic.gdx.files.FileHandle;
 %0A%0Apublic
@@ -308,50 +308,249 @@
     
-InputStream rdr = Gdx.files.internal(file)
+FileHandle handle = Gdx.files.external(file);%0A        if (handle.exists()) %7B%0A            System.err.println(%22USING OVERLOADED NODES%22);%0A        %7D else %7B%0A            handle = Gdx.files.internal(file);%0A        %7D%0A        InputStream rdr = handle
 .rea

Add nodes overriding