]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Allow prvm_edictset to return the current value (#228) master
authorJames O'Neill <hemebond@gmail.com>
Sat, 26 Apr 2025 16:32:57 +0000 (01:32 +0900)
committerGitHub <noreply@github.com>
Sat, 26 Apr 2025 16:32:57 +0000 (12:32 -0400)
Implement @Baker7's suggestion by updating `prvm_edictset` so that when
no new value is provided it will instead call `prvm_edictget`, returning
the current value. Resolves #213

prvm_edict.c

index 5f96e19c792fd929fb29e57910ffe58f7c1415b5..4bf008d6249224058c2abe553c5a49d2f404b492 100644 (file)
@@ -1252,7 +1252,13 @@ static void PRVM_ED_EdictSet_f(cmd_state_t *cmd)
        prvm_edict_t *ed;
        mdef_t *key;
 
-       if(Cmd_Argc(cmd) != 5)
+       if (Cmd_Argc(cmd) == 4) {
+               // Baker: Turn into prvm_edictget when no value(s) provided
+               PRVM_ED_EdictGet_f(cmd);
+               return;
+       }
+
+       if (Cmd_Argc(cmd) != 5)
        {
                Con_Print("prvm_edictset <program name> <edict number> <field> <value>\n");
                return;