summaryrefslogtreecommitdiff
path: root/blarandom.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'blarandom.cpp')
-rw-r--r--blarandom.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/blarandom.cpp b/blarandom.cpp
index 4099d0b..1d99e05 100644
--- a/blarandom.cpp
+++ b/blarandom.cpp
@@ -26,6 +26,7 @@
v0.31 - Changed help description
v0.4 - Added coin & dice presets
v0.5 - Added 8ball preset
+ v0.6 - Can now use count with presets
*/
@@ -38,7 +39,7 @@
int main() {
- std::string version = "0.5";
+ std::string version = "0.6";
RandomLib::Random r; // Create r
r.Reseed(); // and give it a unique seed
@@ -86,13 +87,16 @@ int main() {
bool coin = false;
bool letter = false;
bool eightball = false;
+ bool dice = false;
+ bool d20 = false;
if (args[0].empty()) {
min = 1;
max = 10;
- } else if (!args[0].compare("dice")) {
+ } else if (!args[0].compare("dice") || !args[0].compare("die")) {
min = 1;
max = 6;
+ dice = true;
} else if (!args[0].compare("coin")) {
min = 0;
max = 1;
@@ -100,15 +104,24 @@ int main() {
} else if (!args[0].compare("d20")) {
min = 1;
max = 20;
- } else if (!args[0].compare("letter")) {
- min = 1;
- max = 26;
+ d20 = true;
+ } else if (!args[0].compare("letter") || !args[0].compare("letter")) {
+ min = 0;
+ max = 25;
letter = true;
} else if (!args[0].compare("8ball")) {
min = 0;
max = 17;
eightball = true;
}
+
+ if (coin || dice || letter || d20 || eightball) {
+ if (args[1].empty()) {
+ count = 1;
+ } else {
+ count = atoi(args[1].c_str());
+ }
+ }
int intResult = 0;
std::string strResult = "";