summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwjoe <joe@lc8n.com>2012-05-15 14:09:53 +0100
committerwjoe <joe@lc8n.com>2012-05-15 14:09:53 +0100
commit3e1cfaf3cd8abd25b6df740dccf5e606aa182711 (patch)
tree6b40ea338e79e826133be3d584d9a892e7ee95a8
parent23f433494a1f1c04274d23e4d6e39fa13a785d0d (diff)
v0.6 - Can now use counts with presets
-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 = "";