Skip to content
Permalink
Browse files
Editor&Engine: Added new "default-content" field for block-*.ini
This field should replace old "default-npc-content" field that still use the SMBX format of data (0 - nothing, 1~999 - coins, 1000+id - NPC-ID with 1000 added). The "default-content" field will use the internal Moondust format (0 - nothing, negative - coins, positive - NPC-ID) instead. The "default-npc-content" field will still work, but will be deprecated. If two "default-npc-content" and "default-content" defined, the "default-content" will be used and "default-npc-content" will be ignored.
  • Loading branch information
Wohlstand committed May 21, 2021
1 parent 63cd6da commit b41664933a081e9e4406f231e1273cd3b4f0ad73
Showing 1 changed file with 20 additions and 4 deletions.
@@ -267,10 +267,26 @@ bool BlockSetup::parse(IniProcessing *setup,
default_slippery = (iTmp >= 0);
default_slippery_value = (iTmp >= 0) ? bool(iTmp) : false;

setup->read("default-npc-content", default_content_raw, pMerge(default_content_raw, -1));
iTmp = default_content_raw;
default_content = (iTmp >= 0);
default_content_value = (iTmp >= 0) ? (iTmp < 1000 ? iTmp * -1 : iTmp - 1000) : 0;
if(setup->hasKey("default-content")) // New format
{
setup->read("default-content", default_content_raw, pMerge(default_content_raw, 0xFFFFFFFF));
iTmp = default_content_raw;
default_content = (iTmp != 0xFFFFFFFF);
default_content_value = (iTmp == 0xFFFFFFFF) ? 0 : iTmp;
}
else
if(setup->hasKey("default-npc-content")) // Deprecated format
{
setup->read("default-npc-content", default_content_raw, pMerge(default_content_raw, -1));
iTmp = default_content_raw;
default_content = (iTmp >= 0);
default_content_value = (iTmp >= 0) ? (iTmp < 1000 ? iTmp * -1 : iTmp - 1000) : 0;
}
else if(!merge_with) // Default value
{
default_content = false;
default_content_value = 0;
}

#undef pMerge
#undef pMergeMe

0 comments on commit b416649

Please sign in to comment.