From b2890a33348ece7c47a957dd01eabcdeba306a70 Mon Sep 17 00:00:00 2001 From: ac-stef Date: Fri, 9 Jun 2017 21:52:55 +0200 Subject: [PATCH] allow more edit commands in multiplayer (editentity, edittextureslot, editmapmodelslot, editmapsoundslot) the commands are still not allowed to change anything in coop, but information retrieval is ok --- source/src/audiomanager.cpp | 4 ++-- source/src/rendermodel.cpp | 4 ++-- source/src/texture.cpp | 4 ++-- source/src/world.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/src/audiomanager.cpp b/source/src/audiomanager.cpp index ad305771..9fb94b59 100644 --- a/source/src/audiomanager.cpp +++ b/source/src/audiomanager.cpp @@ -944,12 +944,12 @@ COMMAND(deletemapsoundslot, "is"); void editmapsoundslot(int *n, char *name, char *maxuses) // edit slot parameters != "" { - EDITMP("editmapsoundslot"); + EDIT("editmapsoundslot"); string res = ""; if(mapconfigdata.mapsoundlines.inrange(*n)) { mapsoundline &msl = mapconfigdata.mapsoundlines[*n]; - if(*name || *maxuses) + if((*name || *maxuses) && !multiplayer("editmapsoundslot")) { // change attributes if(*maxuses) msl.maxuses = strtol(maxuses, NULL, 0); if(*name) copystring(msl.name, strncmp(name, mapsoundfinalpath, mapsoundfinalpath_n) ? name : name + mapsoundfinalpath_n); diff --git a/source/src/rendermodel.cpp b/source/src/rendermodel.cpp index 1f2471ff..958e6738 100644 --- a/source/src/rendermodel.cpp +++ b/source/src/rendermodel.cpp @@ -197,11 +197,11 @@ COMMAND(deletemapmodelslot, "is"); void editmapmodelslot(int *n, char *rad, char *h, char *zoff, char *scale, char *name) // edit slot parameters != "" { string res = ""; - EDITMP("editmapmodelslot"); + EDIT("editmapmodelslot"); if(mapmodels.inrange(*n)) { mapmodelinfo &mmi = mapmodels[*n]; - if(*rad || *h || *zoff || *scale || *name) + if((*rad || *h || *zoff || *scale || *name) && !multiplayer("editmapmodelslot")) { // change attributes if(*rad) mmi.rad = strtol(rad, NULL, 0); if(*h) mmi.h = strtol(h, NULL, 0); diff --git a/source/src/texture.cpp b/source/src/texture.cpp index 9d9a8455..47ef2d1d 100644 --- a/source/src/texture.cpp +++ b/source/src/texture.cpp @@ -1078,11 +1078,11 @@ COMMAND(deletetextureslot, "iss"); void edittextureslot(int *n, char *scale, char *name) // edit slot parameters != "" { string res = ""; - EDITMP("edittextureslot"); + EDIT("edittextureslot"); if(slots.inrange(*n)) { Slot &s = slots[*n]; - if(*scale || *name) + if((*scale || *name) && !multiplayer("edittextureslot")) { // change attributes float newscale = atof(scale); _texture(s, *scale ? &newscale : NULL, *name ? name : NULL); diff --git a/source/src/world.cpp b/source/src/world.cpp index 40af53f2..d0a00ec8 100644 --- a/source/src/world.cpp +++ b/source/src/world.cpp @@ -485,13 +485,13 @@ void editentity(char **args, int numargs) // index x y z a1 a2 a3 a4 ... if(numargs > 0) { int n = ATOI(args[0]); - EDITMP("editentity"); + EDIT("editentity"); if(!*args[0] || !ents.inrange(n)) return; entity &e = ents[n]; bool edit = false; for(int i = 1; i < numargs; i++) if(*args[i]) edit = true; // only arguments other than empty strings can edit anything - otherwise we're just browsing int t = e.type < MAXENTTYPES ? e.type : NOTUSED; - if(edit) + if((edit) && !multiplayer("editentity")) { if(e.type == SOUND) { // disable sound /before/ changing it