ManaPlus
socialtabbase.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2011-2019 The ManaPlus Developers
4  * Copyright (C) 2019-2021 Andrei Karas
5  *
6  * This file is part of The ManaPlus Client.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef GUI_WIDGETS_TABS_SOCIALTABBASE_H
23 #define GUI_WIDGETS_TABS_SOCIALTABBASE_H
24 
25 #include "actormanager.h"
26 
27 ACTORMANAGER_H
28 
30 
31 ENUMS_RESOURCES_MAP_MAPITEMTYPE_H
32 
33 #define addAvatars(mob, str, type) \
34 {\
35  ava = new Avatar(str);\
36  ava->setOnline(false);\
37  ava->setLevel(-1);\
38  ava->setType(MapItemType::SEPARATOR);\
39  ava->setX(0);\
40  ava->setY(0);\
41  avatars->push_back(ava);\
42  mobs = actorManager->get##mob##s();\
43  i = mobs.begin();\
44  i_end = mobs.end();\
45  while (i != i_end)\
46  {\
47  std::string name;\
48  int level = -1;\
49  if ((*i).empty())\
50  {\
51  name = _("(default)");\
52  level = 0;\
53  }\
54  else\
55  {\
56  name = *i;\
57  }\
58  ava = new Avatar(name);\
59  ava->setOnline(true);\
60  ava->setLevel(level);\
61  ava->setType(MapItemType::type);\
62  ava->setX(0);\
63  ava->setY(0);\
64  avatars->push_back(ava);\
65  ++ i;\
66  }\
67 }
68 
69 #define updateAtkListStart() \
70  if (!socialWindow || !localPlayer || !actorManager)\
71  return;\
72  STD_VECTOR<Avatar*> *const avatars = mBeings->getMembers();\
73  STD_VECTOR<Avatar*>::iterator ia = avatars->begin();\
74  while (ia != avatars->end())\
75  {\
76  delete *ia;\
77  ++ ia;\
78  }\
79  avatars->clear();\
80  Avatar *ava = nullptr;\
81  std::list<std::string> mobs;\
82  std::list<std::string>::const_iterator i;\
83  std::list<std::string>::const_iterator i_end
84 
85 #endif // GUI_WIDGETS_TABS_SOCIALTABBASE_H