ManaPlus
Macros | Functions | Variables
actorsprite.cpp File Reference

(43abb22)

#include "being/actorsprite.h"
#include "configuration.h"
#include "settings.h"
#include "statuseffect.h"
#include "being/localplayer.h"
#include "const/utils/timer.h"
#include "gui/theme.h"
#include "listeners/debugmessagelistener.h"
#include "particle/particle.h"
#include "resources/db/statuseffectdb.h"
#include "resources/loaders/imageloader.h"
#include "resources/sprite/animatedsprite.h"
#include "resources/sprite/imagesprite.h"
#include "resources/sprite/spritereference.h"
#include "utils/checkutils.h"
#include "utils/delete2.h"
#include "utils/foreach.h"
#include "utils/timer.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define for_each_cursors()
 
#define end_foreach   }
 

Functions

static void applyEffectByOption (ActorSprite *const actor, uint32_t option, const char *const name, const OptionsMap &options)
 
static void applyEffectByOption1 (ActorSprite *const actor, uint32_t option, const char *const name, const OptionsMap &options)
 
static const char * cursorType (const TargetCursorTypeT type)
 
static const char * cursorSize (const TargetCursorSizeT size)
 

Variables

static const unsigned int STATUS_EFFECTS = 32
 

Macro Definition Documentation

◆ end_foreach

#define end_foreach   }

◆ for_each_cursors

#define for_each_cursors ( )

Function Documentation

◆ applyEffectByOption()

static void applyEffectByOption ( ActorSprite *const  actor,
uint32_t  option,
const char *const  name,
const OptionsMap options 
)
static

Definition at line 249 of file actorsprite.cpp.

References config, DebugMessageListener::distributeEvent(), Enable_false, Enable_true, FOR_EACH, Configuration::getBoolValue(), IsStart_false, Logger::log(), logger, ServerCommandType::option, ActorSprite::setStatusEffect(), ServerCommandType::str, and strprintf().

Referenced by ActorSprite::setStatusEffectOpiton0(), and ActorSprite::setStatusEffectOpitons().

253 {
254  FOR_EACH (OptionsMapCIter, it, options)
255  {
256  const uint32_t opt = (*it).first;
257  const int32_t id = (*it).second;
258  const Enable enable = (opt & option) != 0 ? Enable_true : Enable_false;
259  option |= opt;
260  option ^= opt;
261  actor->setStatusEffect(id,
262  enable,
263  IsStart_false);
264  }
265  if (option != 0U &&
266  config.getBoolValue("unimplimentedLog"))
267  {
268  const std::string str = strprintf(
269  "Error: unknown effect by %s. "
270  "Left value: %u",
271  name,
272  option);
273  logger->log(str);
275  }
276 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
Configuration config
const bool Enable_true
Definition: enable.h:29
Logger * logger
Definition: logger.cpp:95
bool getBoolValue(const std::string &key) const
OptionsMap::const_iterator OptionsMapCIter
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
const bool IsStart_false
Definition: isstart.h:29
const bool Enable_false
Definition: enable.h:29
static void distributeEvent(const std::string &msg)
void log(const char *const log_text,...)
Definition: logger.cpp:243
void setStatusEffect(const int32_t index, const Enable active, const IsStart start)

◆ applyEffectByOption1()

static void applyEffectByOption1 ( ActorSprite *const  actor,
uint32_t  option,
const char *const  name,
const OptionsMap options 
)
static

Definition at line 278 of file actorsprite.cpp.

References config, DebugMessageListener::distributeEvent(), Enable_false, Enable_true, FOR_EACH, Configuration::getBoolValue(), IsStart_false, Logger::log(), logger, ActorSprite::setStatusEffect(), ServerCommandType::str, and strprintf().

Referenced by ActorSprite::setStatusEffectOpitons().

282 {
283  FOR_EACH (OptionsMapCIter, it, options)
284  {
285  const uint32_t opt = (*it).first;
286  const int32_t id = (*it).second;
287  if (opt == option)
288  {
289  actor->setStatusEffect(id,
290  Enable_true,
291  IsStart_false);
292  option = 0U;
293  }
294  else
295  {
296  actor->setStatusEffect(id,
297  Enable_false,
298  IsStart_false);
299  }
300  }
301  if (option != 0 &&
302  config.getBoolValue("unimplimentedLog"))
303  {
304  const std::string str = strprintf(
305  "Error: unknown effect by %s. "
306  "Left value: %u",
307  name,
308  option);
309  logger->log(str);
311  }
312 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
Configuration config
const bool Enable_true
Definition: enable.h:29
Logger * logger
Definition: logger.cpp:95
bool getBoolValue(const std::string &key) const
OptionsMap::const_iterator OptionsMapCIter
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
const bool IsStart_false
Definition: isstart.h:29
const bool Enable_false
Definition: enable.h:29
static void distributeEvent(const std::string &msg)
void log(const char *const log_text,...)
Definition: logger.cpp:243
void setStatusEffect(const int32_t index, const Enable active, const IsStart start)

◆ cursorSize()

static const char* cursorSize ( const TargetCursorSizeT  size)
static

◆ cursorType()

static const char* cursorType ( const TargetCursorTypeT  type)
static

Definition at line 530 of file actorsprite.cpp.

References TargetCursorType::IN_RANGE, TargetCursorType::NONE, TargetCursorType::NORMAL, and TargetCursorType::NUM_TCT.

Referenced by ActorSprite::initTargetCursor().

531 {
532  switch (type)
533  {
535  return "in-range";
536  default:
540  return "normal";
541  }
542 }

Variable Documentation

◆ STATUS_EFFECTS

const unsigned int STATUS_EFFECTS = 32
static

Definition at line 64 of file actorsprite.cpp.

Referenced by ActorSprite::setStatusEffectBlock().