From dcaff5e512901450f590b512e2a164a773be22b5 Mon Sep 17 00:00:00 2001 From: charles <128108973+OldFoolAgain@users.noreply.github.com> Date: Sat, 26 Aug 2023 20:50:27 -0400 Subject: [PATCH] streams updated to base --- source/CPacketReceive.cpp | 66 +++++++++++++++++++-------------------- source/CPacketReceive.h | 66 +++++++++++++++++++-------------------- source/CPacketSend.cpp | 30 +++++++++--------- source/CPacketSend.h | 30 +++++++++--------- source/cBaseObject.cpp | 8 ++--- source/cBaseObject.h | 10 +++--- source/cChar.cpp | 10 +++--- source/cChar.h | 10 +++--- source/cGuild.cpp | 2 +- source/cGuild.h | 2 +- source/cItem.cpp | 10 +++--- source/cItem.h | 10 +++--- source/cMultiObj.cpp | 10 +++--- source/cMultiObj.h | 10 +++--- source/cServerData.cpp | 4 +-- source/cServerData.h | 2 +- source/cSocket.cpp | 10 +++--- source/effect.cpp | 4 +-- source/fileio.cpp | 2 +- source/jail.cpp | 2 +- source/jail.h | 2 +- source/mapstuff.cpp | 4 +-- source/mapstuff.h | 4 +-- source/msgboard.cpp | 4 +-- source/network.h | 4 +-- source/regions.cpp | 14 ++++----- source/regions.h | 4 +-- source/ssection.cpp | 4 +-- source/ssection.h | 4 +-- source/teffect.h | 2 +- source/townregion.cpp | 2 +- source/townregion.h | 2 +- 32 files changed, 174 insertions(+), 174 deletions(-) diff --git a/source/CPacketReceive.cpp b/source/CPacketReceive.cpp index 4f8ccbd9f..945511bd1 100644 --- a/source/CPacketReceive.cpp +++ b/source/CPacketReceive.cpp @@ -181,7 +181,7 @@ void CheckBanTimer( CAccountBlock_st &actbTemp ) //| BYTE[30] password //| BYTE unknown1 (not usually 0x00 - so not nullptr) //o------------------------------------------------------------------------------------------------o -void CPIFirstLogin::Log( std::ofstream &outStream, bool fullHeader ) +void CPIFirstLogin::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -439,7 +439,7 @@ UI08 CPIFirstLogin::Unknown( void ) //| BYTE[2] server # chosen //| 0x80 Packet //o------------------------------------------------------------------------------------------------o -void CPIServerSelect::Log( std::ofstream &outStream, bool fullHeader ) +void CPIServerSelect::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -507,7 +507,7 @@ bool CPIServerSelect::Handle( void ) //| BYTE[30] sid //| BYTE[30] password //o------------------------------------------------------------------------------------------------o -void CPISecondLogin::Log( std::ofstream &outStream, bool fullHeader ) +void CPISecondLogin::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -673,7 +673,7 @@ bool CPISecondLogin::Handle( void ) //| Normally older client send a 4 byte seed (local ip). //| Newer clients 2.48.0.3+ (KR) and 6.0.5.0+ (2D) are sending this packet. //o------------------------------------------------------------------------------------------------o -void CPINewClientVersion::Log( std::ofstream &outStream, bool fullHeader ) +void CPINewClientVersion::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -837,7 +837,7 @@ bool CPINewClientVersion::Handle( void ) //| Server version: 0xbd 0x0 0x3 (client replies with client version of this packet) //| Clients sends a client version of this packet ONCE at login (without server request.) //o------------------------------------------------------------------------------------------------o -void CPIClientVersion::Log( std::ofstream &outStream, bool fullHeader ) +void CPIClientVersion::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -1171,7 +1171,7 @@ void CPIClientVersion::SetClientVersionShortAndType( CSocket *tSock, char *verSt //| "Greying" has no packet, purely client internal. //| Minimal value:5, maximal: 18 //o------------------------------------------------------------------------------------------------o -void CPIUpdateRangeChange::Log( std::ofstream &outStream, bool fullHeader ) +void CPIUpdateRangeChange::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -1246,7 +1246,7 @@ bool CPIUpdateRangeChange::Handle( void ) //| Client will send this packet without 0x01 Byte when the server sends FLAG & 0x02 in the 0xA9 Packet during logon. //| Server responds with same packet, plus the 0x01 Byte, allowing client to finish logging out. //o------------------------------------------------------------------------------------------------o -void CPILogoutStatus::Log( std::ofstream &outStream, bool fullHeader ) +void CPILogoutStatus::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -1473,7 +1473,7 @@ void CPIStatusRequest::Receive( void ) playerId = tSock->GetDWord( 6 ); } -void CPIStatusRequest::Log( std::ofstream &outStream, bool fullHeader ) +void CPIStatusRequest::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -1683,7 +1683,7 @@ void CPIDblClick::Receive( void ) objectId = tSock->GetDWord( 1 ); } -void CPIDblClick::Log( std::ofstream &outStream, bool fullHeader ) +void CPIDblClick::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -1722,7 +1722,7 @@ void CPISingleClick::Receive( void ) objectId = tSock->GetDWord( 1 ); } -void CPISingleClick::Log( std::ofstream &outStream, bool fullHeader ) +void CPISingleClick::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -1779,7 +1779,7 @@ bool CPIMoveRequest::Handle( void ) return true; } -void CPIMoveRequest::Log( std::ofstream &outStream, bool fullHeader ) +void CPIMoveRequest::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -1934,7 +1934,7 @@ void CPITargetCursor::Receive( void ) { tSock->Receive( 19, false ); } -void CPITargetCursor::Log( std::ofstream &outStream, bool fullHeader ) +void CPITargetCursor::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -3184,7 +3184,7 @@ void CPICreateCharacter::Create2DCharacter( void ) memcpy( password, &tSock->Buffer()[40], 30 ); // Does this really have anything to do with passwords? } -void CPICreateCharacter::Log( std::ofstream &outStream, bool fullHeader ) +void CPICreateCharacter::Log( std::ostream &outStream, bool fullHeader ) { if( tSock->ClientType() == CV_SA3D || tSock->ClientType() == CV_HS3D ) { @@ -3322,7 +3322,7 @@ void CPIPlayCharacter::Receive( void ) memcpy( unknown, &tSock->Buffer()[35], 33 ); } -void CPIPlayCharacter::Log( std::ofstream &outStream, bool fullHeader ) +void CPIPlayCharacter::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -3405,7 +3405,7 @@ const std::string CPIGumpInput::Reply( void ) const return reply; } -void CPIGumpInput::Log( std::ofstream &outStream, bool fullHeader ) +void CPIGumpInput::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -3512,7 +3512,7 @@ void CPIDyeWindow::Receive( void ) newValue = tSock->GetWord( 7 ); } -void CPIDyeWindow::Log( std::ofstream &outStream, bool fullHeader ) +void CPIDyeWindow::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -3710,7 +3710,7 @@ bool CPIToolTipRequestAoS::Handle( void ) { return true; } -void CPIToolTipRequestAoS::Log( std::ofstream &outStream, bool fullHeader ) +void CPIToolTipRequestAoS::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -3820,7 +3820,7 @@ bool CPIMetrics::Handle() return true; } -void CPIMetrics::Log( std::ofstream &outStream, bool fullHeader ) +void CPIMetrics::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -3999,7 +3999,7 @@ bool CPISubcommands::Handle( void ) } return retVal; } -void CPISubcommands::Log( std::ofstream &outStream, bool fullHeader ) +void CPISubcommands::Log( std::ostream &outStream, bool fullHeader ) { if( subPacket != nullptr ) { @@ -4220,7 +4220,7 @@ bool CPIPartyCommand::Handle( void ) } return true; } -void CPIPartyCommand::Log( std::ofstream &outStream, bool fullHeader ) +void CPIPartyCommand::Log( std::ostream &outStream, bool fullHeader ) { UI08 partyCmd = tSock->GetByte( 5 ); @@ -4379,7 +4379,7 @@ bool CPITrackingArrow::Handle( void ) } return true; } -void CPITrackingArrow::Log( std::ofstream &outStream, bool fullHeader ) +void CPITrackingArrow::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -4423,7 +4423,7 @@ bool CPIClientLanguage::Handle( void ) tSock->Language( newLang ); return true; } -void CPIClientLanguage::Log( std::ofstream &outStream, bool fullHeader ) +void CPIClientLanguage::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -4494,7 +4494,7 @@ bool CPIUOTDActions::Handle( void ) Effects->PlayCharacterAnimation( ourChar, action, 1 ); return true; } -void CPIUOTDActions::Log( std::ofstream &outStream, bool fullHeader ) +void CPIUOTDActions::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -4546,7 +4546,7 @@ bool CPIToolTipRequest::Handle( void ) } return true; } -void CPIToolTipRequest::Log( std::ofstream &outStream, bool fullHeader ) +void CPIToolTipRequest::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -4604,7 +4604,7 @@ bool CPIPopupMenuRequest::Handle( void ) } return true; } -void CPIPopupMenuRequest::Log( std::ofstream &outStream, bool fullHeader ) +void CPIPopupMenuRequest::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -5103,7 +5103,7 @@ bool CPIPopupMenuSelect::Handle( void ) return true; } -void CPIPopupMenuSelect::Log( std::ofstream &outStream, bool fullHeader ) +void CPIPopupMenuSelect::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -5149,7 +5149,7 @@ bool CPIExtendedStats::Handle( void ) ourChar->SetSkillLock( static_cast( value ), statToSet ); return true; } -void CPIExtendedStats::Log( std::ofstream &outStream, bool fullHeader ) +void CPIExtendedStats::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -5231,7 +5231,7 @@ bool CPIBandageMacro::Handle(void) return false; } -void CPIBandageMacro::Log( std::ofstream &outStream, bool fullHeader ) +void CPIBandageMacro::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -5285,7 +5285,7 @@ bool CPIClosedStatusGump::Handle( void ) return false; } -void CPIClosedStatusGump::Log( std::ofstream &outStream, bool fullHeader ) +void CPIClosedStatusGump::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -5334,7 +5334,7 @@ bool CPIToggleFlying::Handle(void) return true; } -void CPIToggleFlying::Log(std::ofstream &outStream, bool fullHeader) +void CPIToggleFlying::Log(std::ostream &outStream, bool fullHeader) { if( fullHeader ) { @@ -5369,7 +5369,7 @@ void CPIToggleFlying::Log(std::ofstream &outStream, bool fullHeader) //| settings are enabled, player will get kicked within 30 seconds //| if this packet is not received by the server. //o------------------------------------------------------------------------------------------------o -void CPIKrriosClientSpecial::Log( std::ofstream &outStream, bool fullHeader ) +void CPIKrriosClientSpecial::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -5554,7 +5554,7 @@ bool CPISpellbookSelect::Handle( void ) } return true; } -void CPISpellbookSelect::Log( std::ofstream &outStream, bool fullHeader ) +void CPISpellbookSelect::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -5765,7 +5765,7 @@ bool CPIAOSCommand::Handle( void ) return false; } -void CPIAOSCommand::Log( std::ofstream &outStream, bool fullHeader ) +void CPIAOSCommand::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { diff --git a/source/CPacketReceive.h b/source/CPacketReceive.h index acbc9f8c7..ce314e569 100644 --- a/source/CPacketReceive.h +++ b/source/CPacketReceive.h @@ -21,7 +21,7 @@ class CPIFirstLogin : public CPInputBuffer virtual const std::string Pass( void ); virtual UI08 Unknown( void ); virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPIServerSelect : public CPInputBuffer @@ -37,7 +37,7 @@ class CPIServerSelect : public CPInputBuffer virtual void Receive( void ) override; virtual SI16 ServerNum( void ); virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPISecondLogin : public CPInputBuffer @@ -58,7 +58,7 @@ class CPISecondLogin : public CPInputBuffer virtual const std::string Name( void ); virtual const std::string Pass( void ); virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPIClientVersion : public CPInputBuffer @@ -75,7 +75,7 @@ class CPIClientVersion : public CPInputBuffer CPIClientVersion( CSocket *s ); virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; virtual void SetClientVersionShortAndType( CSocket *s, char *verString ); }; @@ -99,7 +99,7 @@ class CPINewClientVersion : public CPInputBuffer CPINewClientVersion( CSocket *s ); virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPIUpdateRangeChange : public CPInputBuffer @@ -114,7 +114,7 @@ class CPIUpdateRangeChange : public CPInputBuffer CPIUpdateRangeChange( CSocket *s ); virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPILogoutStatus : public CPInputBuffer @@ -129,7 +129,7 @@ class CPILogoutStatus : public CPInputBuffer CPILogoutStatus( CSocket *s ); virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPIKrriosClientSpecial : public CPInputBuffer @@ -147,7 +147,7 @@ class CPIKrriosClientSpecial : public CPInputBuffer CPIKrriosClientSpecial( CSocket *s ); virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPITips : public CPInputBuffer @@ -203,7 +203,7 @@ class CPIStatusRequest : public CPInputBuffer CPIStatusRequest( CSocket *s ); virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPISpy : public CPInputBuffer @@ -266,7 +266,7 @@ class CPIDblClick : public CPInputBuffer CPIDblClick( CSocket *s ); virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPISingleClick : public CPInputBuffer @@ -281,7 +281,7 @@ class CPISingleClick : public CPInputBuffer CPISingleClick( CSocket *s ); virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPIMoveRequest : public CPInputBuffer @@ -294,7 +294,7 @@ class CPIMoveRequest : public CPInputBuffer CPIMoveRequest( CSocket *s ); virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPIResyncReq : public CPInputBuffer @@ -343,7 +343,7 @@ class CPITargetCursor : public CPInputBuffer CPITargetCursor( CSocket *s ); virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader ) override; + virtual void Log( std::ostream &outStream, bool fullHeader ) override; }; class CPIEquipItem : public CPInputBuffer @@ -597,7 +597,7 @@ class CPICreateCharacter : public CPInputBuffer virtual bool Handle( void ) override; virtual void SetNewCharGenderAndRace( CChar *mChar ); virtual void SetNewCharSkillsStats( CChar *mChar ); - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPIPlayCharacter : public CPInputBuffer @@ -616,7 +616,7 @@ class CPIPlayCharacter : public CPInputBuffer CPIPlayCharacter( CSocket *s ); virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPIGumpInput : public CPInputBuffer @@ -643,7 +643,7 @@ class CPIGumpInput : public CPInputBuffer UI08 Index( void ) const; UI08 Unk( SI32 offset ) const; const std::string Reply( void ) const; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPIHelpRequest : public CPInputBuffer @@ -686,7 +686,7 @@ class CPIDyeWindow : public CPInputBuffer CPIDyeWindow( CSocket *s ); virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPIMsgBoardEvent : public CPInputBuffer @@ -740,7 +740,7 @@ class CPIMetrics : public CPInputBuffer virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; @@ -759,7 +759,7 @@ class CPISubcommands : public CPInputBuffer CPISubcommands( CSocket *s ); virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPIPartyCommand : public CPInputBuffer @@ -773,7 +773,7 @@ class CPIPartyCommand : public CPInputBuffer virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; @@ -788,7 +788,7 @@ class CPITrackingArrow : public CPInputBuffer virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; @@ -805,7 +805,7 @@ class CPIClientLanguage : public CPInputBuffer virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; @@ -822,7 +822,7 @@ class CPIUOTDActions : public CPInputBuffer virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; @@ -839,7 +839,7 @@ class CPIToolTipRequestAoS : public CPInputBuffer virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; @@ -856,7 +856,7 @@ class CPIToolTipRequest : public CPInputBuffer virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; @@ -873,7 +873,7 @@ class CPIPopupMenuRequest : public CPInputBuffer virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; @@ -891,7 +891,7 @@ class CPIPopupMenuSelect : public CPInputBuffer virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; @@ -909,7 +909,7 @@ class CPIExtendedStats : public CPInputBuffer virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; @@ -924,7 +924,7 @@ class CPIBandageMacro : public CPInputBuffer virtual void Receive(void) override; virtual bool Handle(void) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; @@ -939,7 +939,7 @@ class CPIClosedStatusGump : public CPInputBuffer virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; @@ -954,7 +954,7 @@ class CPIToggleFlying : public CPInputBuffer virtual void Receive(void) override; virtual bool Handle(void) override; - virtual void Log(std::ofstream &outStream, bool fullHeader = true) override; + virtual void Log(std::ostream &outStream, bool fullHeader = true) override; }; @@ -969,7 +969,7 @@ class CPISpellbookSelect : public CPInputBuffer virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; @@ -984,7 +984,7 @@ class CPIAOSCommand : public CPInputBuffer virtual void Receive( void ) override; virtual bool Handle( void ) override; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; diff --git a/source/CPacketSend.cpp b/source/CPacketSend.cpp index ea74d7646..5756b38da 100644 --- a/source/CPacketSend.cpp +++ b/source/CPacketSend.cpp @@ -72,7 +72,7 @@ using namespace std::string_literals; //| //| Note: Only send once after login. It’s mandatory to send it once. //o------------------------------------------------------------------------------------------------o -void CPCharLocBody::Log( std::ofstream &outStream, bool fullHeader ) +void CPCharLocBody::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -1901,7 +1901,7 @@ void CPDrawContainer::Serial( SERIAL toSet ) //| BYTE response text length //| BYTE[response text length] response text //o------------------------------------------------------------------------------------------------o -void CPOpenGump::Log( std::ofstream &outStream, bool fullHeader ) +void CPOpenGump::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -3132,7 +3132,7 @@ CPEnableClientFeatures::CPEnableClientFeatures( CSocket *mSock ) } } -void CPEnableClientFeatures::Log( std::ofstream &outStream, bool fullHeader ) +void CPEnableClientFeatures::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -3271,7 +3271,7 @@ CPNegotiateAssistantFeatures::CPNegotiateAssistantFeatures( [[maybe_unused]] CSo pStream.WriteLong( 8, cwmWorldState->ServerData()->GetDisabledAssistantFeatures() & 0xFFFFFFFF ); } -void CPNegotiateAssistantFeatures::Log( std::ofstream &outStream, bool fullHeader ) +void CPNegotiateAssistantFeatures::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -4342,7 +4342,7 @@ CPKrriosClientSpecial::CPKrriosClientSpecial( CSocket * mSock, CChar * mChar, UI } } -void CPKrriosClientSpecial::Log( std::ofstream &outStream, bool fullHeader ) +void CPKrriosClientSpecial::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -4375,7 +4375,7 @@ void CPKrriosClientSpecial::Log( std::ofstream &outStream, bool fullHeader ) //| 0x04 = Tokuno //| 0x05 = TerMur) //o------------------------------------------------------------------------------------------------o -void CPMapChange::Log( std::ofstream &outStream, bool fullHeader ) +void CPMapChange::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -4461,7 +4461,7 @@ void CPCloseGump::InternalReset( void ) pStream.WriteLong( 5, _gumpId ); // gumpId - which gump to destroy pStream.WriteLong( 9, _buttonId ); // buttonId - response buttonId for packet 0xB1 } -void CPCloseGump::Log( std::ofstream &outStream, bool fullHeader ) +void CPCloseGump::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -4640,7 +4640,7 @@ void CPItemsInContainer::CopyData( CSocket *mSock, CItem& toCopy ) NumberOfItems( itemCount ); } -void CPItemsInContainer::Log( std::ofstream &outStream, bool fullHeader ) +void CPItemsInContainer::Log( std::ostream &outStream, bool fullHeader ) { size_t numItems = pStream.GetUShort( 3 ); if( fullHeader ) @@ -4807,7 +4807,7 @@ auto CPOpenBuyWindow::CopyData( CItem& toCopy, CChar *vendorId, CPItemsInContain pStream.WriteShort( 1, length ); } -void CPOpenBuyWindow::Log( std::ofstream &outStream, bool fullHeader ) +void CPOpenBuyWindow::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -4886,7 +4886,7 @@ void CPOpenBuyWindow::Log( std::ofstream &outStream, bool fullHeader ) //| 0x4000 = new movement packets 0xF0 -> 0xF2 //| 0x8000 = unlock new felucca areas (faction areas) //o------------------------------------------------------------------------------------------------o -void CPCharAndStartLoc::Log( std::ofstream &outStream, bool fullHeader ) +void CPCharAndStartLoc::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) outStream << "[SEND]Packet : CPCharAndStartLoc 0xA9 --> Length: " << pStream.GetSize() << TimeStamp() << std::endl; @@ -6880,7 +6880,7 @@ void CPSendGumpMenu::Finalize( void ) pStream.WriteShort( tlOff, static_cast( tlines )); } -void CPSendGumpMenu::Log( std::ofstream &outStream, bool fullHeader ) +void CPSendGumpMenu::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -9453,7 +9453,7 @@ void CPPartyMemberList::AddMember( CChar *member ) pStream.WriteShort( 1, static_cast( curPos ) + 4 ); } -void CPPartyMemberList::Log( std::ofstream &outStream, bool fullHeader ) +void CPPartyMemberList::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -9508,7 +9508,7 @@ void CPPartyInvitation::Leader( CChar *leader ) pStream.WriteLong( 6, leader->GetSerial() ); } -void CPPartyInvitation::Log( std::ofstream &outStream, bool fullHeader ) +void CPPartyInvitation::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -9569,7 +9569,7 @@ void CPPartyMemberRemove::AddMember( CChar *member ) pStream.WriteShort( 1, static_cast( curPos ) + 4 ); } -void CPPartyMemberRemove::Log( std::ofstream &outStream, bool fullHeader ) +void CPPartyMemberRemove::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { @@ -9643,7 +9643,7 @@ void CPPartyTell::InternalReset( void ) pStream.WriteByte( 5, 3 ); // subcommand } -void CPPartyTell::Log( std::ofstream &outStream, bool fullHeader ) +void CPPartyTell::Log( std::ostream &outStream, bool fullHeader ) { if( fullHeader ) { diff --git a/source/CPacketSend.h b/source/CPacketSend.h index a8bdcb303..f875fdfae 100644 --- a/source/CPacketSend.h +++ b/source/CPacketSend.h @@ -21,7 +21,7 @@ class CPCharLocBody : public CPUOXBuffer virtual void Flag( UI08 toPut ); virtual void HighlightColour( UI08 color ); CPCharLocBody & operator = ( CChar &toCopy ); - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPacketSpeech : public CPUOXBuffer @@ -462,7 +462,7 @@ class CPOpenGump : public CPUOXBuffer virtual void AddResponse( UI16 modelNum, UI16 colour, std::string responseText ); virtual void Finalize( void ); CPOpenGump &operator = ( CChar &toCopy ); - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPTargetCursor : public CPUOXBuffer @@ -691,21 +691,21 @@ class CPEnableClientFeatures : public CPUOXBuffer { public: CPEnableClientFeatures( CSocket *mSock ); - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPNegotiateAssistantFeatures : public CPUOXBuffer { public: CPNegotiateAssistantFeatures( CSocket *mSock ); - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPKrriosClientSpecial : public CPUOXBuffer { public: CPKrriosClientSpecial( CSocket *mSock, CChar * mChar, UI08 type, bool locations ); - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPLogoutResponse : public CPUOXBuffer @@ -897,7 +897,7 @@ class CPMapChange : public CPUOXBuffer } virtual void SetMap( UI08 newMap ); CPMapChange& operator = ( CBaseObject& moving ); - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPCloseGump : public CPUOXBuffer @@ -911,7 +911,7 @@ class CPCloseGump : public CPUOXBuffer virtual ~CPCloseGump() { } - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPItemsInContainer : public CPUOXBuffer @@ -938,7 +938,7 @@ class CPItemsInContainer : public CPUOXBuffer void VendorSerial( SERIAL toSet ); virtual void AddItem( CItem *toAdd, UI16 itemNum, CSocket *mSock ); void Add( UI16 itemNum, SERIAL toAdd, SERIAL cont, UI08 amount ); - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPCorpseClothing : public CPUOXBuffer @@ -971,7 +971,7 @@ class CPOpenBuyWindow : public CPUOXBuffer virtual void NumberOfItems( UI08 numItems ); virtual UI08 NumberOfItems( void ) const; virtual void AddItem( CItem *toAdd, CTownRegion *tReg, UI16 &baseOffset ); - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPCharAndStartLoc : public CPUOXBuffer @@ -992,7 +992,7 @@ class CPCharAndStartLoc : public CPUOXBuffer virtual auto AddStartLocation( __STARTLOCATIONDATA__ *sLoc, UI08 locOffset ) -> void; virtual auto NewAddStartLocation( __STARTLOCATIONDATA__ *sLoc, UI08 locOffset ) -> void; CPCharAndStartLoc& operator = ( CAccountBlock_st& actbBlock ); - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPUpdScroll : public CPUOXBuffer @@ -1334,7 +1334,7 @@ class CPSendGumpMenu : public CPUOXBuffer void addText( const std::string& msg ); void Finalize( void ); - virtual void Log( std::ofstream &outStream, bool fullHeader ) override; + virtual void Log( std::ostream &outStream, bool fullHeader ) override; }; class CPNewSpellBook : public CPUOXBuffer @@ -1578,7 +1578,7 @@ class CPPartyMemberList : public CPUOXBuffer { } void AddMember( CChar *member ); - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPPartyInvitation : public CPUOXBuffer @@ -1590,7 +1590,7 @@ class CPPartyInvitation : public CPUOXBuffer virtual ~CPPartyInvitation() { } - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; void Leader( CChar *leader ); }; @@ -1604,7 +1604,7 @@ class CPPartyMemberRemove : public CPUOXBuffer { } void AddMember( CChar *member ); - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPPartyTell : public CPUOXBuffer @@ -1616,7 +1616,7 @@ class CPPartyTell : public CPUOXBuffer virtual ~CPPartyTell() { } - virtual void Log( std::ofstream &outStream, bool fullHeader = true ) override; + virtual void Log( std::ostream &outStream, bool fullHeader = true ) override; }; class CPDropItemApproved : public CPUOXBuffer diff --git a/source/cBaseObject.cpp b/source/cBaseObject.cpp index 693f8e988..7f62821e4 100644 --- a/source/cBaseObject.cpp +++ b/source/cBaseObject.cpp @@ -717,7 +717,7 @@ void CBaseObject::SetOwner( CChar *newOwner ) //| Purpose - Dumps out body information of the object //| This is tag/data pairing information //o------------------------------------------------------------------------------------------------o -bool CBaseObject::DumpBody( std::ofstream &outStream ) const +bool CBaseObject::DumpBody( std::ostream &outStream ) const { SI16 temp_st2, temp_dx2, temp_in2; const char newLine = '\n'; @@ -1669,7 +1669,7 @@ void CBaseObject::IncIntelligence( SI16 toInc ) //| Mode 0 - Text //| Mode 1 - Binary //o------------------------------------------------------------------------------------------------o -bool CBaseObject::DumpFooter( std::ofstream &outStream ) const +bool CBaseObject::DumpFooter( std::ostream &outStream ) const { outStream << "\no---o\n\n"; return true; @@ -1682,8 +1682,8 @@ bool CBaseObject::DumpFooter( std::ofstream &outStream ) const //o------------------------------------------------------------------------------------------------o //| Purpose - Loads object from disk based on mode //o------------------------------------------------------------------------------------------------o -void ReadWorldTagData( std::ifstream &inStream, std::string &tag, std::string &data ); -bool CBaseObject::Load( std::ifstream &inStream ) +void ReadWorldTagData( std::istream &inStream, std::string &tag, std::string &data ); +bool CBaseObject::Load( std::istream &inStream ) { std::string tag = "", data = "", UTag = ""; while( tag != "o---o" ) diff --git a/source/cBaseObject.h b/source/cBaseObject.h index 91dd3d4f5..638e826f7 100644 --- a/source/cBaseObject.h +++ b/source/cBaseObject.h @@ -194,11 +194,11 @@ class CBaseObject void SetSpawn( SERIAL newSpawn ); virtual void SetOwner( CChar *newOwner ); - virtual bool Save( std::ofstream &outStream ) = 0; - virtual bool DumpHeader( std::ofstream &outStream ) const = 0; - virtual bool DumpBody( std::ofstream &outStream ) const; - bool DumpFooter( std::ofstream &outStream ) const; - bool Load( std::ifstream &inStream ); + virtual bool Save( std::ostream &outStream ) = 0; + virtual bool DumpHeader( std::ostream &outStream ) const = 0; + virtual bool DumpBody( std::ostream &outStream ) const; + bool DumpFooter( std::ostream &outStream ) const; + bool Load( std::istream &inStream ); virtual bool HandleLine( std::string &UTag, std::string &data ); diff --git a/source/cChar.cpp b/source/cChar.cpp index 234eae5f6..3cf42c9c2 100644 --- a/source/cChar.cpp +++ b/source/cChar.cpp @@ -3058,12 +3058,12 @@ bool CChar::FinishedItems( void ) //o------------------------------------------------------------------------------------------------o //| Purpose - Dump character data to worldfile //o------------------------------------------------------------------------------------------------o -bool CChar::DumpHeader( std::ofstream &outStream ) const +bool CChar::DumpHeader( std::ostream &outStream ) const { outStream << "[CHARACTER]" << '\n'; return true; } -bool CChar::DumpBody( std::ofstream &outStream ) const +bool CChar::DumpBody( std::ostream &outStream ) const { CBaseObject::DumpBody( outStream ); // Make the default save of BaseObject members now @@ -3171,7 +3171,7 @@ bool CChar::DumpBody( std::ofstream &outStream ) const } return true; } -void CChar::NPCValues_st::DumpBody( std::ofstream& outStream ) +void CChar::NPCValues_st::DumpBody( std::ostream& outStream ) { const char newLine = '\n'; @@ -3222,7 +3222,7 @@ void CChar::NPCValues_st::DumpBody( std::ofstream& outStream ) } } } -void CChar::PlayerValues_st::DumpBody( std::ofstream& outStream ) +void CChar::PlayerValues_st::DumpBody( std::ostream& outStream ) { const char newLine = '\n'; @@ -3279,7 +3279,7 @@ void CChar::PlayerValues_st::DumpBody( std::ofstream& outStream ) //| Purpose - Saves character to worldfile - returns true/false indicating the success //| of the write operation //o------------------------------------------------------------------------------------------------o -bool CChar::Save( std::ofstream &outStream ) +bool CChar::Save( std::ostream &outStream ) { bool rValue = false; if( !IsFree() ) diff --git a/source/cChar.h b/source/cChar.h index 53d4f6315..ed4cc90ba 100644 --- a/source/cChar.h +++ b/source/cChar.h @@ -74,7 +74,7 @@ class CChar : public CBaseObject struct NPCValues_st { NPCValues_st(); - void DumpBody( std::ofstream& outStream ); + void DumpBody( std::ostream& outStream ); SI08 wanderMode; // NPC Wander Mode SI08 oldWanderMode; // Used for fleeing npcs @@ -134,7 +134,7 @@ class CChar : public CBaseObject struct PlayerValues_st { PlayerValues_st(); - void DumpBody( std::ofstream& outStream ); + void DumpBody( std::ostream& outStream ); SERIAL callNum; // Callnum GM or Counsellor is on SERIAL playerCallNum; // Players call number in GM or Counsellor requestQueue @@ -257,8 +257,8 @@ class CChar : public CBaseObject DAMAGETRACK damageDealt; DAMAGETRACK damageHealed; - virtual bool DumpHeader( std::ofstream &outStream ) const override; - virtual bool DumpBody( std::ofstream &outStream ) const override; + virtual bool DumpHeader( std::ostream &outStream ) const override; + virtual bool DumpBody( std::ostream &outStream ) const override; virtual bool HandleLine( std::string &UTag, std::string &data ) override; virtual bool LoadRemnants( void ) override; @@ -570,7 +570,7 @@ class CChar : public CBaseObject void BreakConcentration( CSocket *sock = nullptr ); - virtual bool Save( std::ofstream &outStream ) override; + virtual bool Save( std::ostream &outStream ) override; virtual void PostLoadProcessing( void ) override; SI16 ActualStrength( void ) const; diff --git a/source/cGuild.cpp b/source/cGuild.cpp index d73c9e9e3..b3576f235 100644 --- a/source/cGuild.cpp +++ b/source/cGuild.cpp @@ -645,7 +645,7 @@ GUILDREL *CGuild::GuildRelationList( void ) //o------------------------------------------------------------------------------------------------o //| Purpose - Save guild data to worldfiles //o------------------------------------------------------------------------------------------------o -void CGuild::Save( std::ofstream &toSave, GUILDID gNum ) +void CGuild::Save( std::ostream &toSave, GUILDID gNum ) { toSave << "[GUILD " << gNum << ']' << '\n' << "{" << '\n'; toSave << "NAME=" << name << '\n'; diff --git a/source/cGuild.h b/source/cGuild.h index b7afa1552..6a7f3861e 100644 --- a/source/cGuild.h +++ b/source/cGuild.h @@ -108,7 +108,7 @@ class CGuild void SetGuildFaction( GuildType newFaction ); void SetGuildRelation( GUILDID otherGuild, GUILDRELATION toSet ); - void Save( std::ofstream &toSave, GUILDID gNum ); + void Save( std::ostream &toSave, GUILDID gNum ); void Load( CScriptSection *toRead ); GUILDREL * GuildRelationList(); // NOTE: This is aimed ONLY at menu stuff diff --git a/source/cItem.cpp b/source/cItem.cpp index 72085948f..27f0885c5 100644 --- a/source/cItem.cpp +++ b/source/cItem.cpp @@ -1453,7 +1453,7 @@ auto CItem::IsShieldType() const -> bool //o------------------------------------------------------------------------------------------------o //| Purpose - Save item details to worldfile //o------------------------------------------------------------------------------------------------o -bool CItem::Save( std::ofstream &outStream ) +bool CItem::Save( std::ostream &outStream ) { if( IsFree() ) return false; @@ -1693,7 +1693,7 @@ auto CItem::SetWeatherDamage( WeatherType effectNum, bool value ) -> void //o------------------------------------------------------------------------------------------------o //| Purpose - Dump item header to worldfile //o------------------------------------------------------------------------------------------------o -bool CItem::DumpHeader( std::ofstream &outStream ) const +bool CItem::DumpHeader( std::ostream &outStream ) const { outStream << "[ITEM]" << '\n'; return true; @@ -1704,7 +1704,7 @@ bool CItem::DumpHeader( std::ofstream &outStream ) const //o------------------------------------------------------------------------------------------------o //| Purpose - Dump item tags and values to worldfile //o------------------------------------------------------------------------------------------------o -bool CItem::DumpBody( std::ofstream &outStream ) const +bool CItem::DumpBody( std::ostream &outStream ) const { CBaseObject::DumpBody( outStream ); const char newLine = '\n'; @@ -3313,7 +3313,7 @@ auto CSpawnItem::IsSectionAList( bool newVal ) -> void //o------------------------------------------------------------------------------------------------o //| Purpose - Dumps Header to Worldfile //o------------------------------------------------------------------------------------------------o -bool CSpawnItem::DumpHeader( std::ofstream &outStream ) const +bool CSpawnItem::DumpHeader( std::ostream &outStream ) const { outStream << "[SPAWNITEM]" << '\n'; return true; @@ -3325,7 +3325,7 @@ bool CSpawnItem::DumpHeader( std::ofstream &outStream ) const //o------------------------------------------------------------------------------------------------o //| Purpose - Dumps Spawn Item to Worldfile //o------------------------------------------------------------------------------------------------o -bool CSpawnItem::DumpBody( std::ofstream &outStream ) const +bool CSpawnItem::DumpBody( std::ostream &outStream ) const { CItem::DumpBody( outStream ); outStream << "Interval=" << static_cast( GetInterval( 0 )) << "," << static_cast( GetInterval( 1 )) << '\n'; diff --git a/source/cItem.h b/source/cItem.h index 77c9f61f8..3a3b60e5d 100644 --- a/source/cItem.h +++ b/source/cItem.h @@ -80,7 +80,7 @@ class CItem : public CBaseObject virtual void AddSelfToOwner( void ) override; auto CheckItemIntegrity() -> void; - virtual bool DumpHeader( std::ofstream &outStream ) const override; + virtual bool DumpHeader( std::ostream &outStream ) const override; virtual bool LoadRemnants( void ) override; UI32 spells[3]; // For spellbooks (eventually should be a derived class) @@ -306,8 +306,8 @@ class CItem : public CBaseObject auto SendPackItemToSocket( CSocket *mSock ) -> void; virtual void RemoveFromSight( CSocket *mSock = nullptr ); - virtual bool Save( std::ofstream &outStream ) override; - virtual bool DumpBody( std::ofstream &outStream ) const override; + virtual bool Save( std::ostream &outStream ) override; + virtual bool DumpBody( std::ostream &outStream ) const override; virtual bool HandleLine( std::string &UTag, std::string &data ) override; virtual void PostLoadProcessing( void ) override; virtual void Cleanup( void ) override; @@ -341,8 +341,8 @@ class CSpawnItem : public CItem auto IsSectionAList() const -> bool; auto IsSectionAList( bool newVal ) -> void; - virtual bool DumpHeader( std::ofstream &outStream ) const override; - virtual bool DumpBody( std::ofstream &outStream ) const override; + virtual bool DumpHeader( std::ostream &outStream ) const override; + virtual bool DumpBody( std::ostream &outStream ) const override; virtual bool HandleLine( std::string &UTag, std::string &data ) override; diff --git a/source/cMultiObj.cpp b/source/cMultiObj.cpp index 29631a19d..1888b25bb 100644 --- a/source/cMultiObj.cpp +++ b/source/cMultiObj.cpp @@ -844,7 +844,7 @@ auto CMultiObj::UnsecureContainer( CItem *toUnsecure ) -> void //o------------------------------------------------------------------------------------------------o //| Purpose - Saves a multi out to disk. outStream is the file to write to //o------------------------------------------------------------------------------------------------o -bool CMultiObj::Save( std::ofstream &outStream ) +bool CMultiObj::Save( std::ostream &outStream ) { bool rValue = false; if( !IsFree() ) @@ -965,7 +965,7 @@ void CMultiObj::SetMaxOwners( UI16 newValue ) //o------------------------------------------------------------------------------------------------o //| Purpose - Dumps out the header for the CMultiObj //o------------------------------------------------------------------------------------------------o -bool CMultiObj::DumpHeader( std::ofstream &outStream ) const +bool CMultiObj::DumpHeader( std::ostream &outStream ) const { outStream << "[HOUSE]" << '\n'; return true; @@ -977,7 +977,7 @@ bool CMultiObj::DumpHeader( std::ofstream &outStream ) const //| Purpose - Writes out all CMultiObj specific information to a world //| file. Also prints out the Item and BaseObject portions //o------------------------------------------------------------------------------------------------o -bool CMultiObj::DumpBody( std::ofstream &outStream ) const +bool CMultiObj::DumpBody( std::ostream &outStream ) const { CItem::DumpBody( outStream ); @@ -1493,7 +1493,7 @@ CBoatObj::~CBoatObj() //o------------------------------------------------------------------------------------------------o //| Purpose - Dumps out the header for the CMultiObj //o------------------------------------------------------------------------------------------------o -bool CBoatObj::DumpHeader( std::ofstream &outStream ) const +bool CBoatObj::DumpHeader( std::ostream &outStream ) const { outStream << "[BOAT]" << '\n'; return true; @@ -1505,7 +1505,7 @@ bool CBoatObj::DumpHeader( std::ofstream &outStream ) const //| Purpose - Writes out all CMultiObj specific information to a world //| file. Also prints out the Item and BaseObject portions //o------------------------------------------------------------------------------------------------o -bool CBoatObj::DumpBody( std::ofstream &outStream ) const +bool CBoatObj::DumpBody( std::ostream &outStream ) const { CMultiObj::DumpBody( outStream ); diff --git a/source/cMultiObj.h b/source/cMultiObj.h index 40a9dd141..b9ff6801e 100644 --- a/source/cMultiObj.h +++ b/source/cMultiObj.h @@ -133,9 +133,9 @@ class CMultiObj : public CItem std::string GetTradeTimestamp( void ) const; void SetTradeTimestamp( time_t newTime ); - virtual bool Save( std::ofstream &outStream ) override; - virtual bool DumpHeader( std::ofstream &outStream ) const override; - virtual bool DumpBody( std::ofstream &outStream ) const override; + virtual bool Save( std::ostream &outStream ) override; + virtual bool DumpHeader( std::ostream &outStream ) const override; + virtual bool DumpBody( std::ostream &outStream ) const override; virtual bool HandleLine( std::string &UTag, std::string &data ) override; virtual void SetOwner( CChar *newOwner ) override; @@ -167,8 +167,8 @@ class CBoatObj : public CMultiObj TIMERVAL nextMoveTime; private: - virtual bool DumpHeader( std::ofstream &outStream ) const override; - virtual bool DumpBody( std::ofstream &outStream ) const override; + virtual bool DumpHeader( std::ostream &outStream ) const override; + virtual bool DumpBody( std::ostream &outStream ) const override; virtual bool HandleLine( std::string &UTag, std::string &data ) override; diff --git a/source/cServerData.cpp b/source/cServerData.cpp index b24074218..d72e19472 100644 --- a/source/cServerData.cpp +++ b/source/cServerData.cpp @@ -6932,7 +6932,7 @@ auto CServerData::SaveTime() -> void timeDestination.close(); } -auto ReadWorldTagData( std::ifstream &inStream, std::string &tag, std::string &data ) -> void; +auto ReadWorldTagData( std::istream &inStream, std::string &tag, std::string &data ) -> void; //o------------------------------------------------------------------------------------------------o //| Function - CServerData::LoadTime() //o------------------------------------------------------------------------------------------------o @@ -6969,7 +6969,7 @@ auto CServerData::LoadTime() -> void } //============================================================================================== -auto CServerData::LoadTimeTags( std::ifstream &input ) -> void +auto CServerData::LoadTimeTags( std::istream &input ) -> void { std::string UTag, tag, data; while( tag != "o---o" ) diff --git a/source/cServerData.h b/source/cServerData.h index fc838d348..254e9388f 100644 --- a/source/cServerData.h +++ b/source/cServerData.h @@ -1210,7 +1210,7 @@ class CServerData auto SaveTime() -> void; auto LoadTime() -> void; - auto LoadTimeTags( std::ifstream &input ) -> void; + auto LoadTimeTags( std::istream &input ) -> void; // These functions return true if it's a new day auto IncSecond() -> bool; diff --git a/source/cSocket.cpp b/source/cSocket.cpp index f5c970fa6..e1b7a5522 100644 --- a/source/cSocket.cpp +++ b/source/cSocket.cpp @@ -35,7 +35,7 @@ const bool LOGDEFAULT = false; //o------------------------------------------------------------------------------------------------o //| Purpose - Dumps packet stream to log file //o------------------------------------------------------------------------------------------------o -void DumpStream( std::ofstream &outStream, const char *strToDump, UI08 num ) +void DumpStream( std::ostream &outStream, const char *strToDump, UI08 num ) { outStream << " "; for( UI08 parseBuff = 0; parseBuff < num; ++parseBuff ) @@ -57,7 +57,7 @@ void DumpStream( std::ofstream &outStream, const char *strToDump, UI08 num ) //o------------------------------------------------------------------------------------------------o //| Purpose - Log packet stream in large buffer //o------------------------------------------------------------------------------------------------o -void DoPacketLogging( std::ofstream &outStream, size_t buffLen, std::vector& myBuffer ) +void DoPacketLogging( std::ostream &outStream, size_t buffLen, std::vector& myBuffer ) { outStream << std::hex; char qbuffer[8]; @@ -89,7 +89,7 @@ void DoPacketLogging( std::ofstream &outStream, size_t buffLen, std::vectorBuffer(); const UI32 len = tSock->InLength(); diff --git a/source/effect.cpp b/source/effect.cpp index bba40c380..7a3e23c1c 100644 --- a/source/effect.cpp +++ b/source/effect.cpp @@ -1797,7 +1797,7 @@ void cEffects::SaveEffects( void ) Console.Print( oldstrutil::format("Effects saved in %.02fsec\n", ( static_cast( e_t-s_t )) / 1000.0f )); } -void ReadWorldTagData( std::ifstream &inStream, std::string &tag, std::string &data ); +void ReadWorldTagData( std::istream &inStream, std::string &tag, std::string &data ); //o------------------------------------------------------------------------------------------------o //| Function - cEffects::LoadEffects() //| Date - 16 March, 2002 @@ -1954,7 +1954,7 @@ void cEffects::LoadEffects( void ) //| Purpose - Output the effect data to the effect destination. Returns true/false //| indicating the success of the write operation //o------------------------------------------------------------------------------------------------o -bool CTEffect::Save( std::ofstream &effectDestination ) const +bool CTEffect::Save( std::ostream &effectDestination ) const { CBaseObject *getPtr = nullptr; const char newLine = '\n'; diff --git a/source/fileio.cpp b/source/fileio.cpp index 4b06e519c..7aee52755 100644 --- a/source/fileio.cpp +++ b/source/fileio.cpp @@ -611,7 +611,7 @@ void LoadCreatures( void ) FileLookup->Dispose( creatures_def ); } -void ReadWorldTagData( std::ifstream &inStream, std::string &tag, std::string &data ) +void ReadWorldTagData( std::istream &inStream, std::string &tag, std::string &data ) { char temp[4097]; tag = "o---o"; diff --git a/source/jail.cpp b/source/jail.cpp index f1022306d..93990bfe6 100644 --- a/source/jail.cpp +++ b/source/jail.cpp @@ -194,7 +194,7 @@ void CJailCell::PeriodicCheck( void ) //o------------------------------------------------------------------------------------------------o //| Purpose - Save out data on jailed players to stream //o------------------------------------------------------------------------------------------------o -void CJailCell::WriteData( std::ofstream &outStream, size_t cellNumber ) +void CJailCell::WriteData( std::ostream &outStream, size_t cellNumber ) { std::vector::const_iterator jIter; for( jIter = playersInJail.begin(); jIter != playersInJail.end(); ++jIter ) diff --git a/source/jail.h b/source/jail.h index b4c429f9f..dd2a64a2f 100644 --- a/source/jail.h +++ b/source/jail.h @@ -47,7 +47,7 @@ class CJailCell JailOccupant_st *Occupant( size_t occupantId ); void PeriodicCheck( void ); void AddOccupant( JailOccupant_st *toAdd ); - void WriteData( std::ofstream &outStream, size_t cellNum ); + void WriteData( std::ostream &outStream, size_t cellNum ); }; class CJailSystem diff --git a/source/mapstuff.cpp b/source/mapstuff.cpp index bd7c8463d..a328e5a84 100644 --- a/source/mapstuff.cpp +++ b/source/mapstuff.cpp @@ -1505,7 +1505,7 @@ auto TileInfo::CollectionArt() -> std::vector& //o------------------------------------------------------------------------------------------------o //| Purpose - Process terrain data read from tiledata file //o------------------------------------------------------------------------------------------------o -auto TileInfo::ProcessTerrain( std::ifstream &input ) -> void +auto TileInfo::ProcessTerrain( std::istream &input ) -> void { terrainData.reserve( 0x4000 ); std::uint32_t value32 = 0; @@ -1567,7 +1567,7 @@ auto TileInfo::ProcessTerrain( std::ifstream &input ) -> void //o------------------------------------------------------------------------------------------------o //| Purpose - Process art/statics data read from tiledata file //o------------------------------------------------------------------------------------------------o -auto TileInfo::ProcessArt( std::ifstream &input ) -> void +auto TileInfo::ProcessArt( std::istream &input ) -> void { artData.reserve( 0xFFFF ); std::uint32_t value32 = 0; diff --git a/source/mapstuff.h b/source/mapstuff.h index 00953391d..ef53623ca 100644 --- a/source/mapstuff.h +++ b/source/mapstuff.h @@ -16,8 +16,8 @@ class TileInfo constexpr static auto hsSize = 3188736; std::vector terrainData; std::vector artData; - auto ProcessTerrain( std::ifstream &input ) -> void; - auto ProcessArt( std::ifstream &input ) -> void; + auto ProcessTerrain( std::istream &input ) -> void; + auto ProcessArt( std::istream &input ) -> void; bool isHsFormat; public: TileInfo( const std::string &filename = "" ); diff --git a/source/msgboard.cpp b/source/msgboard.cpp index b035a9498..7e1fb4a43 100644 --- a/source/msgboard.cpp +++ b/source/msgboard.cpp @@ -300,7 +300,7 @@ bool GetMaxSerial( const std::string& fileName, UI08 *nextMsgId, const PostTypes //o------------------------------------------------------------------------------------------------o //| Purpose - Writes a new post to the .bbf file //o------------------------------------------------------------------------------------------------o -void MsgBoardWritePost( std::ofstream& mFile, const MsgBoardPost_st& msgBoardPost ) +void MsgBoardWritePost( std::ostream& mFile, const MsgBoardPost_st& msgBoardPost ) { char wBuffer[4]; @@ -526,7 +526,7 @@ void MsgBoardPost( CSocket *tSock ) //o------------------------------------------------------------------------------------------------o //| Purpose - Reads in a post from its specified file. //o------------------------------------------------------------------------------------------------o -bool MsgBoardReadPost( std::ifstream& file, MsgBoardPost_st& msgBoardPost, SERIAL msgSerial = INVALIDSERIAL ) +bool MsgBoardReadPost( std::istream& file, MsgBoardPost_st& msgBoardPost, SERIAL msgSerial = INVALIDSERIAL ) { char buffer[4]; diff --git a/source/network.h b/source/network.h index 5fb214e6e..46b01fc09 100644 --- a/source/network.h +++ b/source/network.h @@ -576,7 +576,7 @@ class CPUOXBuffer UI32 PackedLength( void ) const; const UI08 * PackedPointer( void ) const; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ); + virtual void Log( std::ostream &outStream, bool fullHeader = true ); }; class CPInputBuffer @@ -592,7 +592,7 @@ class CPInputBuffer } virtual void Receive( void ) = 0; - virtual void Log( std::ofstream &outStream, bool fullHeader = true ); + virtual void Log( std::ostream &outStream, bool fullHeader = true ); virtual bool Handle( void ); void SetSocket( CSocket *toSet ); CSocket * GetSocket( void ) const; diff --git a/source/regions.cpp b/source/regions.cpp index 7d01d90ea..1fe7875ac 100644 --- a/source/regions.cpp +++ b/source/regions.cpp @@ -34,7 +34,7 @@ SI32 FileSize( std::string filename ) //o------------------------------------------------------------------------------------------------o //| Purpose - Creates a new character object based on data loaded from worldfiles //o------------------------------------------------------------------------------------------------o -void LoadChar( std::ifstream& readDestination ) +void LoadChar( std::istream& readDestination ) { CChar *x = static_cast( ObjectFactory::GetSingleton().CreateBlankObject( OT_CHAR )); if( x == nullptr ) @@ -52,7 +52,7 @@ void LoadChar( std::ifstream& readDestination ) //o------------------------------------------------------------------------------------------------o //| Purpose - Creates a new item object based on data loaded from worldfiles //o------------------------------------------------------------------------------------------------o -void LoadItem( std::ifstream& readDestination ) +void LoadItem( std::istream& readDestination ) { CItem *x = static_cast( ObjectFactory::GetSingleton().CreateBlankObject( OT_ITEM )); if( x == nullptr ) @@ -70,7 +70,7 @@ void LoadItem( std::ifstream& readDestination ) //o------------------------------------------------------------------------------------------------o //| Purpose - Creates a new multi object, like a house, based on data loaded from worldfiles //o------------------------------------------------------------------------------------------------o -void LoadMulti( std::ifstream& readDestination ) +void LoadMulti( std::istream& readDestination ) { CMultiObj *ourHouse = static_cast( ObjectFactory::GetSingleton().CreateBlankObject( OT_MULTI )); if( !ourHouse->Load( readDestination )) // if no load, DELETE @@ -85,7 +85,7 @@ void LoadMulti( std::ifstream& readDestination ) //o------------------------------------------------------------------------------------------------o //| Purpose - Creates a new boat object based on data loaded from worldfiles //o------------------------------------------------------------------------------------------------o -void LoadBoat( std::ifstream& readDestination ) +void LoadBoat( std::istream& readDestination ) { CBoatObj *ourBoat = static_cast( ObjectFactory::GetSingleton().CreateBlankObject( OT_BOAT )); if( !ourBoat->Load( readDestination )) // if no load, DELETE @@ -100,7 +100,7 @@ void LoadBoat( std::ifstream& readDestination ) //o------------------------------------------------------------------------------------------------o //| Purpose - Creates a new spawn object based on data loaded from worldfiles //o------------------------------------------------------------------------------------------------o -void LoadSpawnItem( std::ifstream& readDestination ) +void LoadSpawnItem( std::istream& readDestination ) { CSpawnItem *ourSpawner = static_cast( ObjectFactory::GetSingleton().CreateBlankObject( OT_SPAWNER )); if( !ourSpawner->Load( readDestination )) // if no load, DELETE @@ -117,7 +117,7 @@ void LoadSpawnItem( std::ifstream& readDestination ) //| to deal with pointer based stuff in region rather than index based stuff in array //| Also saves out all data regardless (in preparation for a simple binary save) //o------------------------------------------------------------------------------------------------o -void CMapRegion::SaveToDisk( std::ofstream& writeDestination ) +void CMapRegion::SaveToDisk( std::ostream& writeDestination ) { std::vector removeChar; for( const auto &charToWrite : charData.collection() ) @@ -1041,7 +1041,7 @@ void CMapHandler::Load( void ) //o------------------------------------------------------------------------------------------------o //| Purpose - Loads in objects from specified file //o------------------------------------------------------------------------------------------------o -void CMapHandler::LoadFromDisk( std::ifstream& readDestination, SI32 baseValue, SI32 fileSize, UI32 maxSize ) +void CMapHandler::LoadFromDisk( std::istream& readDestination, SI32 baseValue, SI32 fileSize, UI32 maxSize ) { char line[1024]; R32 basePercent = static_cast( baseValue ) / static_cast( maxSize ) * 100.0f; diff --git a/source/regions.h b/source/regions.h index bed0e376f..9c304871f 100644 --- a/source/regions.h +++ b/source/regions.h @@ -55,7 +55,7 @@ class CMapRegion { }; - void SaveToDisk( std::ofstream& writeDestination ); + void SaveToDisk( std::ostream& writeDestination ); }; class CMapWorld @@ -90,7 +90,7 @@ class CMapHandler WORLDLIST mapWorlds; CMapRegion overFlow; - void LoadFromDisk( std::ifstream& readDestination, SI32 baseValue, SI32 fileSize, UI32 maxSize ); + void LoadFromDisk( std::istream& readDestination, SI32 baseValue, SI32 fileSize, UI32 maxSize ); public: CMapHandler() = default; ~CMapHandler(); diff --git a/source/ssection.cpp b/source/ssection.cpp index 0ef00d3bf..c2a563b47 100644 --- a/source/ssection.cpp +++ b/source/ssection.cpp @@ -553,7 +553,7 @@ npcList( false ), itemList( false ), npcListData( "" ), itemListData( "" ) //| Purpose - Default constructor, initializing all variables //| and grabbing a section from the file passed in //o------------------------------------------------------------------------------------------------o -CScriptSection::CScriptSection( std::ifstream& input, DEFINITIONCATEGORIES d ) : +CScriptSection::CScriptSection( std::istream& input, DEFINITIONCATEGORIES d ) : dfnCat( d ), npcList( false ), itemList( false ), npcListData( "" ), itemListData( "" ) { data.resize( 0 ); @@ -868,7 +868,7 @@ UI32 itemIndexHolder = 0; //o------------------------------------------------------------------------------------------------o //| Purpose - Creates section data from the input stream passed in //o------------------------------------------------------------------------------------------------o -auto CScriptSection::CreateSection( std::ifstream& input ) -> void +auto CScriptSection::CreateSection( std::istream& input ) -> void { char line[2048]; std::string sLine; diff --git a/source/ssection.h b/source/ssection.h index 55ea2efb7..a2a660aec 100644 --- a/source/ssection.h +++ b/source/ssection.h @@ -325,7 +325,7 @@ class CScriptSection auto collection2() -> std::vector&; CScriptSection(); - CScriptSection( std::ifstream& input, DEFINITIONCATEGORIES d ); + CScriptSection( std::istream& input, DEFINITIONCATEGORIES d ); ~CScriptSection(); auto First() -> std::string; auto Next() -> std::string; @@ -347,7 +347,7 @@ class CScriptSection auto NpcListExist() const -> bool; auto ItemListData() const -> std::string; auto NpcListData() const -> std::string; - auto CreateSection( std::ifstream& inputbuf ) -> void; + auto CreateSection( std::istream& inputbuf ) -> void; }; #endif diff --git a/source/teffect.h b/source/teffect.h index e2b4ace32..b691e48cb 100644 --- a/source/teffect.h +++ b/source/teffect.h @@ -42,7 +42,7 @@ class CTEffect void ObjPtr( CBaseObject *value ) { objptr = value; } void AssocScript( UI16 value ) { assocScript = value; } - bool Save( std::ofstream &effectDestination ) const; // saves the current effect + bool Save( std::ostream &effectDestination ) const; // saves the current effect }; #endif diff --git a/source/townregion.cpp b/source/townregion.cpp index e2c5e6924..abe9bf622 100644 --- a/source/townregion.cpp +++ b/source/townregion.cpp @@ -254,7 +254,7 @@ bool CTownRegion::Load( Script *ss ) //| Purpose - Saves town region data to worldfiles //| Notes - entry is the region #, fp is the file to save in //o------------------------------------------------------------------------------------------------o -bool CTownRegion::Save( std::ofstream &outStream ) +bool CTownRegion::Save( std::ostream &outStream ) { const char newLine = '\n'; outStream << "[TOWNREGION " + std::to_string( regionNum ) + "]\n{\n"; diff --git a/source/townregion.h b/source/townregion.h index 86c0096a3..91184eed7 100644 --- a/source/townregion.h +++ b/source/townregion.h @@ -102,7 +102,7 @@ class CTownRegion bool ViewBudget( CSocket *sock ); bool PeriodicCheck( void ); bool Load( Script *ss ); // entry is the region #, fp is the file to load from - bool Save( std::ofstream &outStream ); // entry is the region #, fp is the file to save in + bool Save( std::ostream &outStream ); // entry is the region #, fp is the file to save in bool InitFromScript( CScriptSection *toScan ); bool AddAsTownMember( CChar& toAdd ); // toAdd is the character to add bool RemoveTownMember( CChar& toAdd ); // toAdd is the character to remove