Hendricks266, on 17 October 2017 - 12:35 PM, said:
This stands opposed to every commit Helix or I have made regarding "enumifying" a set of magic constants.
Furthermore, what if you want to search for all code effecting the shotgun at once? The Unix utility for this is called grep, and you'll usually see it used as a verb. You'll have much more luck grepping for SHOTGUN_WEAPON than "2".
This is an interesting discussion, well worth having, and I have an open mind about it. You make a good point about the search, although it's not quite as bad as you make it out to be (it would take several different searches to round up all the shotgun references, but one could certainly do a lot better than searching for "2").
I don't agree that using constants instead of defined labels necessarily leads one down a slippery slope to completely neglecting code style. Empirically that's just false. I also think that coding at the source level may require different standards. For one thing, the source code could potentially be used for a different Build game. In any case, I regard the weapon numbers differently from, say, tile numbers. I would never use "2000" in the place of "PIGCOP", and not just because of readability -- in theory you could move PIGCOP to a different tile and it would more or less work the same (although there would be some issues because there is hardcoded stuff for tile 2000 in the source!). But putting SHOTGUN_WEAPON on a slot other than 2 would require changing a lot of stuff.