From 6cde48e49ffa5acce51a3a2c07dea3ead7ecc8b2 Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 10 Jul 2013 19:38:53 +0000 Subject: [PATCH] (svn r25582) [1.3] -Backport from trunk: - Fix: [Script] Documentation implied that XXList::AddItem has a default for value if it isn't filled in [FS#5638] (r25579, r25577) - Fix: Make content list appear faster (r25573) - Fix: Non-ICU layouter started new lines with the space which triggered the linebreak (r25568) - Fix: If the next order cannot be resolved, reset the current order property instead of leaving it in an intermediate state [FS#5633] (r25562) --- src/gfx_layout.cpp | 2 +- src/network/core/tcp_content.cpp | 22 +++++++++++++++++++++- src/order_cmd.cpp | 6 +++++- src/script/api/script_list.hpp | 9 ++++++--- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/gfx_layout.cpp b/src/gfx_layout.cpp index 114c5c3e65..84755ade80 100644 --- a/src/gfx_layout.cpp +++ b/src/gfx_layout.cpp @@ -355,7 +355,7 @@ ParagraphLayout::Line *ParagraphLayout::nextLine(int max_width) last_char = this->buffer; } else { /* A space is found; perfect place to terminate */ - this->buffer = last_space; + this->buffer = last_space + 1; last_char = last_space; } break; diff --git a/src/network/core/tcp_content.cpp b/src/network/core/tcp_content.cpp index 95b31fc9d2..164f8de3c3 100644 --- a/src/network/core/tcp_content.cpp +++ b/src/network/core/tcp_content.cpp @@ -192,8 +192,28 @@ bool NetworkContentSocketHandler::HandlePacket(Packet *p) */ void NetworkContentSocketHandler::ReceivePackets() { + /* + * We read only a few of the packets. This as receiving packets can be expensive + * due to the re-resolving of the parent/child relations and checking the toggle + * state of all bits. We cannot do this all in one go, as we want to show the + * user what we already received. Otherwise, it can take very long before any + * progress is shown to the end user that something has been received. + * It is also the case that we request extra content from the content server in + * case there is an unknown (in the content list) piece of content. These will + * come in after the main lists have been requested. As a result, we won't be + * getting everything reliably in one batch. Thus, we need to make subsequent + * updates in that case as well. + * + * As a result, we simple handle an arbitrary number of packets in one cycle, + * and let the rest be handled in subsequent cycles. These are ran, almost, + * immediately after this cycle so in speed it does not matter much, except + * that the user inferface will appear better responding. + * + * What arbitrary number to choose is the ultimate question though. + */ Packet *p; - while ((p = this->ReceivePacket()) != NULL) { + int i = 42; + while (--i != 0 && (p = this->ReceivePacket()) != NULL) { bool cont = this->HandlePacket(p); delete p; if (!cont) return; diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index e86e31900e..48bc4bc136 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -1906,7 +1906,11 @@ VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v) */ bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth, bool pbs_look_ahead) { - if (conditional_depth > v->GetNumOrders()) return false; + if (conditional_depth > v->GetNumOrders()) { + v->current_order.Free(); + v->dest_tile = 0; + return false; + } switch (order->GetType()) { case OT_GOTO_STATION: diff --git a/src/script/api/script_list.hpp b/src/script/api/script_list.hpp index 88b0d6f792..2117f959da 100644 --- a/src/script/api/script_list.hpp +++ b/src/script/api/script_list.hpp @@ -33,11 +33,11 @@ public: /** Sort ascending */ static const bool SORT_ASCENDING = true; - /** Sort descnding */ + /** Sort descending */ static const bool SORT_DESCENDING = false; private: - ScriptListSorter *sorter; ///< Sorting algorithm + ScriptListSorter *sorter; ///< Sorting algorithm SorterType sorter_type; ///< Sorting type bool sort_ascending; ///< Whether to sort ascending or descending bool initialized; ///< Whether an iteration has been started @@ -54,13 +54,16 @@ public: ScriptList(); ~ScriptList(); +#ifdef DOXYGEN_API /** * Add a single item to the list. * @param item the item to add. Should be unique, otherwise it is ignored. * @param value the value to assign. - * @note the value is set to 0 by default. */ + void AddItem(int32 item, int32 value); +#else void AddItem(int32 item, int32 value = 0); +#endif /* DOXYGEN_API */ /** * Remove a single item from the list.