Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor ConsoleSystem cleanup #40

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Minor ConsoleSystem cleanup #40

wants to merge 7 commits into from

Conversation

richardnlarge
Copy link

Here's a handful of trivial console-related updates.

Since the server's printing doesn't clear to EOL, pre-existing text in a console window gets smeared behind server output. This is only noticable when starting the server from an already-open command line window.
The window should probably not be resized unless the user explicitly requests to do so. Mainly only matters if starting the server from an already-open command line window.
The old warning message logged upon parsing window size command arguments was misleading. "Capping" implies enforcement of a maximum size but the code implemented a minimum size. Regardless of the original code's intent, for better or for worse, the window size is the users' business. Should they wish to have funky window sizes, so be it.

Additionally, threw in try-catch blocks to gracefully handle resize exceptions.
The console favored scrolling down instead of moving the prompt from the second-to-last line to the last line, which resulted in a wasted blank line at the bottom of the console.

Additionally, BlankDrawnCommandLine calls were always followed up with a SetCursorPosition to move the cursor to the beginning of the line. Slightly simplified this process by moving the column reset into BlankDrawnCommandLine.
Clear the current command line upon pressing Escape.
Internal PacketWriter.WritePosition()'s duties are fulfilled by one of the public PacketWriter.Write() overloads.
Both a container that holds all objects and a container that holds zone/object relationships aren't really needed. These have been folded into a single container for only zone/object pairings, which can be queried with LINQ to fulfill the same intent as before. The container has been changed from a Dictionary to a List under the assumption that any one zone will not have duplicate object IDs, as supported by the SQL scripts in the Resources submodule.
Additionally, removed function-local list copies that the functions returned in favor of LINQ statements.

Added a warning for when the filesystem fallback has no directory for the requested zone.

Updated NPC caching to prevent the database from being queried when a zone's NPCs have already been loaded.

Implemented getObjectByID(string, uint) and updated getObjectByID(uint). The function now warns when either the requested object is not found or there are multiple matching objects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant