1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #include "ultima/ultima4/game/context.h"
24 #include "ultima/ultima4/game/player.h"
25 #include "ultima/ultima4/views/stats.h"
26 #include "ultima/ultima4/map/location.h"
27 
28 namespace Ultima {
29 namespace Ultima4 {
30 
31 Context *g_context;
32 
Context()33 Context::Context() : _stats(nullptr), _aura(nullptr),
34 		_party(nullptr), _location(nullptr) {
35 	g_context = this;
36 	reset();
37 }
38 
~Context()39 Context::~Context() {
40 	g_context = nullptr;
41 	reset();
42 }
43 
reset()44 void Context::reset() {
45 	delete _stats;
46 	delete _aura;
47 	delete _party;
48 
49 	while (_location)
50 		locationFree(&_location);
51 
52 	_stats = nullptr;
53 	_aura = nullptr;
54 	_party = nullptr;
55 	_location = nullptr;
56 
57 	_lastShip = nullptr;
58 	_line = 9999;
59 	_col = 0;
60 	_moonPhase = 0;
61 	_windDirection = 0;
62 	_windCounter = 0;
63 	_windLock = false;
64 	_horseSpeed = 0;
65 	_opacity = 0;
66 	_lastCommandTime = 0;
67 	_transportContext = TRANSPORT_ANY;
68 }
69 
70 } // End of namespace Ultima4
71 } // End of namespace Ultima
72