From dc8525dfd2f14a95ebf45dcfe3c0c54fee3df6c4 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Tue, 26 Jul 2016 13:12:57 -0600 Subject: [PATCH] light: entities: refactor EntDict_VectorForKey --- include/light/entities.hh | 2 +- light/entities.cc | 6 +++--- light/light.cc | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/light/entities.hh b/include/light/entities.hh index fac753d4..9a106169 100644 --- a/include/light/entities.hh +++ b/include/light/entities.hh @@ -152,7 +152,7 @@ const std::vector& GetLights(); const entdict_t *FindEntDictWithKeyPair(const std::string &key, const std::string &value); const char *ValueForKey(const entity_t *ent, const char *key); -void GetVectorForKey(const entdict_t *ent, const char *key, vec3_t vec); +void EntDict_VectorForKey(const entdict_t &ent, const std::string &key, vec3_t vec); std::string EntDict_StringForKey(const entdict_t &dict, const std::string key); float EntDict_FloatForKey(const entdict_t &dict, const std::string key); diff --git a/light/entities.cc b/light/entities.cc index 1ebb8e0e..368ffacb 100644 --- a/light/entities.cc +++ b/light/entities.cc @@ -143,7 +143,7 @@ SetupSpotlights(void) for (entity_t &entity : all_lights) { if (entity.targetent) { vec3_t targetOrigin; - GetVectorForKey(entity.targetent, "origin", targetOrigin); + EntDict_VectorForKey(*entity.targetent, "origin", targetOrigin); VectorSubtract(targetOrigin, *entity.origin.vec3Value(), entity.spotvec); VectorNormalize(entity.spotvec); entity.spotlight = true; @@ -1158,9 +1158,9 @@ const entdict_t *FindEntDictWithKeyPair(const std::string &key, const std::strin } void -GetVectorForKey(const entdict_t *ent, const char *key, vec3_t vec) +EntDict_VectorForKey(const entdict_t &ent, const std::string &key, vec3_t vec) { - std::string value = EntDict_StringForKey(*ent, key); + std::string value = EntDict_StringForKey(ent, key); sscanf(value.c_str(), "%f %f %f", &vec[0], &vec[1], &vec[2]); } diff --git a/light/light.cc b/light/light.cc index 57f1bf8b..4ca40160 100644 --- a/light/light.cc +++ b/light/light.cc @@ -401,7 +401,7 @@ FindModelInfo(const bsp2_t *bsp, const char *lmscaleoverride) /* Set up the offset for rotate_* entities */ if (EntDict_StringForKey(*entdict, "classname").find("rotate_") == 0) { - GetVectorForKey(entdict, "origin", info.offset); + EntDict_VectorForKey(*entdict, "origin", info.offset); } /* Enable .lit if needed */