Extend per-entry scan depth limit, add warnings on overflow

This commit is contained in:
Cohee 2024-02-23 21:18:40 +02:00
parent c9f0d61f19
commit 4baefeba68
2 changed files with 4 additions and 2 deletions

View File

@ -4539,7 +4539,7 @@
<div name="perEntryOverridesBlock" class="flex-container wide100p alignitemscenter"> <div name="perEntryOverridesBlock" class="flex-container wide100p alignitemscenter">
<div class="world_entry_form_control flex1"> <div class="world_entry_form_control flex1">
<small class="textAlignCenter" data-i18n="Scan Depth">Scan Depth</small> <small class="textAlignCenter" data-i18n="Scan Depth">Scan Depth</small>
<input class="text_pole" name="scanDepth" type="number" placeholder="Use global setting" data-i18n="[placeholder]Use global setting" max="100"> <input class="text_pole" name="scanDepth" type="number" placeholder="Use global setting" data-i18n="[placeholder]Use global setting" max="1000">
</div> </div>
<div class="world_entry_form_control flex1"> <div class="world_entry_form_control flex1">
<small class="textAlignCenter" data-i18n="Case-Sensitive">Case-Sensitive</small> <small class="textAlignCenter" data-i18n="Case-Sensitive">Case-Sensitive</small>

View File

@ -70,7 +70,7 @@ const SORT_ORDER_KEY = 'world_info_sort_order';
const METADATA_KEY = 'world_info'; const METADATA_KEY = 'world_info';
const DEFAULT_DEPTH = 4; const DEFAULT_DEPTH = 4;
const MAX_SCAN_DEPTH = 100; const MAX_SCAN_DEPTH = 1000;
/** /**
* Represents a scanning buffer for one evaluation of World Info. * Represents a scanning buffer for one evaluation of World Info.
@ -1513,11 +1513,13 @@ function getWorldEntry(name, data, entry) {
// Clamp if necessary // Clamp if necessary
if (value < 0) { if (value < 0) {
$(this).val(0).trigger('input'); $(this).val(0).trigger('input');
toastr.warning('Scan depth cannot be negative');
return; return;
} }
if (value > MAX_SCAN_DEPTH) { if (value > MAX_SCAN_DEPTH) {
$(this).val(MAX_SCAN_DEPTH).trigger('input'); $(this).val(MAX_SCAN_DEPTH).trigger('input');
toastr.warning(`Scan depth cannot exceed ${MAX_SCAN_DEPTH}`);
return; return;
} }