From 36832f3a5378f739da7040f0711b7101dbc2af02 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Mon, 17 May 2010 21:58:00 -0600 Subject: Add support for different target cursor sizes for NPCs Moves the parsing logic for the size strings into BeingInfo to share the code. Reviewed-by: Freeyorp --- src/resources/beinginfo.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/resources/beinginfo.cpp') diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp index 30b4f86f..66addde9 100644 --- a/src/resources/beinginfo.cpp +++ b/src/resources/beinginfo.cpp @@ -21,6 +21,8 @@ #include "resources/beinginfo.h" +#include "log.h" + #include "utils/dtor.h" #include "utils/gettext.h" @@ -51,6 +53,22 @@ void BeingInfo::setDisplay(SpriteDisplay display) mDisplay = display; } +void BeingInfo::setTargetCursorSize(const std::string &size) +{ + if (size == "small") + setTargetCursorSize(ActorSprite::TC_SMALL); + else if (size == "medium") + setTargetCursorSize(ActorSprite::TC_MEDIUM); + else if (size == "large") + setTargetCursorSize(ActorSprite::TC_LARGE); + else + { + logger->log("Unknown target cursor type \"%s\" for %s - using medium " + "sized one", size.c_str(), getName().c_str()); + setTargetCursorSize(ActorSprite::TC_MEDIUM); + } +} + void BeingInfo::addSound(SoundEvent event, const std::string &filename) { if (mSounds.find(event) == mSounds.end()) -- cgit v1.2.3-70-g09d2