|
8 | 8 | #include <unordered_set>
|
9 | 9 | #include <utility>
|
10 | 10 |
|
11 |
| -#include "assign.h" |
12 | 11 | #include "cached_options.h"
|
13 | 12 | #include "calendar.h"
|
14 | 13 | #include "cata_utility.h"
|
|
42 | 41 |
|
43 | 42 | struct itype;
|
44 | 43 |
|
| 44 | +static const harvest_id harvest_list_human( "human" ); |
| 45 | + |
45 | 46 | static const material_id material_flesh( "flesh" );
|
46 | 47 |
|
47 | 48 | static const speed_description_id speed_description_DEFAULT( "DEFAULT" );
|
@@ -961,7 +962,7 @@ void mtype::load( const JsonObject &jo, const std::string_view src )
|
961 | 962 | weighted_string_id_reader<efftype_id, int> { 1 } );
|
962 | 963 |
|
963 | 964 | optional( jo, was_loaded, "starting_ammo", starting_ammo );
|
964 |
| - assign( jo, "luminance", luminance, true ); |
| 965 | + optional( jo, was_loaded, "luminance", luminance, 0 ); |
965 | 966 | optional( jo, was_loaded, "revert_to_itype", revert_to_itype, itype_id() );
|
966 | 967 | optional( jo, was_loaded, "broken_itype", broken_itype, itype_id() );
|
967 | 968 | optional( jo, was_loaded, "mech_weapon", mech_weapon, itype_id() );
|
@@ -993,9 +994,8 @@ void mtype::load( const JsonObject &jo, const std::string_view src )
|
993 | 994 | "death_drops for mtype " + id.str() );
|
994 | 995 | }
|
995 | 996 |
|
996 |
| - assign( jo, "harvest", harvest ); |
997 |
| - // FIXME: assign doesn't trigger issues that optional does??? |
998 |
| - //optional( jo, was_loaded, "harvest", harvest, harvest_id::NULL_ID() ); |
| 997 | + // FIXME: there's code to check if harvest is null, which will never trigger as it defaults to human |
| 998 | + optional( jo, was_loaded, "harvest", harvest, harvest_list_human ); |
999 | 999 |
|
1000 | 1000 | optional( jo, was_loaded, "dissect", dissect );
|
1001 | 1001 |
|
@@ -1311,12 +1311,10 @@ mtype_special_attack MonsterGenerator::create_actor( const JsonObject &obj,
|
1311 | 1311 |
|
1312 | 1312 | void mattack_actor::load( const JsonObject &jo, const std::string &src )
|
1313 | 1313 | {
|
1314 |
| - // Legacy support |
1315 |
| - if( !jo.has_string( "id" ) ) { |
1316 |
| - id = jo.get_string( "type" ); |
| 1314 | + if( jo.has_string( "id" ) ) { |
| 1315 | + mandatory( jo, false, "id", id ); |
1317 | 1316 | } else {
|
1318 |
| - // Loading ids can't be strict at the moment, since it has to match the stored version |
1319 |
| - assign( jo, "id", id, false ); |
| 1317 | + mandatory( jo, false, "type", id ); |
1320 | 1318 | }
|
1321 | 1319 |
|
1322 | 1320 | mandatory( jo, was_loaded, "cooldown", cooldown, dbl_or_var_reader{} );
|
|
0 commit comments