X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ffileio.cpp;h=7f1a90a8d08b7e7c634545c0fb78b34dbc1b94c8;hb=86ad64f2288cf50ae9832116ef37c433556355c4;hp=1002dca87fecf22b79cbb2883253e9660fe6c34b;hpb=e78daf62eb771ee29a59035d16cf63c1e6ebe144;p=architektonas diff --git a/src/fileio.cpp b/src/fileio.cpp index 1002dca..7f1a90a 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -126,11 +126,7 @@ enum ObjectTypeFile { OTFContainer, OTFContainerEnd, OTFObject, OTFEndOfFile }; Container, otherwise it enumerates all objects within itself. */ fprintf(file, "ARCHITEKTONAS DRAWING V1.1\n"); -#if 0 - object->Enumerate(file); -#else WriteObjectToFile(file, (Object *)c); -#endif fprintf(file, "END\n"); return true; } @@ -142,66 +138,13 @@ enum ObjectTypeFile { OTFContainer, OTFContainerEnd, OTFObject, OTFEndOfFile }; fscanf(file, "ARCHITEKTONAS DRAWING V%f", &version); -//printf("Load: version = %f\n", version); -// if (version != 1.0) -// return false; - - if (version == 1.0) + if (version == 1.0f) return LoadVersion1_0(file, drawing); - else if (version == 1.1) + else if (version == 1.1f) return LoadVersion1_1(file, drawing); +//printf("LoadAtnsFile: Could not locate version! (version=%f)\n", version); return false; - /* Approach: read each object in the file, one by one. If the object is a - Container, add objects to it until an "endContainer" marker is found. - This will require a stack to maintain the current Container. */ - -#if 0 - std::vector containerStack; - Container * currentTopContainer = drawing;//new Container(Vector(0, 0)); - Object * object; -// ObjectType objectType; - int objectType; - - while (!feof(file)) - { - if (FileIO::GetObjectFromFile(file, currentTopContainer, &object, &objectType) == false) - return false; - - // object->type down below can be replaced with objType. - // Above could be: bool FileIO::GetObjectFromFile(FILE *, Object *, - // ObjectType *); where the return value tells if it's a valid object, - // Object * returns the reconstructed object and ObjectType * returns - // the object type. - - if (objectType == OTFEndOfFile) - { -//printf("Load: container size = %li\n", drawing->objects.size()); - return true; - } - else if (objectType == OTFContainer) - { - containerStack.push_back(currentTopContainer); - currentTopContainer = new Container(Vector(0, 0), currentTopContainer); - } - else if (objectType == OTFContainerEnd) - { - Container * containerToAdd = currentTopContainer; - currentTopContainer = containerStack.back(); - containerStack.pop_back(); - currentTopContainer->Add(containerToAdd); - } - else - { - currentTopContainer->Add(object); -//printf("Load: Adding object. Container size = %li (%li)\n", drawing->objects.size(), currentTopContainer->objects.size()); - } - } - - return false; -#else - return false; -#endif }