@@ -103,7 +103,7 @@ using std::string;
103103
104104// FIXME: A lot of code in one file, all doing different things... there's something fishy about it.
105105
106- static bool parseKeySpec (std::string keyspec, int *psym, int *pmod, std::string *pfocus = NULL );
106+ static bool parseKeySpec (std::string keyspec, int *psym, int *pmod, std::string *pfocus = nullptr );
107107size_t loadScriptFiles (Core* core, color_ostream& out, const std::vector<std::string>& prefix, const std::filesystem::path& folder);
108108
109109namespace DFHack {
@@ -210,7 +210,7 @@ thread_local int CommandDepthCounter::depth = 0;
210210
211211void Core::cheap_tokenise (std::string const & input, std::vector<std::string>& output)
212212{
213- std::string *cur = NULL ;
213+ std::string *cur = nullptr ;
214214 size_t i = 0 ;
215215
216216 // Check the first non-space character
@@ -241,7 +241,7 @@ void Core::cheap_tokenise(std::string const& input, std::vector<std::string>& ou
241241 {
242242 unsigned char c = input[i];
243243 if (isspace (c)) {
244- cur = NULL ;
244+ cur = nullptr ;
245245 } else {
246246 if (!cur) {
247247 output.push_back (" " );
@@ -280,7 +280,7 @@ static void fHKthread(IODATA * iodata)
280280{
281281 Core * core = iodata->core ;
282282 PluginManager * plug_mgr = iodata->plug_mgr ;
283- if (plug_mgr == 0 || core == 0 )
283+ if (! plug_mgr || ! core)
284284 {
285285 std::cerr << " Hotkey thread has croaked." << std::endl;
286286 return ;
@@ -1424,7 +1424,7 @@ static void fIOthread(IODATA * iod)
14241424 main_history.load (HISTORY_FILE.c_str ());
14251425
14261426 Console & con = core->getConsole ();
1427- if (plug_mgr == 0 )
1427+ if (plug_mgr == nullptr )
14281428 {
14291429 con.printerr (" Something horrible happened in Core's constructor...\n " );
14301430 return ;
@@ -1496,18 +1496,18 @@ Core::Core() :
14961496 toolCount{0 }
14971497{
14981498 // init the console. This must be always the first step!
1499- plug_mgr = 0 ;
1499+ plug_mgr = nullptr ;
15001500 errorstate = false ;
15011501 vinfo = 0 ;
15021502 memset (&(s_mods), 0 , sizeof (s_mods));
15031503
15041504 // set up hotkey capture
15051505 suppress_duplicate_keyboard_events = true ;
15061506 hotkey_set = NO;
1507- last_world_data_ptr = NULL ;
1508- last_local_map_ptr = NULL ;
1507+ last_world_data_ptr = nullptr ;
1508+ last_local_map_ptr = nullptr ;
15091509 last_pause_state = false ;
1510- top_viewscreen = NULL ;
1510+ top_viewscreen = nullptr ;
15111511
15121512 color_ostream::log_errors_to_stderr = true ;
15131513};
@@ -1531,7 +1531,7 @@ void Core::fatal (std::string output, const char * title)
15311531 std::cout << " DFHack fatal error: " << out.str () << std::endl;
15321532 if (!title)
15331533 title = " DFHack error!" ;
1534- DFSDL::DFSDL_ShowSimpleMessageBox (0x10 /* SDL_MESSAGEBOX_ERROR */ , title, out.str ().c_str (), NULL );
1534+ DFSDL::DFSDL_ShowSimpleMessageBox (0x10 /* SDL_MESSAGEBOX_ERROR */ , title, out.str ().c_str (), nullptr );
15351535
15361536 bool is_headless = bool (getenv (" DFHACK_HEADLESS" ));
15371537 if (is_headless)
@@ -2004,7 +2004,7 @@ void Core::doUpdate(color_ostream &out)
20042004 Lua::Core::Reset (out, " DF code execution" );
20052005
20062006 // find the current viewscreen
2007- df::viewscreen *screen = NULL ;
2007+ df::viewscreen *screen = nullptr ;
20082008 if (df::global::gview)
20092009 {
20102010 screen = &df::global::gview->view ;
@@ -2230,7 +2230,7 @@ namespace DFHack {
22302230}
22312231
22322232void Core::handleLoadAndUnloadScripts (color_ostream& out, state_change_event event) {
2233- static const X::InitVariationTable table = X::getTable (X::computeInitVariationTable (0 ,
2233+ static const X::InitVariationTable table = X::getTable (X::computeInitVariationTable (nullptr ,
22342234 (int )SC_WORLD_LOADED, " onLoad" , " onLoadWorld" , " onWorldLoaded" , " " ,
22352235 (int )SC_WORLD_UNLOADED, " onUnload" , " onUnloadWorld" , " onWorldUnloaded" , " " ,
22362236 (int )SC_MAP_LOADED, " onMapLoad" , " onLoadMap" , " " ,
@@ -2330,7 +2330,7 @@ void Core::onStateChange(color_ostream &out, state_change_event event)
23302330 else
23312331 {
23322332 char timebuf[30 ];
2333- time_t rawtime = time (NULL );
2333+ time_t rawtime = time (nullptr );
23342334 struct tm * timeinfo = localtime (&rawtime);
23352335 strftime (timebuf, sizeof (timebuf), " [%Y-%m-%dT%H:%M:%S%z] " , timeinfo);
23362336 evtlog << timebuf;
@@ -2416,7 +2416,7 @@ int Core::Shutdown ( void )
24162416 if (plug_mgr)
24172417 {
24182418 delete plug_mgr;
2419- plug_mgr = 0 ;
2419+ plug_mgr = nullptr ;
24202420 }
24212421 // invalidate all modules
24222422 allModules.clear ();
@@ -2998,7 +2998,7 @@ bool Process::patchMemory(void *target, const void* src, size_t count)
29982998#define MODULE_GETTER (TYPE ) \
29992999TYPE * Core::get##TYPE() \
30003000{ \
3001- if (errorstate) return NULL ;\
3001+ if (errorstate) return nullptr ;\
30023002 if (!s_mods.p ##TYPE)\
30033003 {\
30043004 std::unique_ptr<Module> mod = create##TYPE ();\
0 commit comments