Fixed compile errors.
This commit is contained in:
parent
033d16babb
commit
5e71d5299c
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
cMobSpawnerEntity::cMobSpawnerEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World)
|
cMobSpawnerEntity::cMobSpawnerEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World)
|
||||||
: super(E_BLOCK_MOB_SPAWNER, a_BlockX, a_BlockY, a_BlockZ, a_World)
|
: super(E_BLOCK_MOB_SPAWNER, a_BlockX, a_BlockY, a_BlockZ, a_World)
|
||||||
, m_Entity(cMonster::mtPig)
|
, m_Entity(mtPig)
|
||||||
, m_SpawnDelay(100)
|
, m_SpawnDelay(100)
|
||||||
, m_IsActive(false)
|
, m_IsActive(false)
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@ void cMobSpawnerEntity::UsedBy(cPlayer * a_Player)
|
|||||||
if (a_Player->GetEquippedItem().m_ItemType == E_ITEM_SPAWN_EGG)
|
if (a_Player->GetEquippedItem().m_ItemType == E_ITEM_SPAWN_EGG)
|
||||||
{
|
{
|
||||||
cMonster::eType MonsterType = cItemSpawnEggHandler::ItemDamageToMonsterType(a_Player->GetEquippedItem().m_ItemDamage);
|
cMonster::eType MonsterType = cItemSpawnEggHandler::ItemDamageToMonsterType(a_Player->GetEquippedItem().m_ItemDamage);
|
||||||
if (MonsterType == cMonster::mtInvalidType)
|
if (MonsterType == mtInvalidType)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ void cMobSpawnerEntity::ResetTimer(void)
|
|||||||
|
|
||||||
void cMobSpawnerEntity::SpawnEntity(void)
|
void cMobSpawnerEntity::SpawnEntity(void)
|
||||||
{
|
{
|
||||||
int NearbyEntities = GetNearbyEntityNum(m_Entity);
|
int NearbyEntities = GetNearbyMonsterNum(m_Entity);
|
||||||
if (NearbyEntities >= 6)
|
if (NearbyEntities >= 6)
|
||||||
{
|
{
|
||||||
ResetTimer();
|
ResetTimer();
|
||||||
@ -125,7 +125,7 @@ void cMobSpawnerEntity::SpawnEntity(void)
|
|||||||
class cCallback : public cChunkCallback
|
class cCallback : public cChunkCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cCallback(int a_RelX, int a_RelY, int a_RelZ, cMonster::eType a_MobType, int a_NearbyEntitiesNum) :
|
cCallback(int a_RelX, int a_RelY, int a_RelZ, eMonsterType a_MobType, int a_NearbyEntitiesNum) :
|
||||||
m_RelX(a_RelX),
|
m_RelX(a_RelX),
|
||||||
m_RelY(a_RelY),
|
m_RelY(a_RelY),
|
||||||
m_RelZ(a_RelZ),
|
m_RelZ(a_RelZ),
|
||||||
@ -170,7 +170,7 @@ void cMobSpawnerEntity::SpawnEntity(void)
|
|||||||
|
|
||||||
Monster->SetPosition(PosX, RelY, PosZ);
|
Monster->SetPosition(PosX, RelY, PosZ);
|
||||||
Monster->SetYaw(Random.NextFloat() * 360.0f);
|
Monster->SetYaw(Random.NextFloat() * 360.0f);
|
||||||
if (Chunk->GetWorld()->SpawnMobFinalize(Monster) != cMonster::mtInvalidType)
|
if (Chunk->GetWorld()->SpawnMobFinalize(Monster) != mtInvalidType)
|
||||||
{
|
{
|
||||||
EntitiesSpawned = true;
|
EntitiesSpawned = true;
|
||||||
Chunk->BroadcastSoundParticleEffect(2004, (int)(PosX * 8.0), (int)(RelY * 8.0), (int)(PosZ * 8.0), 0);
|
Chunk->BroadcastSoundParticleEffect(2004, (int)(PosX * 8.0), (int)(RelY * 8.0), (int)(PosZ * 8.0), 0);
|
||||||
@ -182,7 +182,7 @@ void cMobSpawnerEntity::SpawnEntity(void)
|
|||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
int m_RelX, m_RelY, m_RelZ;
|
int m_RelX, m_RelY, m_RelZ;
|
||||||
cMonster::eType m_MobType;
|
eMonsterType m_MobType;
|
||||||
int m_NearbyEntitiesNum;
|
int m_NearbyEntitiesNum;
|
||||||
} Callback(m_RelX, m_PosY, m_RelZ, m_Entity, NearbyEntities);
|
} Callback(m_RelX, m_PosY, m_RelZ, m_Entity, NearbyEntities);
|
||||||
|
|
||||||
@ -224,35 +224,35 @@ AString cMobSpawnerEntity::GetEntityName() const
|
|||||||
{
|
{
|
||||||
switch (m_Entity)
|
switch (m_Entity)
|
||||||
{
|
{
|
||||||
case cMonster::mtBat: return "Bat";
|
case mtBat: return "Bat";
|
||||||
case cMonster::mtBlaze: return "Blaze";
|
case mtBlaze: return "Blaze";
|
||||||
case cMonster::mtCaveSpider: return "CaveSpider";
|
case mtCaveSpider: return "CaveSpider";
|
||||||
case cMonster::mtChicken: return "Chicken";
|
case mtChicken: return "Chicken";
|
||||||
case cMonster::mtCow: return "Cow";
|
case mtCow: return "Cow";
|
||||||
case cMonster::mtCreeper: return "Creeper";
|
case mtCreeper: return "Creeper";
|
||||||
case cMonster::mtEnderDragon: return "EnderDragon";
|
case mtEnderDragon: return "EnderDragon";
|
||||||
case cMonster::mtEnderman: return "Enderman";
|
case mtEnderman: return "Enderman";
|
||||||
case cMonster::mtGhast: return "Ghast";
|
case mtGhast: return "Ghast";
|
||||||
case cMonster::mtGiant: return "Giant";
|
case mtGiant: return "Giant";
|
||||||
case cMonster::mtHorse: return "EntityHorse";
|
case mtHorse: return "EntityHorse";
|
||||||
case cMonster::mtIronGolem: return "VillagerGolem";
|
case mtIronGolem: return "VillagerGolem";
|
||||||
case cMonster::mtMagmaCube: return "LavaSlime";
|
case mtMagmaCube: return "LavaSlime";
|
||||||
case cMonster::mtMooshroom: return "MushroomCow";
|
case mtMooshroom: return "MushroomCow";
|
||||||
case cMonster::mtOcelot: return "Ozelot";
|
case mtOcelot: return "Ozelot";
|
||||||
case cMonster::mtPig: return "Pig";
|
case mtPig: return "Pig";
|
||||||
case cMonster::mtSheep: return "Sheep";
|
case mtSheep: return "Sheep";
|
||||||
case cMonster::mtSilverfish: return "Silverfish";
|
case mtSilverfish: return "Silverfish";
|
||||||
case cMonster::mtSkeleton: return "Skeleton";
|
case mtSkeleton: return "Skeleton";
|
||||||
case cMonster::mtSlime: return "Slime";
|
case mtSlime: return "Slime";
|
||||||
case cMonster::mtSnowGolem: return "SnowMan";
|
case mtSnowGolem: return "SnowMan";
|
||||||
case cMonster::mtSpider: return "Spider";
|
case mtSpider: return "Spider";
|
||||||
case cMonster::mtSquid: return "Squid";
|
case mtSquid: return "Squid";
|
||||||
case cMonster::mtVillager: return "Villager";
|
case mtVillager: return "Villager";
|
||||||
case cMonster::mtWitch: return "Witch";
|
case mtWitch: return "Witch";
|
||||||
case cMonster::mtWither: return "WitherBoss";
|
case mtWither: return "WitherBoss";
|
||||||
case cMonster::mtWolf: return "Wolf";
|
case mtWolf: return "Wolf";
|
||||||
case cMonster::mtZombie: return "Zombie";
|
case mtZombie: return "Zombie";
|
||||||
case cMonster::mtZombiePigman: return "PigZombie";
|
case mtZombiePigman: return "PigZombie";
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
ASSERT(!"Unknown monster type!");
|
ASSERT(!"Unknown monster type!");
|
||||||
@ -308,7 +308,7 @@ int cMobSpawnerEntity::GetNearbyPlayersNum(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int cMobSpawnerEntity::GetNearbyEntityNum(cMonster::eType a_EntityType)
|
int cMobSpawnerEntity::GetNearbyMonsterNum(eMonsterType a_EntityType)
|
||||||
{
|
{
|
||||||
Vector3d SpawnerPos(m_PosX + 0.5, m_PosY + 0.5, m_PosZ + 0.5);
|
Vector3d SpawnerPos(m_PosX + 0.5, m_PosY + 0.5, m_PosZ + 0.5);
|
||||||
int NumEntities = 0;
|
int NumEntities = 0;
|
||||||
@ -316,7 +316,7 @@ int cMobSpawnerEntity::GetNearbyEntityNum(cMonster::eType a_EntityType)
|
|||||||
class cCallback : public cChunkDataCallback
|
class cCallback : public cChunkDataCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cCallback(Vector3d a_SpawnerPos, cMonster::eType a_EntityType, int & a_NumEntities) :
|
cCallback(Vector3d a_SpawnerPos, eMonsterType a_EntityType, int & a_NumEntities) :
|
||||||
m_SpawnerPos(a_SpawnerPos),
|
m_SpawnerPos(a_SpawnerPos),
|
||||||
m_EntityType(a_EntityType),
|
m_EntityType(a_EntityType),
|
||||||
m_NumEntities(a_NumEntities)
|
m_NumEntities(a_NumEntities)
|
||||||
@ -344,7 +344,7 @@ int cMobSpawnerEntity::GetNearbyEntityNum(cMonster::eType a_EntityType)
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
Vector3d m_SpawnerPos;
|
Vector3d m_SpawnerPos;
|
||||||
cMonster::eType m_EntityType;
|
eMonsterType m_EntityType;
|
||||||
int & m_NumEntities;
|
int & m_NumEntities;
|
||||||
} Callback(SpawnerPos, a_EntityType, NumEntities);
|
} Callback(SpawnerPos, a_EntityType, NumEntities);
|
||||||
|
|
||||||
|
@ -45,10 +45,10 @@ public:
|
|||||||
void SpawnEntity(void);
|
void SpawnEntity(void);
|
||||||
|
|
||||||
/** Returns the entity type who will be spawn by this mob spawner. */
|
/** Returns the entity type who will be spawn by this mob spawner. */
|
||||||
cMonster::eType GetEntity(void) const { return m_Entity; }
|
eMonsterType GetEntity(void) const { return m_Entity; }
|
||||||
|
|
||||||
/** Sets the entity type who will be spawn by this mob spawner. */
|
/** Sets the entity type who will be spawn by this mob spawner. */
|
||||||
void SetEntity(cMonster::eType a_EntityType) { m_Entity = a_EntityType; }
|
void SetEntity(eMonsterType a_EntityType) { m_Entity = a_EntityType; }
|
||||||
|
|
||||||
/** Returns the entity name. (Required by the protocol) */
|
/** Returns the entity name. (Required by the protocol) */
|
||||||
AString GetEntityName(void) const;
|
AString GetEntityName(void) const;
|
||||||
@ -57,7 +57,7 @@ public:
|
|||||||
int GetSpawnDelay(void) const { return m_SpawnDelay; }
|
int GetSpawnDelay(void) const { return m_SpawnDelay; }
|
||||||
|
|
||||||
int GetNearbyPlayersNum(void);
|
int GetNearbyPlayersNum(void);
|
||||||
int GetNearbyEntityNum(cMonster::eType a_EntityType);
|
int GetNearbyMonsterNum(eMonsterType a_EntityType);
|
||||||
|
|
||||||
// tolua_end
|
// tolua_end
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/** The entity to spawn. */
|
/** The entity to spawn. */
|
||||||
cMonster::eType m_Entity;
|
eMonsterType m_Entity;
|
||||||
|
|
||||||
int m_SpawnDelay;
|
int m_SpawnDelay;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user