Skip to content

Commit 523d681

Browse files
authored
Merge pull request #82790 from ehughsbaird/appease-clang
Appease clang
2 parents 30dd6a4 + bec3094 commit 523d681

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

src/generic_factory.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@
3636
#include "string_formatter.h"
3737
#include "string_id.h"
3838
#include "units.h"
39-
#include "weighted_list.h"
4039

4140
class quantity;
4241

4342
template <typename E> class enum_bitset;
43+
template<typename T> struct weighted_int_list;
44+
template <typename T, typename W> struct weighted_list;
4445

4546
/**
4647
A generic class to store objects identified by a `string_id`.

src/magic_ter_fur_transform.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
#include "translation.h"
2121
#include "trap.h"
2222
#include "type_id.h"
23-
#include "weighted_list.h"
23+
24+
template<typename T> struct weighted_int_list;
2425

2526
namespace
2627
{

src/mapgen_functions.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "debug.h"
2222
#include "flood_fill.h"
2323
#include "map.h"
24+
#include "mapdata.h"
2425
#include "map_iterator.h"
2526
#include "map_scale_constants.h"
2627
#include "mapgen.h"

src/weighted_list.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ template <typename T, typename W> struct weighted_list {
235235
}
236236

237237
void deserialize( const JsonValue &jv ) {
238+
// this function does things in a way that makes clang-tidy unhappy
239+
// CATA_DO_NOT_CHECK_SERIALIZE
238240
if( jv.test_array() ) {
239241
for( const JsonValue entry : jv.get_array() ) {
240242
if( entry.test_array() ) {
@@ -248,7 +250,7 @@ template <typename T, typename W> struct weighted_list {
248250
}
249251
}
250252
} else {
251-
jv.throw_error( "weighted list must be in format [[a, b], ...]" );
253+
jv.throw_error( "weighted list must be in format [[a, b], ]" );
252254
}
253255
}
254256

@@ -264,7 +266,7 @@ template <typename T, typename W> struct weighted_list {
264266
template <typename T> struct weighted_int_list : public weighted_list<T, int> {
265267

266268
weighted_int_list() = default;
267-
weighted_int_list( int default_weight ) : default_weight( default_weight ) {};
269+
explicit weighted_int_list( int default_weight ) : default_weight( default_weight ) {};
268270
// populate the precalc_array for O(1) lookups
269271
void precalc() {
270272
precalc_array.clear();
@@ -314,7 +316,7 @@ template <typename T> struct weighted_float_list : public weighted_list<T, doubl
314316

315317
// TODO: precalc using alias method
316318
weighted_float_list() = default;
317-
weighted_float_list( int default_weight ) : default_weight( default_weight ) {};
319+
explicit weighted_float_list( int default_weight ) : default_weight( default_weight ) {};
318320

319321
protected:
320322

0 commit comments

Comments
 (0)