|
@@ -127,6 +127,8 @@ void Director::client_input(const std::string &input) {
|
|
|
void Director::server_line(const std::string &line,
|
|
|
const std::string &raw_line) {
|
|
|
// check for if we entered game/left game
|
|
|
+ SL_history.push_back(line);
|
|
|
+
|
|
|
if (!chain) BUGZ_LOG(info) << "SL: [" << line << "]";
|
|
|
|
|
|
if (line.find("TradeWars Game Server ") != std::string::npos) {
|
|
@@ -140,6 +142,45 @@ void Director::server_line(const std::string &line,
|
|
|
// reset "active game" -- we're at the TWGS main menu
|
|
|
}
|
|
|
|
|
|
+ if (line == "Trade Wars 2002 Win32 module now loading.") {
|
|
|
+ // This happens if the game is customized with ANSI/menus/etc.
|
|
|
+ // We're not detecting the Selection, go find what was selected.
|
|
|
+ auto find = SL_history.rbegin();
|
|
|
+ ++find;
|
|
|
+ while (find != SL_history.rend()) {
|
|
|
+ if (*find != "") {
|
|
|
+ std::string last_SL = *find;
|
|
|
+ char ch = last_SL[last_SL.length() - 1];
|
|
|
+ if ((game) && (game != ch)) {
|
|
|
+ galaxy.save();
|
|
|
+ }
|
|
|
+ game = ch;
|
|
|
+
|
|
|
+ BUGZ_LOG(warning) << "GAME " << game << " activated!";
|
|
|
+ galaxy.game = game;
|
|
|
+ galaxy.username = username;
|
|
|
+ galaxy.load();
|
|
|
+
|
|
|
+ // YAML loaded, set sensible default config values (if missing).
|
|
|
+ if (!galaxy.config.contains("display_lines")) {
|
|
|
+ galaxy.config["display_lines"] = 20;
|
|
|
+ }
|
|
|
+
|
|
|
+ galaxy.meta["help"]["display_lines"] =
|
|
|
+ "Number of report lines to display";
|
|
|
+
|
|
|
+ if (!galaxy.config.contains("burnt_percent")) {
|
|
|
+ galaxy.config["burnt_percent"] = 40;
|
|
|
+ }
|
|
|
+
|
|
|
+ galaxy.meta["help"]["burnt_percent"] =
|
|
|
+ "Don't display ports in report below this percent";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ ++find;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (line.find("Selection (? for menu): ") != std::string::npos) {
|
|
|
char ch = line[line.length() - 1];
|
|
|
if (ch >= 'A' && ch < 'Q') {
|
|
@@ -967,8 +1008,8 @@ void Director::macro_have_input(void) {
|
|
|
char c = toupper(id->input[0]);
|
|
|
macro_item.assign(1, c);
|
|
|
if (galaxy.meta["macros"].contains(macro_item)) {
|
|
|
- constexpr ANSIColor key("BOLD GREEN"); // COLOR::GREEN, ATTR::BOLD);
|
|
|
- constexpr ANSIColor value("BOLD BLUE"); // COLOR::BLUE, ATTR::BOLD);
|
|
|
+ constexpr ANSIColor key("BOLD GREEN"); // COLOR::GREEN, ATTR::BOLD);
|
|
|
+ constexpr ANSIColor value("BOLD BLUE"); // COLOR::BLUE, ATTR::BOLD);
|
|
|
std::string output =
|
|
|
str(boost::format("%1%%2% : %3%%4%\n\r") % key() % macro_item %
|
|
|
value() % galaxy.meta["macros"][macro_item]);
|