Skip to content

Commit

Permalink
Apply migrations to more jmapgens
Browse files Browse the repository at this point in the history
jmapgen_spawn_item and jmapgen_liquid_item did not migrate items passed
to them. This showed up when spawning in a rural gas station with
generic guns, a shotgun and shot for it would be spawned, but not
migrated to the generic guns versions.
Migrate those now.
  • Loading branch information
anothersimulacrum authored and olanti-p committed Jan 12, 2021
1 parent 66ee906 commit 306de96
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/mapgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,9 @@ class jmapgen_liquid_item : public jmapgen_piece
amount( jsi, "amount", 0, 0 )
, liquid( jsi.get_string( "liquid" ) )
, chance( jsi, "chance", 1, 1 ) {
// Itemgroups apply migrations when being loaded, but we need to migrate
// individual items here.
liquid = item_controller->migrate_id( itype_id( liquid ) );
if( !item::type_is_defined( itype_id( liquid ) ) ) {
set_mapgen_defer( jsi, "liquid", "no such item type '" + liquid + "'" );
}
Expand Down Expand Up @@ -1389,6 +1392,9 @@ class jmapgen_spawn_item : public jmapgen_piece
type( jsi.get_string( "item" ) )
, amount( jsi, "amount", 1, 1 )
, chance( jsi, "chance", 100, 100 ) {
// Itemgroups apply migrations when being loaded, but we need to migrate
// individual items here.
type = item_controller->migrate_id( type );
if( !item::type_is_defined( type ) ) {
set_mapgen_defer( jsi, "item", "no such item" );
}
Expand Down

0 comments on commit 306de96

Please sign in to comment.