summaryrefslogtreecommitdiffstats
path: root/source/cFurnaceEntity.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-19 10:37:10 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-19 10:37:10 +0100
commit1e90dad2456f383c2624acc85ab62445440e1156 (patch)
tree3792ac31a9304e20a9dab67c4235a40ec1d3b385 /source/cFurnaceEntity.cpp
parentSocketThreads: proper thread finishing sequence (doesn't trigger AppVerifier checks :) (diff)
downloadcuberite-1e90dad2456f383c2624acc85ab62445440e1156.tar
cuberite-1e90dad2456f383c2624acc85ab62445440e1156.tar.gz
cuberite-1e90dad2456f383c2624acc85ab62445440e1156.tar.bz2
cuberite-1e90dad2456f383c2624acc85ab62445440e1156.tar.lz
cuberite-1e90dad2456f383c2624acc85ab62445440e1156.tar.xz
cuberite-1e90dad2456f383c2624acc85ab62445440e1156.tar.zst
cuberite-1e90dad2456f383c2624acc85ab62445440e1156.zip
Diffstat (limited to 'source/cFurnaceEntity.cpp')
-rw-r--r--source/cFurnaceEntity.cpp58
1 files changed, 22 insertions, 36 deletions
diff --git a/source/cFurnaceEntity.cpp b/source/cFurnaceEntity.cpp
index 3c4a7403d..389d4af54 100644
--- a/source/cFurnaceEntity.cpp
+++ b/source/cFurnaceEntity.cpp
@@ -122,11 +122,7 @@ bool cFurnaceEntity::Tick( float a_Dt )
cWindow* Window = GetWindow();
if( Window )
{
- const std::list< cPlayer* > & OpenedBy = Window->GetOpenedBy();
- for( std::list< cPlayer* >::const_iterator itr = OpenedBy.begin(); itr != OpenedBy.end(); ++itr )
- {
- Window->SendWholeWindow( (*itr)->GetClientHandle() );
- }
+ Window->BroadcastWholeWindow();
}
m_TimeCooked = 0.f;
@@ -135,19 +131,13 @@ bool cFurnaceEntity::Tick( float a_Dt )
cWindow* Window = GetWindow();
if( Window )
{
- const std::list< cPlayer* > & OpenedBy = Window->GetOpenedBy();
- for( std::list< cPlayer* >::const_iterator itr = OpenedBy.begin(); itr != OpenedBy.end(); ++itr )
- {
- cClientHandle* Client = (*itr)->GetClientHandle();
-
- cPacket_InventoryProgressBar Progress;
- Progress.m_ProgressBar = 0;
- Progress.m_WindowID = (char)Window->GetWindowID();
- Progress.m_Value = (short)( m_TimeCooked * (180.f/m_CookTime) );
- if( Progress.m_Value > 180 ) Progress.m_Value = 180;
- if( Progress.m_Value < 0 ) Progress.m_Value = 0;
- Client->Send( Progress );
- }
+ cPacket_InventoryProgressBar Progress;
+ Progress.m_ProgressBar = 0;
+ Progress.m_WindowID = (char)Window->GetWindowID();
+ Progress.m_Value = (short)( m_TimeCooked * (180.f/m_CookTime) );
+ if( Progress.m_Value > 180 ) Progress.m_Value = 180;
+ if( Progress.m_Value < 0 ) Progress.m_Value = 0;
+ Window->Broadcast(Progress);
}
}
}
@@ -161,30 +151,26 @@ bool cFurnaceEntity::Tick( float a_Dt )
m_BurnTime = 0;
if( StartCooking() && Window )
{
- const std::list< cPlayer* > & OpenedBy = Window->GetOpenedBy();
- for( std::list< cPlayer* >::const_iterator itr = OpenedBy.begin(); itr != OpenedBy.end(); ++itr )
- {
- Window->SendWholeWindow( (*itr)->GetClientHandle() );
- }
+ Window->BroadcastWholeWindow();
}
}
if( Window )
{
- const std::list< cPlayer* > & OpenedBy = Window->GetOpenedBy();
- for( std::list< cPlayer* >::const_iterator itr = OpenedBy.begin(); itr != OpenedBy.end(); ++itr )
- {
- cClientHandle* Client = (*itr)->GetClientHandle();
+ cPacket_InventoryProgressBar Progress;
+ Progress.m_WindowID = (char)Window->GetWindowID();
+ Progress.m_ProgressBar = 1;
- cPacket_InventoryProgressBar Progress;
- Progress.m_WindowID = (char)Window->GetWindowID();
- Progress.m_ProgressBar = 1;
-
- if( m_BurnTime > 0.f ) Progress.m_Value = (short)( m_TimeBurned * (150.f/m_BurnTime) );
- else Progress.m_Value = 0;
- if( Progress.m_Value > 150 ) Progress.m_Value = 150;
- if( Progress.m_Value < 0 ) Progress.m_Value = 0;
- Client->Send( Progress );
+ if ( m_BurnTime > 0.f )
+ {
+ Progress.m_Value = (short)( m_TimeBurned * (150.f / m_BurnTime) );
+ if ( Progress.m_Value > 150 ) Progress.m_Value = 150;
+ if ( Progress.m_Value < 0 ) Progress.m_Value = 0;
+ }
+ else
+ {
+ Progress.m_Value = 0;
}
+ Window->Broadcast( Progress );
}
return ((m_CookingItem != 0) || (m_TimeBurned < m_BurnTime)) && m_BurnTime > 0.f; // Keep on ticking, if there's more to cook, or if it's cooking
}