| 161 | } |
| 162 | |
| 163 | command_result df_liquids (color_ostream &out_, vector <string> & parameters) |
| 164 | { |
| 165 | if(!out_.is_console()) |
| 166 | return CR_FAILURE; |
| 167 | Console &out = static_cast<Console&>(out_); |
| 168 | |
| 169 | for(size_t i = 0; i < parameters.size();i++) |
| 170 | { |
| 171 | if(parameters[i] == "help" || parameters[i] == "?") |
| 172 | return CR_WRONG_USAGE; |
| 173 | } |
| 174 | |
| 175 | if (!Maps::IsValid()) |
| 176 | { |
| 177 | out.printerr("Map is not available!\n"); |
| 178 | return CR_FAILURE; |
| 179 | } |
| 180 | |
| 181 | std::vector<std::string> commands; |
| 182 | bool end = false; |
| 183 | |
| 184 | out << "Welcome to the liquid spawner.\nType 'help' or '?' for a list of available commands, 'q' to quit.\nPress return after a command to confirm." << std::endl; |
| 185 | |
| 186 | while(!end) |
| 187 | { |
| 188 | string input = ""; |
| 189 | |
| 190 | std::stringstream str; |
| 191 | print_prompt(str, cur_mode); |
| 192 | str << "# "; |
| 193 | int rv; |
| 194 | while ((rv = out.lineedit(str.str(),input,liquids_hist)) |
| 195 | == Console::RETRY); |
| 196 | if (rv <= Console::FAILURE) |
| 197 | return rv == Console::FAILURE ? CR_FAILURE : CR_OK; |
| 198 | liquids_hist.add(input); |
| 199 | |
| 200 | commands.clear(); |
| 201 | Core::cheap_tokenise(input, commands); |
| 202 | string command = commands.empty() ? "" : commands[0]; |
| 203 | |
| 204 | if(command=="help" || command == "?") |
| 205 | { |
| 206 | out << "Modes:" << endl |
| 207 | << "m - switch to magma" << endl |
| 208 | << "w - switch to water" << endl |
| 209 | << "o - make obsidian wall instead" << endl |
| 210 | << "of - make obsidian floors" << endl |
| 211 | << "rs - make a river source" << endl |
| 212 | << "f - flow bits only" << endl |
| 213 | << "wclean - remove salt and stagnant flags from tiles" << endl |
| 214 | << "Set-Modes (only for magma/water):" << endl |
| 215 | << "s+ - only add" << endl |
| 216 | << "s. - set" << endl |
| 217 | << "s- - only remove" << endl |
| 218 | << "Properties (only for magma/water):" << endl |
| 219 | << "f+ - make the spawned liquid flow" << endl |
| 220 | << "f. - don't change flow state (read state in flow mode)" << endl |
nothing calls this directly
no test coverage detected