Commit Graph

34 Commits

Author SHA1 Message Date
Binrui Dong 9fdb7ef59c Run IWYU
* Change _ctype.h and __locale to cctype and clocale

* Change _wctype.h to cwctype in game.cpp

* Change __functional_base to functional

* Remove libcxx internal headers

* Remove UNIX system headers

* Fix clang-tidy error with -nostdinc++
2021-02-06 00:18:41 -05:00
John Bytheway bf910e50e3 Declare lots of things static
Use the new clang-tidy check to convert a bunch of declarations to
static.

In a few cases, there were 'secret' dependencies being exposed without
headers.  Convert those to work via headers instead.
2020-09-05 23:13:04 -04:00
John Bytheway 51ddbd5661 Convert existing uses of auto caught by new check 2020-09-01 06:54:06 -04:00
John Bytheway 2463bc2374 Clear player in throwing_test
Without this, this test run in isolation would fail.

I'm not sure what aspect of the extra clearing code is needed.
2020-08-27 05:31:45 -04:00
Kevin Granade c5ccf0c2c7 IWYU for tests (#42806) 2020-08-09 09:46:57 +03:00
anothersimulacrum 8eaa61fd8f Remove inventory.h from character.h
Convert it to a pimpl<T> to help speed up build times.
2020-08-03 23:25:28 +00:00
Kevin Granade 6d1841ac67 Precompiled Catch2 header (#42453)
* Hoist catch.hpp include to the top of files

* Precompile the catch header in tests
2020-07-29 01:28:26 +03:00
Trioct 0907f8c230 Remove and replace Character::i_rem( int ) uses (#42136) 2020-07-15 08:57:24 +03:00
Kevin Granade cf21972870 Global reference migration part 21 (#41942) 2020-07-08 09:26:50 +03:00
John Bytheway e189957ff2 Run IWYU 20200408 (#39364)
* Helper script to run IWYU

* Run IWYU

* Update deprecated headers

* Run IWYU again

* Re-suppress cxxabi.h

This pragma got accidentally removed because it was deemed to be a
comment attached to a #include.

* Remove extra SDL header includes

* Fix ime.cpp headers

Some tweaks to help IWYU not break this file by messing with
platform-specific stuff not relevant on Linux.

* Update game.h

* Move new point.h includes inside #ifdef

* Re-add platform_win.h to mapsharing.cpp

* Apply suggestions from code review

Co-authored-by: ZhilkinSerg <ZhilkinSerg@users.noreply.github.com>
2020-04-10 12:16:19 +03:00
Kevin Granade 36d9c58ae7 Add test asserting that time to throw is independent of size of thrown item stack size 2020-03-29 00:21:29 +00:00
Kevin Granade 5d392c0d6b Rebalance archery take... 5? (#37241)
* Rebalance archery take... 5?

* Require a ranged weapon to break a damage threshold in order to inflict a critical hit.

* Re-audit strength requirements.

* Apply suggestions from code review

Co-Authored-By: Isaac Freund <ifreund@ifreund.xyz>

* Outline archery balance guidelines.

Co-authored-by: Isaac Freund <ifreund@ifreund.xyz>
2020-03-02 09:39:49 +03:00
John Bytheway 35d93e3460 Set standard_npc position at construction time
This allows tests to avoid calling set_pos on such, which is not safe,
since it assumes the npc is a 'real' one.
2020-01-11 21:27:53 -05:00
Fris0uman 8f0b78ff63 Encapsulate Stamina (#34861) 2019-10-25 23:49:30 -07:00
John Bytheway 4321c025d2 IWYU 20190629 (#31990)
* Add IWYU pragma: keep

* Run IWYU and astyle

* Run IWYU a second time

* Prevent #include <cxxabi.h>

Unclear why IWYU thinks this is needed.  It isn't, and it causes
problems on Visual Studio.
2019-07-01 12:25:53 +03:00
John Bytheway f3049e5eea Fix missing declarations (#30739)
* Fix missing declarations
Mark functions with no prior declarations as static, and remove the
unused ones.
* Move debug_is_safe_string definition
Put it inside !WIN32 since it's only used there.
2019-05-22 11:00:54 -07:00
KorGgenT f42afc59d4 test includes 2019-05-21 10:25:49 -04:00
John Bytheway aff4636618 Run IWYU
Having refactored the type ids into a single header, IWYU is now able to
find many places where other headers can be removed.
2019-05-06 22:47:10 +01:00
John Bytheway 69de386614 Add in-vehicle sanity checks before setpos
After discovering that setpos can break the vehicle cache stuff, add
some sanity checks in various places in the tests where I'm concerned
they might unknowingly be moving a player out of a vehicle.
2019-05-05 10:38:24 +01:00
John Bytheway 5e20851c5b Second pass of IWYU changes
IWYU is not entirely idempotent; these are the changes from a second
pass of running it.
2019-04-22 12:02:41 +01:00
John Bytheway e3e7700aef Apply IWYU changes
This is a run of IWYU followed by astyle.
2019-04-22 11:42:51 +01:00
ZhilkinSerg c0bce91fa1 Used const where appropriate 2019-01-06 23:00:08 +03:00
John Bytheway b0576393e3 Sort headers according to IWYU conventions
A first step towards IWYU support.  Doing the sorting first because it
makes reviewing any additions or removals of headers much simpler.

The IWYU order is:
- Associated headers
- Misc system headers
- C++ STL headers
- Other project headers

The biggest change is moving system headers before project headers (they
are usually afterwards in Cata at the moment.

The associated header for a cpp file is the header file which declares
the functions defined in that cpp file.  Normally that's the one which
shares the same name (up to extension), and if so IWYU figures it out
automatically.

However, in this project there are many corner cases, so we need to use
IWYU pragma: associated to tell it which header (or, in some cases,
which headers) is the associated header.  We are unusual in having
multiple associated headers for some files, which might lead to
discovering some interesting IWYU bugs later, but in theory it is
supported.
2019-01-05 14:03:31 +00:00
John Bytheway 2041e449d0 Fix unused variable warnings 2018-12-06 22:02:17 +00:00
ZhilkinSerg d4f9f135ef Removed unused include directives (tests) 2018-11-07 17:02:14 +03:00
ZhilkinSerg 693784928c Removed unused variable declarations 2018-11-07 15:44:15 +03:00
ZhilkinSerg f8eb2acd05 Optimized includes (tests) 2018-11-07 03:55:47 +03:00
John Bytheway e7d230a214 Make throwing_test slightly more lenient
This test does 500 iterations and requires than the zombie is killed in
none of them.  This fails sometimes (about 1% of the time).  I looked
into a failure and it seemed like it was just the player getting really
lucky with a series of four headshots.

Therefore, changing the test to permit up to 1 zombie death out of 500
iterations.  This should reduce the failure rate to about 1 in 10000.
2018-10-13 17:26:50 +01:00
Kevin Granade 98fa9af846 Merge remote-tracking branch 'origin/pr/25410'
* origin/pr/25410:
  Tiny throwing tweak
  Fix possible invalidated pos index on throw
  Fix failing throwing tests after rebalance
  Rebalance throwing
  Fix test to model correct behavior
  Force player to wield when throwing
  Add passing throwing balance tests
  Templatize statistics class
2018-09-08 23:51:35 +00:00
Alan Brady d57b31763f Tiny throwing tweak
Somehow travis found a way to make this test fail once so I'm tweaking
it down slightly further.
2018-09-07 19:52:26 -07:00
Alan Brady 4219dd4eb8 Fix failing throwing tests after rebalance
Now that intentional changes have been made to fix throwing balance, the
other tests need to be fixed to reflect the new values.
2018-09-06 20:08:22 -07:00
Alan Brady b413850638 Fix test to model correct behavior
Now that there's tests to model the current throwing behavior, we should
modify the test to match the behavior we want.

Here that is a simple matter of changing the range on
test_player_kills_monster from 10 to 1 which will cause it to fail until
the behavior is fixed.
2018-09-06 20:08:22 -07:00
Alan Brady b0132c0e22 Add passing throwing balance tests
This adds a set of tests to model the current behavior of the throwing
skill.
2018-09-06 20:08:22 -07:00
Kevin Granade 405bc8109f Add throwing distance test and tweak throwing to make it pass. 2018-08-03 02:04:31 +00:00