From 0edf0016d969800e29a82d41a779dd86e9c91758 Mon Sep 17 00:00:00 2001 From: Misa Date: Tue, 7 Mar 2023 23:05:43 -0800 Subject: [PATCH] `const&`-ify `getcolorfromname` and `getcrewmanfromname` This brings these functions into conforming code style and is a small performance optimization. --- desktop_version/src/Script.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index a58b1735..d8206779 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -131,7 +131,7 @@ void scriptclass::tokenize( const std::string& t ) } } -static int getcolorfromname(std::string name) +static int getcolorfromname(const std::string& name) { if (name == "player") return CYAN; else if (name == "cyan") return CYAN; @@ -149,7 +149,7 @@ static int getcolorfromname(std::string name) return color; // Last effort to give a valid color, maybe they just input the color? } -static int getcrewmanfromname(std::string name) +static int getcrewmanfromname(const std::string& name) { if (name == "player") return obj.getplayer(); // Return the player int color = getcolorfromname(name); // Maybe they passed in a crewmate name, or an id?