From efdabd888010c25ee0769b3d651d12b7501d4916 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Sun, 7 Jun 2020 15:54:07 +0100 Subject: [PATCH] Make suggested changes --- src/openrct2/world/SpriteBase.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/openrct2/world/SpriteBase.h b/src/openrct2/world/SpriteBase.h index edf2a4af1c..ced5d89fbf 100644 --- a/src/openrct2/world/SpriteBase.h +++ b/src/openrct2/world/SpriteBase.h @@ -36,12 +36,11 @@ struct SpriteBase template bool Is() const; template T* As() { - T* result = nullptr; - if (Is()) - { - result = reinterpret_cast(this); - } - return result; + return Is() ? reinterpret_cast(this) : nullptr; + } + template const T* As() const + { + return Is() ? reinterpret_cast(this) : nullptr; } };