1
0
Fork 0

(svn r20520) [1.0] -Backport from trunk:

- Fix: Draw error messages in white by default, they may not have a colour set when coming from a NewGRF (r20514)
- Fix: Entering half the 'generation seeds' in the console's 'newgame' command failed to set the correct seed [FS#4036] (r20512)
- Fix: Desync when converting rail all as trains with a part on the converted rails need updating and not only the engines (r20500)
- Fix: Ignore the non-stop state when comparing one order type to another order type, otherwise non-stop nearest depot orders fail [FS#4030] (r20498)
- Fix: Non-dedicated servers failing to load a game caused the introgame to be the server's game causing desyncs when people tried to join [FS#3960] (r20497)
release/1.0
rubidium 2010-08-16 23:06:22 +00:00
parent d74a79cc8c
commit d6e34c9ad0
6 changed files with 32 additions and 14 deletions

View File

@ -955,7 +955,7 @@ DEF_CONSOLE_CMD(ConNewGame)
return true;
}
StartNewGameWithoutGUI((argc == 2) ? (uint)atoi(argv[1]) : GENERATE_NEW_SEED);
StartNewGameWithoutGUI((argc == 2) ? strtoul(argv[1], NULL, 10) : (uint)GENERATE_NEW_SEED);
return true;
}

View File

@ -650,13 +650,14 @@ public:
} else {
int extra = (r.bottom - r.top + 1 - this->height_summary - this->height_detailed - WD_PAR_VSEP_WIDE) / 2;
/* Note: NewGRF supplied error message often do not start with a colour code, so default to white. */
int top = r.top + WD_FRAMERECT_TOP;
int bottom = top + this->height_summary + extra;
DrawStringMultiLine(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, top, bottom, this->summary_msg, TC_FROMSTRING, SA_CENTER);
DrawStringMultiLine(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, top, bottom, this->summary_msg, TC_WHITE, SA_CENTER);
bottom = r.bottom - WD_FRAMERECT_BOTTOM;
top = bottom - this->height_detailed - extra;
DrawStringMultiLine(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, top, bottom, this->detailed_msg, TC_FROMSTRING, SA_CENTER);
DrawStringMultiLine(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, top, bottom, this->detailed_msg, TC_WHITE, SA_CENTER);
}
SwitchToNormalRefStack(); // Switch back to the normal text ref. stack for NewGRF texts.

View File

@ -934,6 +934,9 @@ void NetworkDisconnect(bool blocking)
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
NetworkClose();
/* Reinitialize the UDP stack, i.e. close all existing connections. */
NetworkUDPInitialize();
}
/**

View File

@ -878,6 +878,7 @@ bool SafeSaveOrLoad(const char *filename, int mode, GameMode newgm, Subdirectory
case SL_OK: return true;
case SL_REINIT:
#ifdef ENABLE_NETWORK
if (_network_dedicated) {
/*
* We need to reinit a network map...
@ -889,6 +890,11 @@ bool SafeSaveOrLoad(const char *filename, int mode, GameMode newgm, Subdirectory
MakeNewGame(false, true);
return false;
}
if (_network_server) {
/* We can't load the intro game as server, so disconnect first. */
NetworkDisconnect();
}
#endif /* ENABLE_NETWORK */
switch (ogm) {
default:

View File

@ -115,7 +115,7 @@ bool Order::Equals(const Order &other) const
* destination because those get clear/filled in during the order
* evaluation. If we do not do this the order will continuously be seen as
* a different order and it will try to find a "nearest depot" every tick. */
if ((this->type == OT_GOTO_DEPOT && this->type == other.type) &&
if ((this->IsType(OT_GOTO_DEPOT) && this->type == other.type) &&
((this->GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0 ||
(other.GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0)) {
return

View File

@ -41,6 +41,9 @@
#include "table/railtypes.h"
#include "table/track_land.h"
/** Helper type for lists/vectors of trains */
typedef SmallVector<Train *, 16> TrainList;
RailtypeInfo _railtypes[RAILTYPE_END];
assert_compile(sizeof(_original_railtypes) <= sizeof(_railtypes));
@ -1344,12 +1347,8 @@ static Vehicle *UpdateTrainPowerProc(Vehicle *v, void *data)
if (v->type != VEH_TRAIN) return NULL;
/* Similar checks as in Train::PowerChanged() */
Train *t = Train::From(v);
if (t->IsArticulatedPart()) return NULL;
const RailVehicleInfo *rvi = RailVehInfo(t->engine_type);
if (GetVehicleProperty(t, PROP_TRAIN_POWER, rvi->power) != 0) t->First()->PowerChanged();
TrainList *affected_trains = static_cast<TrainList*>(data);
affected_trains->Include(Train::From(v)->First());
return NULL;
}
@ -1381,6 +1380,7 @@ CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
if (ey < sy) Swap(ey, sy);
_error_message = STR_ERROR_NO_SUITABLE_RAILROAD_TRACK; // by default, there is no track to convert
TrainList affected_trains;
for (uint x = sx; x <= ex; ++x) {
for (uint y = sy; y <= ey; ++y) {
@ -1436,8 +1436,8 @@ CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
SetRailType(tile, totype);
MarkTileDirtyByTile(tile);
/* update power of train engines on this tile */
FindVehicleOnPos(tile, NULL, &UpdateTrainPowerProc);
/* update power of train on this tile */
FindVehicleOnPos(tile, &affected_trains, &UpdateTrainPowerProc);
}
}
@ -1494,8 +1494,8 @@ CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
SetRailType(tile, totype);
SetRailType(endtile, totype);
FindVehicleOnPos(tile, NULL, &UpdateTrainPowerProc);
FindVehicleOnPos(endtile, NULL, &UpdateTrainPowerProc);
FindVehicleOnPos(tile, &affected_trains, &UpdateTrainPowerProc);
FindVehicleOnPos(endtile, &affected_trains, &UpdateTrainPowerProc);
YapfNotifyTrackLayoutChange(tile, track);
YapfNotifyTrackLayoutChange(endtile, track);
@ -1529,6 +1529,14 @@ CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
}
}
if (flags & DC_EXEC) {
/* Railtype changed, update trains as when entering different track */
for (Train **v = affected_trains.Begin(); v != affected_trains.End(); v++) {
(*v)->PowerChanged();
(*v)->UpdateAcceleration();
}
}
return (cost.GetCost() == 0) ? CMD_ERROR : cost;
}