diff options
| author | Petr Mrázek | 2012-07-12 02:16:08 +0200 |
|---|---|---|
| committer | Petr Mrázek | 2012-07-12 02:16:08 +0200 |
| commit | 6be752454d637e3076f9428e9f39055c2de654c9 (patch) | |
| tree | 6b188ec6915d019b52242ec5f330563795408a48 /plugins/zone.cpp | |
| parent | 8f8f25384c54075c5a72cf50d133f19465eebf9c (diff) | |
| download | dfhack-6be752454d637e3076f9428e9f39055c2de654c9.tar.gz dfhack-6be752454d637e3076f9428e9f39055c2de654c9.tar.bz2 dfhack-6be752454d637e3076f9428e9f39055c2de654c9.tar.xz | |
Check zone plugin parameters better
Diffstat (limited to 'plugins/zone.cpp')
| -rw-r--r-- | plugins/zone.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/plugins/zone.cpp b/plugins/zone.cpp index ce610128..9bd0e8c0 100644 --- a/plugins/zone.cpp +++ b/plugins/zone.cpp @@ -1856,14 +1856,18 @@ command_result df_zone (color_ostream &out, vector <string> & parameters) // if followed by another parameter, check if it's numeric if(i < parameters.size()-1) { - stringstream ss(parameters[i+1]); - int new_building = -1; - ss >> new_building; - if(new_building != -1) + auto & str = parameters[i+1]; + if(str.size() > 0 && str[0] >= '0' && str[0] <= '9') { - i++; - target_building = new_building; - out << "Assign selected unit(s) to building #" << target_building <<std::endl; + stringstream ss(parameters[i+1]); + int new_building = -1; + ss >> new_building; + if(new_building != -1) + { + i++; + target_building = new_building; + out << "Assign selected unit(s) to building #" << target_building <<std::endl; + } } } if(target_building == -1) |
