From: Mario Date: Sat, 11 Jun 2016 04:20:44 +0000 (+1000) Subject: Prevent save and fill commands from working when not in edit mode X-Git-Tag: xonotic-v0.8.2~832 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4ca91b6191140abb8927dfb0b2e2541d6d5a0f84;p=xonotic%2Fxonotic-data.pk3dir.git Prevent save and fill commands from working when not in edit mode --- diff --git a/qcsrc/common/minigames/minigame/bd.qc b/qcsrc/common/minigames/minigame/bd.qc index 84120e1b0..976c3b707 100644 --- a/qcsrc/common/minigames/minigame/bd.qc +++ b/qcsrc/common/minigames/minigame/bd.qc @@ -320,6 +320,14 @@ void bd_unfill_recurse(entity minigame, entity player, int thetype, int letter, void bd_do_fill(entity minigame, entity player, string dir, string thetile) { +#ifdef SVQC + if(!player.minigame_players.bd_canedit) + { + sprint(player.minigame_players, "You're not allowed to edit levels, sorry!\n"); + return; + } +#endif + if(minigame.minigame_flags & BD_TURN_EDIT) { int thetype = stof(thetile); @@ -561,8 +569,16 @@ void bd_load_level(entity minigame) fclose(file_get); } -void bd_close_editor(entity minigame) +void bd_close_editor(entity minigame, entity player) { +#ifdef SVQC + if(!player.minigame_players.bd_canedit) + { + sprint(player.minigame_players, "You're not allowed to edit levels, sorry!\n"); + return; + } +#endif + entity dozer = bd_find_dozer(minigame); if(!dozer) { @@ -637,7 +653,7 @@ int bd_server_event(entity minigame, string event, ...) bd_activate_editor(minigame,...(0,entity)); return true; case "save": - bd_close_editor(minigame); + bd_close_editor(minigame,...(0,entity)); return true; case "fill": bd_do_fill(minigame, ...(0,entity), ((...(1,int)) >= 2 ? argv(1) : string_null), ((...(1,int)) >= 3 ? argv(2) : string_null));