15
15
16
16
namespace xc
17
17
{
18
+ inline static const string& trim (const string& str)
19
+ {
20
+ static const char * whitespaceDelimiters = " \t\n\r\f\v " ;
21
+
22
+ const_cast <string&>(str).erase (str.find_last_not_of (whitespaceDelimiters) + 1 );
23
+ const_cast <string&>(str).erase (0 , str.find_first_not_of (whitespaceDelimiters));
24
+
25
+ return str;
26
+ }
27
+
18
28
BGSKeyword** g_keyword_is_child_player = nullptr ;
19
29
vector<UInt32> g_facegen_primary_exception_formids =
20
30
{
@@ -57,11 +67,11 @@ namespace xc
57
67
auto it_sep = it->second .find_first_of (' :' );
58
68
if (it_sep != std::string::npos)
59
69
{
60
- plugin_name = it->second .substr (it_sep + 1 );
61
- value = it->second .substr (0 , it_sep);
70
+ plugin_name = trim ( it->second .substr (it_sep + 1 ) );
71
+ value = trim ( it->second .substr (0 , it_sep) );
62
72
}
63
73
else
64
- value = it->second ;
74
+ value = trim ( it->second ) ;
65
75
66
76
if (value.find_first_of (" 0x" ) == 0 )
67
77
formid = strtoul (it->second .c_str () + 2 , &end_ptr, 16 );
@@ -78,10 +88,14 @@ namespace xc
78
88
else if ((index_plugin = dataHandler->GetLoadedLightModIndex (plugin_name.c_str ())) != INVALID_INDEX)
79
89
formid = (formid & (0x00000FFF )) | (index_plugin << 12 ) | 0xFE000000 ;
80
90
// If there is no such thing, then it is a waste of a stupid user's time
81
- else continue ;
91
+ else
92
+ {
93
+ _MESSAGE (" Failed NPC added (no found plugin) \" %s\" (%08X)" , plugin_name, formid);
94
+ continue ;
95
+ }
82
96
}
83
97
84
- // _MESSAGE("Skip NPC added \"%s\" (%08X)", it->first.c_str(), formid);
98
+ _MESSAGE (" Skip NPC added \" %s\" (%08X)" , it->first .c_str (), formid);
85
99
g_facegen_exception_formids.push_back (formid);
86
100
}
87
101
}
0 commit comments