1 ////////////////////////////////////////////////////////////////////////////////
2 // Scorched3D (c) 2000-2009
4 // This file is part of Scorched3D.
6 // Scorched3D is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // Scorched3D is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with Scorched3D; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ////////////////////////////////////////////////////////////////////////////////
21 #include <engine/ScorchedContext.h>
22 #include <engine/GameState.h>
23 #include <engine/ActionController.h>
24 #include <engine/ViewPoints.h>
25 #include <engine/ModFiles.h>
26 #include <net/NetInterface.h>
27 #include <coms/ComsMessageHandler.h>
28 #include <common/OptionsTransient.h>
29 #include <tank/TankContainer.h>
30 #include <tank/TankTeamScore.h>
31 #include <tank/TankModelStore.h>
32 #include <target/TargetSpace.h>
33 #include <movement/TargetMovement.h>
34 #include <landscapemap/LandscapeMaps.h>
35 #include <landscapedef/LandscapeDefinitions.h>
36 #include <weapons/AccessoryStore.h>
37 #include <lua/LUAScriptHook.h>
39 ScorchedContext::ScorchedContext(const char *name
, bool server
) :
42 actionController
= new ActionController();
43 accessoryStore
= new AccessoryStore();
44 gameState
= new GameState(name
);
45 targetContainer
= new TargetContainer();
46 tankContainer
= new TankContainer(*targetContainer
);
47 landscapeMaps
= new LandscapeMaps();
48 comsMessageHandler
= new ComsMessageHandler(name
);
49 netInterface
= (NetInterface
*) 0;
50 optionsGame
= new OptionsScorched();
51 optionsTransient
= new OptionsTransient(*optionsGame
);
52 viewPoints
= new ViewPoints();
53 modFiles
= new ModFiles();
54 landscapes
= new LandscapeDefinitions();
55 tankModelStore
= new TankModelStore();
56 tankTeamScore
= new TankTeamScore();
57 targetSpace
= new TargetSpace();
58 targetMovement
= new TargetMovement();
59 luaScriptFactory
= new LUAScriptFactory();
60 luaScriptHook
= new LUAScriptHook(luaScriptFactory
,
61 server
?"server":"client",
62 server
?S3D::getSettingsFile("serverhooks"):S3D::getSettingsFile("clienthooks"));
64 getViewPoints().setContext(this);
65 getActionController().setScorchedContext(this);
66 getTargetSpace().setContext(this);
67 luaScriptFactory
->setContext(this);
70 ScorchedContext::~ScorchedContext()