summaryrefslogtreecommitdiff
path: root/plugins/Brushes.h
diff options
context:
space:
mode:
authorJared Adams2012-05-07 18:31:28 -0600
committerJared Adams2012-05-07 18:31:28 -0600
commit833bf518d973473d8abf8533e58b069610ddeb9c (patch)
treead888de4231d11065cc48c3e33ba3e9fc897b624 /plugins/Brushes.h
parent567b3e2a52a3be8949c4536cff15e68b55f87fc6 (diff)
downloaddfhack-833bf518d973473d8abf8533e58b069610ddeb9c.tar.gz
dfhack-833bf518d973473d8abf8533e58b069610ddeb9c.tar.bz2
dfhack-833bf518d973473d8abf8533e58b069610ddeb9c.tar.xz
Fix some issues
Diffstat (limited to 'plugins/Brushes.h')
-rw-r--r--plugins/Brushes.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/plugins/Brushes.h b/plugins/Brushes.h
index 7cbc73da..a408f47b 100644
--- a/plugins/Brushes.h
+++ b/plugins/Brushes.h
@@ -201,17 +201,17 @@ command_result parseRectangle(color_ostream & out,
int & width, int & height, int & zLevels,
bool hasConsole = true)
{
- int newWidth = 0, newHeight = 0, newZLevels = 1;
- // z is different so 'range w h' won't ask for it.
+ int newWidth = 0, newHeight = 0, newZLevels = 0;
if (end > start + 1)
{
newWidth = atoi(input[start++].c_str());
newHeight = atoi(input[start++].c_str());
- }
-
- if (end > start) {
- newZLevels = atoi(input[start++].c_str());
+ if (end > start) {
+ newZLevels = atoi(input[start++].c_str());
+ } else {
+ newZLevels = 1; // So 'range w h' won't ask for it.
+ }
}
string command = "";
@@ -226,7 +226,7 @@ command_result parseRectangle(color_ostream & out,
str << "Set range width <" << width << "> ";
con.lineedit(str.str(), command, hist);
hist.add(command);
- newWidth = command == "" ? width : atoi(command.c_str());
+ newWidth = command.empty() ? width : atoi(command.c_str());
} else {
return CR_WRONG_USAGE;
}
@@ -240,7 +240,7 @@ command_result parseRectangle(color_ostream & out,
str << "Set range height <" << height << "> ";
con.lineedit(str.str(), command, hist);
hist.add(command);
- newHeight = command == "" ? height : atoi(command.c_str());
+ newHeight = command.empty() ? height : atoi(command.c_str());
} else {
return CR_WRONG_USAGE;
}
@@ -254,7 +254,7 @@ command_result parseRectangle(color_ostream & out,
str << "Set range z-levels <" << zLevels << "> ";
con.lineedit(str.str(), command, hist);
hist.add(command);
- newZLevels = command == "" ? zLevels : atoi(command.c_str());
+ newZLevels = command.empty() ? zLevels : atoi(command.c_str());
} else {
return CR_WRONG_USAGE;
}
@@ -262,7 +262,7 @@ command_result parseRectangle(color_ostream & out,
width = newWidth < 1? 1 : newWidth;
height = newHeight < 1? 1 : newHeight;
- zLevels = newZLevels < 1? 1 : zLevels;
+ zLevels = newZLevels < 1? 1 : newZLevels;
return CR_OK;
}