|
@@ -50,15 +50,6 @@ void harry_idle_event(int fd) {
|
|
|
buffer << "^CS^S2^C" << std::setfill('0') << std::setw(2) << color
|
|
|
<< phrases[r] << "^P2^CR^D" << std::setw(2) << strlen(phrases[r]);
|
|
|
|
|
|
-
|
|
|
- slen = snprintf(buffer, sizeof(buffer), "^S2^C%02d%s^P2^CR^D%02d", color, cp,
|
|
|
- (int)strlen(cp));
|
|
|
- if (slen >= sizeof(buffer)) {
|
|
|
- ZF_LOGE("snprintf %d > size %d", slen, (int)sizeof(buffer));
|
|
|
- buffer[0] = 0;
|
|
|
- }
|
|
|
- */
|
|
|
-
|
|
|
std::string str = buffer.str();
|
|
|
ZF_LOGD("harry_event: render(%d, \"%s\")", fd, str.c_str());
|
|
|
render(fd, str);
|
|
@@ -83,16 +74,8 @@ int mangle_clrscr(std::string &buffer, std::string &work, size_t pos) {
|
|
|
return 0;
|
|
|
|
|
|
if (ANSI_CLS_count > 1) {
|
|
|
-
|
|
|
-
|
|
|
- struct console_details temp_console;
|
|
|
- memcpy(&temp_console, &console, sizeof(console));
|
|
|
- console_receive(&temp_console, buffer.substr(0, pos));
|
|
|
- std::string restore_color;
|
|
|
- restore_color.assign(color_restore(&temp_console));
|
|
|
- */
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
if (random_activate(level * 5)) {
|
|
|
std::ostringstream display;
|
|
|
int needs_cls = 0;
|
|
@@ -132,9 +115,6 @@ int mangle_clrscr(std::string &buffer, std::string &work, size_t pos) {
|
|
|
|
|
|
display.str(std::string());
|
|
|
display.clear();
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
} else {
|
|
|
fgoto.assign("^CS^F");
|
|
|
}
|
|
@@ -154,9 +134,6 @@ int mangle_clrscr(std::string &buffer, std::string &work, size_t pos) {
|
|
|
|
|
|
display << (needs_cls ? "\x1b[2J" : "") << fgoto << "^CR^P3";
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
std::string display_output = display.str();
|
|
|
|
|
|
ZF_LOGI("mangle(ANSI_CLS): %d file inserted %s", r,
|
|
@@ -167,7 +144,7 @@ int mangle_clrscr(std::string &buffer, std::string &work, size_t pos) {
|
|
|
work.insert(pos, std::string(display_output.size(), ' '));
|
|
|
return 1;
|
|
|
} else {
|
|
|
-
|
|
|
+
|
|
|
if (random_activate(level * 5)) {
|
|
|
int r;
|
|
|
std::ostringstream display;
|
|
@@ -209,22 +186,14 @@ int mangle_clrscr(std::string &buffer, std::string &work, size_t pos) {
|
|
|
if (strncmp(phrasing[r], "^G", 2) == 0) {
|
|
|
display << "^CS^S3^P1" << phrasing[r] << "^S0^R0^CR^P1^G0101";
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
} else {
|
|
|
display << "^CS^G" << std::setw(2) << std::setfill('0') << x
|
|
|
<< std::setw(2) << y << "^S3^C" << std::setw(2) << color
|
|
|
<< "^P1" << phrasing[r] << "^S0^R0^CR^P1^G0101";
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
};
|
|
|
|
|
|
std::string display_output = display.str();
|
|
|
|
|
|
-
|
|
|
-
|
|
|
|
|
|
|
|
|
ZF_LOGD("mangle(ANSI_CLS): Inserted color=%02d r=%d phrase='%s'", color,
|
|
@@ -322,7 +291,7 @@ int mangle(int fd, std::string &buffer) {
|
|
|
|
|
|
replace(buffer, old_string, new_string);
|
|
|
replace(work, old_string, new_string);
|
|
|
- level = 0;
|
|
|
+ level = 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -410,6 +379,8 @@ int mangle(int fd, std::string &buffer) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+#ifndef NO_BUFFER_DEBUG
|
|
|
|
|
|
ZF_LOGV_LR("Buffer:", buffer);
|
|
|
ZF_LOGV_LR("Work:", work);
|
|
@@ -446,6 +417,7 @@ int mangle(int fd, std::string &buffer) {
|
|
|
|
|
|
oss.str(std::string());
|
|
|
oss.clear();
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
if (level) {
|