Open RedMisao opened 5 days ago
There are two duplicates so far:
Search " "id": "(took_antihistamine|star_vampire_blood_drink)"" (4 hits in 2 files of 5449 searched) [RegEx]
C:\Projects\Cataclysm-DDA\data\json\effects.json (3 hits)
Line 3384: "id": "took_antihistamine",
Line 4979: "id": "star_vampire_blood_drink",
Line 4996: "id": "star_vampire_blood_drink",
C:\Projects\Cataclysm-DDA\data\json\obsoletion_and_migration_0.I\obsolete_effect.json (1 hit)
Line 72: "id": "took_antihistamine",
We can at least report duplicates to the debug.log
:
diff --git a/src/effect.cpp b/src/effect.cpp
index 8c8d7eba02..1686ba70ee 100644
--- a/src/effect.cpp
+++ b/src/effect.cpp
@@ -1510,6 +1510,9 @@ void load_effect_type( const JsonObject &jo, const std::string_view src )
{
effect_type new_etype;
new_etype.id = efftype_id( jo.get_string( "id" ) );
+ if( effect_types.find( new_etype.id ) != effect_types.end() ) {
+ DebugLog( D_WARNING, DC_ALL ) << "Error duplicate effect id found:" << new_etype.id.str();
+ }
if( jo.has_member( "name" ) ) {
for( const JsonValue entry : jo.get_array( "name" ) ) {
Describe the bug
Title. In other words, two effects with the same ID aren't detected by the game. In other words, it doesn't prevent loading, like it happens for other JSON
type
s with the same ID.Attach save file
N/A, this should cause an error and it is not, so it's undetectable unless you're looking for it in the repo
Steps to reproduce
Either load this as a mod, or copy and paste the two effects somewhere in data\json\effects.json
Expected behavior
I expected the game not loading, with the usual: "Error:
id
(structtype
) has two definitions from the same source (mod
)!"Screenshots
N/A, the game seems to not detect it.
Versions and configuration
Additional context
Adding names and descriptions makes no difference.
Could be related to #51456, seems
effect_type
are handled different from other objects?