Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / CellFormula.cpp
diff options
context:
space:
mode:
Commit1bbfed319336bf6002e4bc47c11c0260386320b9 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-29 14:45:12 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-29 14:45:12 +0300
Filescbe4570ad1e1ce25e172059cfaa420e98a25b581 /src/Models/CellFormula.cpp
FMI-OOP-P2_Tables-1bbfed319336bf6002e4bc47c11c0260386320b9.tar
FMI-OOP-P2_Tables-1bbfed319336bf6002e4bc47c11c0260386320b9.tar.gz
FMI-OOP-P2_Tables-1bbfed319336bf6002e4bc47c11c0260386320b9.zip
Parent657f9b35f4469f301cb458f423352edc53281743 (diff)
Autocommit at 29.05.2022 @ 14:45
1 files changed, 2 insertions, 6 deletions
-rw-r--r--src/Models/CellFormula.cpp8
diff --git a/src/Models/CellFormula.cpp b/src/Models/CellFormula.cpp
index 942b6e5..2e2636d 100644
--- a/src/Models/CellFormula.cpp
+++ b/src/Models/CellFormula.cpp
@@ -80,12 +80,8 @@ void CellFormula::parseAndSetValue(const char* str) {
if (currOp == '^') currOp *= -1;
else if ((currOp == '+' || currOp == '-') && formula.get_count() != 0) {
- unsigned cntr = 1;
- Pair<Cell*, char>& prev = formula[formula.get_count() - cntr];
- while (prev.right == '*' || prev.right == '/') {
- prev.right *= -1;
- prev = formula[formula.get_count() - ++cntr];
- }
+ for (unsigned i = formula.get_count() - 1; (formula[i].right == '*' || formula[i].right == '/') && i > 0; i--)
+ if (formula[i].right > 0) formula[i].right *= -1;
}
if (currOp == '-') {