Skip to content

Commit 2499cf9

Browse files
committed
Added plugin callback OnPluginWorldSave
1 parent 9f96adc commit 2499cf9

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

OtherTypes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,7 @@ class CPlugin :public CObject
959959
DISPID m_dispid_plugin_disconnect ; // "OnPluginDisconnect"
960960
DISPID m_dispid_plugin_close ; // "OnPluginClose"
961961
DISPID m_dispid_plugin_save_state ; // "OnPluginSaveState"
962+
DISPID m_dispid_plugin_world_save ; // "OnPluginWorldSave"
962963
DISPID m_dispid_plugin_enable ; // "OnPluginEnable"
963964
DISPID m_dispid_plugin_disable ; // "OnPluginDisable"
964965
DISPID m_dispid_plugin_command ; // "OnPluginCommand"

doc.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4945,6 +4945,26 @@ BOOL CMUSHclientDoc::DoSave(LPCTSTR lpszPathName, BOOL bReplace)
49454945
}
49464946
} // end of executing save script
49474947

4948+
4949+
// now do plugins "world save"
4950+
CPlugin * pSavedPlugin = m_CurrentPlugin;
4951+
m_CurrentPlugin = NULL;
4952+
4953+
// tell each plugin the world is saving
4954+
for (POSITION pluginpos = m_PluginList.GetHeadPosition(); pluginpos; )
4955+
{
4956+
CPlugin * pPlugin = m_PluginList.GetNext (pluginpos);
4957+
4958+
if (!(pPlugin->m_bEnabled)) // ignore disabled plugins
4959+
continue;
4960+
4961+
// see what the plugin makes of this,
4962+
pPlugin->ExecutePluginScript (ON_PLUGIN_WORLD_SAVE, pPlugin->m_dispid_plugin_world_save);
4963+
} // end of doing each plugin
4964+
4965+
m_CurrentPlugin = pSavedPlugin;
4966+
4967+
49484968
BOOL bSuccess = CDocument::DoSave (newName, bReplace);
49494969

49504970
if (bSuccess)

plugins.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ CPlugin::CPlugin (CMUSHclientDoc * pDoc)
3434
m_dispid_plugin_disconnect = DISPID_UNKNOWN;
3535
m_dispid_plugin_close = DISPID_UNKNOWN;
3636
m_dispid_plugin_save_state = DISPID_UNKNOWN;
37+
m_dispid_plugin_world_save = DISPID_UNKNOWN;
3738
m_dispid_plugin_enable = DISPID_UNKNOWN;
3839
m_dispid_plugin_disable = DISPID_UNKNOWN;
3940
m_dispid_plugin_command = DISPID_UNKNOWN;

stdafx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,7 @@ void DeleteStyle (CStyle * pStyle, const char * filename, const long linenumber)
490490
#define ON_PLUGIN_DISCONNECT "OnPluginDisconnect"
491491
#define ON_PLUGIN_CLOSE "OnPluginClose"
492492
#define ON_PLUGIN_SAVE_STATE "OnPluginSaveState"
493+
#define ON_PLUGIN_WORLD_SAVE "OnPluginWorldSave"
493494
#define ON_PLUGIN_ENABLE "OnPluginEnable"
494495
#define ON_PLUGIN_DISABLE "OnPluginDisable"
495496
#define ON_PLUGIN_COMMAND "OnPluginCommand"

xml/xml_load_world.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,8 @@ LONGLONG iCounterFrequency = large_int_frequency.QuadPart;
427427
= m_CurrentPlugin->GetPluginDispid (ON_PLUGIN_CLOSE );
428428
m_CurrentPlugin->m_dispid_plugin_save_state
429429
= m_CurrentPlugin->GetPluginDispid (ON_PLUGIN_SAVE_STATE);
430+
m_CurrentPlugin->m_dispid_plugin_world_save
431+
= m_CurrentPlugin->GetPluginDispid (ON_PLUGIN_WORLD_SAVE);
430432
m_CurrentPlugin->m_dispid_plugin_enable
431433
= m_CurrentPlugin->GetPluginDispid (ON_PLUGIN_ENABLE );
432434
m_CurrentPlugin->m_dispid_plugin_disable

0 commit comments

Comments
 (0)