X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcommon%2FTargetingMode.h;h=83d1d831fb99a550dfb35c86de83fc2716c923c1;hb=147732d7eaf3c082b9120a7f2b815a4a7886aa97;hp=08829deeb30aab092b8ed10da88307179d729d98;hpb=e7debb76868a32fa6280d11ed428640c1e48f480;p=l2e.git diff --git a/src/common/TargetingMode.h b/src/common/TargetingMode.h index 08829de..83d1d83 100644 --- a/src/common/TargetingMode.h +++ b/src/common/TargetingMode.h @@ -15,41 +15,31 @@ namespace common { class TargetingMode { public: - TargetingMode() : mode(0) { } + TargetingMode() : mode(0), ally(true) { } public: - bool TargetsEnemy() const { return (mode & FACTION_MASK) == ENEMY; } - bool TargetsAlly() const { return (mode & FACTION_MASK) == ALLY; } - bool TargetsAll() const { return (mode & COUNT_MASK) == ALL; } - bool TargetsMultiple() const { return (mode & COUNT_MASK) == MULTIPLE; } - bool TargetsSingle() const { return (mode & COUNT_MASK) == SINGLE; } - - void TargetAll() { mode = (mode & FACTION_MASK) | ALL; } - void TargetMultiple() { mode = (mode & FACTION_MASK) | MULTIPLE; } - void TargetSingle() { mode = (mode & FACTION_MASK) | SINGLE; } - void TargetAlly() { mode = ALLY | (mode & COUNT_MASK); } - void TargetEnemy() { mode = ENEMY | (mode & COUNT_MASK); } - - void TargetAllEnemies() { mode = ENEMY | ALL; } - void TargetMultipleEnemies() { mode = ENEMY | MULTIPLE; } - void TargetSingleEnemy() { mode = ENEMY | SINGLE; } - void TargetAllAllies() { mode = ALLY | ALL; } - void TargetMultipleAllies() { mode = ALLY | MULTIPLE; } - void TargetSingleAlly() { mode = ALLY | SINGLE; } + bool TargetsEnemy() const { return !ally; } + bool TargetsAlly() const { return ally; } + bool TargetsAll() const { return mode == ALL; } + bool TargetsMultiple() const { return mode == MULTIPLE; } + bool TargetsSingle() const { return mode == SINGLE; } + + void TargetAll() { mode = ALL; } + void TargetMultiple() { mode = MULTIPLE; } + void TargetSingle() { mode = SINGLE; } + void TargetAlly() { ally = true; } + void TargetEnemy() { ally = false; } static void CreateTypeDescription(); private: enum { ALL = 0, - ALLY = 0, MULTIPLE = 1, SINGLE = 2, - COUNT_MASK = 127, - ENEMY = 128, - FACTION_MASK = 128, }; - Uint8 mode; + int mode; + bool ally; };