Rolisteam / DiceParser

Powerful dice Roller is used as discord bot, irc bot, cli tool and inside Rolisteam : 1d20+4, 1L[head,arm,leg,belly,chest], 1d6+1d8, 8+5*3
http://www.rolisteam.org/
GNU General Public License v3.0
125 stars 31 forks source link

use of undeclared identifier 'diceList' in cli/main.cpp #21

Closed DarwinAwardWinner closed 5 years ago

DarwinAwardWinner commented 5 years ago

I was interested in building this myself to use the CLI dice roller, but I ran into a problem compiling it:

$ make
[  1%] Automatic MOC and UIC for target irc
[  1%] Built target irc_autogen
[ 48%] Built target irc
[ 50%] Automatic MOC for target dice
[ 50%] Built target dice_autogen
[ 51%] Building CXX object cli/CMakeFiles/dice.dir/main.cpp.o
/Users/ryan/src/DiceParser/cli/main.cpp:309:40: error: use of undeclared identifier
      'diceList'
                resultStr.replace("%2",diceList.trimmed());
                                       ^
/Users/ryan/src/DiceParser/cli/main.cpp:347:20: warning: enumeration value 'BOT' not
      handled in switch [-Wswitch]
            switch(format)
                   ^
/Users/ryan/src/DiceParser/cli/main.cpp:347:20: note: add missing switch cases
            switch(format)
                   ^
1 warning and 1 error generated.
make[2]: *** [cli/CMakeFiles/dice.dir/main.cpp.o] Error 1
make[1]: *** [cli/CMakeFiles/dice.dir/all] Error 2
make: *** [all] Error 2

This appears to be in the startDiceParsing function. Looking at the code, I don't see a diceList variable declared anywhere in the function. Furthermore, the lines before and after this line refer to stringResult while this line refers to resultStr, which makes it look out of place. So I suspect that this is a mistake in the code. Unfortunately, I'm not familiar enough with the codebase to know how to fix this myself.

I'm using commit 48de810db56b728726ec8b499b9a12c687b53795, the latest master at time of writing.

DarwinAwardWinner commented 5 years ago

Looking into the git history, it seems the offending line was introduced in 0586f25925f4db4a181c7d7d0a3925bb8a6daecf, part of the diceResult branch. I checked out the last commit before the latest merge of this branch into master, bd4a0c837bd5e3b4dbf9d3dcef892850d04ec6ac, and that commit builds and runs just fine.

obiwankennedy commented 5 years ago

Hi,

This commit https://github.com/Rolisteam/DiceParser/commit/934387b1219ee16ab38d5a2a7e2f6e87f46b9900 should fix this issue.

DarwinAwardWinner commented 5 years ago

Thanks!