From: Mircea Kitsune Date: Fri, 28 Oct 2011 13:22:56 +0000 (+0300) Subject: Begin each line with object*, where * is the number of the object. Databese saving... X-Git-Tag: xonotic-v0.6.0~35^2~18^2~82 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=eb993cfd2d514c2dc66360bd4e91b33b5c9175af;p=xonotic%2Fxonotic-data.pk3dir.git Begin each line with object*, where * is the number of the object. Databese saving can be considered complete. Next comes the reading --- 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); }