class EscapedMnemonic
{
-StringBuffer m_buffer;
+private:
+ std::string m_buffer;
+
public:
-EscapedMnemonic( std::size_t capacity ) : m_buffer( capacity ){
+ EscapedMnemonic() : m_buffer(){
- m_buffer.push_back( '_' );
- }
- const char* c_str() const {
- return m_buffer.c_str();
- }
- void push_back( char c ){ // not escaped
- m_buffer.push_back( c );
- }
- std::size_t write( const char* buffer, std::size_t length ){
- for ( const char* end = buffer + length; buffer != end; ++buffer )
- {
- if ( *buffer == '_' ) {
- m_buffer.push_back( '_' );
- }
-
- m_buffer.push_back( *buffer );
+ m_buffer.push_back( '_' );
+ }
+ const char* c_str() const {
+ return m_buffer.c_str();
+ }
+ void push_back( char c ){ // not escaped
+ m_buffer.push_back( c );
+ }
+ std::size_t write( const char* buffer, std::size_t length ){
+ for ( const char* end = buffer + length; buffer != end; ++buffer )
+ {
+ if ( *buffer == '_' ) {
+ m_buffer.push_back( '_' );
}
- return length;
+
+ m_buffer.push_back( *buffer );
}
+ return length;
+ }
};
template<typename T>
class LoadMRU
{
- std::size_t m_number;
+private:
+ std::size_t m_number;
+
public:
- LoadMRU( std::size_t number )
- : m_number( number ){
- }
- void load(){
- if ( ConfirmModified( "Open Map" ) ) {
- MRU_Activate( m_number - 1 );
- }
+ LoadMRU( std::size_t number )
+ : m_number( number ){
+ }
+ void load(){
+ if ( ConfirmModified( "Open Map" ) ) {
+ MRU_Activate( m_number - 1 );
}
+ }
};
typedef MemberCaller<LoadMRU, void(), &LoadMRU::load> LoadMRUCaller;
{
++iGame;
}
- m_sGameFile = ( *iGame )->mGameFile;
+
+ if ( ( *iGame )->mGameFile != m_sGameFile ) {
+ m_sGameFile = ( *iGame )->mGameFile;
+
+ // do not trigger radiant restart when switching game on startup using Global Preferences dialog
+ if ( !onStartup ) {
+ PreferencesDialog_restartRequired( "Selected Game" );
+ }
+ }
+
+ // onStartup can only be true once, when Global Preferences are displayed at startup
+ onStartup = false;
}
void CGameDialog::GameFileExport( const Callback<void(int)> & importCallback ) const {