From e91485c50c1d3dd445372e4079c574ce1bcb3478 Mon Sep 17 00:00:00 2001 From: Major Cooke Date: Sun, 25 Jul 2021 15:28:15 -0500 Subject: [PATCH] Added GetString/Int/Double/Object(UI) functions to Service. - These functions serve to deprecate (UI)Get and allow for reducing string translations, as well as passing in objects for maximum flexibility. --- wadsrc/static/zscript/engine/service.zs | 46 +++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/wadsrc/static/zscript/engine/service.zs b/wadsrc/static/zscript/engine/service.zs index 16a731f1f4..5f834a809c 100644 --- a/wadsrc/static/zscript/engine/service.zs +++ b/wadsrc/static/zscript/engine/service.zs @@ -3,15 +3,57 @@ */ class Service abstract { - virtual play String Get(String request) + deprecated("4.6.1", "Use GetString() instead") virtual play String Get(String request) { return ""; } - virtual ui String UiGet(String request) + deprecated("4.6.1", "Use GetStringUI() instead") virtual ui String UiGet(String request) { return ""; } + + // Play variants + virtual play String GetString(String request, string stringArg = "", int intArg = 0, double doubleArg = 0, Object objectArg = null) + { + return ""; + } + + virtual play int GetInt(String request, string stringArg = "", int intArg = 0, double doubleArg = 0, Object objectArg = null) + { + return 0; + } + + virtual play double GetDouble(String request, string stringArg = "", int intArg = 0, double doubleArg = 0, Object objectArg = null) + { + return 0.0; + } + + virtual play Object GetObject(String request, string stringArg = "", int intArg = 0, double doubleArg = 0, Object objectArg = null) + { + return null; + } + + // UI variants + virtual ui String GetStringUI(String request, string stringArg = "", int intArg = 0, double doubleArg = 0, Object objectArg = null) + { + return ""; + } + + virtual ui int GetIntUI(String request, string stringArg = "", int intArg = 0, double doubleArg = 0, Object objectArg = null) + { + return 0; + } + + virtual ui double GetDoubleUI(String request, string stringArg = "", int intArg = 0, double doubleArg = 0, Object objectArg = null) + { + return 0.0; + } + + virtual ui Object GetObjectUI(String request, string stringArg = "", int intArg = 0, double doubleArg = 0, Object objectArg = null) + { + return null; + } } /**