Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/json/npcs/Kindred/NPC_Brigitte_LaCroix.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"gender": "female",
"name_suffix": "Bone Seer",
"class": "NC_BONE_SEER",
"attitude": 7,
"attitude": 0,
"mission": 3,
"chat": "TALK_BONE_SEER",
"faction": "no_faction",
Expand Down
2 changes: 1 addition & 1 deletion data/json/npcs/militia/GM_Militia_Guard.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"id": "MILITIA_GUARD1",
"//": "A member of the Gray Moose Lodge, trying to safe in their isolated location",
"class": "MILITIA_GUARD1",
"attitude": 7,
"attitude": 0,
"name_suffix": "Militia Guard",
"mission": 8,
"chat": "TALK_MILITIA_Guard1",
Expand Down
2 changes: 1 addition & 1 deletion data/mods/DinoMod/NPC/NC_BO_BARONYX.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"gender": "male",
"name_suffix": "CEO",
"class": "NC_SWAMPER",
"attitude": 7,
"attitude": 0,
"mission": 3,
"chat": "TALK_SWAMPER",
"faction": "swamper",
Expand Down
2 changes: 1 addition & 1 deletion data/mods/DinoMod/NPC/NC_Red.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"id": "old_guard_red",
"name_unique": "Red",
"class": "NC_SOLDIER",
"attitude": 7,
"attitude": 0,
"mission": 3,
"chat": "TALK_OLD_GUARD_RED",
"faction": "old_guard",
Expand Down
22 changes: 21 additions & 1 deletion src/npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,26 @@ void npc_template::load( const JsonObject &jsobj, std::string_view src )
if( jsobj.has_string( "temp_suffix" ) ) {
jsobj.read( "temp_suffix", tem.temp_suffix );
}
std::set allowed_attitudes = {
NPCATT_NULL,
NPCATT_TALK,
NPCATT_FOLLOW,
NPCATT_LEAD,
NPCATT_WAIT,
NPCATT_MUG,
NPCATT_WAIT_FOR_LEAVE,
NPCATT_KILL,
NPCATT_FLEE,
NPCATT_HEAL
};
const npc_attitude to_set = static_cast<npc_attitude>( jsobj.get_int( "attitude" ) );
if( allowed_attitudes.count( to_set ) > 0 ) {
guy.set_attitude( to_set );
} else {
debugmsg( "NPC class %s has invalid attitude enum %d", guy.idz.c_str(),
static_cast<int>( to_set ) );
guy.set_attitude( NPCATT_NULL );
}
guy.set_attitude( static_cast<npc_attitude>( jsobj.get_int( "attitude" ) ) );
guy.mission = static_cast<npc_mission>( jsobj.get_int( "mission" ) );
guy.chatbin.first_topic = jsobj.get_string( "chat" );
Expand Down Expand Up @@ -3162,7 +3182,7 @@ std::string npc_attitude_name( npc_attitude att )
case NPCATT_LEGACY_4:
case NPCATT_LEGACY_5:
case NPCATT_LEGACY_6:
return _( "NPC Legacy Attitude" );
return _( "ERROR! Legacy Attitude" );
default:
break;
}
Expand Down
Loading