425 case NM_CALLBACK: { |
425 case NM_CALLBACK: { |
426 _news_type13_desc.top = top; |
426 _news_type13_desc.top = top; |
427 w = AllocateWindowDesc(&_news_type13_desc); |
427 w = AllocateWindowDesc(&_news_type13_desc); |
428 if (ni->flags & NF_VIEWPORT) |
428 if (ni->flags & NF_VIEWPORT) |
429 AssignWindowViewport(w, 2, 58, 0x1AA, 0x6E, |
429 AssignWindowViewport(w, 2, 58, 0x1AA, 0x6E, |
430 ni->data_a | (ni->flags & NF_VEHICLE ? 0x80000000 : 0), 0); |
430 ni->data_a | (ni->flags & NF_VEHICLE ? 0x80000000 : 0), ZOOM_LVL_NEWS); |
431 break; |
431 break; |
432 } |
432 } |
433 |
433 |
434 case NM_THIN: { |
434 case NM_THIN: { |
435 _news_type2_desc.top = top; |
435 _news_type2_desc.top = top; |
436 w = AllocateWindowDesc(&_news_type2_desc); |
436 w = AllocateWindowDesc(&_news_type2_desc); |
437 if (ni->flags & NF_VIEWPORT) |
437 if (ni->flags & NF_VIEWPORT) |
438 AssignWindowViewport(w, 2, 58, 0x1AA, 0x46, |
438 AssignWindowViewport(w, 2, 58, 0x1AA, 0x46, |
439 ni->data_a | (ni->flags & NF_VEHICLE ? 0x80000000 : 0), 0); |
439 ni->data_a | (ni->flags & NF_VEHICLE ? 0x80000000 : 0), ZOOM_LVL_NEWS); |
440 break; |
440 break; |
441 } |
441 } |
442 |
442 |
443 default: { |
443 default: { |
444 _news_type0_desc.top = top; |
444 _news_type0_desc.top = top; |
445 w = AllocateWindowDesc(&_news_type0_desc); |
445 w = AllocateWindowDesc(&_news_type0_desc); |
446 if (ni->flags & NF_VIEWPORT) |
446 if (ni->flags & NF_VIEWPORT) |
447 AssignWindowViewport(w, 3, 17, 0x112, 0x2F, |
447 AssignWindowViewport(w, 3, 17, 0x112, 0x2F, |
448 ni->data_a | (ni->flags & NF_VEHICLE ? 0x80000000 : 0), 0); |
448 ni->data_a | (ni->flags & NF_VEHICLE ? 0x80000000 : 0), ZOOM_LVL_NEWS); |
449 break; |
449 break; |
450 } |
450 } |
451 } |
451 } |
452 |
452 |
453 /*DEBUG(misc, 0, " cur %3d, old %2d, lat %3d, for %3d, tot %2d", |
453 /*DEBUG(misc, 0, " cur %3d, old %2d, lat %3d, for %3d, tot %2d", |
618 GetString(buffer, str, lastof(buffer)); |
618 GetString(buffer, str, lastof(buffer)); |
619 /* Copy the just gotten string to another buffer to remove any formatting |
619 /* Copy the just gotten string to another buffer to remove any formatting |
620 * from it such as big fonts, etc. */ |
620 * from it such as big fonts, etc. */ |
621 ptr = buffer; |
621 ptr = buffer; |
622 dest = buffer2; |
622 dest = buffer2; |
|
623 WChar c_last = '\0'; |
623 for (;;) { |
624 for (;;) { |
624 WChar c = Utf8Consume(&ptr); |
625 WChar c = Utf8Consume(&ptr); |
625 if (c == 0) break; |
626 if (c == 0) break; |
626 if (c == '\r') { |
627 /* Make a space from a newline, but ignore multiple newlines */ |
|
628 if (c == '\n' && c_last != '\n') { |
|
629 dest[0] = ' '; |
|
630 dest++; |
|
631 } else if (c == '\r') { |
627 dest[0] = dest[1] = dest[2] = dest[3] = ' '; |
632 dest[0] = dest[1] = dest[2] = dest[3] = ' '; |
628 dest += 4; |
633 dest += 4; |
629 } else if (IsPrintable(c)) { |
634 } else if (IsPrintable(c)) { |
630 dest += Utf8Encode(dest, c); |
635 dest += Utf8Encode(dest, c); |
631 } |
636 } |
|
637 c_last = c; |
632 } |
638 } |
633 |
639 |
634 *dest = '\0'; |
640 *dest = '\0'; |
635 /* Truncate and show string; postfixed by '...' if neccessary */ |
641 /* Truncate and show string; postfixed by '...' if neccessary */ |
636 DoDrawStringTruncated(buffer2, x, y, color, maxw); |
642 DoDrawStringTruncated(buffer2, x, y, color, maxw); |