Author Topic: Balance of bows and bullets  (Read 16903 times)

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8597
    • View Profile
Re: Balance of bows and bullets
« Reply #30 on: August 23, 2016, 12:36:43 pm »
Thanks for the reply, I'll have a look, see what I can use.

As for pointer != 0, I am still using it because I want to backpatch some of my changes to vanilla and they are still in the pre-2011 era.

And the cmath will be fixed too.

Offline Yankes

  • Commander
  • *****
  • Posts: 3194
    • View Profile
Re: Balance of bows and bullets
« Reply #31 on: August 23, 2016, 08:28:13 pm »
The 'nullptr' changes at the end don't actually have any effect whatsoever. I just like to fix that stuff when I see it, for good code hygiene. There was a time when `if (pointer != 0)` was standard practice; but that time is behind us (since nullptr was introduced in the 2011 version of C++).
I prefer too C++11 stuff (other wise I would not switch to it) but there third option: `if (pointer)`.

Quote
There's the one you fixed already in CraftWeapon.cpp (I also changed `floor` to `std::floor`, but it works either way. I suppose there must be a `using std` somewhere else in the code.). The following two files also need the same treatment. (i.e. #include <cmath>)
`floor` is C function and `std::floor` C++ function.

Offline karadoc

  • Colonel
  • ****
  • Posts: 230
    • View Profile
Re: Balance of bows and bullets
« Reply #32 on: August 24, 2016, 10:33:09 am »
`floor` is C function and `std::floor` C++ function.
I did think of that, but I thought that the C function would only be defined in <math.h> (or stdlib.h, or something like that). But I think you're probably right that it was the C version rather than an using std thing.