ScummVM API documentation
person.h
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 modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ULTIMA_ULTIMA1_WIDGETS_PERSON_H
23 #define ULTIMA_ULTIMA1_WIDGETS_PERSON_H
24 
25 #include "ultima/ultima1/widgets/urban_widget.h"
26 #include "ultima/ultima1/maps/map.h"
27 #include "ultima/ultima1/maps/map_base.h"
28 #include "ultima/ultima1/game.h"
29 #include "ultima/shared/maps/creature.h"
30 
31 namespace Ultima {
32 namespace Ultima1 {
33 namespace Widgets {
34 
38 class Person : public UrbanWidget, public Shared::Maps::Creature {
39  DECLARE_MESSAGE_MAP;
40 protected:
41  Ultima1Game *_game;
42  Maps::MapBase *_map;
43 protected:
47  bool areGuardsHostile() const;
48 
52  int getRandomDelta() const;
53 
58  return Point(getRandomDelta(), getRandomDelta());
59  }
60 public:
61  CLASSDEF;
62 
66  Person(Ultima1Game *game, Maps::MapBase *map, uint tileNum, int hitPoints) :
67  UrbanWidget(game, map, tileNum), Shared::Maps::Creature(game, map, hitPoints), _game(game), _map(map) {}
68 
72  Person(Ultima1Game *game, Maps::MapBase *map, uint tileNum) :
73  UrbanWidget(game, map, tileNum), Shared::Maps::Creature(game, map), _game(game), _map(map) {}
74 
78  void synchronize(Common::Serializer &s) override;
79 
83  virtual void talk() {}
84 
90  bool subtractHitPoints(uint amount) override;
91 };
92 
93 } // End of namespace Widgets
94 } // End of namespace Ultima1
95 } // End of namespace Ultima
96 
97 #endif
Definition: urban_widget.h:35
bool subtractHitPoints(uint amount) override
void synchronize(Common::Serializer &s) override
Person(Ultima1Game *game, Maps::MapBase *map, uint tileNum, int hitPoints)
Definition: person.h:66
Definition: serializer.h:79
Creature(Game *game, MapBase *)
Definition: creature.h:67
Definition: map_base.h:39
Definition: person.h:38
virtual void talk()
Definition: person.h:83
Definition: detection.h:27
Definition: creature.h:40
Definition: rect.h:45
Definition: game.h:42
Person(Ultima1Game *game, Maps::MapBase *map, uint tileNum)
Definition: person.h:72
Point getRandomMoveDelta() const
Definition: person.h:57