Merge branch 'dev'

Merging content from dev
dev-ui
Piotr Dziwinski 2013-03-30 15:22:28 +01:00
commit 3dd3fe66c6
2854 changed files with 70730 additions and 287823 deletions

View File

@ -1,3 +1,13 @@
*IN-DEVELOPEMENT*
----------------
Make licence explicit: it is GPLv3 as per the conditions of the source
code dump from Epsitec.
Fix URL of colobot repository.
Render README for Markdown.
Ease git-based releasing.
Handle levels iternationalisation with po4a.
Drop translations as they are built from colobot itself.
----------------
2012-10-05

21
CMakeLists.txt Normal file
View File

@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 2.8)
if(NOT DEFINED COLOBOT_INSTALL_DATA_DIR)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(COLOBOT_INSTALL_DATA_DIR ${CMAKE_INSTALL_PREFIX}/data CACHE PATH "Colobot shared data directory")
else()
set(COLOBOT_INSTALL_DATA_DIR ${CMAKE_INSTALL_PREFIX}/share/games/colobot CACHE PATH "Colobot shared data directory")
endif()
endif()
install(DIRECTORY ai DESTINATION ${COLOBOT_INSTALL_DATA_DIR})
install(DIRECTORY fonts DESTINATION ${COLOBOT_INSTALL_DATA_DIR})
install(DIRECTORY help DESTINATION ${COLOBOT_INSTALL_DATA_DIR})
install(DIRECTORY icons DESTINATION ${COLOBOT_INSTALL_DATA_DIR})
install(DIRECTORY models DESTINATION ${COLOBOT_INSTALL_DATA_DIR})
#install(DIRECTORY models-new DESTINATION ${COLOBOT_INSTALL_DATA_DIR})
install(DIRECTORY music DESTINATION ${COLOBOT_INSTALL_DATA_DIR})
install(DIRECTORY sounds DESTINATION ${COLOBOT_INSTALL_DATA_DIR})
install(DIRECTORY textures DESTINATION ${COLOBOT_INSTALL_DATA_DIR})
add_subdirectory(levels)

674
LICENSE Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

24
README.md Normal file
View File

@ -0,0 +1,24 @@
# Colobot Data Files
## *IN-DEVELOPEMENT* Release
This package contains the data files for the Colobot project (https://github.com/colobot/colobot).
It includes (or will include):
* textures, background images, etc.
* model files,
* sounds and music
* some documents describing the formats
* conversion scripts and tools for packaging
This is a development release that will be modified and updated as necessary.
File paths, names, formats are subject to change, so don't take them for granted.
All packages released will be labeled with date of release in format RRRR-MM-DD and released as often as
changes are made in the files.
# License
The source code contained here was released by Epsitec -- the original
creator of the game -- on open source (GPLv3) license. The code was
given and the rights granted specifically to PPC community in
March 2012. Since then, we have been modifying the code and working on
our goals, which are briefly summed up below.

View File

@ -1,16 +0,0 @@
Colobot Data Files
Development Release 2012-10-05
This package contains the data files for the Colobot project (https://github.com/colobot/colobot).
It includes (or will include):
- textures, background images, etc.
- model files,
- sounds and music
- some documents describing the formats
- conversion scripts and tools for packaging
This is a development release that will be modified and updated as necessary.
File paths, names, formats are subject to change, so don't take them for granted.
All packages released will be labeled with date of release in format RRRR-MM-DD and released as often as
changes are made in the files.

View File

@ -80,7 +80,7 @@ extern void object::Attack( )
}
}
// Calcule la distance jusqu'à la base.
// Calcule la distance jusqu'à la base.
float object::RetBaseDistance()
{

View File

@ -78,7 +78,7 @@ extern void object::Attack( )
}
}
// Calcule la distance jusqu'à la base.
// Calcule la distance jusqu'à la base.
float object::RetBaseDistance()
{

View File

@ -80,7 +80,7 @@ extern void object::Attack( )
}
}
// Calcule la distance jusqu'à la base.
// Calcule la distance jusqu'à la base.
float object::RetBaseDistance()
{

View File

@ -1,11 +1,11 @@
extern void object::Attack( )
{
int list[], i; // liste des objets cherchés
int list[], i; // liste des objets cherchés
object target; // info sur la cible
point lastPos; // dernière position (pr test si bloquée)
point lastPos; // dernière position (pr test si bloquée)
float distTar; // distance de la cible
float dirTar; // direction de la cible
float r; // valeur aléatoire
float r; // valeur aléatoire
float mp; // puissance moteur
float tangle; // angle d'esquive en cas d'eau
boolean ifmove; // si on avance en tirant ou pas
@ -52,7 +52,7 @@ extern void object::Attack( )
wait(cmdline(0)); // attend pour entrer en action
lastPos = position; // initialise
ifmove = true;
while ( true ) // répète à l'infini
while ( true ) // répète à l'infini
{
target = radar(list);
dirTar = direction(target.position);
@ -82,7 +82,7 @@ extern void object::Attack( )
{
ifmove = true;
if (distance(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
lastPos = position;
turn(rand()*360-180);
motor(1,1);

View File

@ -1,11 +1,11 @@
extern void object::Attack( )
{
int list[], i; // liste des objets cherchés
int list[], i; // liste des objets cherchés
object target; // info sur la cible
point lastPos; // dernière position (pr test si bloquée)
point lastPos; // dernière position (pr test si bloquée)
float distTar; // distance de la cible
float dirTar; // direction de la cible
float r; // valeur aléatoire
float r; // valeur aléatoire
float mp; // puissance moteur
float tangle; // angle d'esquive en cas d'eau
boolean ifmove; // si on avance en tirant ou pas
@ -52,7 +52,7 @@ extern void object::Attack( )
wait(cmdline(0)); // attend pour entrer en action
lastPos = position; // initialise
ifmove = true;
while ( true ) // répète à l'infini
while ( true ) // répète à l'infini
{
target = radar(list);
dirTar = direction(target.position);
@ -82,7 +82,7 @@ extern void object::Attack( )
{
ifmove = true;
if (distance(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
lastPos = position;
turn(rand()*360-180);
motor(1,1);

View File

@ -1,11 +1,11 @@
extern void object::Attack( )
{
int list[], i; // liste des objets cherchés
int list[], i; // liste des objets cherchés
object target; // info sur la cible
point lastPos; // dernière position (pr test si bloquée)
point lastPos; // dernière position (pr test si bloquée)
float distTar; // distance de la cible
float dirTar; // direction de la cible
float r; // valeur aléatoire
float r; // valeur aléatoire
float mp; // puissance moteur
float tangle; // angle d'esquive en cas d'eau
boolean ifmove; // si on avance en tirant ou pas
@ -52,7 +52,7 @@ extern void object::Attack( )
// wait(cmdline(0)); // attend pour entrer en action
lastPos = position; // initialise
ifmove = true;
while ( true ) // répète à l'infini
while ( true ) // répète à l'infini
{
target = radar(list);
dirTar = direction(target.position);
@ -82,7 +82,7 @@ extern void object::Attack( )
{
ifmove = true;
if (distance(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
lastPos = position;
turn(rand()*360-180);
motor(1,1);

View File

@ -1,12 +1,12 @@
extern void object::Attack( )
{
int list[], i; // liste des objets cherchés
int list[], i; // liste des objets cherchés
object target; // info sur la cible
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
float distCent; // rayon de la zone
float distLim; // rayon à ne pas dépasser
float r; // valeur aléatoire
float distLim; // rayon à ne pas dépasser
float r; // valeur aléatoire
errmode(0); // ne stoppe pas si erreur
while ( ismovie() != 0 ) wait(1);
@ -35,28 +35,28 @@ extern void object::Attack( )
list[i++] = Subber;
list[i++] = Me;
center.x = cmdline(0); // prend les coordonnée
center.x = cmdline(0); // prend les coordonnée
center.y = cmdline(1); // du centre de la zone
center.z = 0; // à exclure
center.z = 0; // à exclure
distCent = cmdline(2); // rayon de la zone
distLim = cmdline(3);
lastPos = position; // initialise
turn(rand()*360-180);
motor(1,1); // en avant toute
while ( true ) // répère à l'infini
while ( true ) // répère à l'infini
{
target = radar(list, 0, 360, 0, 40);
if (target == null or topo(position)<0)// pas de cible à proximité
if (target == null or topo(position)<0)// pas de cible à proximité
{ // ou pieds dans l'eau
if (distance2d(position, center) < distCent
or distance2d(position, center) > distLim
or topo(position)<0)
{ // si la fourmi est dans la zone interdite
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor (-0.5, -0.5);//recule lentement
wait (1.5); //attend qu'ait reculé
wait (1.5); //attend qu'ait reculé
if (distance2d(position, center) < distCent+20)
{ //si trop proche du centre
if (direction(center)>0) turn(direction(center)-180); else turn(direction(center)+180);
@ -81,7 +81,7 @@ extern void object::Attack( )
else
{ //si elle est bien dans la zone
if (distance2d(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
turn(rand()*360-180);
motor(1,1);
wait(1);
@ -89,13 +89,13 @@ extern void object::Attack( )
r = rand();
if (r > 0.7)
{ //dans un cas sur dix
motor (1, 0.8);// tourne à droite
motor (1, 0.8);// tourne à droite
wait(rand()*3);// pendant un moment
motor (1, 1); // puis tout droit
}
if (r < 0.3)
{ //dans un cas sur dix
motor (0.8, 1);// tourne à gauche
motor (0.8, 1);// tourne à gauche
wait(rand()*3);// pendant un moment
motor (1, 1); // puis tout droit
}
@ -104,7 +104,7 @@ extern void object::Attack( )
}
}
else
{ // si cible à proximité
{ // si cible à proximité
turn(direction(target.position));
fire(target.position); // et tire deux fois
motor(1,1); // avance

View File

@ -1,13 +1,13 @@
extern void object::Attack( )
{
int list[], i; // liste des objets cherchés
int list[], i; // liste des objets cherchés
object target; // info sur la cible
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
float distCent; // rayon de la zone
float r; // valeur aléatoire
float stdHight; // Altitude du point de départ
float tolHight; // tolérance acceptée par rapport à stdHight
float r; // valeur aléatoire
float stdHight; // Altitude du point de départ
float tolHight; // tolérance acceptée par rapport à stdHight
errmode(0); // ne stoppe pas si erreur
while ( ismovie() != 0 ) wait(1);
@ -36,28 +36,28 @@ extern void object::Attack( )
list[i++] = Subber;
// list[i++] = Me;
center.x = cmdline(0); // prend les coordonnée
center.x = cmdline(0); // prend les coordonnée
center.y = cmdline(1); // du centre de la zone
center.z = 0; // à patrouiller
center.z = 0; // à patrouiller
distCent = cmdline(2); // rayon de la zone
stdHight = topo(position);//L'altitude dont il ne faut pas s'écarter
stdHight = topo(position);//L'altitude dont il ne faut pas s'écarter
tolHight = 9;
lastPos = position; // initialise
motor(1,1); // en avant toute
while ( true ) // répère à l'infini
while ( true ) // répère à l'infini
{
target = radar(WingedShooter);
if (target.position.y < 20
or abs(topo(position)-stdHight) > tolHight)//pas de cible à proximité
{ // ou s'écarte trop de l'altitude de départ
or abs(topo(position)-stdHight) > tolHight)//pas de cible à proximité
{ // ou s'écarte trop de l'altitude de départ
if (distance2d(position, center) > distCent or
abs(topo(position)-stdHight) > tolHight)
{ // si la fourmi est en dehors de la zone
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor (-0.5, -0.5);//recule lentement
wait (1.5); //attend qu'ait reculé
wait (1.5); //attend qu'ait reculé
turn(direction(center));
motor (1, 1); //puis en avant toute
do
@ -65,7 +65,7 @@ extern void object::Attack( )
lastPos = position;
wait(1); //tant que pas dans la zone
if (distance2d(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
turn(rand()*360-180);
motor(1,1);
wait(1);
@ -78,7 +78,7 @@ extern void object::Attack( )
else
{ //si elle est bien dans la zone
if (distance2d(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
turn(rand()*360-180);
motor(1,1);
wait(1);
@ -86,13 +86,13 @@ extern void object::Attack( )
r = rand();
if (r > 0.6)
{ //dans un cas sur dix
motor (1, 0.5);// tourne à droite
motor (1, 0.5);// tourne à droite
wait(rand()*3);// pendant un moment
motor (1, 1); // puis tout droit
}
if (r < 0.4)
{ //dans un cas sur dix
motor (0.5, 1);// tourne à gauche
motor (0.5, 1);// tourne à gauche
wait(rand()*3);// pendant un moment
motor (1, 1); // puis tout droit
}
@ -101,7 +101,7 @@ extern void object::Attack( )
}
}
else
{ // si cible à proximité
{ // si cible à proximité
turn(direction(target.position));
fire(target.position); // tourne vers la cible
}

View File

@ -1,13 +1,13 @@
extern void object::Attack( )
{
int list[], i; // liste des objets cherchés
int list[], i; // liste des objets cherchés
object target; // info sur la cible
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
float distCent; // rayon de la zone
float r; // valeur aléatoire
float stdHight; // Altitude du point de départ
float tolHight; // tolérance acceptée par rapport à stdHight
float r; // valeur aléatoire
float stdHight; // Altitude du point de départ
float tolHight; // tolérance acceptée par rapport à stdHight
errmode(0); // ne stoppe pas si erreur
while ( ismovie() != 0 ) wait(1);
@ -36,28 +36,28 @@ extern void object::Attack( )
list[i++] = Subber;
list[i++] = Me;
center.x = cmdline(0); // prend les coordonnée
center.x = cmdline(0); // prend les coordonnée
center.y = cmdline(1); // du centre de la zone
center.z = 0; // à patrouiller
center.z = 0; // à patrouiller
distCent = cmdline(2); // rayon de la zone
stdHight = topo(position);//L'altitude dont il ne faut pas s'écarter
stdHight = topo(position);//L'altitude dont il ne faut pas s'écarter
tolHight = 1;
lastPos = position; // initialise
motor(1,1); // en avant toute
while ( true ) // répère à l'infini
while ( true ) // répère à l'infini
{
target = radar(list, 0, 360, 0, 40);
if (target == null
or abs(topo(position)-stdHight) > tolHight)//pas de cible à proximité
{ // ou s'écarte trop de l'altitude de départ
or abs(topo(position)-stdHight) > tolHight)//pas de cible à proximité
{ // ou s'écarte trop de l'altitude de départ
if (distance2d(position, center) > distCent or
abs(topo(position)-stdHight) > tolHight)
{ // si la fourmi est en dehors de la zone
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor (-0.5, -0.5);//recule lentement
wait (1.5); //attend qu'ait reculé
wait (1.5); //attend qu'ait reculé
turn(direction(center));
motor (1, 1); //puis en avant toute
do
@ -65,7 +65,7 @@ extern void object::Attack( )
lastPos = position;
wait(1); //tant que pas dans la zone
if (distance2d(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
turn(rand()*360-180);
motor(1,1);
wait(1);
@ -78,7 +78,7 @@ extern void object::Attack( )
else
{ //si elle est bien dans la zone
if (distance2d(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
turn(rand()*360-180);
motor(1,1);
wait(1);
@ -86,13 +86,13 @@ extern void object::Attack( )
r = rand();
if (r > 0.6)
{ //dans un cas sur dix
motor (1, 0.5);// tourne à droite
motor (1, 0.5);// tourne à droite
wait(rand()*3);// pendant un moment
motor (1, 1); // puis tout droit
}
if (r < 0.4)
{ //dans un cas sur dix
motor (0.5, 1);// tourne à gauche
motor (0.5, 1);// tourne à gauche
wait(rand()*3);// pendant un moment
motor (1, 1); // puis tout droit
}
@ -101,7 +101,7 @@ extern void object::Attack( )
}
}
else
{ // si cible à proximité
{ // si cible à proximité
turn(direction(target.position));
fire(target.position); // tourne vers la cible
}

View File

@ -1,13 +1,13 @@
extern void object::Attack( )
{
int list[], i; // liste des objets cherchés
int list[], i; // liste des objets cherchés
object target; // info sur la cible
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
float distCent; // rayon de la zone
float r; // valeur aléatoire
float stdHight; // Altitude du point de départ
float tolHight; // tolérance acceptée par rapport à stdHight
float r; // valeur aléatoire
float stdHight; // Altitude du point de départ
float tolHight; // tolérance acceptée par rapport à stdHight
errmode(0); // ne stoppe pas si erreur
while ( ismovie() != 0 ) wait(1);
@ -36,29 +36,29 @@ extern void object::Attack( )
list[i++] = Subber;
list[i++] = Me;
center.x = cmdline(0); // prend les coordonnée
center.x = cmdline(0); // prend les coordonnée
center.y = cmdline(1); // du centre de la zone
center.z = 0; // à patrouiller
center.z = 0; // à patrouiller
distCent = cmdline(2); // rayon de la zone
stdHight = topo(position);//L'altitude dont il ne faut pas s'écarter
tolHight = cmdline(3); // tolérance admise
stdHight = topo(position);//L'altitude dont il ne faut pas s'écarter
tolHight = cmdline(3); // tolérance admise
lastPos = position; // initialise
motor(1,1); // en avant toute
while ( true ) // répère à l'infini
while ( true ) // répère à l'infini
{
target = radar(list, 0, 360, 0, 40);
if (target == null
or topo(position)-stdHight > tolHight
or stdHight-topo(position) > tolHight)//pas de cible à proximité
{ // ou s'écarte trop de l'altitude de départ
or stdHight-topo(position) > tolHight)//pas de cible à proximité
{ // ou s'écarte trop de l'altitude de départ
if (distance2d(position, center) > distCent
or abs(topo(position)-stdHight) > tolHight)
{ // si la fourmi est en dehors de la zone
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor (-0.5, -0.5);//recule lentement
wait (1.5); //attend qu'ait reculé
wait (1.5); //attend qu'ait reculé
turn(direction(center));
motor (1, 1); //puis en avant toute
do
@ -66,7 +66,7 @@ extern void object::Attack( )
lastPos = position;
wait(1); //tant que pas dans la zone
if (distance2d(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
turn(rand()*360-180);
motor(1,1);
wait(1);
@ -79,7 +79,7 @@ extern void object::Attack( )
else
{ //si elle est bien dans la zone
if (distance2d(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
turn(rand()*360-180);
motor(1,1);
wait(1);
@ -87,13 +87,13 @@ extern void object::Attack( )
r = rand();
if (r > 0.6)
{ //dans un cas sur dix
motor (1, 0.7);// tourne à droite
motor (1, 0.7);// tourne à droite
wait(rand()*3);// pendant un moment
motor (1, 1); // puis tout droit
}
if (r < 0.4)
{ //dans un cas sur dix
motor (0.7, 1);// tourne à gauche
motor (0.7, 1);// tourne à gauche
wait(rand()*3);// pendant un moment
motor (1, 1); // puis tout droit
}
@ -102,7 +102,7 @@ extern void object::Attack( )
}
}
else
{ // si cible à proximité
{ // si cible à proximité
turn(direction(target.position));
fire(target.position); // tourne vers la cible
motor(1,1); // avance

View File

@ -1,11 +1,11 @@
extern void object::Attack( )
{
int list[], i; // liste des objets cherchés
int list[], i; // liste des objets cherchés
object target; // info sur la cible
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
float distCent; // rayon de la zone
float r; // valeur aléatoire
float r; // valeur aléatoire
float distTar; // distance de la cible
float dirTar; // direction de la cible
float mp; // puissance moteur
@ -39,36 +39,36 @@ extern void object::Attack( )
list[i++] = Subber;
list[i++] = Me;
center.x = cmdline(0); // prend les coordonnée
center.x = cmdline(0); // prend les coordonnée
center.y = cmdline(1); // du centre de la zone
center.z = 0; // à patrouiller
center.z = 0; // à patrouiller
distCent = cmdline(2); // rayon de la zone
lastPos = position; // initialise
motor(1,1); // en avant toute
while (radar(list, 0, 360, 0, 40) == null) // répète jusqu'à contact
while (radar(list, 0, 360, 0, 40) == null) // répète jusqu'à contact
{
target = radar(list, 0, 360, 0, 40);
if (target == null or topo(position)<0)// pas de cible à proximité
if (target == null or topo(position)<0)// pas de cible à proximité
{ // ou pieds dans l'eau
if (distance2d(position, center) > distCent or topo(position)<0)
{ // si la fourmi est en dehors de la zone
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor (-0.5, -0.5);//recule lentement
wait (1.5); //attend qu'ait reculé
wait (1.5); //attend qu'ait reculé
if (direction(center)>0) motor (0,1); else motor (1,0);
do wait(0.2); //tourne vers le centre
while (direction(center) > 20
or direction(center) < -20);
//tant que pas orienté vers le centre
//tant que pas orienté vers le centre
motor (1, 1); //puis en avant toute
do
{
lastPos = position;
wait(0.5); //tant que pas dans la zone
if (distance2d(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
turn(rand()*360-180);
motor(1,1);
wait(1);
@ -80,7 +80,7 @@ extern void object::Attack( )
else
{ //si elle est bien dans la zone
if (distance2d(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
turn(rand()*360-180);
motor(1,1);
wait(1);
@ -88,13 +88,13 @@ extern void object::Attack( )
r = rand();
if (r > 0.9)
{ //dans un cas sur dix
motor (1, 0.5);// tourne à droite
motor (1, 0.5);// tourne à droite
wait(rand()*3);// pendant un moment
motor (1, 1); // puis tout droit
}
if (r < 0.1)
{ //dans un cas sur dix
motor (0.5, 1);// tourne à gauche
motor (0.5, 1);// tourne à gauche
wait(rand()*3);// pendant un moment
motor (1, 1); // puis tout droit
}
@ -103,7 +103,7 @@ extern void object::Attack( )
}
}
else
{ // si cible à proximité
{ // si cible à proximité
turn(direction(target.position));
fire(target.position); // tourne vers la cible
fire(target.position); // et tire deux fois
@ -115,7 +115,7 @@ extern void object::Attack( )
//a eu un contact avec l'astronaute
lastPos = position; // initialise
ifmove = true;
while ( true ) // répète à l'infini
while ( true ) // répète à l'infini
{
target = radar(list);
dirTar = direction(target.position);
@ -147,7 +147,7 @@ extern void object::Attack( )
{
ifmove = true;
if (distance(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
lastPos = position;
turn(rand()*360-180);
motor(1,1);

View File

@ -1,11 +1,11 @@
extern void object::Attack( )
{
int list[], i; // liste des objets cherchés
int list[], i; // liste des objets cherchés
object target; // info sur la cible
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
float distCent; // rayon de la zone
float r; // valeur aléatoire
float r; // valeur aléatoire
errmode(0); // ne stoppe pas si erreur
while ( ismovie() != 0 ) wait(1);
@ -34,24 +34,24 @@ extern void object::Attack( )
list[i++] = Subber;
list[i++] = Me;
center.x = cmdline(0); // prend les coordonnée
center.x = cmdline(0); // prend les coordonnée
center.y = cmdline(1); // du centre de la zone
center.z = 0; // à patrouiller
center.z = 0; // à patrouiller
distCent = cmdline(2); // rayon de la zone
lastPos = position; // initialise
motor(1,1); // en avant toute
while ( true ) // répère à l'infini
while ( true ) // répère à l'infini
{
target = radar(list, 0, 360, 0, 40);
if (target == null or topo(position)<0)// pas de cible à proximité
if (target == null or topo(position)<0)// pas de cible à proximité
{ // ou pieds dans l'eau
if (distance2d(position, center) > distCent or topo(position)<0)
{ // si la fourmi est en dehors de la zone
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor (-0.5, -0.5);//recule lentement
wait (1.5); //attend qu'ait reculé
wait (1.5); //attend qu'ait reculé
turn(direction(center));
motor (1, 1); //puis en avant toute
do
@ -59,7 +59,7 @@ extern void object::Attack( )
lastPos = position;
wait(1); //tant que pas dans la zone
if (distance2d(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
turn(rand()*360-180);
motor(1,1);
wait(1);
@ -71,7 +71,7 @@ extern void object::Attack( )
else
{ //si elle est bien dans la zone
if (distance2d(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
turn(rand()*360-180);
motor(1,1);
wait(1);
@ -79,13 +79,13 @@ extern void object::Attack( )
r = rand();
if (r > 0.6)
{ //dans un cas sur dix
motor (1, 0.5);// tourne à droite
motor (1, 0.5);// tourne à droite
wait(rand()*3);// pendant un moment
motor (1, 1); // puis tout droit
}
if (r < 0.4)
{ //dans un cas sur dix
motor (0.5, 1);// tourne à gauche
motor (0.5, 1);// tourne à gauche
wait(rand()*3);// pendant un moment
motor (1, 1); // puis tout droit
}
@ -94,7 +94,7 @@ extern void object::Attack( )
}
}
else
{ // si cible à proximité
{ // si cible à proximité
turn(direction(target.position));
fire(target.position); // tourne vers la cible
}

View File

@ -1,11 +1,11 @@
extern void object::Attack( )
{
int list[], i; // liste des objets cherchés
int list[], i; // liste des objets cherchés
object target; // info sur la cible
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
float distCent; // rayon de la zone
float r; // valeur aléatoire
float r; // valeur aléatoire
errmode(0); // ne stoppe pas si erreur
while ( ismovie() != 0 ) wait(1);
@ -34,24 +34,24 @@ extern void object::Attack( )
list[i++] = Subber;
list[i++] = Me;
center.x = cmdline(0); // prend les coordonnée
center.x = cmdline(0); // prend les coordonnée
center.y = cmdline(1); // du centre de la zone
center.z = 0; // à patrouiller
center.z = 0; // à patrouiller
distCent = cmdline(2); // rayon de la zone
lastPos = position; // initialise
motor(1,1); // en avant toute
while ( true ) // répète à l'infini
while ( true ) // répète à l'infini
{
target = radar(list, 0, 360, 0, 40);
if (target == null or topo(position)<0)// pas de cible à proximité
if (target == null or topo(position)<0)// pas de cible à proximité
{ // ou pieds dans l'eau
if (distance2d(position, center) > distCent or topo(position)<0)
{ // si la fourmi est en dehors de la zone
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor (-0.5, -0.5);//recule lentement
wait (1.5); //attend qu'ait reculé
wait (1.5); //attend qu'ait reculé
turn(direction(center));
motor (1, 1); //puis en avant toute
do
@ -59,7 +59,7 @@ extern void object::Attack( )
lastPos = position;
wait(0.5); //tant que pas dans la zone
if (distance2d(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
turn(rand()*360-180);
motor(1,1);
wait(1);
@ -71,7 +71,7 @@ extern void object::Attack( )
else
{ //si elle est bien dans la zone
if (distance2d(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
turn(rand()*360-180);
motor(1,1);
wait(1);
@ -79,13 +79,13 @@ extern void object::Attack( )
r = rand();
if (r > 0.6)
{ //dans un cas sur dix
motor (1, 0.7);// tourne à droite
motor (1, 0.7);// tourne à droite
wait(rand()*3);// pendant un moment
motor (1, 1); // puis tout droit
}
if (r < 0.4)
{ //dans un cas sur dix
motor (0.7, 1);// tourne à gauche
motor (0.7, 1);// tourne à gauche
wait(rand()*3);// pendant un moment
motor (1, 1); // puis tout droit
}
@ -94,7 +94,7 @@ extern void object::Attack( )
}
}
else
{ // si cible à proximité
{ // si cible à proximité
turn(direction(target.position));
fire(target.position); // et tire deux fois
motor(1,1); // avance

View File

@ -1,11 +1,11 @@
extern void object::Attack( )
{
int list[], i; // liste des objets cherchés
int list[], i; // liste des objets cherchés
object target; // info sur la cible
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
float distCent; // rayon de la zone
float r; // valeur aléatoire
float r; // valeur aléatoire
float mp; // vitesse maxi
float minAlt; // altitude minimale (danger lave!)
@ -36,26 +36,26 @@ extern void object::Attack( )
list[i++] = Subber;
list[i++] = Me;
center.x = cmdline(0); // prend les coordonnée
center.x = cmdline(0); // prend les coordonnée
center.y = cmdline(1); // du centre de la zone
center.z = 0; // à patrouiller
center.z = 0; // à patrouiller
distCent = cmdline(2); // rayon de la zone
mp = 0.4;
minAlt = cmdline(3);
lastPos = position; // initialise
motor(mp, mp); // en avant toute
while ( true ) // répère à l'infini
while ( true ) // répère à l'infini
{
target = radar(list, 0, 360, 0, 40);
if (target == null or topo(position)<minAlt)// pas de cible à proximité
if (target == null or topo(position)<minAlt)// pas de cible à proximité
{ // ou pieds dans l'eau
if (distance2d(position, center) > distCent or topo(position)<minAlt)
{ // si la fourmi est en dehors de la zone
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor (-0.4, -0.4);//recule lentement
wait (1.5); //attend qu'ait reculé
wait (1.5); //attend qu'ait reculé
turn(direction(center));
motor (mp, mp); //puis en avant toute
do
@ -63,7 +63,7 @@ extern void object::Attack( )
lastPos = position;
wait(0.5); //tant que pas dans la zone
if (distance2d(lastPos, position) < 0.1)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
turn(rand()*360-180);
motor(mp, mp);
wait(0.5);
@ -75,7 +75,7 @@ extern void object::Attack( )
else
{ //si elle est bien dans la zone
if (distance2d(lastPos, position) < 0.1)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
turn(rand()*360-180);
motor(mp, mp);
wait(0.5);
@ -83,13 +83,13 @@ extern void object::Attack( )
r = rand();
if (r > 0.6)
{ //dans un cas sur dix
motor (mp, mp*0.5);// tourne à droite
motor (mp, mp*0.5);// tourne à droite
wait(rand()*2);// pendant un moment
motor (mp, mp); // puis tout droit
}
if (r < 0.4)
{ //dans un cas sur dix
motor (mp*0.5, mp);// tourne à gauche
motor (mp*0.5, mp);// tourne à gauche
wait(rand()*2);// pendant un moment
motor (mp, mp); // puis tout droit
}
@ -98,7 +98,7 @@ extern void object::Attack( )
}
}
else
{ // si cible à proximité
{ // si cible à proximité
turn(direction(target.position));
fire(target.position); // tourne vers la cible
}

View File

@ -1,6 +1,6 @@
extern void object::Attack( )
{
int list[], i; // liste des objets cherchés
int list[], i; // liste des objets cherchés
object target; // info sur la cible
errmode(0); // ne stoppe pas si erreur

View File

@ -1,6 +1,6 @@
extern void object::Attack( )
{
int list[], i; // liste des objets cherchés
int list[], i; // liste des objets cherchés
object target; // info sur la cible
errmode(0); // ne stoppe pas si erreur

View File

@ -1,12 +1,12 @@
extern void object::Attack( )
{
int list[], i; // liste des objets cherchés
int list[], i; // liste des objets cherchés
object target; // info sur la cible
object queen; // info sur la reine
point center; // coordonnées du centre de la zone
point center; // coordonnées du centre de la zone
float distCent; // rayon de la zone
float r; // valeur aléatoire
int ifTarget; // si on a trouvé une cible et quel genre
float r; // valeur aléatoire
int ifTarget; // si on a trouvé une cible et quel genre
errmode(0); // ne stoppe pas si erreur
while ( ismovie() != 0 ) wait(1);
@ -35,14 +35,14 @@ extern void object::Attack( )
list[i++] = Subber;
list[i++] = Me;
center.x = -65; // prend les coordonnée
center.x = -65; // prend les coordonnée
center.y = 255; // du centre de la zone
center.z = 0; // à patrouiller
center.z = 0; // à patrouiller
distCent = 140; // rayon de la zone
motor(1,1); // en avant toute
ifTarget = 0; // pas de cible précise
while ( true ) // répète à l'infini
ifTarget = 0; // pas de cible précise
while ( true ) // répète à l'infini
{
queen = radar(AlienQueen);
if (rand() < 0.2 and queen != null) ifTarget = 2;//on retourne vers la reine
@ -95,10 +95,10 @@ void object::Random(point center, float distCent)
void object::HorsZone(point center, float distCent)
{ // si la fourmi est en dehors de la zone
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor (-0.5, -0.5);//recule lentement
wait (1.5); //attend qu'ait reculé
wait (1.5); //attend qu'ait reculé
turn(direction(center));
motor (1, 1); //puis en avant toute
do
@ -113,13 +113,13 @@ void object::DansZone()
float r = rand();
if (r > 0.6)
{ //dans un cas sur dix
motor (1, 0.7); // tourne à droite
motor (1, 0.7); // tourne à droite
wait(rand()*3); // pendant un moment
motor (1, 1); // puis tout droit
}
if (r < 0.4)
{ //dans un cas sur dix
motor (0.7, 1); // tourne à gauche
motor (0.7, 1); // tourne à gauche
wait(rand()*3); // pendant un moment
motor (1, 1); // puis tout droit
}
@ -128,7 +128,7 @@ void object::DansZone()
}
void object::shoot(point tarPos)
{ // si cible à proximité
{ // si cible à proximité
turn(direction(tarPos));
fire(tarPos); // tourne vers la cible
fire(tarPos); // et tire deux fois

View File

@ -1,11 +1,11 @@
extern void object::Attack( )
{
int list[], i; // liste des objets cherchés
int list[], i; // liste des objets cherchés
object target; // info sur la cible
point center; // coordonnées du centre de la zone
point center; // coordonnées du centre de la zone
float distCent; // rayon de la zone
float r; // valeur aléatoire
int ifTarget; // si on a trouvé une cible et quel genre
float r; // valeur aléatoire
int ifTarget; // si on a trouvé une cible et quel genre
errmode(0); // ne stoppe pas si erreur
while ( ismovie() != 0 ) wait(1);
@ -34,14 +34,14 @@ extern void object::Attack( )
list[i++] = Subber;
list[i++] = Me;
center.x = -65; // prend les coordonnée
center.x = -65; // prend les coordonnée
center.y = 255; // du centre de la zone
center.z = 0; // à patrouiller
center.z = 0; // à patrouiller
distCent = 140; // rayon de la zone
motor(1,1); // en avant toute
ifTarget = 0; // pas de cible précise
while ( true ) // répète à l'infini
ifTarget = 0; // pas de cible précise
while ( true ) // répète à l'infini
{
target = radar(list);
if(target.position.y > 65)
@ -90,10 +90,10 @@ void object::Random(point center, float distCent)
void object::HorsZone(point center, float distCent)
{ // si la fourmi est en dehors de la zone
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor (-0.5, -0.5);//recule lentement
wait (1.5); //attend qu'ait reculé
wait (1.5); //attend qu'ait reculé
turn(direction(center));
motor (1, 1); //puis en avant toute
do
@ -108,13 +108,13 @@ void object::DansZone()
float r = rand();
if (r > 0.8)
{ //dans un cas sur dix
motor (1, 0.8); // tourne à droite
motor (1, 0.8); // tourne à droite
wait(rand()*2); // pendant un moment
motor (1, 1); // puis tout droit
}
if (r < 0.2)
{ //dans un cas sur dix
motor (0.8, 1); // tourne à gauche
motor (0.8, 1); // tourne à gauche
wait(rand()*2); // pendant un moment
motor (1, 1); // puis tout droit
}
@ -123,7 +123,7 @@ void object::DansZone()
}
void object::shoot(point tarPos)
{ // si cible à proximité
{ // si cible à proximité
turn(direction(tarPos));
fire(tarPos); // tourne vers la cible
fire(tarPos); // et tire deux fois

View File

@ -1,11 +1,11 @@
extern void object::Attack( )
{
int list[], i; // liste des objets cherchés
int list[], i; // liste des objets cherchés
object target; // info sur la cible
point center; // coordonnées du centre de la zone
point center; // coordonnées du centre de la zone
float distCent; // rayon de la zone
float r; // valeur aléatoire
int ifTarget; // si on a trouvé une cible et quel genre
float r; // valeur aléatoire
int ifTarget; // si on a trouvé une cible et quel genre
errmode(0); // ne stoppe pas si erreur
while ( ismovie() != 0 ) wait(1);
@ -34,14 +34,14 @@ extern void object::Attack( )
list[i++] = Subber;
list[i++] = Me;
center.x = -65; // prend les coordonnée
center.x = -65; // prend les coordonnée
center.y = 255; // du centre de la zone
center.z = 0; // à patrouiller
center.z = 0; // à patrouiller
distCent = 140; // rayon de la zone
motor(1,1); // en avant toute
ifTarget = 0; // pas de cible précise
while ( true ) // répète à l'infini
ifTarget = 0; // pas de cible précise
while ( true ) // répète à l'infini
{
target = radar(list);
if(target.position.y > 180)
@ -90,10 +90,10 @@ void object::Random(point center, float distCent)
void object::HorsZone(point center, float distCent)
{ // si la fourmi est en dehors de la zone
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor (-0.5, -0.5);//recule lentement
wait (1.5); //attend qu'ait reculé
wait (1.5); //attend qu'ait reculé
turn(direction(center));
motor (1, 1); //puis en avant toute
do
@ -108,13 +108,13 @@ void object::DansZone()
float r = rand();
if (r > 0.8)
{ //dans un cas sur dix
motor (1, 0.8); // tourne à droite
motor (1, 0.8); // tourne à droite
wait(rand()*2); // pendant un moment
motor (1, 1); // puis tout droit
}
if (r < 0.2)
{ //dans un cas sur dix
motor (0.8, 1); // tourne à gauche
motor (0.8, 1); // tourne à gauche
wait(rand()*2); // pendant un moment
motor (1, 1); // puis tout droit
}
@ -123,7 +123,7 @@ void object::DansZone()
}
void object::shoot(point tarPos)
{ // si cible à proximité
{ // si cible à proximité
turn(direction(tarPos));
fire(tarPos); // tourne vers la cible
fire(tarPos); // et tire deux fois

View File

@ -18,7 +18,7 @@ extern void object::Convert( )
p = radar(TitaniumOre);
if ( p == null )
{
message("Minerai pas trouvé");
message("Minerai pas trouvé");
return;
}
goto(p.position);
@ -27,26 +27,26 @@ extern void object::Convert( )
p = radar(Converter);
if ( p == null )
{
message("Convertisseur pas trouvé");
message("Convertisseur pas trouvé");
return;
}
goto(p.position);
drop(); // dépose minerai
drop(); // dépose minerai
move(-4);
wait(15); // attend conversion
move(4);
grab(); // prend métal
grab(); // prend métal
move(-4);
}
p = radar(SpaceShip);
if ( p == null )
{
message("Vaisseau spatial pas trouvé");
message("Vaisseau spatial pas trouvé");
return;
}
goto(p.position);
drop(); // dépose minerai
drop(); // dépose minerai
if ( energyCell.energyLevel < 0.25 )
{

View File

@ -1,11 +1,11 @@
extern void object::Attack( )
{
int list[], i; // liste des objets cherchés
int list[], i; // liste des objets cherchés
object target; // info sur la cible
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
point center; // coordonnées du centre de la zone
point lastPos; // dernière position (pr test si bloquée)
float distCent; // rayon de la zone
float r; // valeur aléatoire
float r; // valeur aléatoire
errmode(0); // ne stoppe pas si erreur
while ( ismovie() != 0 ) wait(1);
@ -34,24 +34,24 @@ extern void object::Attack( )
list[i++] = Subber;
list[i++] = Me;
center.x = cmdline(0); // prend les coordonnée
center.x = cmdline(0); // prend les coordonnée
center.y = cmdline(1); // du centre de la zone
center.z = 0; // à patrouiller
center.z = 0; // à patrouiller
distCent = cmdline(2); // rayon de la zone
lastPos = position; // initialise
motor(1,1); // en avant toute
while ( true ) // répère à l'infini
while ( true ) // répère à l'infini
{
target = radar(list, 0, 360, 0, 10);
if (target == null or topo(position)<0)// pas de cible à proximité
if (target == null or topo(position)<0)// pas de cible à proximité
{ // ou pieds dans l'eau
if (distance2d(position, center) > distCent or topo(position)<0)
{ // si la fourmi est en dehors de la zone
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor(0, 0); //s'arrête
wait(0.5); //marque un arrêt
motor (-0.5, -0.5);//recule lentement
wait (1.5); //attend qu'ait reculé
wait (1.5); //attend qu'ait reculé
turn(direction(center));
motor (1, 1); //puis en avant toute
do
@ -59,7 +59,7 @@ extern void object::Attack( )
lastPos = position;
wait(1); //tant que pas dans la zone
if (distance2d(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
turn(rand()*360-180);
motor(1,1);
wait(1);
@ -71,7 +71,7 @@ extern void object::Attack( )
else
{ //si elle est bien dans la zone
if (distance2d(lastPos, position) < 0.2)
{ //si elle est bloquée par obstacle
{ //si elle est bloquée par obstacle
turn(rand()*360-180);
motor(1,1);
wait(1);
@ -79,13 +79,13 @@ extern void object::Attack( )
r = rand();
if (r > 0.6)
{ //dans un cas sur dix
motor (1, 0.7);// tourne à droite
motor (1, 0.7);// tourne à droite
wait(rand()*3);// pendant un moment
motor (1, 1); // puis tout droit
}
if (r < 0.4)
{ //dans un cas sur dix
motor (0.7, 1);// tourne à gauche
motor (0.7, 1);// tourne à gauche
wait(rand()*3);// pendant un moment
motor (1, 1); // puis tout droit
}
@ -94,7 +94,7 @@ extern void object::Attack( )
}
}
else
{ // si cible à proximité
{ // si cible à proximité
fire();
}
}

View File

@ -30,4 +30,3 @@ extern void object::Solution( )
}
}
}

View File

@ -14,4 +14,3 @@ extern void object::Solution( )
}
}
}

View File

@ -40,4 +40,3 @@ extern void object::Hare( )
}
}
}

View File

@ -12,4 +12,3 @@ void object::Square(float length)
turn(90);
}
}

View File

@ -23,4 +23,3 @@ extern void object::Solution( )
}
}
}

View File

@ -18,4 +18,3 @@ extern void object::Solution( )
drop(); // drop the titanium cube
}
}

View File

@ -34,4 +34,3 @@ extern void object::Solution( )
drop(); // drop the titanium cube
}
}

View File

@ -15,4 +15,3 @@ extern void object::Solution( )
drop(); // drop the titanium cube
}

View File

@ -36,11 +36,11 @@ extern void object::Solution( )
dir = (dir+bomb)/2;
}
if ( dir < 0 ) // à droite ?
if ( dir < 0 ) // à droite ?
{
motor(1, 1+dir/90);
}
else // à gauche ?
else // à gauche ?
{
motor(1-dir/90, 1);
}

View File

@ -29,11 +29,11 @@ extern void object::Solution( )
}
}
if ( dir < 0 ) // à droite ?
if ( dir < 0 ) // à droite ?
{
motor(1, 1+dir/90);
}
else // à gauche ?
else // à gauche ?
{
motor(1-dir/90, 1);
}

View File

@ -51,14 +51,14 @@ extern void object::Attack( )
{
if ( load == null ) // ne porte rien ?
{
p = radar(OrgaMatter); // cherche matière
p = radar(OrgaMatter); // cherche matière
if ( p == null )
{
jet(1); // monte
dest = position;
dest.x += (rand()-0.5)*10;
dest.y += (rand()-0.5)*10;
goto(dest); // va n'importe où
goto(dest); // va n'importe où
wait(2);
}
else
@ -69,17 +69,17 @@ extern void object::Attack( )
if ( dist > 1.25 )
{
jet(1); // monte
goto(p.position); // va sur le matière
goto(p.position); // va sur le matière
}
else
{
jet(-1); // descend
while ( altitude > 0 );
grab(); // prend la matière
grab(); // prend la matière
}
}
}
else // porte matière ?
else // porte matière ?
{
jet(1); // monte
p = radar(list, 0, 360, 0, 1000, 1, FilterOnlyLanding);
@ -88,7 +88,7 @@ extern void object::Attack( )
dest = position;
dest.x += (rand()-0.5)*10;
dest.y += (rand()-0.5)*10;
goto(dest); // va n'importe où
goto(dest); // va n'importe où
wait(2);
}
else
@ -102,7 +102,7 @@ extern void object::Attack( )
}
else
{
drop(); // lâche la matière
drop(); // lâche la matière
}
}
}

View File

@ -15,14 +15,14 @@ extern void object::Attack( )
{
if ( load == null ) // ne porte rien ?
{
p = radar(OrgaMatter); // cherche matière
p = radar(OrgaMatter); // cherche matière
if ( p == null )
{
jet(1); // monte
dest = position;
dest.x += (rand()-0.5)*10;
dest.y += (rand()-0.5)*10;
goto(dest); // va n'importe où
goto(dest); // va n'importe où
wait(2);
}
else
@ -34,17 +34,17 @@ extern void object::Attack( )
if ( dist > 1.25 )
{
jet(1); // monte
goto(p.position); // va sur la matière
goto(p.position); // va sur la matière
}
else
{
jet(-1); // descend
while ( altitude > 0 );
grab(); // prend la matière
grab(); // prend la matière
}
}
}
else // porte matière ?
else // porte matière ?
{
jet(1); // monte
p = radar(list, 0, 360, 0, 1000, 1, FilterOnlyLanding);
@ -53,7 +53,7 @@ extern void object::Attack( )
dest = center;
dest.x += (rand()-0.5)*100;
dest.y += (rand()-0.5)*100;
goto(dest, 0, 1, 0); // va n'importe où
goto(dest, 0, 1, 0); // va n'importe où
}
else
{
@ -66,7 +66,7 @@ extern void object::Attack( )
}
else
{
drop(); // lâche la matière
drop(); // lâche la matière
}
}
}

View File

@ -51,14 +51,14 @@ extern void object::Attack( )
{
if ( load == null ) // ne porte rien ?
{
p = radar(OrgaMatter); // cherche matière
p = radar(OrgaMatter); // cherche matière
if ( p == null )
{
jet(1); // monte
dest = position;
dest.x += (rand()-0.5)*10;
dest.y += (rand()-0.5)*10;
goto(dest); // va n'importe où
goto(dest); // va n'importe où
wait(2);
}
else
@ -69,17 +69,17 @@ extern void object::Attack( )
if ( dist > 1.25 )
{
jet(1); // monte
goto(p.position); // va sur la matière
goto(p.position); // va sur la matière
}
else
{
jet(-1); // descend
while ( altitude > 0 );
grab(); // prend la matière
grab(); // prend la matière
}
}
}
else // porte matière ?
else // porte matière ?
{
jet(1); // monte
p = radar(list, 0, 360, 0, 1000, 1, FilterOnlyLanding);
@ -88,7 +88,7 @@ extern void object::Attack( )
dest = position;
dest.x += (rand()-0.5)*10;
dest.y += (rand()-0.5)*10;
goto(dest); // va n'importe où
goto(dest); // va n'importe où
wait(2);
}
else
@ -102,7 +102,7 @@ extern void object::Attack( )
}
else
{
drop(); // lâche la matière
drop(); // lâche la matière
}
}
}

View File

@ -1,7 +1,7 @@
extern void object::Guêpes()
extern void object::Guêpes()
{
float p;// puissance max des moteurs
float r;// nombre aléatoire
float r;// nombre aléatoire
point c;// centre de la zone permise
c.x = 0;

View File

@ -21,7 +21,7 @@ extern void object::Attack( )
{
dist = distance(p.position, position);
prox = dist/2; // on se rapproche
if ( prox < 2.5 ) prox = 2.5; // pas trop tout de même
if ( prox < 2.5 ) prox = 2.5; // pas trop tout de même
dest.x = (position.x-p.position.x)*prox/dist + p.position.x;
dest.y = (position.y-p.position.y)*prox/dist + p.position.y;
dest.z = (position.z-p.position.z)*prox/dist + p.position.z;

View File

@ -89,8 +89,8 @@ extern void object::Attack( )
}
}
// Cherche une cible sur l'île. Si la cible est plus loin,
// elle est ignorée.
// Cherche une cible sur l'île. Si la cible est plus loin,
// elle est ignorée.
object object::TargetSearch(int[] list)
{
@ -102,7 +102,7 @@ object object::TargetSearch(int[] list)
if ( p == null ) return null;
center.x = 0;
center.y = 100; // sommet de l'île
center.y = 100; // sommet de l'île
center.z = p.position.z;
dist = distance(p.position, center);
if ( dist > 80 ) return null; // ignore si trop loin

View File

@ -1,2 +0,0 @@
101.07.28 21:13 B d:\Robot\projet1\english\script\ttrap1.txt --> 212.23.248.127 /web/download/colobot/program ttrap1.txt
101.07.28 21:13 B d:\Robot\projet1\english\script\ttrap2.txt --> 212.23.248.127 /web/download/colobot/program ttrap2.txt

7
help/D/authors.txt Normal file
View File

@ -0,0 +1,7 @@
Development team: Beta tester core team:
- Daniel Roux - Adrien Roux - Michael Jubin
- Denis Dumoulin - Didier Raboud - Daniel Sauthier
- Otto Kölbl - Nicolas Beuchat - Nicolas Stubi
- Michael Walz - Joël Roux - Patrick Thévoz
- Didier Gertsch

91
help/D/cbot.txt Normal file
View File

@ -0,0 +1,91 @@
\b;Programming - the CBOT language
The CBOT language is very close in structure and syntax to C++ and Java. It has been adapted for the specific purposes of COLOBOT, and for an efficient pedagogical approach.
This language is made up of instructions (see below), \l;blocks\u cbot\bloc;, \l;functions\u cbot\function;, \l;classes\u cbot\class;, \l;variables\u cbot\var;, \l;arrays\u cbot\array;, \l;expressions\u cbot\expr; and \l;conditions\u cbot\cond;.
o \c;\token;Instructions\norm;\n;
In the program editor, an instruction in the CBOT language is always displayed on an orange background. If an instruction hasn't got an orange background, this means that it has been misspelled. Instruction names are always written in lower case.
o \c;\type;Type\norm;\n;
The \l;type\u cbot\type; of a variable appears with a green background.
o \c;\const;Constants\norm;\n;
Constants like \l;categories\u cbot\category; are displayed with a red background.
\t;Instructions in the CBOT language:
\c;\l;extern\u cbot\extern; \n;Indicate the main function
\c;\l;if\u cbot\if; \n;Choice structure
\c;\l;else\u cbot\if; \n;Alternative choice structure
\c;\l;for\u cbot\for; \n;Loop structure
\c;\l;while\u cbot\while; \n;Control structure
\c;\l;do\u cbot\do; \n;Control structure
\c;\l;break\u cbot\break; \n;Exit from a loop
\c;\l;continue\u cbot\continue; \n;Continues the loop
\c;\l;return\u cbot\return; \n;Exit from a function
\c;\l;sizeof\u cbot\sizeof; \n;Size of an array
\t;Specific instructions for bots:
\c;\l;radar\u cbot\radar; \n;Object detection
\c;\l;direction\u cbot\direct; \n;Calculates a rotation angle
\c;\l;distance\u cbot\dist; \n;Calculates a distance
\c;\l;distance2d\u cbot\dist2d; \n;Calculates a distance
\c;\l;wait\u cbot\wait; \n;Waits
\c;\l;move\u cbot\move; \n;Moves forward or backward
\c;\l;turn\u cbot\turn; \n;Turns
\c;\l;goto\u cbot\goto; \n;Goes to a given position
\c;\l;motor\u cbot\motor; \n;Direct motor control
\c;\l;jet\u cbot\jet; \n;Direct jet engine control
\c;\l;message\u cbot\message; \n;Displays a message
\c;\l;retobject\u cbot\retobj; \n;Returns an object from a function
\c;\l;errmode\u cbot\errmode; \n;Error treatement control
\c;\l;abstime\u cbot\abstime; \n;Returns the absolute time
\t;Instructions about topology:
\c;\l;space\u cbot\space; \n;Calculates a free space
\c;\l;topo\u cbot\topo; \n;Returns the altitude of a point
\c;\l;flatground\u cbot\flatgrnd; \n;Returns radius of a flat area
\t;Instructions specific to some bots:
\c;\l;grab\u cbot\grab; \n;Picks up an object
\c;\l;drop\u cbot\drop; \n;Puts down an object
\c;\l;sniff\u cbot\sniff; \n;Sounds the subsoil
\c;\l;thump\u cbot\thump; \n;Overturns alien insects
\c;\l;recycle\u cbot\recycle; \n;Recycles a derelict bot
\c;\l;shield\u cbot\shield; \n;Extends or withdraws the shield
\c;\l;fire\u cbot\fire; \n;Fires the cannon
\c;\l;aim\u cbot\aim; \n;Vertical angle of the cannon
\t;Specific instructions for exchange posts:
\c;\l;receive\u cbot\receive; \n;Receives an information
\c;\l;send\u cbot\send; \n;Sends a new information
\c;\l;testinfo\u cbot\testinfo; \n;Tests if an information exists
\c;\l;deleteinfo\u cbot\delinfo; \n;Deletes an existing information
\t;Specific instructions for classes:
\c;\l;class\u cbot\class; \n;Class declararion
\c;\l;public\u cbot\public; \n;Declares a public function
\c;\l;private\u cbot\private; \n;Declares a private class member
\c;\l;static\u cbot\static; \n;Declares a static class member
\c;\l;synchronized\u cbot\synchro; \n;Prevents simultaneous execution
\c;\l;new\u cbot\new; \n;Creates a new instance
\c;\l;this\u cbot\this; \n;Reference to the current instance
\t;Specific instructions for strings:
\c;\l;strlen\u cbot\strlen; \n;Gets string length
\c;\l;strleft\u cbot\strleft; \n;Extracts left part
\c;\l;strright\u cbot\strright; \n;Extracts right part
\c;\l;strmid\u cbot\strmid; \n;Extracts center part
\c;\l;strfind\u cbot\strfind; \n;Finds a substring.
\c;\l;strval\u cbot\strval; \n;Converts string to number
\c;\l;strupper\u cbot\strupper; \n;Converts to upper case
\c;\l;strlower\u cbot\strlower; \n;Converts to lower case
\t;Specific instructions for files:
\c;\l;open\u cbot\open; \n;Opens a file
\c;\l;close\u cbot\close; \n;Closes a file
\c;\l;writeln\u cbot\writeln; \n;Writes line to a file
\c;\l;readln\u cbot\readln; \n;Reads line from a file
\c;\l;eof\u cbot\eof; \n;Tests if end of file
\c;\l;deletefile\u cbot\deletef; \n;Deletes a file
\t;See also
\l;Types\u cbot\type; and \l;categories\u cbot\category;.

11
help/D/cbot/abstime.txt Normal file
View File

@ -0,0 +1,11 @@
\b;Instruction \c;abstime\n;
Syntax¦:
\s;\c;abstime ( );\n;
Return the time in seconds elapsed since the beginning of the mission.
\t;Return: \c;\l;float\u cbot\float;\n;
Time in seconds.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

21
help/D/cbot/aim.txt Normal file
View File

@ -0,0 +1,21 @@
\b;Instruction \c;aim\n;
Syntax :
\s;\c;aim ( angle );\n;
This instruction sets the vertical angle of the cannon. The following robots are equipped with a cannon:
o \l;Shooter\u object\botfr;
o \l;Orga shooter\u object\botor;
o \l;Phazer shooter\u object\botphaz;
When controlling the robot through programming, the only way to turn the gun left or right is to turn the whole robot with the instruction \c;\l;turn\u cbot\turn;\n;.
\t;angle: \c;\l;float\u cbot\float;\n;
Angle in degrees of the gun relative to the robot. A positive value orients the gun upward. For shooters and orga shooters, the angle must range from \c;-20\n; to \c;+20\n; degrees. For phazer shooters, the angle must range from \c;-20\n; to \c;45\n; degrees.
\t;Return value: \c;\l;int\u cbot\int;\n;
Zero if everything is OK, a value different from zero if the rotation could not be performed:
\c;== 0 \n;The gun has now got the desired orientation
\c;!= 0 \n;rotation impossible
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

31
help/D/cbot/array.txt Normal file
View File

@ -0,0 +1,31 @@
\b;Arrays
An array is basically a collection of variables of the same type or class. You can use N dimensionnal arrays in the CBOT language. Each dimension is limited to 9999 elements. You must use square brackets \c;[]\n; after the type name or the variable name to declare an array.
\c;
\s;int [ ] a; // an array of int
\s;int a [12]; // an array of int limited to 12 elements
\s;string s[3]; // an array of 3 strings
\s;float xy[][]; // an 2 dimensionnal array of floats
\n;
Actually when the CBOT interpreter encounters an array declaration, it just creates a \c;\l;null\u cbot\null;\n; \l;reference\u cbot\pointer;:
\c;
\s;int a[5]; // a is now a null reference
\n;
As soon as you put values into the array, the elements are created and the reference is initialized:
\c;
\s;a[2] = 213; // a points to
\s; // 3 élements [0], [1] et [2]
\n;
After this operation, \c;a\n; contains a reference to the elements of the array. Elements \c;[0]\n; and \c;[1]\n; are created but not initialized because an array cannot contain empty elements. The \c;\l;sizeof\u cbot\sizeof;\n; instruction allows you to obtain the number of elements contained in an array.
When an array is declared with a maximum size, the program will stop as soon as there is an access beyond the maximum array size. No error is signalled during compilation even if the error is obvious:
\c;
\s;{
\s; int a[5];
\s; a[7] = 123; // no error at compile time
\s; // but error at run time
\s;}
\n;
If you pass an array as parameter to a \l;function\u cbot\function;, the function only receives a \l;reference\u cbot\pointer; to the array. That means if you modify an array element in the function, the element of the array that has been passed the function will be actuallay modified.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

49
help/D/cbot/bloc.txt Normal file
View File

@ -0,0 +1,49 @@
\b;Blocks
You can use braces \c;{ }\n; to group a number of instructions together in order to make one single block out of them, for example:
\c;
\s; {
\s; float t;
\s; t = a;
\s; a = b;
\s; b = t; // switches round a and b
\s; }
\n;
Every instruction in the block is followed by a \l;semicolon\u cbot\term;, but the block itself is not.
Let us take the following example with the instruction \c;\l;if\u cbot\if;\n; to illustrate the use of blocks in a program:
\c;
\s; if ( a < b )
\s; \n;instruction 1\c;;
\s; \n;instruction 2\c;;
\s; \n;instruction 3\c;;
\n;
If the \l;condition\u cbot\cond; is true, instructions 1, 2 and 3 are performed. If the condition is false, only instruction 1 is ignored, instructions 2 and 3 are performed. The fact that instruction 2 is lined up with instruction 1 does not matter.
If you want to perform instructions 1 and 2 only if the condition is true, you have to bracket them together in a block:
\c;
\s; if ( a < b )
\s; {
\s; \n;instruction 1\c;;
\s; \n;instruction 2\c;;
\s; }
\s; \n;instruction 3\c;;
\n;
Blocks may be needed with instructions \c;\l;if\u cbot\if;\n;, \c;\l;while\u cbot\while;\n; and \c;\l;for\u cbot\for;\n;, in order to group several instructions that should be performed only if a condition is true, or repeated several times.
You can fit blocks into other blocks, on as many levels as you need. Here is an example of imbrication on two levels :
\c;
\s; if ( a > b )
\s; {
\s; int i = 0;
\s; while ( i < 18 )
\s; {
\s; move(10);
\s; turn(5);
\s; i = i+1;
\s; }
\s; }
\n;
You had better line up the open brace \c;{\n; with the closing brace \c;}\n; in order to improve readability, but it is not compulsory. The following example takes less space, is equivalent to the previous example, but it is not advisable to write your programs in the following style :
\c;
\s; if(a>b) { int i=0; while(i<18) {
\s; move(10);turn(5);i=i+1; }}
\n;
\t;See also
\l;Instructions\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

5
help/D/cbot/bool.txt Normal file
View File

@ -0,0 +1,5 @@
\b;Type \c;bool\n;
In a variable of this type you can put a boolean value, that is a value that can take only two states: true or false.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

25
help/D/cbot/break.txt Normal file
View File

@ -0,0 +1,25 @@
\b;Instruction \c;break\n;
Syntax :
\s;\c;while ( condition )
\s;{
\s; break;
\s;}
\n;
With this instruction, you can get out immediately of a \c;\l;while\u cbot\while;\n; or \c;\l;for\u cbot\for;\n; loop.
Here is an example:
\s;\c;int i = 0;
\s;while ( true )
\s;{
\s; \n;Instructions ...\c;
\s; i = i+1;
\s; if ( i >= 10 )
\s; {
\s; break;
\s; }
\s; \n;more instructions ...\c;
\s;}
\n;
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

108
help/D/cbot/category.txt Normal file
View File

@ -0,0 +1,108 @@
\b;Value \c;Categories\n;
Categories represent the names of objects in the CBOT language. Everything in COLOBOT is an object: robots, buildings, raw materials, etc., even yourself.
In a program, categories are always displayed on a \const;red background\norm;. If a category isn't highlighted in red, it is misspelled. Caps and lower cases should be kept as is.
Below are the different categories available :
\t;Buildings :
\button 176; \c;\l;Houston\u object\Huston; \n;Mission Control
\button 171; \c;\l;SpaceShip\u object\base; \n;Spaceship
\button 160; \c;\l;BotFactory\u object\factory; \n;Robot Factory
\button 163; \c;\l;ResearchCenter\u object\research; \n;Research Center
\button 168; \c;\l;RadarStation\u object\radar; \n;Radar
\button 172; \c;\l;ExchangePost\u object\exchange; \n;Information Exchange Post
\button 169; \c;\l;RepairCenter\u object\repair; \n;Repair Center
\button 165; \c;\l;DefenseTower\u object\tower; \n;Defense Tower
\button 166; \c;\l;AutoLab\u object\labo; \n;Organic Matter Analyzer
\button 164; \c;\l;PowerStation\u object\station; \n;Power Station
\button 167; \c;\l;PowerPlant\u object\energy; \n;Power Cell Factory
\button 170; \c;\l;NuclearPlant\u object\nuclear; \n;Nuclear Plant
\button 162; \c;\l;Converter\u object\convert; \n;Titanium Converter
\button 161; \c;\l;Derrick\u object\derrick; \n;Derrick
\button 174; \c;\l;PowerCaptor\u object\captor; \n;Parabolic Lightning Conductor
\button 175; \c;\l;Vault\u object\safe; \n;Vault
\c;\l;StartArea\u object\start; \n;Starting Pad
\c;\l;GoalArea\u object\goal; \n;Finishing Pad
\c;\l;AlienNest\u object\nest; \n;Alien Nest
\t;Portable Objects :
\c;\l;TitaniumOre\u object\titanore; \n;Titanium Ore
\c;\l;UraniumOre\u object\uranore; \n;Uranium Ore
\c;\l;Titanium\u object\titan; \n;Cube of converted Titanium
\c;\l;PowerCell\u object\power; \n;Regular Power Cell
\c;\l;NuclearCell\u object\atomic; \n;Nuclear Power Cell
\c;\l;OrgaMatter\u object\bullet; \n;Organic Matter
\c;\l;BlackBox\u object\bbox; \n;Black Box
\c;\l;TNT\u object\tnt; \n;Explosive device
\c;\l;KeyA..D\u object\key; \n;Keys A, B, C and D
\t;Robots :
\button 158; \c;\l;PracticeBot\u object\bottr; \n;Practice Bot
\button 173; \c;\l;TargetBot\u object\bottarg; \n;Target Bot
\button 137; \c;\l;WheeledGrabber\u object\botgr; \n;Wheeled Grabber
\button 138; \c;\l;TrackedGrabber\u object\botgc; \n;Tracked Grabber
\button 139; \c;\l;WingedGrabber\u object\botgj; \n;Winged Grabber
\button 150; \c;\l;LeggedGrabber\u object\botgs; \n;Legged Grabber
\button 140; \c;\l;WheeledSniffer\u object\botsr; \n;Wheeled Sniffer
\button 141; \c;\l;TrackedSniffer\u object\botsc; \n;Tracked Sniffer
\button 142; \c;\l;WingedSniffer\u object\botsj; \n;Winged Sniffer
\button 152; \c;\l;LeggedSniffer\u object\botss; \n;Legged Sniffer
\button 143; \c;\l;WheeledShooter\u object\botfr; \n;Wheeled Shooter
\button 144; \c;\l;TrackedShooter\u object\botfc; \n;Tracked Shooter
\button 145; \c;\l;WingedShooter\u object\botfj; \n;Winged Shooter
\button 151; \c;\l;LeggedShooter\u object\botfs; \n;Legged Shooter
\button 153; \c;\l;WheeledOrgaShooter\u object\botor; \n;Wheeled Orga Shooter
\button 154; \c;\l;TrackedOrgaShooter\u object\botoc; \n;Tracked Orga Shooter
\button 155; \c;\l;WingedOrgaShooter\u object\botoj; \n;Winged Orga Shooter
\button 156; \c;\l;LeggedOrgaShooter\u object\botos; \n;Legged Orga Shooter
\button 149; \c;\l;Subber\u object\botsub; \n;Subber
\button 148; \c;\l;Recycler\u object\botrecy; \n;Recycler
\button 157; \c;\l;Shielder\u object\botshld; \n;Shielder
\button 146; \c;\l;Thumper\u object\bottump; \n;Thumper
\button 147; \c;\l;PhazerShooter\u object\botphaz; \n;Phazer Shooter
\t;Enemies :
\c;\l;AlienQueen\u object\mother; \n;Alien Queen
\c;\l;AlienEgg\u object\egg; \n;Alien Egg
\c;\l;AlienAnt\u object\ant; \n;Ant
\c;\l;AlienSpider\u object\spider; \n;Spider
\c;\l;AlienWasp\u object\wasp; \n;Wasp
\c;\l;AlienWorm\u object\worm; \n;Worm
\t;Miscellaneous :
\button 136; \c;\l;Me\u object\human; \n;You!
\c;\l;Mine\u object\mine; \n;Mine
\c;\l;Barrier\u object\barrier; \n;Barrier
\c;\l;Wreck\u object\wreck; \n;Derelict bot
\c;\l;Ruin\u object\ruin; \n;Derelict building
\t;Flags and Other Indicators :
\c;\l;BlueFlag\u object\flag; \n;Blue Flag
\c;\l;RedFlag\u object\flag; \n;Red Flag
\c;\l;GreenFlag\u object\flag; \n;Green Flag
\c;\l;YellowFlag\u object\flag; \n;Yellow Flag
\c;\l;VioletFlag\u object\flag; \n;Violet Flag
\c;\l;WayPoint\u object\waypoint; \n;Checkpoint
\c;\l;EnergySite\u object\enerspot; \n;Underground Energy Deposit
\c;\l;TitaniumSite\u object\stonspot; \n;Underground Titanium Deposit
\c;\l;UraniumSite\u object\uranspot; \n;Underground Uranium Deposit
\t;See also
\l;CBOT Language\u cbot; and \l;Variables\u cbot\type;.

72
help/D/cbot/class.txt Normal file
View File

@ -0,0 +1,72 @@
\b;Instruction \c;class\n;
This allows you to declare a class definition using following syntax:
\c;
\s;public class ClassName
\s;{
\s; declarations;
\s;}
\n;
Classes can only be \l;public\u cbot\public;, that is they can be used from all bots in a mission. Class members are also public, that is they are accessible from outside the class. Class members can be fields or functions (also called methods), for example the followin class \c;MyClass\n; contains 4 fields (a, b, x and s) and one method (MyFunction).
\c;
\s;public class MyClass
\s;{
\s; int a, b;
\s; float x = 3.33;
\s; string s = "hello";
\s; float MyFunction( float value )
\s; {
\s; return (value*x)-1;
\s; }
\s;}
\n;
As shown in this exemple the class members can be initialized (\c;x=3.33\n;). You can also define a constructor which is a special method having the same name as the class name. This method will be called automatically at creation time of a class instance. You can also declare more than one method with the same name but different parameters.
\c;
\s;public class MyClass
\s;{
\s; int a, b;
\s; void MyClass( )
\s; {
\s; a = 2; b = 3;
\s; }
\s; void MyClass( int a, int b )
\s; {
\s; this.a = a; this.b = b;
\s; }
\s;}
\n;
In this example two constructors are declared for \c;MyClass\n;, one without parameters and the other one with two parameters. As the names of the parameters of the second constructor are the same as the names of the two members \c;a\n; et \c;b\n; we must use the \c;\l;this\u cbot\this;.a\n; and \c;\l;this\u cbot\this;.b\n; to avoid confusion with the parameters. Another more simpler solution would be to give different names to the parameters.
\c;
\s;void Test( )
\s;{
\s; MyClass item1(); // constr. w/o parameters
\s; MyClass item2(4, 5); // constr. with 2 parameters
\s; MyClass item3; // no constructor called,
\s; // therefore item3 == null
\s;}
\n;
You can also define a destructor. This must be a \c;void\n; fonction without parameters that has the same name as the class name but prefixed by the ~ character. The destructor is called automatically as soon as the class instance is no more referenced by anyone.
\c;
\s;public class MyClass
\s;{
\s; static private int counter = 0; // instance counter
\s; void MyClass( )
\s; {
\s; counter ++; // one instance more
\s; }
\s; void ~MyClass( )
\s; {
\s; counter --; // one instance less
\s; }
\s;}
\s;void Test()
\s;{
\s; MyClass item1( ); // counter = 1
\s; MyClass item2( ); // counter = 2
\s; item1 = null; // counter = 1
\s;} // counter = 0
\n;
If you pass a class instance as parameter to a \l;function\u cbot\function;, the function only receives a \l;reference\u cbot\pointer; to the instance. That means if you modify the instance in the function, the instance that has been passed to the function will be actuallay modified.
\t;See also
\c;\l;public\u cbot\public;\n;, \c;\l;private\u cbot\private;\n;, \c;\l;static\u cbot\static;\n;, \c;\l;synchronized\u cbot\synchro;\n;, \c;\l;new\u cbot\new;\n;, \c;\l;reference\u cbot\pointer;\n;, \c;\l;this\u cbot\this;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

8
help/D/cbot/close.txt Normal file
View File

@ -0,0 +1,8 @@
\b;Instruction \c;close\n;
Close a file opened previously with \c;\l;open\u cbot\open;\n;. This is a method of the \c;\l;file\u cbot\file;\n; class; therefore you cannot write \c;close()\n; but only \c;handle.close()\n;¦:
\c;
\s; handle.close();
\n;
\t;See also
\c;\l;file\u cbot\file;\n;, \c;\l;open\u cbot\open;\n;, \c;\l;readln\u cbot\readln;\n;, \c;\l;writeln\u cbot\writeln;\n; and \c;\l;eof\u cbot\eof;\n;.
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

29
help/D/cbot/cond.txt Normal file
View File

@ -0,0 +1,29 @@
\b;Conditions
A condition is a special \l;expression\u cbot\expr; that returns a \l;boolean\u cbot\bool; value, that can only be either \c;\l;true\u cbot\true;\n; or \c;\l;false\u cbot\false;\n;. With a condition, you can choose f. ex. if the instructions in a \c;\l;while\u cbot\while;\n; loop must be repeated again, or if the instruction in a \c;\l;if\u cbot\if;\n; bloc must be executed.
Here are some operators that you can use in conditions to compare two values :
\c;a == b \n;\c;a\n; equals \c;b\n;
\c;a != b \n;\c;a\n; is different from \c;b\n;
\c;a < b \n;\c;a\n; smaller than \c;b\n;
\c;a <= b \n;\c;a\n; smaller than or equal to \c;b\n;
\c;a > b \n;\c;a\n; greater than \c;b\n;
\c;a >= b \n;\c;a\n; greater than or equal to \c;b\n;
For example :
\c;12 == 12 \n;returns true
\c;45 != 47 \n;returns true
\c;99 == 98 \n;returns false
\c;12 < -1 \n;returns false
\c;12 >= 10 \n;returns true
\c;12 >= 12 \n;returns true
\t;Remarque
Be careful not to confuse the equality comparison \c;==\n; with the assignment of a \l;variable\u cbot\var; \c;=\n;.
\c;a == b\n; is an expression that compares \c;a\n; with \c;b\n;.
\c;a = b\n; is an expression that copies the value of \c;b\n; into \c;a\n;.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

25
help/D/cbot/continue.txt Normal file
View File

@ -0,0 +1,25 @@
\b;Instruction \c;continue\n;
Syntax :
\s;\c;while ( condition )
\s;{
\s; continue;
\s;}
\n;
With this instruction, you can jump over the rest of instructions in the \c;\l;bloc\u cbot\bloc;\n; of a \c;\l;while\u cbot\while;\n; or \c;\l;for\u cbot\for;\n; loop: The execution will resume at the beginning of the bloc, the next time the loop is repeated.
Here is an example:
\s;\c;int i = 0;
\s;while ( i < 5 )
\s;{
\s; i = i+1;
\s; if ( i == 3 )
\s; {
\s; continue;
\s; }
\s; \n;Instructions ...\c;
\s;}
\n;
The instructions will only be executed for the values of \c;i\n; 1, 2, 4 and 5.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

10
help/D/cbot/deletef.txt Normal file
View File

@ -0,0 +1,10 @@
\b;Instruction \c;deletefile\n;
The deletefile instruction deletes an existing file in the files/ folder.
Files can only be deleted in the files/ folder which is located in the folder where Colobot has been installed. You cannot not delete files that are located elsewhere than in the files/ folder.
Syntax¦:
\s;\c;deletefile ( filename );\n;
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

15
help/D/cbot/delinfo.txt Normal file
View File

@ -0,0 +1,15 @@
\b;Instruction \c;deleteinfo\n;
Syntax¦:
\s;\c;deleteinfo ( name, power );\n;
Delete an existing information in the closest \l;information exchange post\u object\exchange;.
\t;name: \c;string\n;
Name of the information to be deleted. This name is a string: it must be written in quotation marks "¦".
\t;power: \c;float\n;
Power of the transmitter, which corresponds to the maximal distance between the sender and the exchange post. If the distance is longer, the information won't be deleted. Default value is 10 metres.
\t;See also
\c;\l;receive\u cbot\receive;\n;, \c;\l;send\u cbot\send;\n; and \c;\l;testinfo\u cbot\testinfo;\n;.
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

15
help/D/cbot/direct.txt Normal file
View File

@ -0,0 +1,15 @@
\b;Instruction \c;direction\n;
Syntax :
\s;\c;direction ( pos );\n;
Calculates the rotation that a robot must perform in order to point towards a given position.
\t;pos: \c;\l;point\u cbot\point;\n;
Position towards which the robot must point.
\t;Return value: \c;\l;float\u cbot\float;\n;
Angle of the rotation that must be performed. -90 means f. ex. a rotation of 90 degrees to the right.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

30
help/D/cbot/dist.txt Normal file
View File

@ -0,0 +1,30 @@
\b;Instruction \c;distance\n;
With the instruction \c;distance( , )\n; you can calculate the distance between two positions.
\b;Basic use
If you write \c;position\n; alone, this gives you the position of the bot that executes the program. If you write the name of a variable followed by \c;.position\n;, this gives you the position of the object described in the variable.
Here is a program that moves forward, covering exactly the distance between the bot and the closest ant:
\c;
\s; item = \l;radar\u cbot\radar;(AlienAnt);
\s; \l;move\u cbot\move;(distance(position, item.position));
\n;
This is of course pure suicide. Better to stop 40 meters before, in order to be at shooting range:
\c;
\s; item = radar(AlienAnt);
\s; move(distance(position, item.position) - 40);
\n;
\b;For specialists
Syntax:
\s;\c;distance ( pos1, pos2 );\n;
Calculates the distance between two positions.
\t;pos1, pos2: \c;\l;point\u cbot\point;\n;
Coordinates of the two positions.
\t;Return value: \c;\l;float\u cbot\float;\n;
Distance between the two positions.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

14
help/D/cbot/dist2d.txt Normal file
View File

@ -0,0 +1,14 @@
\b;Instruction \c;distance2d\n;
Syntax:
\s;\c;distance2d ( pos1, pos2 );\n;
Calculates the distance between two positions (ignores the z coordinate).
\t;pos1, pos2: \c;\l;point\u cbot\point;\n;
Coordinates of the two positions.
\t;Return value: \c;\l;float\u cbot\float;\n;
Distance between the two positions.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

28
help/D/cbot/do.txt Normal file
View File

@ -0,0 +1,28 @@
\b;Instruction \c;do - while\n;
Syntax:
\s;\c;do
\s;{
\s; \n;Instructions ...\c;
\s;}
\s;while ( condition );
\n;
This instruction allows you to perform several times the instructions inside the \l;block\u cbot\bloc;. The instructions are executed at least once, because the condition is tested only afterwards.
Be careful not to confuse the instruction \c;do { } while ( );\n; with the instruction \c;\l;while\u cbot\while; ( ) { }\n;; the latter tests the condition before the instructions in the block are executed.
\t;\c;condition\n;
The instructions in the block are performed over and over again, as long as the \l;condition\u cbot\cond; is true.
Here is an example :
\s;\c;do
\s;{
\s; p = radar(TitaniumOre);
\s;}
\s;while ( p == null );
\n;
\t;Attention
Always put a \l;semicolon\u cbot\term; at the end of the line \c;while ( )\n;.
The instructions \c;\l;break\u cbot\break;\n; and \c;\l;continue\u cbot\continue;\n; can be useful inside a block following the instruction \c;do { }\n;.
\t;See also
\l;Instructions\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

29
help/D/cbot/drop.txt Normal file
View File

@ -0,0 +1,29 @@
\b;Instruction \c;drop\n;
The instruction \c;drop();\n; instructs the bot to drop whatever the operating arm is carrying on the ground, on the platform of a building or on the power cell location of a bot.
\b;Basic use
The instruction \c;drop();\n; written in this form drops the object in front of the bot. Here is a short program that grabs an object in front of the bot and drops it 5 meters further:
\c;
\s; \l;grab\u cbot\grab;();
\s; \l;move\u cbot\move;(5);
\s; drop();
\n;
\b;For specialists
Syntax:
\s;\c;drop ( oper );\n;
This instruction appeals to the operating arm of a \l;grabber bot\u object\botgr;, in order to drop what it is holding.
\t;oper: \c;\l;int\u cbot\int;\n; (default value\c;InFront\n;)
Oper indicates where the robot should drop the object. If no indication is given, the object is dropped in front of the bot.
\c;InFront \n; Drops in front (default value).
\c;Behind \n; Drops behind.
\c;EnergyCell\n; Drops on the bot's own power cell location.
\t;Return value: \c;\l;int\u cbot\int;\n;
Normally an error stops the program. You can prevent the program from stopping on errors by using the \c;\l;errmode\u cbot\errmode;(0)\n; instruction. A value different from zero if an error occurred is then returned by \c;drop();\n;.
\c;== 0 \n;object was dropped
\c;!= 0 \n;error, no object was dropped
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

15
help/D/cbot/eof.txt Normal file
View File

@ -0,0 +1,15 @@
\b;Instruction \c;eof\n;
Test the end of file condition of an open file. This is a method of the \c;\l;file\u cbot\file;\n; class; therefore you cannot write \c;eof()\n; but only \c;handle.eof()\n;¦:
\c;
\s; if ( handle.eof() )
\n;
Example¦:
\c;
\s; while ( not handle.eof() )
\s; {
\s; s = handle.readln();
\s; }
\n;
\t;See also
\c;\l;file\u cbot\file;\n;, \c;\l;open\u cbot\open;\n;, \c;\l;close\u cbot\close;\n;, \c;\l;readln\u cbot\readln;\n; and \c;\l;writeln\u cbot\writeln;\n;.
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

33
help/D/cbot/errmode.txt Normal file
View File

@ -0,0 +1,33 @@
\b;Instruction \c;errmode\n;
The \c;errmode();\n; instruction allows you to chose if the program should stop when an error occurs in one of the following instructions: \c;\l;goto\u cbot\goto;\n;, \c;\l;move\u cbot\move;\n;, \c;\l;grab\u cbot\grab;\n;, \c;\l;drop\u cbot\drop;\n;, etc.
\b;For specialists
Syntax¦:
\s;\c;errmode ( mode );\n;
Normally the program is stopped when an error occurs. If you use the instruction \c;errmode(0);\n; at the beginning of the program, the instructions listed above return a value different from zero if the instruction could not be performed.
\t;mode: \c;\l;float\u cbot\float;\n; (\c;1\n; per default)
Error treatment mode.
\c;0\n; -> continues program execution and returns a non zero value
\c;1\n; -> stops the program (default behavior)
Exemple 1¦:
\s;\c;errmode(0);
\s;while ( goto(pos) != 0 )
\s;{
\s; wait(2);
\s;}
\n;
Exemple 2¦:
\s;\c;errmode(0);
\s;int err;
\s;err = goto(pos);
\s;if ( err != 0 )
\s;{
\s; \n;goto did not perform correctly ...\c;
\s; \n;take some appropriate action ...\c;
\s;}
\n;
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

88
help/D/cbot/expr.txt Normal file
View File

@ -0,0 +1,88 @@
\b;Expressions
Expressions can include the following operators:
\c;+\n; addition
\c;-\n; subtraction
\c;*\n; multiplication
\c;/\n; division
\c;%\n; remainder of the division (only for the type \c;\l;int\u cbot\int;\n;)
With the addition operator \c;+\n;, you can not only add numbers, you can also append \l;strings\u cbot\string;.
\c;
\s; int i = 12+3; // returns 15
\s; string s = "a"+"bc"; // returns "abc"
\s; int i = 2-5; // returns -3
\s; float f = 3.01*10; // returns 30.1
\s; int i = 5/3; // returns 1
\s; float f = 5/3; // returns 1.67
\s; float f = 5/0; // returns an error
\s; int i = 13%5; // returns 3
\s; int i = -8%3; // returns -2
\n;
An expression can include constants or \l;variables\u cbot\var;. For example:
\s;\c; 12+dist\n;
Multiplications and divisions are performed before additions and subtractions. In order to be sure that the operations are performed in the right order, use brackets:
\c;
\s; 12*a+b/c \n;is equivalent to\c; (12*a)+(b/c)
\s; 2.5*(dist+range)
\n;
In order to improve readability, you can put as many spaces as you want:
\c;
\s; 12*a + b/c
\s; 2.5 * (dist+range)
\n;
Here is a list of mathematical functions:
\c;sin(angle) \n;sinus
\c;cos(angle) \n;cosinus
\c;tan(angle) \n;tangent
\c;asin(value) \n;arc-sinus
\c;acos(value) \n;arc-cosinus
\c;atan(value) \n;arc-tangente
\c;sqrt(value) \n;square root
\c;pow(x, y) \n;x power y
\c;rand() \n;random value ranging between 0 and 1
Angles are in degrees.
\t;Compound assignment operators (for specialists)
Besides the \c;=\n; operators for variable assignment there are several compound-assignment operators.
The compound-assignment operators combine the \c;=\n; assignment operator with another binary operator such as \c;+\n; or \c;-\n;. Compound-assignment operators perform the operation specified by the additional operator and then assign the result to the left operand. For example, a compound-assignment expression such as
\c;\s;expression1 += expression2
is equivalent to
\c;\s;expression1 = expression1 + expression2
\c;+=\n; addition
\c;-=\n; subtraction
\c;*=\n; multiplication
\c;/=\n; division
\c;%=\n; remainder of the division (only for the type \c;\l;int\u cbot\int;\n;)
\t;Prefix and posfix increment- and decrement operators (for specialists)
The operators \c;++\n; and \c;--\n; allow you to increment (++) or to decrement (--) a variable in very compact and efficient manner.
For example to increment the variable \c;a\n; you can write
\c;\s; a++ ;
\n;instead of
\c;\s; a = a + 1 ;
\n;
The value of the expression \c;a++\n; is the value of the variable \c;a\n; before the increment. If you use the prefix operator \c;++a\n; the value of the expression is the value of the variable \c;a\n; after the increment. The same holds for the \c;--\n; decrement operator.
Exemples:
\c;\s; a = 2 ;
\s; b = a++ ;
\s; // now b contains 2 and a contains 3
\c;\s; a = 2 ;
\s; b = ++a ;
\s; // now b contains 3 and a contains 3
\n;
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

30
help/D/cbot/extern.txt Normal file
View File

@ -0,0 +1,30 @@
\b;Instruction \c;extern\n;
The \c;extern\n; instruction determines the \l;function\u cbot\function; that acts as main program of a robot. The name of the function declared with \c;extern\n; will apear in the program list in the lower left corner of the screen.
\c;
\s;extern void object::MowDown( )
\s;{
\s; while ( true )
\s; {
\s; fire(1);
\s; turn(10);
\s; }
\s;}
\n;
If the program contains other functions, only the main function must be preceded by \c;extern\n;.
\c;
\s;extern void object::Square( )
\s;{
\s; for ( int i=0 ; i<4 ; i++ )
\s; {
\s; Line(10);
\s; }
\s;}
\s;
\s;void object::Line(float dist)
\s;{
\s; move(dist);
\s; turn(90);
\s;}
\n;
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

6
help/D/cbot/false.txt Normal file
View File

@ -0,0 +1,6 @@
\b;Type \c;false\n;
This value means that a condition is not true; it is one of the two values that a \l;boolean\u cbot\bool; \l;variable\u cbot\var; can take.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

18
help/D/cbot/file.txt Normal file
View File

@ -0,0 +1,18 @@
\b;Type \c;file\n;
This type is used for accessing files in the files/ folder.
\c;
\s; file handle();
\n;
Use the syntax above for declaring a file handle. You must use () to create an instance of the \c;file\n; class. Without the () the handle would have the value \c;\l;null\u cbot\null;\n;.
Files can only be created and opened in the files/ folder which is located in the folder where Colobot has been installed. You cannot not create or open files elsewhere than in the files/ folder.
\b;For specialists
\c;file\n; is actually not a simple type but a class. \c;open\n;, \c;close\n;, \c;writeln\n; etc. are methods of the \c;file\n; class. This is the reason why we always write \c;handle.method()\n;¦:
\c;
\s; handle.open("test.txt", "w");
\s; handle.close();
\n;
\t;See also
\c;\l;open\u cbot\open;\n;, \c;\l;close\u cbot\close;\n;, \c;\l;readln\u cbot\readln;\n;, \c;\l;writeln\u cbot\writeln;\n; and \c;\l;eof\u cbot\eof;\n;.
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

31
help/D/cbot/fire.txt Normal file
View File

@ -0,0 +1,31 @@
\b;Instruction \c;fire\n;
The instruction \c;fire();\n; fires the bot's onboard cannon.
\b;Basic use
Generally this instruction is used to shoot one-second bursts:
\c;
\s; fire(1);
\n;
\b;For specialists
Syntax:
\s;\c;fire ( time );\n;
Fires the gun, with a burst that lasts a certain time. The longer the burst, the more energy it needs. This instruction can be used with the following bot types:
o \l;Shooter\u object\botfr;
o \l;Orga shooter\u object\botor;
o \l;Phazer shooter\u object\botphaz;
When controlling the robot through programming, the only way to turn the gun left or right is to turn the whole robot with the instruction \c;\l;turn\u cbot\turn;\n;.
In order to move the gun upward or downward, use the instruction \c;\l;aim\u cbot\aim;\n;.
\t;time: \c;\l;float\u cbot\float;\n;
Duration of the burst. Generally, the value given is 1. Shorter bursts can also be performed in order to spare time and energy.
\t;Return value: \c;\l;int\u cbot\int;\n;
Zero if OK, or a value different from zero if an error occurred.
\c;== 0 \n;the cannon has been fired
\c;!= 0 \n;error, the cannon could not be fired
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

17
help/D/cbot/flatgrnd.txt Normal file
View File

@ -0,0 +1,17 @@
\b;Instruction \c;flatground\n;
Syntax¦:
\s;\c;flatground ( center, rmax );\n;
Calculates the maximal radius of a flat zone on which a building ca be built.
\t;center: \c;\l;point\u cbot\point;\n;
Center of the circlular zone.
\t;rmax: \c;\l;float\u cbot\float;\n;
Maximal radius.
\t;Return value: \c;\l;float\u cbot\float;\n;
Radius of the flat zone (always between 0 and rmax).
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

25
help/D/cbot/float.txt Normal file
View File

@ -0,0 +1,25 @@
\b;Type \c;float\n;
Use this type for most variables that contains numbers. Variables of this type can contain positive and negative numbers, whole or real numbers, for example:
\c;
\s; 12.9
\s; 1.125
\s; 0.002
\s; -4.1
\n;
If you need only whole numbers (f. ex. 12 or -5000), you should rather use the type \c;\l;int\u cbot\int;\n;.
\t;Attention
Do not insert space or colon characters into a number. To separate the whole part from the fractional part, use a dot.
\c;
\s; Write and not
\s; 12.56 12 . 56
\s; -54.34 -54,34
\s;12895.69 12,895.69
\n;
\t;For specialists
Floating point numbers are represented in Colobot with 32 bits.
The highest value that can be represented is 3.4E+38.
The smallest value that can be represented is 3.4E-38.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

40
help/D/cbot/for.txt Normal file
View File

@ -0,0 +1,40 @@
\b;Instruction \c;for\n;
Syntax:
\s;\c;for ( before ; condition ; end )
\s;{
\s; \n;Instructions ...\c;
\s;}
\n;
This instruction allows you to execute a certain number of times the instructions contained in the \l;block\u cbot\bloc;.
\t;\c;before\n;
This instruction is executed before the first loop instance.
\t;\c;condition\n;
This \l;condition\u cbot\cond; determines if another instance of the loop must be executed. It is tested before every instance of the loop.
\t;\c;end\n;
This instruction is executed at the end of every instance of the loop.
Example: count from 1 to 4
\c;\s;\c;for ( i = 0 ; i <= 4 ; i++ )
\s;{
\s; message(i) ;
\s;}
\n;
The following example is strictly equivalent to a \c;for\n;-loop, but it uses the instruction \c;\l;while\u cbot\while;\n;:
\s;\c;before;
\s;while ( condition )
\s;{
\s; \n;Instructions ...\c;
\s; end;
\s;}
\n;
\t;Attention
Do not put a \l;semicolon\u cbot\term; at the end of the line \c;for ( )\n;.
The instructions \c;\l;break\u cbot\break;\n; and \c;\l;continue\u cbot\continue;\n; can be useful inside a block following the instruction \c;for \n;.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

85
help/D/cbot/function.txt Normal file
View File

@ -0,0 +1,85 @@
\b;Functions
With functions you can divide your program into several parts, each of them will execute a specific task.
Let's imagine following program¦:
\c;
\s;extern void object::Remote( )
\s;{
\s; send("order", 1, 100);
\s; wait(5);
\s; send("order", 3, 100);
\s; wait(5);
\s; send("order", 2, 100);
\s; wait(5);
\s; send("order", 4, 100);
\s; wait(5);
\s;}
\n;
\c;send\n; and \c;wait\n; are repeated several times. So it would be a good thing if we created a function that executes these two instructions:
\c;
\s;void object::SendToPost( float op )
\s;{
\s; send("order", op, 100);
\s; wait(5);
\s;}
\s;extern void object::Remote( )
\s;{
\s; SendToPost(1);
\s; SendToPost(3);
\s; SendToPost(2);
\s; SendToPost(4);
\s;}
\n;
A function can have paramteters¦:
\c;
\s;void Example( int a, float x, string s )
\n;
The \c;Exemple\n; function will reveive un integer \c;a\n;, a floating point number \c;x\n; and a string \c;s\n;. Parameters are "passed by value", that is the values of parameter variables in a function are copies of the values the caller specified as variables. If you pass an \c;int\n; to a function, its parameter is a copy of whatever value was being passed as argument, and the function can change its parameter value without affecting values in the code that invoked the function.
If you pass a \l;class\u cbot\class; instance or an \l;array\u cbot\array; as parameter to a function, the function only receives a \l;reference\u cbot\pointer; to the instance or the array. That means if you modify the instance or the array in the function, the instance or the array that has been specified by the caller will be actuallay modified.
A function can also return a result with the \c;\l;return\u cbot\return;\n; instruction. Therefore the function must be declared no longer as void but as a type:
\c;
\s;float Mean( float a, float b )
\s;{
\s; return (a+b)/2;
\s;}
\s;
\s;extern void object::Test( )
\s;{
\s; float value;
\s; value = Mean(2, 6);
\s; message( value ); // will display 4
\s;}
\n;
Some other examples¦:
\c;
\s;float Pi( )
\s;{
\s; return 3.1415;
\s;}
\s;
\s;string Sign( float a )
\s;{
\s; if ( a > 0 ) return "positive";
\s; if ( a < 0 ) return "négative";
\s; return "null";
\s;}
\n;
You can declare several functions with the same name but different parameters¦:
\c;
\s;float Pythagoras( float a, float b )
\s;{
\s; return sqrt((a*a)+(b*b));
\s;}
\s;
\s;float Pythagoras( float a, float b, float c )
\s;{
\s; return sqrt((a*a)+(b*b)+(c*c));
\s;}
\n;
CBOT will call either the one or the other function depending on the paramteres passed.
You can also declare a function \l;public\u cbot\public; so it can be used by other bots.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

35
help/D/cbot/goto.txt Normal file
View File

@ -0,0 +1,35 @@
\b;Instruction \c;goto\n;
The instruction \c;goto();\n; instructs the bot to reach a given position.
\b;Basic use
The most current use consists in moving the bot to an object located with the instruction \c;\l;radar\u cbot\radar;();\n;. If the information returned by the \c;\l;radar\u cbot\radar;();\n; has been stored in a certain variable, write the name of the variable followed by \c;.position\n; in order to get the position of the object. Here is an example of a program that looks for a \l;titanium cube\u object\titan;, goes to the position and grabs it:
\c;
\s; item = \l;radar\u cbot\radar;(Titanium);
\s; goto(item.position);
\s; \l;grab\u cbot\grab;();
\n;
\b;For specialists
Syntax:
\s;\c;goto ( position, altitude, goal, crash );\n;
Tells the robot to go to the given position, avoiding all the obstacles if this is possible.
\t;pos: \c;\l;point\u cbot\point;\n;
Coordinates of the goal position.
\t;altitude: \c;\l;float\u cbot\float;\n;
Flight altitude for \l;winged bots\u object\botgj;. The altitude is useful only for \l;winged bots\u object\botgj;. From the initial altitude, the bot climbs higher until it reaches the specified hight. When arriving close to destination, it goes down to touch the ground at the given position. If no value is given, an altitude of 10 meters is the default value. On very short moves, even winged bot stay on the ground. For all bot except winged bots, this parameter is ignored.
\t;goal: \c;\l;int\u cbot\int;\n; (default value \c;0\n;)
This parameter tells the bot how it must reach the goal:
\c;0\n; stops exactly at the goal position
\c;1\n; goes close to the goal position, without stopping.
If no value is given, \c;1\n; (precision) is the default value.
\t;Return value: \c;\l;int\u cbot\int;\n;
Normally an error stops the program. You can prevent the program from stopping on errors by using the \c;\l;errmode\u cbot\errmode;(0)\n; instruction. A value different from zero if an error occurred is then returned by \c;goto()\n;.
\c;== 0 \n;Goal position reached
\c;!= 0 \n;Goal position impossible to reach
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

29
help/D/cbot/grab.txt Normal file
View File

@ -0,0 +1,29 @@
\b;Instruction \c;grab\n;
The instruction \c;grab();\n; instructs the bot to use the operating arm to grab an object located on the ground, on the platform of a building or on the power cell location of a bot.
\b;Basic use
The instruction \c;grab();\n; written in this form grabs the object located in front of the bot. Here is a short program that grabs an object in front of the bot and drops it 5 meters further:
\c;
\s; grab();
\s; \l;move\u cbot\move;(5);
\s; \l;drop\u cbot\drop;();
\n;
\b;For specialists
Syntax:
\s;\c;grab ( oper );\n;
This instruction appeals to the operating arm of a \l;grabber bot\u object\botgr;, in order to grab the closest object.
\t;oper: \c;\l;int\u cbot\int;\n; (default value\c;InFront\n;)
Oper indicates where the bot should look for an object to grab. If no indication is given, the object is picked up in front of the bot.
\c;InFront \n; Grabs in front (default value).
\c;Behind \n; Grabs behind.
\c;EnergyCell\n; Grabs the bot's own power cell.
\t;Return value: \c;\l;int\u cbot\int;\n;
Normally an error stops the program. You can prevent the program from stopping on errors by using the \c;\l;errmode\u cbot\errmode;(0)\n; instruction. A value different from zero if an error occurred is then returned by \c;grab();\n;.
\c;== 0 \n;an object was grabbed
\c;!= 0 \n;error, no object was grabbed
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

40
help/D/cbot/if.txt Normal file
View File

@ -0,0 +1,40 @@
\b;Instructions \c;if\n; and \c;else\n;
With the instruction \c;if() {}\n; you can execute a set of instructions only if a certain condition is true. Write the condition in brackets \c;()\n;, and the instructions in braces \c;{}\n;.
\b;Basic use
Here is a concrete example: The bot will shoot only if the target is closer than 40 meters:
\c;
\s; item = \l;radar\u cbot\radar;(AlienAnt);
\s; if (\l;distance\u cbot\dist;(position, item.position) < 40)
\s; {
\s; fire(1);
\s; }
\n;
You can also test if an object exists at all. If the instruction \c;\l;radar\u cbot\radar;();\n; does not find the requested object, it returns the value \c;null\n;. So you can test if an object does not exists with the condition \c;(item == null)\n;, or test if it exists with \c;(item != null)\n;. Two equal signs \c;==\n; test equality, an exclamation mark followed by an equal sign \c;!=\n; test inequality. Here is a test that will go to rechage the \l;power cell\u object\power; only if there is a \l;power station\u object\station;:
\c;
\s; item = \l;radar\u cbot\radar;(PowerStation);
\s; if (item != null)
\s; {
\s; \l;goto\u cbot\goto;(item.position);
\s; \l;wait\u cbot\wait;(5);
\s; }
\n;
\b;For specialists
Syntax:
\s;\c;if ( condition )
\s;{
\s; \n;Instructions A ...\c;
\s;}
\s;else
\s;{
\s; \n;Instructions B ...\c;
\s;}
\n;
With this conditional structure you can execute a \l;bloc\u cbot\bloc; A or a \l;bloc\u cbot\bloc; B depending on a \l;condition\u cbot\cond;. If the condition is true, bloc A is executed. If the condition is false, bloc B is executed.
Part \c;else { }\n; is not compulsory.
\t;Attention
Do not put a \l;semicolon\u cbot\term; at the end of the line \c;if ( )\n;.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

20
help/D/cbot/int.txt Normal file
View File

@ -0,0 +1,20 @@
\b;Type \c;int\n;
Use this type for variables that contain only whole numbers, negative or positive. For example:
\c;
\s; 12
\s; 1000
\s; -4
\n;
To represent real numbers like 12.05 or -0.005, use the type \c;\l;float\u cbot\float;\n;.
\t;Attention
Do not put space or colon signs inside a number.
\t;For specialists
Numbers of the type \c;int\n; are represented with 32 bits.
The highest number that can be represented is (2^31)-1, that is 2'147'483'647.
The smallest number that can be represented is -(2^31), that is -2'147'483'648.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

16
help/D/cbot/jet.txt Normal file
View File

@ -0,0 +1,16 @@
\b;Instruction \c;jet\n;
Syntax:
\s;\c;jet ( power );\n;
Direct control of the jet of a \l;winged bot\u object\botgj;. The jet is what makes the bot fly. Use this instruction in order to take off, climb, descend or land.
\t;power: \c;\l;float\u cbot\float;\n;
Power of the jet, ranges between \c;-1\n; and \c;+1\n;. \c;jet(1);\n; instructs the bot to climb as fast as possible, \c;jet(-1);\n; descends as fast as possible, \c;jet(0);\n; stabilizes the altitude. In order to get slower altitude changes, use intermediate values, for example \c;jet(0.3);\n;.
\t;Return value: \c;\l;void\u cbot\void;\n;
None.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

25
help/D/cbot/message.txt Normal file
View File

@ -0,0 +1,25 @@
\b;Instruction \c;message\n;
Syntax:
\s;\c;message ( text, type );\n;
Prints a message on top of the screen. After a few seconds, the message disappears automatically.
\t;text: \c;\l;string\u cbot\string;\n;
Text that is to be displayed. It is possible to append several texts and/or values with the operator \c;+\n;:
\c;message("Not found");\n;
\c;message(angle);\n;
\c;message(n + " object(s) found");\n;
\c;message("Distance = " + dist + " meters");\n;
\t;type: \c;\l;int\u cbot\int;\n; (default value \c;DisplayMessage\n;)
Type of the message, that determines the background color.
o \c;DisplayMessage\n; Standard message on yellow background.
o \c;DisplayInfo \n; Information on green background.
o \c;DisplayWarning\n; Warning on blue background.
o \c;DisplayError \n; Error on red background.
\t;Return value: \c;\l;void\u cbot\void;\n;
None.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

39
help/D/cbot/motor.txt Normal file
View File

@ -0,0 +1,39 @@
\b;Instruction \c;motor\n;
The instruction \c;motor( , );\n; sets the speed for the left-hand and the right-hand motor of the bot.
\b;Basic use
The speed given to the motors will remain constant during the execution of the following instructions. Thanks to this characteristic it is possible to perform a rotation during the instruction \c;\l;fire\u cbot\fire;();\n;. This will sweep a whole zone with only one burst. Here is an example that will sweep the zone in front of the bot:
\c;
\s; \l;turn\u cbot\turn;(45); // turns 45 degrees left
\s; motor(0.5, -0.5); // slow rotation to the right
\s; \l;fire\u cbot\fire;(2); // fire
\s; motor(0,0); // stops the rotation
\n;
With the left-hand motor turning half-speed forward and the right-hand motor turning half-speed backward, the bot will turn slowly on itself during the 2-second-burst.
\b;For specialists
Syntax :
\s;\c;motor ( left, right );\n;
Gives speed instructions to the right and left motors of the robot. The motors will keep this speed until a new motor instruction is performed, or until a \c;\l;move\u cbot\move;\n;, \c;\l;turn\u cbot\turn;\n; or \c;\l;goto\u cbot\goto;\n; instruction is performed.
\t;left: \c;\l;float\u cbot\float;\n;
Speed instruction for the left motor; the value must range between -1 and 1.
\t;right: \c;\l;float\u cbot\float;\n;
Speed instruction for the right motor; the value must range between -1 and 1.
Examples :
\c;motor(1, 1);\n; moves forward with highest possible speed.
\c;motor(-0.5, -0.5);\n; moves backward with half speed.
\c;motor(1, -1);\n; turns right as fast as possible.
Note :
\c;motor(2, 2);\n; will not move forward any faster than \c;motor(1, 1)\n;
\c;motor(-2, -2);\n; will not move backward any faster than \c;motor(-1, -1)\n;
\t;Return value: \c;\l;void\u cbot\void;\n;
None.
\t;See also
\l;Instructions\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

22
help/D/cbot/move.txt Normal file
View File

@ -0,0 +1,22 @@
\b;Instruction \c;move\n;
The instruction \c;move();\n; instructs the bot to move forward or backward while keeping the same orientation. In brackets you must specify the length of the move in meters.
\b;Basic use
If you want the bot to move forward 30 meters, write \c;move(30);\n;. In order to move the bot backward after it dropped a chunk of \l;titanium ore\u object\titanore; on the \l;converter\u object\convert;, write \c;move(-2.5);\n;.
\b;For specialists
Syntax:
\s;\c;move ( length );\n;
Moves forward or backward of a given distance, always keeping the current orientation of the bot.
\t;length: \c;\l;float\u cbot\float;\n;
Length of the move, in meters. A negative value makes the bot move backward.
\t;Return value: \c;\l;int\u cbot\int;\n;
Normally an error stops the program. You can prevent the program from stopping on errors by using the \c;\l;errmode\u cbot\errmode;(0)\n; instruction. A value different from zero if an error occurred is then returned by \c;move()\n;.
\c;== 0 \n;Move executed
\c;!= 0 \n;error, the instruction was not performed correctly
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

16
help/D/cbot/nan.txt Normal file
View File

@ -0,0 +1,16 @@
\b;Type \c;nan\n;
This special value indicates that a \l;variable\u cbot\var; of type \c;\l;int\u cbot\int;\n; or \c;\l;float\u cbot\float;\n; contains no number, but "nothing".
For example, if the instruction \c;\l;receive\u cbot\receive;\n; can not get the requested information, it returns \c;nan\n; :
\c;
\s; value = receive("Length");
\s; if ( value == nan ) // not found ?
\s; {
\s;
\s; }
\n;
\t;Dictionnary
\c;nan\n; = Not A Number
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

21
help/D/cbot/new.txt Normal file
View File

@ -0,0 +1,21 @@
\b;Instruction \c;new\n; (for specialists)
The \c;new\n; operator creates a \l;class\u cbot\class; instance:
\c;\s; MyClass item; // now item is a null reference
\s; item = new MyClass(); // now item is a reference
\s; // to a new class instance
\n;
If you want to create a new instance at declaration time you can ommit the new \c;new\n; operator by putting () after the declaration:
Instead of:
\c;\s; MyClass item = new MyClass();
\n;you can write:
\c;\s; MyClass item();
\n;
If your class has a constructor with parameters you can write:
\c;\s; MyClass item = new MyClass(2, 3);
\n;or:
\c;\s; MyClass item(2, 3);
\n;
\t;See also
\c;\l;class\u cbot\class;\n;, \c;\l;reference\u cbot\pointer;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

7
help/D/cbot/null.txt Normal file
View File

@ -0,0 +1,7 @@
\b;Type \c;null\n;
This special value indicates that the variable containing it does not reference an instance.
\t;See also
\l;References\u cbot\pointer;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

70
help/D/cbot/object.txt Normal file
View File

@ -0,0 +1,70 @@
\b;Type \c;object\n;
Use this type for variables that contain the characteristics of an object, be it a bot, a building, some raw material, an enemy, etc.
\c;\l;int\u cbot\int; object.category \n;\l;Category\u cbot\category; of the object
\c;\l;point\u cbot\point; object.position \n;Position of the object (x,y,z)
\c;\l;float\u cbot\float; object.orientation \n;Orientation of the object (0..360)
\c;\l;float\u cbot\float; object.pitch \n;Forward/backward angle of the object
\c;\l;float\u cbot\float; object.roll \n;Right/left angle of the object
\c;\l;float\u cbot\float; object.energyLevel \n;Energy level (0..1)
\c;\l;float\u cbot\float; object.shieldLevel \n;Shield level (0..1)
\c;\l;float\u cbot\float; object.temperature \n;Jet temperature (0..1)
\c;\l;float\u cbot\float; object.altitude \n;Altitude above ground
\c;\l;float\u cbot\float; object.lifeTime \n;Lifetime of the object
\c;object object.energyCell \n;Power cell on the bot
\c;object object.load \n;Object carried by the bot
\s;\c;category\n;
The \n;\l;category\u cbot\category; of an object allows you to know what it is, f. ex. what kind of bot, building, enemy, etc.
\s;\c;position\n;
Position of the object on the planet, in meters. The coordinates \c;x\n; and \c;y\n; correspond to the location on a map, the \c;z\n; coordinate corresponds to the altitude above (respectively below) sea level.
\s;\c;orientation\n;
Orientation of the object, in degrees. The orientation tells you what direction the object is facing. An orientation of \c;0\n; corresponds to an object facing eastwards, thus following the positive \c;x\n; axis. The orientation is measured counterclockwise.
\s;\c;pitch\n;
Forward/backward angle of the robot. A pitch of \c;0\n; means that the bot is standing on flat ground. A positive inclination means that it is facing upwards, a negative inclination means that it is facing downwards.
\s;\c;roll\n;
Left/right angle of the bot, in degrees. A positive value means that the bot is leaning to the left side, a negative value means that it is leaning to the right side.
\s;\c;energyLevel\n;
Energy level, between 0 and 1. A normal \l;power cell\u object\power; that is fully charged returns the value \c;1\n;. A \l;nuclear power cell\u object\atomic; never returns a value higher than 1, it just lasts longer. Attention: The energy level of a bot is always zero, because the energy is not contained in the bot, but in the power cell. To know the energy level of the power cell of a bot, you must write \c;energyCell.energyLevel\n;.
\s;\c;shieldLevel\n;
Shield level of a robot or building. A level \c;1\n; indicates that the shield is still perfect. Every time that the bot or building gets a bullet or collides with another object, the shield level decreases. When the level reaches \c;0\n;, the next bullet or collision will destroy the bot or building.
Bots can re-energize their shield on a \l;repair center\u object\repair;. The shield of a building is repaired if it lays inside the protection sphere of a \l;shielder\u object\botshld;.
\s;\c;temperature\n;
Temperature of the jet of \l;winged bots\u object\botgj;. \c;0\n; corresponds to a cold jet. When used, the temperature increases progressively. When it reaches the value \c;1\n;, the jet is overheated and stops working, until it cooled down a little.
\s;\c;altitude\n;
The \c;z\n; coordinate of the position indicates the altitude above sea level, whereas the \c;altitude\n; indicates the height above ground. This value is meaningful only for \l;winged bots\u object\botgj; and for \l;wasps\u object\wasp;. For all other objects, this value is zero.
\s;\c;lifeTime\n;
The age of the object in seconds since it's creation.
\s;\c;energyCell\n;
This information is special, because it returns the information about another object, in this case the power pack. This means that energyCell contains all the characteristics of a normal object, for example \c;category\n; (PowerCell or NuclearCell), \c;position\n; (the position of the cell), etc.
If you want to know the energy level of a robot, you must not check \c;energyLevel\n;, but \c;energyCell.energyLevel\n;.
If the bot has bot no power cell, \c;energyCell\n; returns \c;null\n;.
\s;\c;load\n;
This information also returns the description of a whole object: the description of the object carried by a \l;grabber\u object\botgr;. If it carries nothing, \c;load\n; returns \c;null\n;.
\b;Examples
The type \c;object\n; returns the special value \c;\l;null\u cbot\null;\n; when the object does not exist. For example:
\c;
\s; object a;
\s; a = radar(BotGrabberRoller);
\s; if ( a == null ) // object does not exist ?
\s; {
\s; }
\s; if ( a.position.z > 50 ) // is it on a mountain ?
\s; {
\s; }
\n;
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

20
help/D/cbot/open.txt Normal file
View File

@ -0,0 +1,20 @@
\b;Instruction \c;open\n;
Open a text file in the files/ folder. This is a method of the \c;\l;file\u cbot\file;\n; class. This is the reason why we always write \c;handle.open()\n;¦:
\c;
\s; handle.open("test.txt", "w");
\n;
To open a file, proceed as follows¦:
\c;
\s; file handle();
\s; handle.open("filename", "w");
\s; handle.writeln("abc");
\s; handle.close();
\n;
\c;"r"\n; mode: open for reading.
\c;"w"\n; mode: open for writing.
Files can only be created and opened in the files/ folder which is located in the folder where Colobot has been installed. You cannot not create or open files that are located elsewhere than in the files/ folder.
\t;See also
\c;\l;file\u cbot\file;\n;, \c;\l;close\u cbot\close;\n;, \c;\l;readln\u cbot\readln;\n;, \c;\l;writeln\u cbot\writeln;\n; and \c;\l;eof\u cbot\eof;\n;.
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

11
help/D/cbot/openfile.txt Normal file
View File

@ -0,0 +1,11 @@
\b;Instruction \c;openfile\n;
\c;openfile();\n; opens an text file in the files/ folder. This is not a method of the \c;\l;file\u cbot\file;\n; class but openfile returne a \l;reference\u cbot\pointer; to a new instance of the file class. You must supply two parameters, the filename and the opening mode.
\c;
\s;file handle = openfile("filename", "r");
\n;
\c;"r"\n; mode: open for reading.
\c;"w"\n; mode: open for writing.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

36
help/D/cbot/point.txt Normal file
View File

@ -0,0 +1,36 @@
\b;Type \c;point\n;
Variables of this type contain the coordinates of a point in space. This type is made of three values that represent the \c;x\n;, \c;y\n; and \c;z\n; coordinates.
\c;x\n; and \c;y\n; correspond to the place on the ground. The positive \c;x\n; axis faces towards east, the positive \c;y\n; axis faces towards north.
The \c;z\n; value corresponds to the altitude above sea level.
If you want to declare a variable of type point, you can write:
\c;
\s; point a (10, 20, 30);
\n;
You can also set the variable taking one value after another:
\c;
\s; point b;
\s; b.x = 10;
\s; b.y = 20;
\s; b.z = 30;
\n;
With these examples, the following \l;condition\u cbot\cond; is true:
\c;
\s; if ( a == b )
\s; {
\s; }
\n;
The following declaration :
\c;
\s; point c (4, 7);
\n;
Is equivalent to :
\c;
\s; point c;
\s; c.x = 4;
\s; c.y = 7;
\s; c.z = 0;
\n;
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

53
help/D/cbot/pointer.txt Normal file
View File

@ -0,0 +1,53 @@
\b;References (for specialists)
CBOT uses references for \l;classes\u cbot\class; and \l;arrays\u cbot\array;. Any class variable actually contains a reference to the instance. The instance actually contains the class fields. Several references can reference the same instance. A \c;\l;null\u cbot\null;\n; reference references nothing. You can compare an instance to a suitcase and a reference to a carrier. Each time we need a new suitcase we create a new instance with a carrier. But a suitcase can be carried by more than one carrier. A carrier who carries no suitcase is a \c;\l;null\u cbot\null;\n; reference.
Example:
\c;\s;{
\s; MyClass item1(); // create a new instance
\s; // referenced by item1
\s; MyClass item2; // create a null reference
\s; item2 = item1; // copy the reference,
\s; // item2 and item1 now reference
\s; // the same instance
\s; item1.a = 12; // modifies the instance
\s; // referenced by item1 (and item2)
\s; message(item2.a);// displays 12
\s;}
\n;
If you pass a \l;class\u cbot\class; instance as parameter to a function, the function only receives a reference to the instance. That means if you modify the instance in the function, the instance that has been specified by the caller will be actuallay modified.
\c;\s;void Test( MyClass item )
\s;{
\s; item.a = 12; // modify the original instance
\s; item = new MyClass(); // new local instance
\s; item.a = 33; // modifie the local instance
\s;}
\n;
Calling the fucntion \c;Test()\n;¦:
\c;\s;{
\s; MyClass toto();
\s; Test(toto);
\s; message(toto.a); // displays 12
\s;}
\n;
The instance containing the field \c;a = 33\n; is referenced only by the newly created instance \c;item\n; inside the fucntion \c;Test\n;. At the end of \c;Test\n; this newly created instance referenced by \c;item\n; is automatically deleted.
A function can return an instance¦:
\c;\s;MyClass Test2( )
\s;{
\s; MyClass item = new MyClass();
\s; item.x = 33;
\s; return item;
\s;}
\n;
Call the function like this:
\c;\s;{
\s; MyClass toto;
\s; toto = Test2(); // toto will contain a reference to
\s; // the instance created by Test2()
\s; message(toto.a); // displays 33
\s;}
\n;
\t;See also
\c;\l;class\u cbot\class;\n;, \c;\l;new\u cbot\new;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

19
help/D/cbot/private.txt Normal file
View File

@ -0,0 +1,19 @@
\b;Instruction \c;private\n; (for specialists)
\l;Class\u cbot\class; members can be \l;public\u cbot\public; (by default) or private. A member can be declared privat by putting \c;private\n; before the type declaration of the member. Private members are not accessible from outside the class definition.
\c;
\s;public class MyClass
\s;{
\s; int b; // public by défault
\s; public int a; // als public
\s; private point position; // privat
\s;}
\s;void Test()
\s;{
\s; MyClass item;
\s; item.a = item.b = 12; // ok
\s; message( item.position ); // this is an error
\s;}
\n;
\t;See also
\c;\l;class\u cbot\class;\n;, \c;\l;public\u cbot\public;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

51
help/D/cbot/public.txt Normal file
View File

@ -0,0 +1,51 @@
\b;Instruction \c;public\n; (for specialists)
This instruction has two distinct purposes¦:
1) Make a function available to other bots.
2) Make a class member accessible from outside the class definition.
\b;Instruction \c;public\n; for functions
If you put \c;public\n; before a \l;function\u cbot\function; definition, you can make the function available to programs in other bots in the same mission.
For example in the first bot we would have¦:
\c;
\s;public void object::Segment(float dist, float angle)
\s;{
\s; move(dist);
\s; turn(angle);
\s;}
\n;
And in another bot we would have¦:
\c;
\s;extern void object::Square( )
\s;{
\s; for ( int i=0 ; i<4 ; i++ )
\s; {
\s; Segment(10, 90);
\s; fire(1);
\s; }
\s;}
\n;
If you have declared a function \c;public\n;, you cannot define a function with the same name and arguments in another bot of the same mission.
If a bot containing a \c;public\n; function is destroyed, the other bots that make use of this function will be stopped with an error.
\b;Instruction \c;public\n; for classes
\l;Class\u cbot\class; members can be public (by default) or \l;privat\u cbot\private;. A member can be declared private by putting \c;private\n; before the member type. Private members are not accessible from outside the class definition.
\c;
\s;public class MyClass
\s;{
\s; int b; // public by default
\s; public int a; // also public
\s; private point position; // privat
\s;}
\s;void Test()
\s;{
\s; MyClass item;
\s; item.a = item.b = 12; // ok
\s; message( item.position ); // this is an error
\s;}
\n;
\t;See also
\c;\l;class\u cbot\class;\n;, \c;\l;private\u cbot\private;\n;, \c;\l;functions\u cbot\function;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

60
help/D/cbot/radar.txt Normal file
View File

@ -0,0 +1,60 @@
\b;Instruction \c;radar\n;
With the instruction \c;radar()\n;, you can look for objects like \l;enemies\u object\mother;, bots, buildings or raw materials.
\b;Basic use
Write in brackets the \l;name of the object\u cbot\category; that you look for. Put the result in a variable of the \l;type\u cbot\type; \c;object\n;. Here is an example that looks for the closest ant:
\c;
\s;// At the beginning of the program:
\s;object item; // variable declaration
\s;
\s;// Look for the closest ant
\s;item = radar(AlienAnt);
\n;
\b;For specialists
Syntax:
\s;\c;radar ( category, angle, focus, min, max, way );\n;
Detects an object according to several parameters.
\image radar1 8 8;
Seen from above, the purple zone corresponds to the zone where objects will be detected.
\t;category: \c;\l;int\u cbot\int;\n;
\l;Category\u cbot\category; of the objects that should be detected. For example, when you are looking for an ant, write \c;radar (AlienAnt)\n;.
\t;angle: \c;\l;float\u cbot\float;\n; (default value\c;0\n;)
Direction that the radar is facing, in degrees.
\c; 0\n; -> radar is facing straight ahead
\c;-90\n; -> radar is facing a quarter turn right
\c; 90\n; -> radar is facing a quarter turn left
\t;focus: \c;\l;float\u cbot\float;\n; (default value\c;360\n;)
Opening angle of the radar, in degrees.
\t;min: \c;\l;float\u cbot\float;\n; (default value \c;0\n;)
Minimum detection distance, in meters. Objects that are closer than the minimum distance will not be detected.
\t;max: \c;\l;float\u cbot\float;\n; (Default value\c;1000\n;)
Maximum detection distance, in meters. Objects that are farther away than the maximum distance will not be detected.
\t;way: \c;\l;float\u cbot\float;\n; (default value\c;1\n;)
Determines which way the objects are detected. With value \c;1\n;, returns the closest object found in the specified zone. With value \c;-1\n;, the farthest object in the zone will be returned.
\t;Return value: \c;\l;object\u cbot\object;\n;
Returns the first object found that corresponds to the specified category in the specified zone. If no object was found, returns the value \c;\l;null\u cbot\null;\n;.
\t;Remark
You do not have to give all the parameters. Here are two examples of instructions that are equivalent:
\c;
\s; radar(Titanium, 0, 360, 0, 1000);
\s; radar(Titanium); // equivalent
\s; radar(Titanium, 0, 90, 0, 1000);
\s; radar(Titanium, 0, 90); // equivalent
\n;
When one or more parameters are not specified, the default values indicated above are used instead; only the first parameter is compulsory.
Generally, only the first parameter is specified: f. ex. \c;radar (AlienAnt)\n; detects the closest ant, wherever it may be.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

20
help/D/cbot/readln.txt Normal file
View File

@ -0,0 +1,20 @@
\b;Instruction \c;readln\n;
Read one line from an open file in the files/ folder. This is a method of the \c;\l;file\u cbot\file;\n; class. This is the reason why we always write \c;handle.readln()\n;¦:
\c;
\s; s = handle.readln();
\n;
The file must have been opened for reading (\c;"r"\n;) with the \c;\l;open\u cbot\open;\n; instruction. \c;readln\n; returns the string containing the whole line but without the end of line characters 0x0D (CR) and 0x0A (LF).
Syntax¦:
\s;\c;string = handle.readln ( );\n;
Example¦:
\c;
\s; string s;
\s; s = handle.readln();
\s; if ( s == "abc" )
\s; ...
\n;
\t;See also
\c;\l;file\u cbot\file;\n;, \c;\l;open\u cbot\open;\n;, \c;\l;close\u cbot\close;\n;, \c;\l;writeln\u cbot\writeln;\n; and \c;\l;eof\u cbot\eof;\n;.
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

18
help/D/cbot/receive.txt Normal file
View File

@ -0,0 +1,18 @@
\b;Instruction \c;receive\n;
Syntax:
\s;\c;receive ( name, power );\n;
Retrieves an information from the closest \l;information exchange post\u object\exchange;.
\t;name: \c;string\n;
Name of the information required from the exchange post. This name is a string: it must be written in quotation marks "¦".
\t;power: \c;float\n;
Power of the receiver, which corresponds to maximal distance between the receiver and the exchange post. If the distance is longer, no information is received. Default value is 10 metres.
\t;Return value: \c;\l;float\u cbot\float;\n;
Value of the retrieved information. If no exchange post is close enough, or if the name of the requested information does not exist in the exchange post, the value \c;nan\n; is returned.
\t;See also
\c;\l;send\u cbot\send;\n;, \c;\l;testinfo\u cbot\testinfo;\n; and \c;\l;deleteinfo\u cbot\delinfo;\n;.
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

14
help/D/cbot/recycle.txt Normal file
View File

@ -0,0 +1,14 @@
\b;Instruction \c;recycle\n;
Syntax:
\s;\c;recycle ( );\n;
Recycles the derelict bot in front of the \l;recycler\u object\botrecy; into a \l;titanium cube\u object\titan;.
\t;Return value: \c;\l;int\u cbot\int;\n;
Zero if OK, or a value different from zero if an error occurred.
\c;== 0 \n;the derelict bot has been recycled
\c;!= 0 \n;error, no derelict bot could be recycled
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

15
help/D/cbot/retobj.txt Normal file
View File

@ -0,0 +1,15 @@
\b;Instruction \c;retobject\n;
Syntax:
\s;\c;retobject ( number );\n;
Returns the object corresponding to the given number.
\t;number: \c;\l;int\u cbot\int;\n;
Number of the object, between 0 and n. "n" represents the total number of objects in the scene.
\t;Return value: \c;\l;object\u cbot\object;\n;
Object corresponding to the number. The return value \c;\l;null\u cbot\null;\n; means that no object corresponds to this number, because the number was too high, and there are not so many objects in the scene.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

31
help/D/cbot/return.txt Normal file
View File

@ -0,0 +1,31 @@
\b;Instruction \c;return\n;
Returns from a function. Syntax:
\c;
\s;void function ( )
\s;{
\s; return;
\s;}
\n;
\b;For specialists
If the \l;function\u cbot\function; has a return type, the \c;return\n; instruction must be followed by the value to be returned:
\c;
\s;float Pi ( )
\s;{
\s; return 3.1415;
\s;}
\s;float Mean (float a, float b)
\s;{
\s; return (a+b)/2;
\s;}
\s;string Sign (float a)
\s;{
\s; if ( a > 0 ) return "positive";
\s; if ( a < 0 ) return "négative";
\s; return "null";
\s;}
\n;
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

18
help/D/cbot/search.txt Normal file
View File

@ -0,0 +1,18 @@
\b;Instruction \c;search\n;
Syntax:
\s;\c;search ( category, position );\n;
Detects the object of the given category that is closest to the given position.
\t;category: \c;\l;int\u cbot\int;\n;
\l;Category\u cbot\category; of the requested object.
\t;position: \c;\l;point\u cbot\point;\n;
\c;search\n; returns the object of the given category that is closest to the position indicated here.
\t;Return value: \c;\l;object\u cbot\object;\n;
Characteristics of the object that has been found. The value \c;\l;null\u cbot\null;\n; means that no object of this category has been found.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

19
help/D/cbot/send.txt Normal file
View File

@ -0,0 +1,19 @@
\b;Instruction \c;send\n;
Syntax¦:
\s;\c;send ( name, value, power );\n;
Sends an information to the closest \l;information exchange post\u object\exchange;.
\t;name: \c;string\n;
Name of the information to be sent to the exchange post. This name is a string: it must be written in quotation marks "¦".
If there is any information having this name, a new entry is created, as far as the total number of entries does not exceed 10. If there is already an information having this name, value is simply replaced by the new.
\t;value: \c;float\n;
Value of the information to be sent.
\t;power: \c;float\n;
Power of the transmitter, which corresponds to the maximal distance to where information can be the sent. Default value is 10 metres.
\t;See also
\c;\l;receive\u cbot\receive;\n;, \c;\l;testinfo\u cbot\testinfo;\n; and \c;\l;deleteinfo\u cbot\delinfo;\n;.
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

Some files were not shown because too many files have changed in this diff Show More