Chapter 3.3 - Compiling the Framework
Before you can call make, you have to do a little change in initcomponents.cpp. It's the main initalization file for the whole RealTimeBattle Framework. The change is to tell the framework that there is a new strategy.
First, you have to add an include statement
pointing to your strategy factory header file.
For exaplme, Brotfrucht calls #include
"bots/brotfucht/bffactory.h"
.
The second step is to add a usig statement for
your factory class in void
initComponents()
. Brotfrucht needs there:
using Brotfrucht::BFFactory;
because
Brotfrucht's namespace is Brotfrucht and its
factory class is called BFFactory.
The last step is the step where we really add
the strategy. In void initComponents()
,
we have to add the line mrc->registrateStrategyFactory("Brotfrucht",auto_ptr&
lt;Strategies::StrategyFactory>(new BFFactory()));
for Brotfrucht for example. mrc is the Master Resource Control,
the central unit of the RealTimeBattle Framework.
Brotfrucht is the name of the strategy. With this
name you can identifiy a strategy for a robot in
the config-file. The second parameter is an auto pointer
to an instance of a class derivated from Strategies::StrategyFactory. For Brotfrucht, it's a new instance of BFFactory().
That are all changes you have to make at the framework. It's ready for compiling now.
Compilation
Take a shell and call make install. If it is your first compilation you have to call the configure script by calling ./configure first.
The first compilation of the RealTimeBattle Framework may take a little time. But when you just add a new strategy it will be faster cause some parts are not getting compiled again.