Modify AutoScreenMessage to keep map of all non-standard ScreenMessages.
This has a lot of advantages over the old ways. Some of the initial ones are that you can log a list of all screenmessages and their respective number and another is that it would be fairly easy to add a reverse lookup, so you could get the name of a ScreenMessage for log use by getting the ScreenMessage number.
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
#ifndef SCREENMESSAGE_H
|
||||
#define SCREENMESSAGE_H
|
||||
|
||||
#include <map>
|
||||
|
||||
enum ScreenMessage {
|
||||
SM_None = 0,
|
||||
SM_DoneClosingWipingLeft,
|
||||
@@ -42,22 +44,32 @@ enum ScreenMessage {
|
||||
SM_BattleDamageLevel1,
|
||||
SM_BattleDamageLevel2,
|
||||
SM_BattleDamageLevel3,
|
||||
|
||||
SM_User
|
||||
};
|
||||
|
||||
// Automatically generate a unique ScreenMessage value
|
||||
class AutoScreenMessage
|
||||
//AutoScreenMessageHandler Class
|
||||
class ASMHClass
|
||||
{
|
||||
public:
|
||||
AutoScreenMessage();
|
||||
operator ScreenMessage() const { return m_sm; }
|
||||
protected:
|
||||
ScreenMessage m_sm;
|
||||
ScreenMessage ToMessageNumber( const CString & Name );
|
||||
void LogMessageNumbers();
|
||||
private:
|
||||
map < CString, ScreenMessage > *m_pScreenMessages;
|
||||
ScreenMessage m_iCurScreenMessage;
|
||||
};
|
||||
|
||||
extern ASMHClass AutoScreenMessageHandler;
|
||||
|
||||
// Automatically generate a unique ScreenMessage value
|
||||
#define AutoScreenMessage( x ) \
|
||||
const ScreenMessage x = AutoScreenMessageHandler.ToMessageNumber( #x );
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2003-2004 Chris Danford
|
||||
* (c) 2003-2005 Chris Danford, Charles Lohr
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
||||
Reference in New Issue
Block a user