mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
pfGameGUIMsg => plString
This commit is contained in:
@ -136,7 +136,7 @@ PF_CONSOLE_CMD( Game, LoadDialog, "string dlgName", "Loads the given GUI dialog
|
||||
if( mgrKey )
|
||||
{
|
||||
pfGameGUIMsg *msg = new pfGameGUIMsg( mgrKey, pfGameGUIMsg::kLoadDialog );
|
||||
msg->SetString( params[ 0 ] );
|
||||
msg->SetString( (const char *)params[ 0 ] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
}
|
||||
@ -148,8 +148,8 @@ PF_CONSOLE_CMD( Game, LoadLocalDialog, "string ageName, string dlgName", "Loads
|
||||
if( mgrKey )
|
||||
{
|
||||
pfGameGUIMsg *msg = new pfGameGUIMsg( mgrKey, pfGameGUIMsg::kLoadDialog );
|
||||
msg->SetString( params[ 1 ] );
|
||||
msg->SetAge( params[ 0 ] );
|
||||
msg->SetString( (const char *)params[ 1 ] );
|
||||
msg->SetAge( (const char *)params[ 0 ] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
}
|
||||
@ -161,7 +161,7 @@ PF_CONSOLE_CMD( Game, ShowDialog, "string dlgName", "Shows the given GUI dialog"
|
||||
if( mgrKey )
|
||||
{
|
||||
pfGameGUIMsg *msg = new pfGameGUIMsg( mgrKey, pfGameGUIMsg::kShowDialog );
|
||||
msg->SetString( params[ 0 ] );
|
||||
msg->SetString( (const char *)params[ 0 ] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
}
|
||||
@ -173,7 +173,7 @@ PF_CONSOLE_CMD( Game, HideDialog, "string dlgName", "Hides the given GUI dialog"
|
||||
if( mgrKey )
|
||||
{
|
||||
pfGameGUIMsg *msg = new pfGameGUIMsg( mgrKey, pfGameGUIMsg::kHideDialog );
|
||||
msg->SetString( params[ 0 ] );
|
||||
msg->SetString( (const char *)params[ 0 ] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
}
|
||||
@ -187,11 +187,11 @@ PF_CONSOLE_CMD( Game, SwitchDialog, "string olddlgName, string newdlgName", "Hid
|
||||
if( mgrKey )
|
||||
{
|
||||
pfGameGUIMsg *msg = new pfGameGUIMsg( mgrKey, pfGameGUIMsg::kHideDialog );
|
||||
msg->SetString( params[ 0 ] );
|
||||
msg->SetString( (const char *)params[ 0 ] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
|
||||
pfGameGUIMsg *msg2 = new pfGameGUIMsg( mgrKey, pfGameGUIMsg::kShowDialog );
|
||||
msg2->SetString( params[ 1 ] );
|
||||
msg2->SetString( (const char *)params[ 1 ] );
|
||||
plgDispatch::MsgSend( msg2 );
|
||||
}
|
||||
}
|
||||
|
@ -181,11 +181,11 @@ bool pfGameGUIMgr::MsgReceive( plMessage* pMsg )
|
||||
if( guiMsg != nil )
|
||||
{
|
||||
if( guiMsg->GetCommand() == pfGameGUIMsg::kLoadDialog )
|
||||
LoadDialog( guiMsg->GetString(), nil, guiMsg->GetAge() );
|
||||
LoadDialog(guiMsg->GetString().c_str(), nil, guiMsg->GetAge().c_str());
|
||||
else if( guiMsg->GetCommand() == pfGameGUIMsg::kShowDialog )
|
||||
IShowDialog( guiMsg->GetString() );
|
||||
IShowDialog(guiMsg->GetString().c_str());
|
||||
else if( guiMsg->GetCommand() == pfGameGUIMsg::kHideDialog )
|
||||
IHideDialog( guiMsg->GetString() );
|
||||
IHideDialog(guiMsg->GetString().c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -52,13 +52,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "hsStream.h"
|
||||
#include "pnMessage/plMessage.h"
|
||||
|
||||
#define GAME_GUI_MSG_STRING_SIZE (128)
|
||||
|
||||
class pfGameGUIMsg : public plMessage
|
||||
{
|
||||
protected:
|
||||
|
||||
uint8_t fCommand;
|
||||
char fString[ 128 ];
|
||||
char *fAge;
|
||||
uint8_t fCommand;
|
||||
plString fString;
|
||||
plString fAge;
|
||||
|
||||
public:
|
||||
enum
|
||||
@ -68,9 +70,8 @@ class pfGameGUIMsg : public plMessage
|
||||
kLoadDialog
|
||||
};
|
||||
|
||||
pfGameGUIMsg() : plMessage( nil, nil, nil ) { SetBCastFlag( kBCastByExactType ); fAge = nil; }
|
||||
pfGameGUIMsg( plKey &receiver, uint8_t command ) : plMessage( nil, nil, nil ) { AddReceiver( receiver ); fCommand = command; fAge = nil; }
|
||||
~pfGameGUIMsg() { delete [] fAge; }
|
||||
pfGameGUIMsg() : plMessage( nil, nil, nil ) { SetBCastFlag( kBCastByExactType ); }
|
||||
pfGameGUIMsg(plKey &receiver, uint8_t command) : plMessage(nil, nil, nil) { AddReceiver(receiver); fCommand = command; }
|
||||
|
||||
CLASSNAME_REGISTER( pfGameGUIMsg );
|
||||
GETINTERFACE_ANY( pfGameGUIMsg, plMessage );
|
||||
@ -79,25 +80,30 @@ class pfGameGUIMsg : public plMessage
|
||||
{
|
||||
plMessage::IMsgRead( s, mgr );
|
||||
s->ReadLE( &fCommand );
|
||||
s->Read( sizeof( fString ), fString );
|
||||
fAge = s->ReadSafeString();
|
||||
char buffer[GAME_GUI_MSG_STRING_SIZE];
|
||||
s->Read(sizeof(buffer), buffer);
|
||||
buffer[GAME_GUI_MSG_STRING_SIZE - 1] = 0;
|
||||
fString = buffer;
|
||||
fAge = s->ReadSafeString_TEMP();
|
||||
}
|
||||
|
||||
virtual void Write(hsStream* s, hsResMgr* mgr)
|
||||
{
|
||||
plMessage::IMsgWrite( s, mgr );
|
||||
s->WriteLE( fCommand );
|
||||
s->Write( sizeof( fString ), fString );
|
||||
char buffer[GAME_GUI_MSG_STRING_SIZE];
|
||||
strncpy(buffer, fString.c_str(), GAME_GUI_MSG_STRING_SIZE);
|
||||
s->Write(sizeof(buffer), buffer);
|
||||
s->WriteSafeString( fAge );
|
||||
}
|
||||
|
||||
uint8_t GetCommand( void ) { return fCommand; }
|
||||
uint8_t GetCommand() const { return fCommand; }
|
||||
|
||||
void SetString( const char *str ) { hsStrncpy( fString, str, sizeof( fString ) - 1 ); }
|
||||
const char *GetString( void ) { return fString; }
|
||||
void SetString(const plString &str) { fString = str; }
|
||||
plString GetString() const { return fString; }
|
||||
|
||||
void SetAge( const char *str ) { delete [] fAge; if( str == nil ) fAge = nil; else fAge = hsStrcpy( str ); }
|
||||
const char *GetAge( void ) { return fAge; }
|
||||
void SetAge(const plString &age) { fAge = age; }
|
||||
plString GetAge() const { return fAge; }
|
||||
};
|
||||
|
||||
#endif // _pfGameGUIMsg_h
|
||||
|
Reference in New Issue
Block a user