# Use of macros in C:DDA code base

**URL:** <https://discourse.cataclysmdda.org/t/use-of-macros-in-c-dda-code-base/13874>\
**Category:** The Drawing Board\
**Created:** [June 17, 2017, 1:21pm UTC](https://discourse.cataclysmdda.org/t/use-of-macros-in-c-dda-code-base/13874 "2017-06-17T13:21:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaNv](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/manv/32/1285_2.png) [@MaNv](https://discourse.cataclysmdda.org/u/MaNv)\
**Post date:** [June 17, 2017, 1:21pm UTC](https://discourse.cataclysmdda.org/t/use-of-macros-in-c-dda-code-base/13874/1 "2017-06-17T13:21:19Z")

</div>

There are uses of preprocessor macros in C:DDA code base, (action.cpp, Line no: 557 is one such instance) which can be easily replaced with templates. I was wondering if there was some rationale behind its usage.  
Its only recently I was introduced to this awesome game 🙂 and came up with this while searching for how the map generation is implemented, so I don’t know if this is the right place to ask this.

---

<div class="post-metadata">

**Author:** ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)\
**Post date:** [June 17, 2017, 8:19pm UTC](https://discourse.cataclysmdda.org/t/use-of-macros-in-c-dda-code-base/13874/2 "2017-06-17T20:19:43Z")

</div>

I glanced at the macro in question, it seems straightforward. I’m not enough of an anti-macro zealot to want them replaced with templates just for existing.

---

<div class="post-metadata">

**Author:** ![MaNv](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/manv/32/1285_2.png) [@MaNv](https://discourse.cataclysmdda.org/u/MaNv)\
**Post date:** [June 18, 2017, 8:39pm UTC](https://discourse.cataclysmdda.org/t/use-of-macros-in-c-dda-code-base/13874/3 "2017-06-18T20:39:16Z")

</div>

Thanks for replying :), I guess me being hit hard has indeed made me a bit paranoid against macros. Well I am not that good at C++ but as far as I know refactoring them is almost always the best choice, I would be happy to submit a pr if its fine.
