# This file is part of the Colobot: Gold Edition source code # Copyright (C) 2001-2016, Daniel Roux, EPSITEC SA & TerranovaTeam # This file is distributed under the same license as the Colobot package. # next_ghost , 2018. msgid "" msgstr "" "Project-Id-Version: 0.1.11\n" "POT-Creation-Date: DATE\n" "PO-Revision-Date: 2018-03-31 13:39+02\n" "Last-Translator: next_ghost \n" "Language-Team: Czech \n" "Language: Czech\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=((n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2);\n" "X-Language: cs_CZ\n" "X-Source-Language: en_US\n" #. type: Title-text #: ../scene.txt:1 #, no-wrap msgid "Remote control #4" msgstr "Dálkové ovládání #4" #. type: Resume-text #: ../scene.txt:2 #, no-wrap msgid "Remote control a bot without using an information exchange post by defining a class for the orders." msgstr "Ovládejte robota na dálku bez použití komunikační stanice. Pro předání povelů definujte třídu." #. type: ScriptName-text #: ../scene.txt:3 #, no-wrap msgid "Remote4" msgstr "Ovladac4" #. type: \b; header #: ../help/help.E.txt:1 #, no-wrap msgid "Exercise" msgstr "Cvičení" #. type: Plain text #: ../help/help.E.txt:2 #, no-wrap msgid "Remote control a slave robot without using an information exchange post. The robot should pass over the 6 blue crosses. You must use a static variable to pass the orders to the slave bot." msgstr "Ovládejte na dálku jiného robota bez použití komunikační stanice. Robot má za úkol přejet přes 6 modrých křížků. Pro předání povelů dělníkovi musíte použít proměnnou deklarovanou jako static." #. type: Bullet: '1)' #: ../help/help.E.txt:5 #, no-wrap msgid "The wheeled grabber without an energy pack and therefore immobile. This is the master you should program so it will transmit orders to the slave." msgstr "Pojízdné rameno bez baterie, tím pádem nepojízdné. To je velitel, kterého musíte naprogramovat, aby předával povely dělníkovi." #. type: Bullet: '2)' #: ../help/help.E.txt:6 #, no-wrap msgid "The slave practice bot which is already programmed and just waits for orders from the master." msgstr "Cvičný robot, který už je naprogramovaný a jen čeká na povely od velitele." #. type: \b; header #: ../help/help.E.txt:8 #, no-wrap msgid "The slave" msgstr "Dělník" #. type: Plain text #: ../help/help.E.txt:9 #, no-wrap msgid "First of all we must understand how the program of the slave works. The class order contains two members: m_type is the order to execute (move or turn) and m_param is the distance to move or the rotation angle:" msgstr "Nejprve si musíme vysvětlit, jak funguje program dělníka. Třída order obsahuje dva atributy: m_type určuje příkaz, který se má provést (move nebo turn) a m_param určuje délku jízdy nebo úhel otočení:" #. type: Plain text #: ../help/help.E.txt:11 #, no-wrap msgid "public class order" msgstr "public class order" #. type: Source code #: ../help/help.E.txt:12 #, no-wrap msgid "" "{\n" "\tint m_type = nan;\n" "\tfloat m_param;\n" "}" msgstr "" "{\n" "\tint m_type = nan;\n" "\tfloat m_param;\n" "}" #. type: Plain text #: ../help/help.E.txt:17 #, no-wrap msgid "A second class exchange contains the mechanism for exchanging the orders. We declare a static class member m_order which will contain the order to be executed. The word static insures that the member m_order is shared between all instances of the class exchange." msgstr "Další třída exchange poskytuje mechanismus pro předávání povelů. V ní je deklarovaný statický atribut m_order, kam budeme povely ukládat. Klíčové slovo static znamená, že všechny instance třídy exchange budou atribut m_order sdílet mezi sebou." #. type: Plain text #: ../help/help.E.txt:19 #, no-wrap msgid "public class exchange" msgstr "public class exchange" #. type: Source code #: ../help/help.E.txt:20 #, no-wrap msgid "" "{\n" "\tstatic private order m_order = new order;" msgstr "" "{\n" "\tstatic private order m_order = new order;" #. type: Plain text #: ../help/help.E.txt:23 #, no-wrap msgid "The put method will be used by the master robot for transmitting an order. As long as m_order is different from nan, the slave has not finished the order and the put method will return false and will do nothing:" msgstr "Velitel bude pro předání povelu volat metodu put. Pokud atribut m_order neobsahuje hodnotu nan, dělník ještě nedokončil předchozí příkaz, takže metoda put vrátí hodnotu false a nebude nic dělat:" #. type: Plain text #: ../help/help.E.txt:25 #, no-wrap msgid "\tsynchronized bool put(order a)" msgstr "\tsynchronized bool put(order a)" #. type: Source code #: ../help/help.E.txt:26 #, no-wrap msgid "" "\t{\n" "\t\tif ( m_order.m_type == nan )\n" "\t\t{\n" "\t\t\tm_order = a;\n" "\t\t\treturn true;\n" "\t\t}\n" "\t\telse\n" "\t\t{\n" "\t\t\treturn false;\n" "\t\t}\n" "\t}" msgstr "" "\t{\n" "\t\tif ( m_order.m_type == nan )\n" "\t\t{\n" "\t\t\tm_order = a;\n" "\t\t\treturn true;\n" "\t\t}\n" "\t\telse\n" "\t\t{\n" "\t\t\treturn false;\n" "\t\t}\n" "\t}" #. type: Plain text #: ../help/help.E.txt:38 #, no-wrap msgid "Another method get will be used by the slave to retrieve the orders. This method returns the order to be executed:" msgstr "Dělník si pak povely přečte pomocí metody get. Tato metoda vrátí povel, který se má provést:" #. type: Plain text #: ../help/help.E.txt:40 #, no-wrap msgid "\tsynchronized order get()" msgstr "\tsynchronized order get()" #. type: Source code #: ../help/help.E.txt:41 #, no-wrap msgid "" "\t{\n" "\t\treturn m_order;\n" "\t}" msgstr "" "\t{\n" "\t\treturn m_order;\n" "\t}" #. type: Plain text #: ../help/help.E.txt:45 #, no-wrap msgid "A third method delete will be used by the slave to indicate that the order has been executed:" msgstr "Dělník nakonec oznámí splnění povelu metodou delete:" #. type: Plain text #: ../help/help.E.txt:47 #, no-wrap msgid "\tsynchronized void delete()" msgstr "\tsynchronized void delete()" #. type: Source code #: ../help/help.E.txt:48 #, no-wrap msgid "" "\t{\n" "\t\tm_order.m_type = nan;\n" "\t}\n" "}" msgstr "" "\t{\n" "\t\tm_order.m_type = nan;\n" "\t}\n" "}" #. type: Plain text #: ../help/help.E.txt:53 #, no-wrap msgid "The main program of the slave contains an instance of the class exchange called list. We put () after the word list in order to create an instance of the class exchange." msgstr "Hlavní program dělníka obsahuje instanci třídy exchange nazvanou list. Závorky za slovem list znamenají, že vytváříme instanci třídy exchange." #. type: Plain text #: ../help/help.E.txt:55 #, no-wrap msgid "extern void object::Slave3( )" msgstr "extern void object::Slave3( )" #. type: Source code #: ../help/help.E.txt:56 #, no-wrap msgid "" "{\n" "\texchange list();\n" "\torder todo;" msgstr "" "{\n" "\texchange list();\n" "\torder todo;" #. type: Plain text #: ../help/help.E.txt:60 #, no-wrap msgid "The outer while loop lasts for ever. The inner while loop waits for an order by using the get method of the exchange class. As soon as get returns a value different from nan, the while loop stops." msgstr "Vnější cyklus while se opakuje donekonečna. Vnitřní cyklus while čeká na povel a stále volá metodu get třídy exchange. Když metoda get vrátí jinou hodnotu než nan, vnitřní cyklus skončí." #. type: Plain text #: ../help/help.E.txt:62 #, no-wrap msgid "\twhile ( true )" msgstr "\twhile ( true )" #. type: Source code #: ../help/help.E.txt:63 #, no-wrap msgid "" "\t{\n" "\t\twhile ( true )\n" "\t\t{\n" "\t\t\ttodo = list.get();\n" "\t\t\tif ( todo.m_type != nan ) break;\n" "\t\t\twait(1);\n" "\t\t}" msgstr "" "\t{\n" "\t\twhile ( true )\n" "\t\t{\n" "\t\t\ttodo = list.get();\n" "\t\t\tif ( todo.m_type != nan ) break;\n" "\t\t\twait(1);\n" "\t\t}" #. type: Plain text #: ../help/help.E.txt:71 #, no-wrap msgid "Now we have received the order in the todo variable. All we have to do is execute it:" msgstr "Když máme povel uložený v proměnné todo, zbývá ho jen provést:" #. type: Plain text #: ../help/help.E.txt:73 #, no-wrap msgid "\t\tif ( todo.m_type == 1 )" msgstr "\t\tif ( todo.m_type == 1 )" #. type: Source code #: ../help/help.E.txt:74 #, no-wrap msgid "" "\t\t{\n" "\t\t\tmove(todo.m_param);\n" "\t\t}\n" "\t\telse if ( todo.m_type == 2 )\n" "\t\t{\n" "\t\t\tturn(todo.m_param);\n" "\t\t}\n" "\t\telse\n" "\t\t{\n" "\t\t\tmessage(\"Unknown order\");\n" "\t\t}" msgstr "" "\t\t{\n" "\t\t\tmove(todo.m_param);\n" "\t\t}\n" "\t\telse if ( todo.m_type == 2 )\n" "\t\t{\n" "\t\t\tturn(todo.m_param);\n" "\t\t}\n" "\t\telse\n" "\t\t{\n" "\t\t\tmessage(\"Unknown order\");\n" "\t\t}" #. type: Plain text #: ../help/help.E.txt:86 #, no-wrap msgid "As soon as the execution of the order is finished, we must call the delete method so the master knows that another order can be sent:" msgstr "Po splnění povelu ještě musíme zavolat metodu delete, aby velitel věděl, že může poslat další povel:" #. type: Plain text #: ../help/help.E.txt:88 #, no-wrap msgid "\t\tlist.delete();" msgstr "\t\tlist.delete();" #. type: Source code #: ../help/help.E.txt:89 #, no-wrap msgid "" "\t}\n" "}" msgstr "" "\t}\n" "}" #. type: \b; header #: ../help/help.E.txt:92 #, no-wrap msgid "The master" msgstr "Velitel" #. type: Plain text #: ../help/help.E.txt:93 #, no-wrap msgid "In the master we write an function called SendOrder which will send an order to the slave:" msgstr "Pro velitele napíšeme funkci SendOrder, která pošle povel dělníkovi:" #. type: Plain text #: ../help/help.E.txt:95 #, no-wrap msgid "void object::SendOrder(float order, float param)" msgstr "void object::SendOrder(float order, float param)" #. type: Source code #: ../help/help.E.txt:96 #, no-wrap msgid "" "{\n" "\texchange list();\n" "\torder todo();\n" "\t\n" "\ttodo.m_type = order;\n" "\ttodo.m_param = param;\n" "\t\n" "\twhile ( list.put(todo) == false )\n" "\t{\n" "\t\twait(1);\n" "\t}\n" "}" msgstr "" "{\n" "\texchange list();\n" "\torder todo();\n" "\t\n" "\ttodo.m_type = order;\n" "\ttodo.m_param = param;\n" "\t\n" "\twhile ( list.put(todo) == false )\n" "\t{\n" "\t\twait(1);\n" "\t}\n" "}" #. type: Plain text #: ../help/help.E.txt:109 #, no-wrap msgid "" "The while loop waits until a pending order has been terminated, that is the slaved has exited from the get method and the delete method has been called.\n" "Now the main program of the master is very simple:" msgstr "" "Cyklus while bude čekat na přijetí předchozího povelu, tedy dokud dělník nedokončí volání metody get a následně nezavolá metodu delete.\n" "Dál už bude hlavní program velitele celkem jednoduchý:" #. type: Plain text #: ../help/help.E.txt:112 #, no-wrap msgid "extern void object::Remote4( )" msgstr "extern void object::Ovladac4( )" #. type: Source code #: ../help/help.E.txt:113 #, no-wrap msgid "" "{\n" "\tSendOrder(1, 20); // move(20);\n" "\tSendOrder(2, 90); // turn(90);\n" "\tSendOrder(1, 20); // move(20);\n" "\tSendOrder(2, 90); // turn(90);\n" "\tSendOrder(1, 10); // move(10);\n" "\tSendOrder(2, 90); // turn(90);\n" "\tSendOrder(1, 10); // move(10);\n" "\tSendOrder(2,-90); // turn(-90);\n" "\tSendOrder(1, 10); // move(10);\n" "}" msgstr "" "{\n" "\tSendOrder(1, 20); // move(20);\n" "\tSendOrder(2, 90); // turn(90);\n" "\tSendOrder(1, 20); // move(20);\n" "\tSendOrder(2, 90); // turn(90);\n" "\tSendOrder(1, 10); // move(10);\n" "\tSendOrder(2, 90); // turn(90);\n" "\tSendOrder(1, 10); // move(10);\n" "\tSendOrder(2,-90); // turn(-90);\n" "\tSendOrder(1, 10); // move(10);\n" "}" #. type: Plain text #: ../help/help.E.txt:125 #, no-wrap msgid " show these instruction at any time." msgstr "Tyto instrukce si můžete kdykoliv znovu přečíst klávesou ." #. type: \t; header #: ../help/help.E.txt:128 #, no-wrap msgid "See also" msgstr "Užitečné odkazy" #. type: Plain text #: ../help/help.E.txt:129 #, no-wrap msgid "Controls and programming." msgstr "Ovládání a programování." #. type: Plain text #: ../help/help.E.txt:4 #, no-wrap msgid "The two main actors of this exercise are:" msgstr "Hlavní role v tomto cvičení hrají:"