(svn r9851) [0.5] -Backport from trunk (r9731, r9741, r9743, r9753, r9757):

- Fix: when you have closed the "Load game"/"New game" windows which you started from the "start server" menu, you shouldn't start a server when starting a new game [SF#1244842] (r9757)
- Fix: Trains were lost after autorenewal/autoreplace [FS#732] (r9753)
- Fix: Stop flooded towns from building roads on water [FS#598] (r9743)
- Fix: Station signs were not resized when the language changed [FS#672] (r9741)
- Fix: In news history, newlines were not replaced with spaces [FS#677] (r9731)
This commit is contained in:
rubidium 2007-05-15 21:42:27 +00:00
parent c9c087e858
commit 4b6d1f9027
6 changed files with 18 additions and 5 deletions

View File

@ -64,6 +64,10 @@ static void SelectGameWndProc(Window *w, WindowEvent *e)
break;
case WE_CLICK:
/* Do not create a network server when you (just) have closed one of the game
* creation/load windows for the network server. */
if (2 <= e->we.click.widget && e->we.click.widget <= 6) _is_network_server = false;
switch (e->we.click.widget) {
case 2: ShowGenerateLandscape(); break;
case 3: ShowSaveLoadDialog(SLD_LOAD_GAME); break;

View File

@ -1647,7 +1647,7 @@ static void ChatWindowWndProc(Window *w, WindowEvent *e)
assert(WP(w, chatquerystr_d).caption < lengthof(chat_captions));
msg = chat_captions[WP(w, chatquerystr_d).caption];
DrawStringRightAligned(w->widget[2].left - 2, w->widget[2].top + 1, msg, 16);
DrawEditBox(w, &WP(w, chatquerystr_d), 2);
DrawEditBox(w, &WP(w, querystr_d), 2);
} break;
case WE_CLICK:
@ -1662,7 +1662,7 @@ static void ChatWindowWndProc(Window *w, WindowEvent *e)
break;
case WE_MOUSELOOP:
HandleEditBox(w, &WP(w, chatquerystr_d), 2);
HandleEditBox(w, &WP(w, querystr_d), 2);
break;
case WE_KEYPRESS:
@ -1670,7 +1670,7 @@ static void ChatWindowWndProc(Window *w, WindowEvent *e)
ChatTabCompletion(w);
} else {
_chat_tab_completion_active = false;
switch (HandleEditBoxKey(w, &WP(w, chatquerystr_d), 2, e)) {
switch (HandleEditBoxKey(w, &WP(w, querystr_d), 2, e)) {
case 1: { /* Return */
DestType type = (DestType)WP(w, chatquerystr_d).caption;
int dest = WP(w, chatquerystr_d).dest;

View File

@ -602,6 +602,7 @@ static void DrawNewsString(int x, int y, uint16 color, const NewsItem *ni, uint
const char *ptr;
char *dest;
StringID str;
WChar c_last;
if (ni->display_mode == 3) {
str = _get_news_string_callback[ni->callback](ni);
@ -615,15 +616,21 @@ static void DrawNewsString(int x, int y, uint16 color, const NewsItem *ni, uint
* from it such as big fonts, etc. */
ptr = buffer;
dest = buffer2;
c_last = '\0';
for (;;) {
WChar c = Utf8Consume(&ptr);
if (c == 0) break;
if (c == '\r') {
/* Make a space from a newline, but ignore multiple newlines */
if (c == '\n' && c_last != '\n') {
dest[0] = ' ';
dest++;
} else if (c == '\r') {
dest[0] = dest[1] = dest[2] = dest[3] = ' ';
dest += 4;
} else if (IsPrintable(c)) {
dest += Utf8Encode(dest, c);
}
c_last = c;
}
*dest = '\0';

View File

@ -200,6 +200,7 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e)
break;
case 24: /* Change interface language */
ReadLanguagePack(e->we.dropdown.index);
UpdateAllStationVirtCoord();
MarkWholeScreenDirty();
break;
case 27: /* Change resolution */

View File

@ -803,7 +803,7 @@ static bool GrowTown(Town *t)
for (ptr = _town_coord_mod; ptr != endof(_town_coord_mod); ++ptr) {
/* Only work with plain land that not already has a house */
if (!IsTileType(tile, MP_HOUSE) && GetTileSlope(tile, NULL) == SLOPE_FLAT) {
if (!CmdFailed(DoCommand(tile, 0, 0, DC_AUTO, CMD_LANDSCAPE_CLEAR))) {
if (!CmdFailed(DoCommand(tile, 0, 0, DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR))) {
DoCommand(tile, GenRandomRoadBits(), t->index, DC_EXEC | DC_AUTO, CMD_BUILD_ROAD);
_current_player = old_player;
return true;

View File

@ -2088,6 +2088,7 @@ static int32 ReplaceVehicle(Vehicle **w, byte flags, int32 total_cost)
new_v->service_interval = old_v->service_interval;
new_front = true;
new_v->unitnumber = old_v->unitnumber; // use the same unit number
new_v->dest_tile = old_v->dest_tile;
new_v->current_order = old_v->current_order;
if (old_v->type == VEH_Train && GetNextVehicle(old_v) != NULL){