K
kenner2
Remove MFC/UI: AIServer (#635)
* AIServer UI Removed
* Handle interrupt signals with graceful shutdowns.
* Rename CServerDlg to AiServerInstance
* Rename stdafx.h to pch.h
* Make AiServerInstance extend Thread and implement loop.
* Replace .rc resources with hardcoded strings
* Remove spdlog::shutdown(). The spdlog library calls this in its destructors.
* AiServerInstance destructor: Added additional logging, reordered thread shutdowns, added blocks to wait for worker threads to finish shutting down before emptying caches.
* Add debugger defaults for server projects
* Tidy up shutdown logic
thread_loop_wrapper() ensures _canTick and _isShutdown are set appropriately, so external code can behave correctly.
* Scope AiServerInstance & AIServerLogger instances within main() (also avoid the logger copy).
* join() our application thread rather than manually poll. The signal handle will still process events.
* Simply return rather than exit in main().
* Default _isShutdown to true. It should only be reset once a thread is started.
* Strip unnecessary includes
* AI: Only bother to queue packets when servers are connected
Upon connection, they will be fully synced, so there's no point in the queue at any other time.
* AI: Remove _listBoxQueue, _listBoxQueueMutex
* Logger: Add console-specific pattern for colour support
* Add/restore AiServerInstance::instance(), fetch rather than passing to constructors
(realistically it shouldn't store the instance in these classes at all, but that's a problem for a later time).
* Fix _USERLOG behaviour; this was broken back when spdlog was introduced. The timestamp written is meant to be the time it was logged, not the time it's written.
To fix this, we essentially just remove it all and log it on-demand which technically changes behaviour (officially it's all queued and only written when the user logs out),
but fixes the timestamp issues. (the timestamp was previously using MFC's CTime, which got removed here because it was "unused", so now that we're re-evaluating that, this fixes that).
* Fix several cases where we were formatting with spdlog and fmt::format() separately. This is because we were previously writing these to the output list as well, but this all goes through spdlog now so it's unnecessary.
* Remove ReportTableLoadError and associated awkward forward declarations. Since the log is simple now (it just goes through spdlog), this can be logged directly.
* Semi-unrelated but related to the cross-platform changes - m_CurrentNPC was using InterlockedIncrementAdd(). For cross-platform purposes, we change this to use std::atomic<> instead, which removes another Windows dependency.
* Use assert() rather than MSVCRT's _ASSERT
* Rename OnInitDialog() -> OnStart(), move OnDestroyWindow() into destructor directly
---------
Co-authored-by: twostars <i.am.twostars@gmail.com>
Github Commit Görüntüle...
See Commints...
..
* AIServer UI Removed
* Handle interrupt signals with graceful shutdowns.
* Rename CServerDlg to AiServerInstance
* Rename stdafx.h to pch.h
* Make AiServerInstance extend Thread and implement loop.
* Replace .rc resources with hardcoded strings
* Remove spdlog::shutdown(). The spdlog library calls this in its destructors.
* AiServerInstance destructor: Added additional logging, reordered thread shutdowns, added blocks to wait for worker threads to finish shutting down before emptying caches.
* Add debugger defaults for server projects
* Tidy up shutdown logic
thread_loop_wrapper() ensures _canTick and _isShutdown are set appropriately, so external code can behave correctly.
* Scope AiServerInstance & AIServerLogger instances within main() (also avoid the logger copy).
* join() our application thread rather than manually poll. The signal handle will still process events.
* Simply return rather than exit in main().
* Default _isShutdown to true. It should only be reset once a thread is started.
* Strip unnecessary includes
* AI: Only bother to queue packets when servers are connected
Upon connection, they will be fully synced, so there's no point in the queue at any other time.
* AI: Remove _listBoxQueue, _listBoxQueueMutex
* Logger: Add console-specific pattern for colour support
* Add/restore AiServerInstance::instance(), fetch rather than passing to constructors
(realistically it shouldn't store the instance in these classes at all, but that's a problem for a later time).
* Fix _USERLOG behaviour; this was broken back when spdlog was introduced. The timestamp written is meant to be the time it was logged, not the time it's written.
To fix this, we essentially just remove it all and log it on-demand which technically changes behaviour (officially it's all queued and only written when the user logs out),
but fixes the timestamp issues. (the timestamp was previously using MFC's CTime, which got removed here because it was "unused", so now that we're re-evaluating that, this fixes that).
* Fix several cases where we were formatting with spdlog and fmt::format() separately. This is because we were previously writing these to the output list as well, but this all goes through spdlog now so it's unnecessary.
* Remove ReportTableLoadError and associated awkward forward declarations. Since the log is simple now (it just goes through spdlog), this can be logged directly.
* Semi-unrelated but related to the cross-platform changes - m_CurrentNPC was using InterlockedIncrementAdd(). For cross-platform purposes, we change this to use std::atomic<> instead, which removes another Windows dependency.
* Use assert() rather than MSVCRT's _ASSERT
* Rename OnInitDialog() -> OnStart(), move OnDestroyWindow() into destructor directly
---------
Co-authored-by: twostars <i.am.twostars@gmail.com>
Github Commit Görüntüle...
See Commints...
..