Introduction |
This file contain general notes about source code and how it organized. You can find more specified information about classes and how to use them in their directory. For each directory in the 'src', there's a directory with the same name here. You can find documents of classes in that directories.
Overview |
The program will start form 'iwor.cpp', containing 'main()'. 'main()' will create an object from 'Interface', and 'Interface' will start the game.
Two major objects is necessary for starting a game: A 'server' to handle connections of robots, receiving their message and etc. A 'world' to keep information about world, location of the objects (such as robots and walls) and such that.
'Interface' will handle communication between 'server' and the 'world'. It will gain messages from robots, process them, and command the 'world' to do the action. Also 'Interface' will receive messages (such as errors, state of a robot, ...) from 'world' and send them to the robots through the 'server'.
Directories Description |
Source code is in 'src' directory. 'src' itself consists of several
other directories:
structures: Contains data structures used in IWOR.
network: This directory contains classes for communication
between processes using sockets.
world: Contains classes for handling the world. This is the
heart of the IWOR. If you want to understand IWOR, you should start
from here.
worldobjects: Obviously, this directory contains objects
in the world. For example, Robot, Factory, and such that.
GUI: Contains GUIHandler class which handle the GUIs connection
and send data to them when the world changes.
java-gui: A simple 2D GUI wrote in java.
ncurses-gui: A simple GUI wrote in C++ using ncurses library.
Coding Style |
This section contains some general informations about coding style used in IWOR. It will help you understand the code more clearly.
1) All of the including codes are similar to this:
#ifndef _LINKEDLIST_HPP_INCLUDED
#include "LinkedList.hpp"
#define _LINKEDLIST_HPP_INCLUDED
#endif
This definitions is used to avoid 'mulitdefinition' of a
single header file. This style is used in all of the source
files.
2) There's some 'debug' sections for printing
out debugging information. They're similar to the following:
#ifdef DEBUG
//Printing codes.
#endif
You can active it by passing -DDEBUG parameter to the compiler.
If not, the program will run silently and only print
out necessary informations.