diff options
author | Mattes D <github@xoft.cz> | 2015-05-09 12:44:57 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-05-09 12:44:57 +0200 |
commit | 92b8cd2f2a291b8ea49ab9545208ec0fed7d33ca (patch) | |
tree | b1207b58343d2626043ba0946ed13be155c2e380 /src/Mobs | |
parent | Fixed remaing pragmas (diff) | |
parent | GetSizeName of cSlime and cMagmaCube is now static (diff) | |
download | cuberite-92b8cd2f2a291b8ea49ab9545208ec0fed7d33ca.tar cuberite-92b8cd2f2a291b8ea49ab9545208ec0fed7d33ca.tar.gz cuberite-92b8cd2f2a291b8ea49ab9545208ec0fed7d33ca.tar.bz2 cuberite-92b8cd2f2a291b8ea49ab9545208ec0fed7d33ca.tar.lz cuberite-92b8cd2f2a291b8ea49ab9545208ec0fed7d33ca.tar.xz cuberite-92b8cd2f2a291b8ea49ab9545208ec0fed7d33ca.tar.zst cuberite-92b8cd2f2a291b8ea49ab9545208ec0fed7d33ca.zip |
Diffstat (limited to 'src/Mobs')
-rw-r--r-- | src/Mobs/MagmaCube.cpp | 14 | ||||
-rw-r--r-- | src/Mobs/MagmaCube.h | 6 | ||||
-rw-r--r-- | src/Mobs/Monster.cpp | 2 | ||||
-rw-r--r-- | src/Mobs/Slime.cpp | 2 | ||||
-rw-r--r-- | src/Mobs/Slime.h | 2 |
5 files changed, 20 insertions, 6 deletions
diff --git a/src/Mobs/MagmaCube.cpp b/src/Mobs/MagmaCube.cpp index 3e9abc108..c5dd0def0 100644 --- a/src/Mobs/MagmaCube.cpp +++ b/src/Mobs/MagmaCube.cpp @@ -7,7 +7,7 @@ cMagmaCube::cMagmaCube(int a_Size) : - super("MagmaCube", mtMagmaCube, "mob.MagmaCube.big", "mob.MagmaCube.big", 0.6 * a_Size, 0.6 * a_Size), + super("MagmaCube", mtMagmaCube, Printf("mob.magmacube.%s", GetSizeName(a_Size).c_str()), Printf("mob.magmacube.%s", GetSizeName(a_Size).c_str()), 0.6 * a_Size, 0.6 * a_Size), m_Size(a_Size) { } @@ -27,4 +27,14 @@ void cMagmaCube::GetDrops(cItems & a_Drops, cEntity * a_Killer) - +AString cMagmaCube::GetSizeName(int a_Size) +{ + if (a_Size > 1) + { + return "big"; + } + else + { + return "small"; + } +} diff --git a/src/Mobs/MagmaCube.h b/src/Mobs/MagmaCube.h index d66ea423a..b914dc867 100644 --- a/src/Mobs/MagmaCube.h +++ b/src/Mobs/MagmaCube.h @@ -19,10 +19,14 @@ public: virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override; int GetSize(void) const { return m_Size; } + + /** Returns the text describing the slime's size, as used by the client's resource subsystem for sounds. + Returns either "big" or "small". */ + static AString GetSizeName(int a_Size); protected: - /// Size of the MagmaCube, 1 .. 3, with 1 being the smallest + /// Size of the MagmaCube, 1, 2 and 4, with 1 being the smallest int m_Size; } ; diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index 9df5bd930..3d3fdfb64 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -960,7 +960,7 @@ cMonster * cMonster::NewMonsterFromType(eMonsterType a_MobType) { case mtMagmaCube: { - toReturn = new cMagmaCube(Random.NextInt(2) + 1); + toReturn = new cMagmaCube(1 << Random.NextInt(3)); // Size 1, 2 or 4 break; } case mtSlime: diff --git a/src/Mobs/Slime.cpp b/src/Mobs/Slime.cpp index e42501e47..7fc4821d8 100644 --- a/src/Mobs/Slime.cpp +++ b/src/Mobs/Slime.cpp @@ -89,7 +89,7 @@ void cSlime::KilledBy(TakeDamageInfo & a_TDI) -const AString cSlime::GetSizeName(int a_Size) const +AString cSlime::GetSizeName(int a_Size) { if (a_Size > 1) { diff --git a/src/Mobs/Slime.h b/src/Mobs/Slime.h index 29605992d..40131b101 100644 --- a/src/Mobs/Slime.h +++ b/src/Mobs/Slime.h @@ -27,7 +27,7 @@ public: /** Returns the text describing the slime's size, as used by the client's resource subsystem for sounds. Returns either "big" or "small". */ - const AString GetSizeName(int a_Size) const; + static AString GetSizeName(int a_Size); protected: |