From eb993cfd2d514c2dc66360bd4e91b33b5c9175af Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Fri, 28 Oct 2011 16:22:56 +0300 Subject: [PATCH] Begin each line with object*, where * is the number of the object. Databese saving can be considered complete. Next comes the reading --- qcsrc/server/mutators/sandbox.qc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index f06cb3ea4..173faee9b 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -205,11 +205,12 @@ void sandbox_Storage_DatabaseSave() entity head; string fn; - float fh; + float fh, i; fn = strcat("sandbox/storage_", GetMapname(), ".txt"); fh = fopen(fn, FILE_WRITE); - fputs(fh, strcat("// sandbox storage for map ", GetMapname(), ", containing a total of ", ftos(object_count), " objects.\n")); + fputs(fh, strcat("// sandbox storage for map ", GetMapname(), ", containing a total of ", ftos(object_count), " objects\n")); + i = 1; for(head = world; (head = find(head, classname, "object")); ) { // Unfortunately, attached objects cannot be persisted yet. That's because the parent is specified as an entity, @@ -218,8 +219,9 @@ void sandbox_Storage_DatabaseSave() if(head.owner != world) continue; - // a line with the properties of each file - fputs(fh, strcat(sandbox_Storage_Save(head, TRUE), "\n")); + // use a line for each object, listing all properties + fputs(fh, strcat("object", ftos(i), " ", sandbox_Storage_Save(head, TRUE), "\n")); + i++; } fclose(fh); } -- 2.39.2