From 7e915f8bc7c3901d043c2e06e84f4ee519345a12 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Sun, 2 Apr 2017 17:36:53 +0000 Subject: [PATCH 1/6] (svn r27841) -Fix: Don't consider locks or ship depots as clear water when placing industries. --- src/industry_cmd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 5971964fd7..8fea6953ae 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1383,7 +1383,7 @@ static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTil } if (gfx == GFX_WATERTILE_SPECIALCHECK) { - if (!IsTileType(cur_tile, MP_WATER) || + if (!IsWaterTile(cur_tile) || !IsTileFlat(cur_tile)) { return_cmd_error(STR_ERROR_SITE_UNSUITABLE); } From e37d54fb083bb10d027b67cb3c1a14da3a46a416 Mon Sep 17 00:00:00 2001 From: translators Date: Mon, 3 Apr 2017 17:45:36 +0000 Subject: [PATCH 2/6] (svn r27842) -Update from Eints: spanish: 9 changes by SilverSurferZzZ --- src/lang/spanish.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lang/spanish.txt b/src/lang/spanish.txt index 7cffa0d740..60394841b8 100644 --- a/src/lang/spanish.txt +++ b/src/lang/spanish.txt @@ -1762,7 +1762,7 @@ STR_INTRO_TOOLTIP_ONLINE_CONTENT :{BLACK}Comproba STR_INTRO_TOOLTIP_SCRIPT_SETTINGS :{BLACK}Mostrar configuración de scripts de juego e IAs STR_INTRO_TOOLTIP_QUIT :{BLACK}Salir de 'OpenTTD' -STR_INTRO_TRANSLATION :{BLACK}A esta traducción le faltan {NUM} cadena{P "" s}. Considera ayudar a mejorar OpenTTD convirtiéndote en traductor. Consulta readme.txt para más detalles. +STR_INTRO_TRANSLATION :{BLACK}A esta traducción le faltan {NUM} cadena{P "" s} de texto. Considera ayudar a mejorar OpenTTD convirtiéndote en traductor. Consulta el readme.txt para más detalles. # Quit window STR_QUIT_CAPTION :{WHITE}Salir @@ -2261,7 +2261,7 @@ STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE :{WHITE}... no s STR_CONTENT_ERROR_COULD_NOT_EXTRACT :{WHITE}No ha sido posible descomprimir el archivo descargado STR_MISSING_GRAPHICS_SET_CAPTION :{WHITE}Gráficos no encontrados -STR_MISSING_GRAPHICS_SET_MESSAGE :{BLACK}OpenTTD necesita gráficos para funcionar pero no se pudo encontrar ninguno. ¿Desea permitir que OpenTTD descargue e instale dichos gráficos? +STR_MISSING_GRAPHICS_SET_MESSAGE :{BLACK}OpenTTD necesita gráficos para funcionar pero no pudo encontrarse ninguno. ¿Desea permitir que OpenTTD descargue e instale dichos gráficos? STR_MISSING_GRAPHICS_YES_DOWNLOAD :{BLACK}Sí, descargar los gráficos STR_MISSING_GRAPHICS_NO_QUIT :{BLACK}No, salir de OpenTTD @@ -2898,7 +2898,7 @@ STR_NEWGRF_ERROR_UNSET_SWITCH :{1:STRING} est STR_NEWGRF_ERROR_INVALID_PARAMETER :Parámetro incorrecto para {1:STRING}: párametro {STRING} ({NUM}) STR_NEWGRF_ERROR_LOAD_BEFORE :{1:STRING} debe ser cargado antes de {STRING} STR_NEWGRF_ERROR_LOAD_AFTER :{1:STRING} debe ser cargado después de {STRING} -STR_NEWGRF_ERROR_OTTD_VERSION_NUMBER :{1:STRING} requiere OpenTTD versión {STRING} ó superior +STR_NEWGRF_ERROR_OTTD_VERSION_NUMBER :{1:STRING} necesita la versión {STRING} ó superior de OpenTTD STR_NEWGRF_ERROR_AFTER_TRANSLATED_FILE :El archivo GRF ha sido diseñado para ser traducido STR_NEWGRF_ERROR_TOO_MANY_NEWGRFS_LOADED :Demasiados NewGRFs han sido cargados STR_NEWGRF_ERROR_STATIC_GRF_CAUSES_DESYNC :Cargar {1:STRING} como NewGRF estático con {STRING} puede causar desincronizaciones @@ -3290,10 +3290,12 @@ STR_INDUSTRY_VIEW_INDUSTRY_ANNOUNCED_CLOSURE :{YELLOW}La indu ############ range for requires starts STR_INDUSTRY_VIEW_REQUIRES_CARGO :{BLACK}Requiere: {YELLOW}{STRING}{STRING} -STR_INDUSTRY_VIEW_REQUIRES_CARGO_CARGO :{BLACK}Requiere: {YELLOW}{STRING}{STRING}, {STRING}{STRING} +STR_INDUSTRY_VIEW_REQUIRES_CARGO_CARGO :{BLACK}Necesita: {YELLOW}{STRING}{STRING}, {STRING}{STRING} STR_INDUSTRY_VIEW_REQUIRES_CARGO_CARGO_CARGO :{BLACK}Requiere: {YELLOW}{STRING}{STRING}, {STRING}{STRING}, {STRING}{STRING} ############ range for requires ends +STR_INDUSTRY_VIEW_REQUIRES :{BLACK}Necesita +STR_INDUSTRY_VIEW_ACCEPT_CARGO_AMOUNT :{YELLOW}{CARGO_LONG} {BLACK}esperando ############ range for produces starts STR_INDUSTRY_VIEW_PRODUCES_CARGO :{BLACK}Produce: {YELLOW}{STRING}{STRING} @@ -3362,6 +3364,7 @@ STR_GROUP_REMOVE_ALL_VEHICLES :Quitar todos lo STR_GROUP_RENAME_CAPTION :{BLACK}Renombrar un grupo +STR_GROUP_OCCUPANCY_VALUE :{NUM}% # Build vehicle window STR_BUY_VEHICLE_TRAIN_RAIL_CAPTION :Nuevos Vehículos de Ferrocarril @@ -3811,7 +3814,7 @@ STR_ORDER_GO_TO_NEAREST_DEPOT :Ir al depósito STR_ORDER_GO_TO_NEAREST_HANGAR :Ir al hangar más cercano STR_ORDER_CONDITIONAL :Salto de orden condicional STR_ORDER_SHARE :Compartir órdenes -STR_ORDERS_GO_TO_TOOLTIP :{BLACK}Añadir nueva orden antes de la orden resaltada, o añadirla al final de la lista. Ctrl sobre estaciones ordena 'Carga completa cualquier carga', sobre puntos de ruta ordena 'sin paradas' y sobre depósitos ordena 'mantenimiento'. Ctrl o Compartir órdenes permite a este vehículo compartir órdenes con el vehículo seleccionado. Click sobre un vehículo copia las órdenes. Una órden de depósito desactiva el mantenimiento automático del vehículo +STR_ORDERS_GO_TO_TOOLTIP :{BLACK}Añadir nueva orden antes de la orden resaltada, o añadirla al final de la lista. Ctrl sobre estaciones ordena 'Carga completa de cualquier carga', sobre puntos de ruta ordena 'sin paradas' y sobre depósitos ordena 'mantenimiento'. Ctrl o Compartir órdenes permite a este vehículo compartir órdenes con el vehículo seleccionado. Click sobre un vehículo copia las órdenes. Una órden de depósito desactiva el mantenimiento automático del vehículo STR_ORDERS_VEH_WITH_SHARED_ORDERS_LIST_TOOLTIP :{BLACK}Ver todos los vehículos con el mismo calendario @@ -4108,7 +4111,7 @@ STR_ERROR_MESSAGE_CAPTION_OTHER_COMPANY :{YELLOW}Mensaje # Generic construction errors STR_ERROR_OFF_EDGE_OF_MAP :{WHITE}Fuera del borde del mapa STR_ERROR_TOO_CLOSE_TO_EDGE_OF_MAP :{WHITE}Demasiado cerca del borde del mapa -STR_ERROR_NOT_ENOUGH_CASH_REQUIRES_CURRENCY :{WHITE}No hay suficiente dinero - se requiere {CURRENCY_LONG} +STR_ERROR_NOT_ENOUGH_CASH_REQUIRES_CURRENCY :{WHITE}No hay suficiente dinero - se necesita {CURRENCY_LONG} STR_ERROR_FLAT_LAND_REQUIRED :{WHITE}Se requiere terreno llano STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION :{WHITE}Tierra inclinada en dirección errónea STR_ERROR_CAN_T_DO_THIS :{WHITE}No se puede hacer eso... From 4b637781162ecfac36d68a12161ccc07f81e82e4 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Mon, 3 Apr 2017 21:37:01 +0000 Subject: [PATCH 3/6] (svn r27843) -Change: (Yapf) Consider depot as destination before reversing path and applying penalty. --- src/pathfinder/yapf/yapf_costrail.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pathfinder/yapf/yapf_costrail.hpp b/src/pathfinder/yapf/yapf_costrail.hpp index 64cf963800..f8047955c3 100644 --- a/src/pathfinder/yapf/yapf_costrail.hpp +++ b/src/pathfinder/yapf/yapf_costrail.hpp @@ -403,6 +403,8 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th /* Penalty for reversing in a depot. */ assert(IsRailDepot(cur.tile)); segment_cost += Yapf().PfGetSettings().rail_depot_reverse_penalty; + + } else if (IsRailDepotTile(cur.tile)) { /* We will end in this pass (depot is possible target) */ end_segment_reason |= ESRB_DEPOT; From 95acc016bad47b009454ea26ab9bf2e3c0ff52f3 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Mon, 3 Apr 2017 21:53:51 +0000 Subject: [PATCH 4/6] (svn r27844) -Change: (Yapf) Treat max cost exceeded separately from path too long condition, as destination should not be considered in the former case. --- src/pathfinder/yapf/yapf_costrail.hpp | 5 ++++- src/pathfinder/yapf/yapf_type.hpp | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pathfinder/yapf/yapf_costrail.hpp b/src/pathfinder/yapf/yapf_costrail.hpp index f8047955c3..d9d89b12fa 100644 --- a/src/pathfinder/yapf/yapf_costrail.hpp +++ b/src/pathfinder/yapf/yapf_costrail.hpp @@ -479,7 +479,7 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th /* Finish if we already exceeded the maximum path cost (i.e. when * searching for the nearest depot). */ if (m_max_cost > 0 && (parent_cost + segment_entry_cost + segment_cost) > m_max_cost) { - end_segment_reason |= ESRB_PATH_TOO_LONG; + end_segment_reason |= ESRB_MAX_COST_EXCEEDED; } /* Move to the next tile/trackdir. */ @@ -555,6 +555,9 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th } // for (;;) + /* Don't consider path any further it if exceeded max_cost. */ + if (end_segment_reason & ESRB_MAX_COST_EXCEEDED) return false; + bool target_seen = false; if ((end_segment_reason & ESRB_POSSIBLE_TARGET) != ESRB_NONE) { /* Depot, station or waypoint. */ diff --git a/src/pathfinder/yapf/yapf_type.hpp b/src/pathfinder/yapf/yapf_type.hpp index 8d24eee5e2..b0d99d6602 100644 --- a/src/pathfinder/yapf/yapf_type.hpp +++ b/src/pathfinder/yapf/yapf_type.hpp @@ -19,6 +19,7 @@ enum EndSegmentReason { ESR_RAIL_TYPE, ///< the next tile has a different rail type than our tiles ESR_INFINITE_LOOP, ///< infinite loop detected ESR_SEGMENT_TOO_LONG, ///< the segment is too long (possible infinite loop) + ESR_MAX_COST_EXCEEDED, ///< maximum cost is exceeded ESR_CHOICE_FOLLOWS, ///< the next tile contains a choice (the track splits to more than one segments) ESR_DEPOT, ///< stop in the depot (could be a target next time) ESR_WAYPOINT, ///< waypoint encountered (could be a target next time) @@ -43,6 +44,7 @@ enum EndSegmentReasonBits { ESRB_RAIL_TYPE = 1 << ESR_RAIL_TYPE, ESRB_INFINITE_LOOP = 1 << ESR_INFINITE_LOOP, ESRB_SEGMENT_TOO_LONG = 1 << ESR_SEGMENT_TOO_LONG, + ESRB_MAX_COST_EXCEEDED = 1 << ESR_MAX_COST_EXCEEDED, ESRB_CHOICE_FOLLOWS = 1 << ESR_CHOICE_FOLLOWS, ESRB_DEPOT = 1 << ESR_DEPOT, ESRB_WAYPOINT = 1 << ESR_WAYPOINT, @@ -63,7 +65,7 @@ enum EndSegmentReasonBits { ESRB_CACHED_MASK = ESRB_DEAD_END | ESRB_RAIL_TYPE | ESRB_INFINITE_LOOP | ESRB_SEGMENT_TOO_LONG | ESRB_CHOICE_FOLLOWS | ESRB_DEPOT | ESRB_WAYPOINT | ESRB_STATION | ESRB_SAFE_TILE, /* Reasons to abort pathfinding in this direction. */ - ESRB_ABORT_PF_MASK = ESRB_DEAD_END | ESRB_PATH_TOO_LONG | ESRB_INFINITE_LOOP | ESRB_FIRST_TWO_WAY_RED, + ESRB_ABORT_PF_MASK = ESRB_DEAD_END | ESRB_PATH_TOO_LONG | ESRB_MAX_COST_EXCEEDED | ESRB_INFINITE_LOOP | ESRB_FIRST_TWO_WAY_RED, }; DECLARE_ENUM_AS_BIT_SET(EndSegmentReasonBits) @@ -71,7 +73,7 @@ DECLARE_ENUM_AS_BIT_SET(EndSegmentReasonBits) inline CStrA ValueStr(EndSegmentReasonBits bits) { static const char * const end_segment_reason_names[] = { - "DEAD_END", "RAIL_TYPE", "INFINITE_LOOP", "SEGMENT_TOO_LONG", "CHOICE_FOLLOWS", + "DEAD_END", "RAIL_TYPE", "INFINITE_LOOP", "SEGMENT_TOO_LONG", "MAX_COST_EXCEEDED", "CHOICE_FOLLOWS", "DEPOT", "WAYPOINT", "STATION", "SAFE_TILE", "PATH_TOO_LONG", "FIRST_TWO_WAY_RED", "LOOK_AHEAD_END", "TARGET_REACHED" }; From df5923d7989d2efc7a7a7e1c400d25fca6aeac5d Mon Sep 17 00:00:00 2001 From: peter1138 Date: Mon, 3 Apr 2017 22:02:28 +0000 Subject: [PATCH 5/6] (svn r27845) -Change: (Yapf) Use FindDepotData struct to simplify depot finding code and remove need to return fake path distance. (juanjo) --- src/pathfinder/yapf/yapf_rail.cpp | 35 ++++++++++++------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/src/pathfinder/yapf/yapf_rail.cpp b/src/pathfinder/yapf/yapf_rail.cpp index 5324e4fc87..dccee36860 100644 --- a/src/pathfinder/yapf/yapf_rail.cpp +++ b/src/pathfinder/yapf/yapf_rail.cpp @@ -223,7 +223,7 @@ public: return 't'; } - static bool stFindNearestDepotTwoWay(const Train *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_penalty, int reverse_penalty, TileIndex *depot_tile, bool *reversed) + static FindDepotData stFindNearestDepotTwoWay(const Train *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_penalty, int reverse_penalty) { Tpf pf1; /* @@ -236,16 +236,16 @@ public: * depot orders and you do not disable automatic servicing. */ if (max_penalty != 0) pf1.DisableCache(true); - bool result1 = pf1.FindNearestDepotTwoWay(v, t1, td1, t2, td2, max_penalty, reverse_penalty, depot_tile, reversed); + FindDepotData result1 = pf1.FindNearestDepotTwoWay(v, t1, td1, t2, td2, max_penalty, reverse_penalty); if (_debug_desync_level >= 2) { Tpf pf2; - TileIndex depot_tile2 = INVALID_TILE; - bool reversed2 = false; pf2.DisableCache(true); - bool result2 = pf2.FindNearestDepotTwoWay(v, t1, td1, t2, td2, max_penalty, reverse_penalty, &depot_tile2, &reversed2); - if (result1 != result2 || (result1 && (*depot_tile != depot_tile2 || *reversed != reversed2))) { - DEBUG(desync, 2, "CACHE ERROR: FindNearestDepotTwoWay() = [%s, %s]", result1 ? "T" : "F", result2 ? "T" : "F"); + FindDepotData result2 = pf2.FindNearestDepotTwoWay(v, t1, td1, t2, td2, max_penalty, reverse_penalty); + if (result1.tile != result2.tile || (result1.reverse != result2.reverse)) { + DEBUG(desync, 2, "CACHE ERROR: FindNearestDepotTwoWay() = [%s, %s]", + result1.tile != INVALID_TILE ? "T" : "F", + result2.tile != INVALID_TILE ? "T" : "F"); DumpState(pf1, pf2); } } @@ -253,7 +253,7 @@ public: return result1; } - inline bool FindNearestDepotTwoWay(const Train *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_penalty, int reverse_penalty, TileIndex *depot_tile, bool *reversed) + inline FindDepotData FindNearestDepotTwoWay(const Train *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_penalty, int reverse_penalty) { /* set origin and destination nodes */ Yapf().SetOrigin(t1, td1, t2, td2, reverse_penalty, true); @@ -261,13 +261,10 @@ public: Yapf().SetMaxCost(max_penalty); /* find the best path */ - bool bFound = Yapf().FindPath(v); - if (!bFound) return false; + if (!Yapf().FindPath(v)) return FindDepotData(); - /* some path found - * get found depot tile */ + /* Some path found. */ Node *n = Yapf().GetBestNode(); - *depot_tile = n->GetLastTile(); /* walk through the path back to the origin */ Node *pNode = n; @@ -277,9 +274,7 @@ public: /* if the origin node is our front vehicle tile/Trackdir then we didn't reverse * but we can also look at the cost (== 0 -> not reversed, == reverse_penalty -> reversed) */ - *reversed = (pNode->m_cost != 0); - - return true; + return FindDepotData(n->GetLastTile(), n->m_cost, pNode->m_cost != 0); } }; @@ -611,15 +606,13 @@ bool YapfTrainCheckReverse(const Train *v) FindDepotData YapfTrainFindNearestDepot(const Train *v, int max_penalty) { - FindDepotData fdd; - const Train *last_veh = v->Last(); PBSTileInfo origin = FollowTrainReservation(v); TileIndex last_tile = last_veh->tile; Trackdir td_rev = ReverseTrackdir(last_veh->GetVehicleTrackdir()); - typedef bool (*PfnFindNearestDepotTwoWay)(const Train*, TileIndex, Trackdir, TileIndex, Trackdir, int, int, TileIndex*, bool*); + typedef FindDepotData (*PfnFindNearestDepotTwoWay)(const Train*, TileIndex, Trackdir, TileIndex, Trackdir, int, int); PfnFindNearestDepotTwoWay pfnFindNearestDepotTwoWay = &CYapfAnyDepotRail1::stFindNearestDepotTwoWay; /* check if non-default YAPF type needed */ @@ -627,9 +620,7 @@ FindDepotData YapfTrainFindNearestDepot(const Train *v, int max_penalty) pfnFindNearestDepotTwoWay = &CYapfAnyDepotRail2::stFindNearestDepotTwoWay; // Trackdir, forbid 90-deg } - bool ret = pfnFindNearestDepotTwoWay(v, origin.tile, origin.trackdir, last_tile, td_rev, max_penalty, YAPF_INFINITE_PENALTY, &fdd.tile, &fdd.reverse); - fdd.best_length = ret ? max_penalty / 2 : UINT_MAX; // some fake distance or NOT_FOUND - return fdd; + return pfnFindNearestDepotTwoWay(v, origin.tile, origin.trackdir, last_tile, td_rev, max_penalty, YAPF_INFINITE_PENALTY); } bool YapfTrainFindNearestSafeTile(const Train *v, TileIndex tile, Trackdir td, bool override_railtype) From 2e52de3406f76acdba8b286557bc5cf66971120a Mon Sep 17 00:00:00 2001 From: peter1138 Date: Tue, 4 Apr 2017 00:00:43 +0000 Subject: [PATCH 6/6] (svn r27846) -Fix [FS#5926]: Infinite loop in pathfinder when checking safe waiting position from a waypoint. --- src/pathfinder/yapf/yapf_costrail.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pathfinder/yapf/yapf_costrail.hpp b/src/pathfinder/yapf/yapf_costrail.hpp index d9d89b12fa..22103987ad 100644 --- a/src/pathfinder/yapf/yapf_costrail.hpp +++ b/src/pathfinder/yapf/yapf_costrail.hpp @@ -418,9 +418,16 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th CFollowTrackRail ft(v); TileIndex t = cur.tile; Trackdir td = cur.td; + /* Arbitrary maximum tiles to follow to avoid infinite loops. */ + uint max_tiles = 20; while (ft.Follow(t, td)) { assert(t != ft.m_new_tile); t = ft.m_new_tile; + if (t == cur.tile || --max_tiles == 0) { + /* We looped back on ourself or found another loop, bail out. */ + td = INVALID_TRACKDIR; + break; + } if (KillFirstBit(ft.m_new_td_bits) != TRACKDIR_BIT_NONE) { /* We encountered a junction; it's going to be too complex to * handle this perfectly, so just bail out. There is no simple