@ -234,6 +234,8 @@ command_result RemoteFortressReader_version(color_ostream &out, vector<string> &
return CR_OK ;
return CR_OK ;
}
}
DFHACK_PLUGIN_IS_ENABLED ( enableUpdates ) ;
// Mandatory init function. If you have some global state, create it here.
// Mandatory init function. If you have some global state, create it here.
DFhackCExport command_result plugin_init ( color_ostream & out , std : : vector < PluginCommand > & commands )
DFhackCExport command_result plugin_init ( color_ostream & out , std : : vector < PluginCommand > & commands )
{
{
@ -248,6 +250,7 @@ DFhackCExport command_result plugin_init(color_ostream &out, std::vector <Plugin
" Does nothing. \n "
" Does nothing. \n "
) ) ;
) ) ;
commands . push_back ( PluginCommand ( " RemoteFortressReader_version " , " List the loaded RemoteFortressReader version " , RemoteFortressReader_version , false , " This is used for plugin version checking. " ) ) ;
commands . push_back ( PluginCommand ( " RemoteFortressReader_version " , " List the loaded RemoteFortressReader version " , RemoteFortressReader_version , false , " This is used for plugin version checking. " ) ) ;
enableUpdates = true ;
return CR_OK ;
return CR_OK ;
}
}
@ -288,6 +291,7 @@ DFhackCExport RPCService *plugin_rpcconnect(color_ostream &)
svc - > addFunction ( " GetVersionInfo " , GetVersionInfo , SF_ALLOW_REMOTE ) ;
svc - > addFunction ( " GetVersionInfo " , GetVersionInfo , SF_ALLOW_REMOTE ) ;
svc - > addFunction ( " GetReports " , GetReports , SF_ALLOW_REMOTE ) ;
svc - > addFunction ( " GetReports " , GetReports , SF_ALLOW_REMOTE ) ;
svc - > addFunction ( " MoveCommand " , MoveCommand , SF_ALLOW_REMOTE ) ;
svc - > addFunction ( " MoveCommand " , MoveCommand , SF_ALLOW_REMOTE ) ;
svc - > addFunction ( " JumpCommand " , JumpCommand , SF_ALLOW_REMOTE ) ;
return svc ;
return svc ;
}
}
@ -300,6 +304,14 @@ DFhackCExport command_result plugin_shutdown(color_ostream &out)
return CR_OK ;
return CR_OK ;
}
}
DFhackCExport command_result plugin_onupdate ( color_ostream & out )
{
if ( ! enableUpdates )
return CR_OK ;
KeyUpdate ( ) ;
return CR_OK ;
}
uint16_t fletcher16 ( uint8_t const * data , size_t bytes )
uint16_t fletcher16 ( uint8_t const * data , size_t bytes )
{
{
uint16_t sum1 = 0xff , sum2 = 0xff ;
uint16_t sum1 = 0xff , sum2 = 0xff ;