summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-07-07 10:37:16 +0000
committerrubidium <rubidium@openttd.org>2013-07-07 10:37:16 +0000
commit51f0d11ee3a5cd7b31fcf575424e228d4e69eaa5 (patch)
treec8968cb6aa040f35f49806bc00f2c61102b976ee /src
parentd0eff986be39ba24cf83caf6e96de99416cb02a2 (diff)
downloadopenttd-51f0d11ee3a5cd7b31fcf575424e228d4e69eaa5.tar.xz
(svn r25573) -Change: make content list appear faster by allowing some window redraws in between
Diffstat (limited to 'src')
-rw-r--r--src/lang/slovak.txt2
-rw-r--r--src/network/core/tcp_content.cpp22
2 files changed, 22 insertions, 2 deletions
diff --git a/src/lang/slovak.txt b/src/lang/slovak.txt
index 1c207c717..be5b7a9e0 100644
--- a/src/lang/slovak.txt
+++ b/src/lang/slovak.txt
@@ -1634,7 +1634,7 @@ STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Priemerná veľ
STR_CONFIG_SETTING_MODIFIED_ROAD_REBUILD :Pri rekonštrukcii ciest odstrániť nezmyselné časti: {STRING}
STR_CONFIG_SETTING_MODIFIED_ROAD_REBUILD_HELPTEXT :Odstráň "mŕtve" konce ciest počas financovanej rekonštrukcie ciest.
-STR_CONFIG_SETTING_LINKGRAPH_INTERVAL :Aktualizovať distribučný graf každ{P "ý" "é" "ých"} {STRING} {P "deň" "dni" "dní"}
+STR_CONFIG_SETTING_LINKGRAPH_INTERVAL :Aktualizovať distribučný graf každ{P 0:2 "ý" "é" "ých"} {STRING} {P 0:2 "deň" "dni" "dní"}
STR_CONFIG_SETTING_LINKGRAPH_INTERVAL_HELPTEXT :Čas medzi nasledujúcimi prepočtami grafu spojení. Každý prepočet počíta plány pre jednu súčasť grafu. To znamená, že hodnota X pre toto nastavenie neznamená sa celý graf aktualizuje každých X dní, ale iba jedna súčasť. Čím menej nastavíte, tým viac procesorového času bude potrebného na výpočet. Čím viac nastavíte, tým dlhšie bude trvať, kým sa začne distribuovať na nové trasy.
STR_CONFIG_SETTING_LINKGRAPH_TIME :Použiť {STRING} {P "deň" "dni" "dní"} na prepočítanie distribučného grafu
STR_CONFIG_SETTING_LINKGRAPH_TIME_HELPTEXT :Čas potrebný pre každé prepočítanie grafu spojov. Pri štarte prepočtu je vytvorené vlákno, ktoré môže bežať uvedený počet dní. Čím menej nastavíte, tým je pravdepodobnejšie, že vlákno nestihne skončiť, kým je to možné. Potom sa hra na nejaký čas zasekne. Čím viac nastavíte, tým dlhšie trvá aktualizácia rozdelenia po zmene trasy.
diff --git a/src/network/core/tcp_content.cpp b/src/network/core/tcp_content.cpp
index 95b31fc9d..164f8de3c 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;