From: Mircea Kitsune Date: Fri, 28 Oct 2011 19:49:02 +0000 (+0300) Subject: Attempt to persist attached objects in storage and clipboard, part 1: Store child... X-Git-Tag: xonotic-v0.6.0~35^2~18^2~68 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=04c66b0c9cbe036efc425a60b1dbfa6e688e9a23;p=xonotic%2Fxonotic-data.pk3dir.git Attempt to persist attached objects in storage and clipboard, part 1: Store child objects in the same line as their parent object. Objects are separated by the ; symbol. --- diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index 2495fdb98..a776613ef 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -150,12 +150,10 @@ void sandbox_ObjectRemove(entity e) object_count -= 1; } -string sandbox_ObjectPort_Save(entity e, float database) +string sandbox_ObjectPort_Save_string(entity e, float database) { - // save object properties string s; - - s = strcat(e.model, " "); + s = strcat(s, e.model, " "); s = strcat(s, ftos(e.skin), " "); s = strcat(s, ftos(e.alpha), " "); s = strcat(s, sprintf("\"%.9v\"", e.colormod), " "); @@ -171,6 +169,22 @@ string sandbox_ObjectPort_Save(entity e, float database) s = strcat(s, sprintf("\"%.9v\"", e.origin), " "); s = strcat(s, sprintf("\"%.9v\"", e.angles), " "); } + s = strcat(s, "; "); + return s; +} +string sandbox_ObjectPort_Save(entity e, float database) +{ + // save object properties + string s; + entity head; + + // first set the properties of the main object, then those of each child + s = sandbox_ObjectPort_Save_string(e, database); + for(head = world; (head = find(head, classname, "object")); ) + { + if(head.owner == e) + s = strcat(s, sandbox_ObjectPort_Save_string(head, database)); + } return s; }