mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r27272) [1.5] -Backport from trunk:
- Fix: ScriptList::RemoveList failed to remove a list from itself [FS#6287] (r27258) - Fix: Combined button+dropdown widgets in order and autoreplace GUI had incorrect hitbox when using GUI zoom [FS#6270] (r27255) - Fix: When building a lock on DC_AUTO-removable water-based objects, the water class was always set to canal [FS#6264] (r27254) - Fix: When crossing tram tracks with railroads, cost of extra roads was not being counted [FS#6282] (r27253)
This commit is contained in:
parent
24fdbabaf9
commit
622ea4406d
|
@ -501,6 +501,7 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
|||
}
|
||||
}
|
||||
roadtypes |= ROADTYPES_ROAD;
|
||||
cost.AddCost(2 * _price[PR_BUILD_ROAD]);
|
||||
break;
|
||||
|
||||
case ROADTYPES_ALL:
|
||||
|
|
|
@ -556,6 +556,8 @@ void ScriptList::Sort(SorterType sorter, bool ascending)
|
|||
|
||||
void ScriptList::AddList(ScriptList *list)
|
||||
{
|
||||
if (list == this) return;
|
||||
|
||||
ScriptListMap *list_items = &list->items;
|
||||
for (ScriptListMap::iterator iter = list_items->begin(); iter != list_items->end(); iter++) {
|
||||
this->AddItem((*iter).first);
|
||||
|
@ -565,6 +567,8 @@ void ScriptList::AddList(ScriptList *list)
|
|||
|
||||
void ScriptList::SwapList(ScriptList *list)
|
||||
{
|
||||
if (list == this) return;
|
||||
|
||||
this->items.swap(list->items);
|
||||
this->buckets.swap(list->buckets);
|
||||
Swap(this->sorter, list->sorter);
|
||||
|
@ -694,9 +698,13 @@ void ScriptList::RemoveList(ScriptList *list)
|
|||
{
|
||||
this->modifications++;
|
||||
|
||||
ScriptListMap *list_items = &list->items;
|
||||
for (ScriptListMap::iterator iter = list_items->begin(); iter != list_items->end(); iter++) {
|
||||
this->RemoveItem((*iter).first);
|
||||
if (list == this) {
|
||||
Clear();
|
||||
} else {
|
||||
ScriptListMap *list_items = &list->items;
|
||||
for (ScriptListMap::iterator iter = list_items->begin(); iter != list_items->end(); iter++) {
|
||||
this->RemoveItem((*iter).first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -756,14 +764,12 @@ void ScriptList::KeepBottom(int32 count)
|
|||
|
||||
void ScriptList::KeepList(ScriptList *list)
|
||||
{
|
||||
if (list == this) return;
|
||||
|
||||
this->modifications++;
|
||||
|
||||
ScriptList tmp;
|
||||
for (ScriptListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) {
|
||||
tmp.AddItem((*iter).first);
|
||||
tmp.SetValue((*iter).first, (*iter).second);
|
||||
}
|
||||
|
||||
tmp.AddList(this);
|
||||
tmp.RemoveList(list);
|
||||
this->RemoveList(&tmp);
|
||||
}
|
||||
|
|
|
@ -263,8 +263,6 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag
|
|||
cost.AddCost(ret);
|
||||
|
||||
/* lower tile */
|
||||
WaterClass wc_lower = IsWaterTile(tile - delta) ? GetWaterClass(tile - delta) : WATER_CLASS_CANAL;
|
||||
|
||||
if (!IsWaterTile(tile - delta)) {
|
||||
ret = DoCommand(tile - delta, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
||||
if (ret.Failed()) return ret;
|
||||
|
@ -274,10 +272,9 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag
|
|||
if (!IsTileFlat(tile - delta)) {
|
||||
return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
|
||||
}
|
||||
WaterClass wc_lower = IsWaterTile(tile - delta) ? GetWaterClass(tile - delta) : WATER_CLASS_CANAL;
|
||||
|
||||
/* upper tile */
|
||||
WaterClass wc_upper = IsWaterTile(tile + delta) ? GetWaterClass(tile + delta) : WATER_CLASS_CANAL;
|
||||
|
||||
if (!IsWaterTile(tile + delta)) {
|
||||
ret = DoCommand(tile + delta, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
||||
if (ret.Failed()) return ret;
|
||||
|
@ -287,6 +284,7 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag
|
|||
if (!IsTileFlat(tile + delta)) {
|
||||
return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
|
||||
}
|
||||
WaterClass wc_upper = IsWaterTile(tile + delta) ? GetWaterClass(tile + delta) : WATER_CLASS_CANAL;
|
||||
|
||||
if (IsBridgeAbove(tile) || IsBridgeAbove(tile - delta) || IsBridgeAbove(tile + delta)) {
|
||||
return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
||||
|
|
|
@ -2524,10 +2524,10 @@ void NWidgetLeaf::Draw(const Window *w)
|
|||
bool NWidgetLeaf::ButtonHit(const Point &pt)
|
||||
{
|
||||
if (_current_text_dir == TD_LTR) {
|
||||
int button_width = this->pos_x + this->current_x - 12;
|
||||
int button_width = this->pos_x + this->current_x - NWidgetLeaf::dropdown_dimension.width;
|
||||
return pt.x < button_width;
|
||||
} else {
|
||||
int button_left = this->pos_x + 12;
|
||||
int button_left = this->pos_x + NWidgetLeaf::dropdown_dimension.width;
|
||||
return pt.x >= button_left;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue