Skip to content

Commit

Permalink
Migrate vehicle ammo spawns
Browse files Browse the repository at this point in the history
These weren't migrated, and some hacks existed to ease this in generic
guns.
Remove those hacks, and migrate ammo spawns in vehicle turrets.

See
CleverRaven#36839 (comment)
for more details on why these hacks existed.
  • Loading branch information
anothersimulacrum committed Feb 13, 2021
1 parent cbcfab1 commit 1e68829
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 232 deletions.

This file was deleted.

This file was deleted.

15 changes: 15 additions & 0 deletions src/veh_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "game_constants.h"
#include "init.h"
#include "item.h"
#include "item_factory.h"
#include "item_group.h"
#include "item_pocket.h"
#include "itype.h"
Expand Down Expand Up @@ -1234,6 +1235,20 @@ void vehicle_prototype::finalize()
}
}

std::vector<itype_id> migrated;
for( auto it = pt.ammo_types.begin(); it != pt.ammo_types.end(); ) {
if( item_controller->migrate_id( *it ) != *it ) {
migrated.push_back( item_controller->migrate_id( *it ) );
it = pt.ammo_types.erase( it );
} else {
++it;
}
}

for( const itype_id &migrant : migrated ) {
pt.ammo_types.insert( migrant );
}

if( type_can_contain( *base, pt.fuel ) || base->magazine ) {
if( !item::type_is_defined( pt.fuel ) ) {
debugmsg( "init_vehicles: tank %s specified invalid fuel in %s",
Expand Down

0 comments on commit 1e68829

Please sign in to comment.