ManaPlus
Macros | Functions
actorsprite.cpp File Reference

(aa4ebcf)

#include "being/actorsprite.h"
#include "configuration.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)
 

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 218 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().

222 {
223  FOR_EACH (OptionsMapCIter, it, options)
224  {
225  const uint32_t opt = (*it).first;
226  const int32_t id = (*it).second;
227  const Enable enable = (opt & option) != 0 ? Enable_true : Enable_false;
228  option |= opt;
229  option ^= opt;
230  actor->setStatusEffect(id,
231  enable,
232  IsStart_false);
233  }
234  if (option != 0U &&
235  config.getBoolValue("unimplimentedLog"))
236  {
237  const std::string str = strprintf(
238  "Error: unknown effect by %s. "
239  "Left value: %u",
240  name,
241  option);
242  logger->log(str);
244  }
245 }
#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:88
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:264
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 247 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().

251 {
252  FOR_EACH (OptionsMapCIter, it, options)
253  {
254  const uint32_t opt = (*it).first;
255  const int32_t id = (*it).second;
256  if (opt == option)
257  {
258  actor->setStatusEffect(id,
259  Enable_true,
260  IsStart_false);
261  option = 0U;
262  }
263  else
264  {
265  actor->setStatusEffect(id,
266  Enable_false,
267  IsStart_false);
268  }
269  }
270  if (option != 0 &&
271  config.getBoolValue("unimplimentedLog"))
272  {
273  const std::string str = strprintf(
274  "Error: unknown effect by %s. "
275  "Left value: %u",
276  name,
277  option);
278  logger->log(str);
280  }
281 }
#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:88
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:264
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 464 of file actorsprite.cpp.

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

Referenced by ActorSprite::initTargetCursor().

465 {
466  switch (type)
467  {
469  return "in-range";
470  default:
474  return "normal";
475  }
476 }