diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-07-31 18:15:39 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-07-31 18:15:39 +0200 |
commit | 6b1f7e7a45ebc04f39bb54edc85fbe9c9d0659e7 (patch) | |
tree | 193ada7fa748f645ca0064cd94e77d13393e83cc /src/BlockEntities/BeaconEntity.cpp | |
parent | Updated documentation. (diff) | |
download | cuberite-6b1f7e7a45ebc04f39bb54edc85fbe9c9d0659e7.tar cuberite-6b1f7e7a45ebc04f39bb54edc85fbe9c9d0659e7.tar.gz cuberite-6b1f7e7a45ebc04f39bb54edc85fbe9c9d0659e7.tar.bz2 cuberite-6b1f7e7a45ebc04f39bb54edc85fbe9c9d0659e7.tar.lz cuberite-6b1f7e7a45ebc04f39bb54edc85fbe9c9d0659e7.tar.xz cuberite-6b1f7e7a45ebc04f39bb54edc85fbe9c9d0659e7.tar.zst cuberite-6b1f7e7a45ebc04f39bb54edc85fbe9c9d0659e7.zip |
Diffstat (limited to 'src/BlockEntities/BeaconEntity.cpp')
-rw-r--r-- | src/BlockEntities/BeaconEntity.cpp | 58 |
1 files changed, 11 insertions, 47 deletions
diff --git a/src/BlockEntities/BeaconEntity.cpp b/src/BlockEntities/BeaconEntity.cpp index c94783ba8..55c5ccb7f 100644 --- a/src/BlockEntities/BeaconEntity.cpp +++ b/src/BlockEntities/BeaconEntity.cpp @@ -64,54 +64,18 @@ char cBeaconEntity::CalculatePyramidLevel(void) bool cBeaconEntity::IsValidEffect(cEntityEffect::eType a_Effect, char a_BeaconLevel) { - if (a_Effect == cEntityEffect::effNoEffect) + switch (a_Effect) { - return true; + case cEntityEffect::effRegeneration: return (a_BeaconLevel >= 4); + case cEntityEffect::effStrength: return (a_BeaconLevel >= 3); + case cEntityEffect::effResistance: return (a_BeaconLevel >= 2); + case cEntityEffect::effJumpBoost: return (a_BeaconLevel >= 2); + case cEntityEffect::effSpeed: return (a_BeaconLevel >= 1); + case cEntityEffect::effHaste: return (a_BeaconLevel >= 1); + case cEntityEffect::effNoEffect: return true; } - switch (a_BeaconLevel) - { - case 4: - { - // Beacon level 4 - if (a_Effect == cEntityEffect::effRegeneration) - { - return true; - } - } - case 3: - { - // Beacon level 3 - if (a_Effect == cEntityEffect::effStrength) - { - return true; - } - } - case 2: - { - // Beacon level 2 - switch (a_Effect) - { - case cEntityEffect::effResistance: - case cEntityEffect::effJumpBoost: - { - return true; - } - } - } - case 1: - { - // Beacon level 1 - switch (a_Effect) - { - case cEntityEffect::effSpeed: - case cEntityEffect::effHaste: - { - return true; - } - } - } - } + LOGD("%s: Invalid beacon effect: %d", __FUNCTION__, (int)a_Effect); return false; } @@ -119,7 +83,7 @@ bool cBeaconEntity::IsValidEffect(cEntityEffect::eType a_Effect, char a_BeaconLe -bool cBeaconEntity::SelectPrimaryEffect(cEntityEffect::eType a_Effect) +bool cBeaconEntity::SetPrimaryEffect(cEntityEffect::eType a_Effect) { if (!IsValidEffect(a_Effect, m_BeaconLevel)) { @@ -140,7 +104,7 @@ bool cBeaconEntity::SelectPrimaryEffect(cEntityEffect::eType a_Effect) -bool cBeaconEntity::SelectSecondaryEffect(cEntityEffect::eType a_Effect) +bool cBeaconEntity::SetSecondaryEffect(cEntityEffect::eType a_Effect) { if (!IsValidEffect(a_Effect, m_BeaconLevel)) { |