Skip to content

Commit 950b87d

Browse files
committed
Give robot a volume
This is a bit odd, but as far as I can tell volume was never initialized (UB), but had a non-zero value and so did not trigger any issues with the test. Now that optional always initializes it (to 0), it produced issues. Just assign it to 100 L.
1 parent 6c4cbe1 commit 950b87d

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

data/json/monsters/defense_bot.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@
289289
"diff": 100,
290290
"hp": 50,
291291
"speed": 140,
292+
"volume": "100 L",
292293
"material": [ "steel" ],
293294
"symbol": "@",
294295
"color": "red",

src/item.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7480,7 +7480,7 @@ units::volume item::corpse_volume( const mtype *corpse ) const
74807480
if( corpse_volume > 0_ml ) {
74817481
return corpse_volume;
74827482
}
7483-
debugmsg( "invalid monster volume for corpse" );
7483+
debugmsg( "invalid monster volume for corpse of %s", corpse->id.str() );
74847484
return 0_ml;
74857485
}
74867486

tests/item_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ TEST_CASE( "item_length_sanity_check", "[item]" )
332332
TEST_CASE( "corpse_length_sanity_check", "[item]" )
333333
{
334334
for( const mtype &type : MonsterGenerator::generator().get_all_mtypes() ) {
335+
INFO( type.id.str() )
335336
const item sample = item::make_corpse( type.id );
336337
assert_minimum_length_to_volume_ratio( sample );
337338
}

0 commit comments

Comments
 (0)