| 74 | } |
| 75 | |
| 76 | command_result color(color_ostream &out, std::vector<std::string> ¶ms) |
| 77 | { |
| 78 | if (params.empty()) |
| 79 | return plugin_enable(out, true); |
| 80 | for (auto it = params.begin(); it != params.end(); ++it) |
| 81 | { |
| 82 | std::string p = toLower_cp437(*it); |
| 83 | if (!p.size()) |
| 84 | continue; |
| 85 | #define CHECK_COLOR(color_name) else if (p == toLower_cp437(std::string(#color_name))) \ |
| 86 | { config.flicker = false; config.color = COLOR_##color_name % 8; plugin_enable(out, true); } |
| 87 | CHECK_COLOR(RED) |
| 88 | CHECK_COLOR(GREEN) |
| 89 | CHECK_COLOR(BLUE) |
| 90 | CHECK_COLOR(YELLOW) |
| 91 | CHECK_COLOR(BROWN) |
| 92 | CHECK_COLOR(CYAN) |
| 93 | CHECK_COLOR(MAGENTA) |
| 94 | CHECK_COLOR(WHITE) |
| 95 | CHECK_COLOR(GREY) |
| 96 | CHECK_COLOR(BLACK) |
| 97 | #undef CHECK_COLOR |
| 98 | else if (p == "flicker") |
| 99 | { |
| 100 | config.flicker = true; |
| 101 | plugin_enable(out, true); |
| 102 | } |
| 103 | else if (p.size() >= 3 && p.substr(0, 3) == "aaa") |
| 104 | { |
| 105 | aaaaa_set_tile_hook.toggle(); |
| 106 | } |
| 107 | else if (p == "shift") |
| 108 | { |
| 109 | shift_set_tile_hook.toggle(); |
| 110 | } |
| 111 | else if (p == "disable") |
| 112 | { |
| 113 | plugin_enable(out, false); |
| 114 | } |
| 115 | else if (p != "enable") |
| 116 | { |
| 117 | out.printerr("Unrecognized option: {}\n", p); |
| 118 | return CR_WRONG_USAGE; |
| 119 | } |
| 120 | } |
| 121 | return CR_OK; |
| 122 | } |
| 123 | |
| 124 | DFhackCExport command_result plugin_init (color_ostream &out, std::vector <PluginCommand> &commands) |
| 125 | { |