From a7e6dd9ebf2e7a456dc31b5e9d6409eb9ec20f5c Mon Sep 17 00:00:00 2001 From: garak Date: Tue, 15 Oct 2019 09:35:38 -0400 Subject: [PATCH] add warning when encounter slot total exceeds 8 bytes --- src/editor.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/editor.cpp b/src/editor.cpp index 6e28cdc7..6eeea2d0 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -354,10 +354,14 @@ void Editor::configureEncounterJSON(QWidget *window) { groupTotalMessage += QString("%1 (%2),\t").arg(groupTotals[key]).arg(key); } groupTotalMessage.chop(2); - totalLabel->setText(groupTotalMessage); } else { - totalLabel->setText(QString("Total: %1").arg(QString::number(total))); + groupTotalMessage = QString("Total: %1").arg(QString::number(total)); } + if (total > 0xFF) { + totalLabel->setTextFormat(Qt::RichText); + groupTotalMessage += QString("\tWARNING: value exceeds the limit for a u8 variable."); + } + totalLabel->setText(groupTotalMessage); }; // lambda: Create a new "slot", which is the widget containing a spinner and an index label.