Monthly Archives: May 2007

New String Functions

I’ve written new string functions based on std::string. They’re the typical case insensitive compare, check prefix, compare with list of names, get first argument, get last argument, and other string manipulation functions you’d normally see used with a MUD. The difference is: They’re not very prone to buffer overflows and pointer errors because they’re using […]

Even Higher Warning Levels

When compiling code in MS Visual Studio .Net I always turn warning levels up to 4 (/W4). I’ll end up getting some warnings about things I don’t care about, such as converting an int to true or false when it’s something I did on purpose or not referencing a formal parameter of a function, but […]

Too Many Levels

I’ve played on a handful of MUDs, and just about every one of them has regular player levels from 1 to 50, especially those from the family tree of Basternae. I’ve always thought that was just too many. Although the levels from 1 to 20 have usually been pretty quick and kind of fun, especially […]

Repop Points

Setting up hometown repop points for the various races and classes in Basternae 2 was a real pain. We had, in code, a two-dimensional array that would be referenced to get the room number for each particular race/class combination. Any special cases where someone had a choice or more than one hometown had to be […]

SourceMonitor Update

I just love these statistics tools… Files: 127 Lines: 116,320 Statements: 60,630 % Branches: 29.5 % Comments: 8.5 Class Definitions: 50 Methods/Class: 7.04 Average Statements/Method: 10.8 Max Complexity: 477 Max Depth: 8 Average Depth: 1.87 Average Complexity: 11.71 The number of files, class definitions, and methods per class has increased, while the statements per method […]

XML Files

Traditionally MUDs I’ve seen have used raw text files for player files. Some might use binary, and some might compress them into a gzipped format. There’s a problem with using this sort of file: in general, they are written or read a single line at at time. In Basternae 2 we had a significant problem […]

Project Line Counter Update

I’ve done a lot of writing, rewriting, replacing, and rearranging lately. Here are the current totals: 115,384 lines total 93,783 lines of code 9,859 lines of comments 2,071 mixed (code + comment) lines 13,813 blank lines I guess you could call that a small but not quite negligible increase.

WinMerge

One of my biggest complaints when booting into Linux is that I don’t have access to a merge tool quite as nice as WinMerge. The current version of WinMerge doesn’t run under Wine, but apparently an older version, 2.0.2, will. Some things are optional when writing code, but a good merge tool is not one […]

SourceMonitor

I found a code analysis and metrics program called SourceMonitor today. I downloaded version 2.3.6.1 and fed it the source files for Basternae. Here’s what it came up with: Files: 120 Lines: 114,121 Statements: 59,490 % Branches: 29.2 % Comments: 8.6 Class Definitions: 43 Methods/Class: 4.41 Average Statements/Method: 14.2 Max Complexity: 477 Max Depth: 8 […]

Astyle Rocks!

I’m EXTREMELY picky about the formatting of my code. There are a few commonly-known formats for code: ANSI, Kerninghan & Ritchie, GNU, Linux, and Java. I have a a very strong preference for ANSI style, but with one minor modification: I like my switch statement case labels to be indented. That’s not a strong preference, […]

The Road To C++

I’ve gradually been changing more pieces of code from C to C++. As each piece goes from being a random function dangling somewhere to a piece of a coherent class the code begins to make a little more sense. So many bits and pieces are going to benefit from being private data members.┬áIn a lot […]

Goodbye Shared Strings

Shared string management has been completely removed from the code. Gone. Done for. The result: greater stability at the cost of higher memory requirements and a slight reduction in processor power requirements (which aren’t even a concern). The removal automagically fixed a few bugs due to the less-than-perfect shared string management. Next task: Getting Thendar’s […]

Code Reformatting

One thing I’ve always found annoying is the way that different applications and operating systems handle tabs. In some programs a tab will move you over 4 spaces. Other apps will have different sizes, like 5 or 6 spaces. This can cause things that line up in one app to look totally out of whack […]

Lines and Lines of Code

One of my favorite free little toys for Microsoft Visual Studio is the Project Line Counter (http://www.codeproject.com/macro/linecount.asp). A count of the current Basternae codebase shows: 110,815 lines total 89,446 lines of code 9,880 lines of comments 2,003 mixed (code + comment) lines 13,492 blank lines Progress continues on changing to std::string, constructors and destructors, and […]

Hammering and Tinkering

I’ve been ripping and tearing a bit more and there have been quite a few internal changes: Much of the use of char * has been replaced with std::string, which is a bit more powerful and somewhat safer. Almost all of the shared string routines are no longer being used and the shared string manager […]

And It Begins

I’ve been working with the old Magma 3.0 codebase for almost a week now. Things I’ve done so far: Removed all of the old outdated OS-specific code (Sequent, Apollo, Amiga). Removed all instances of sprintf (a very dangerous function prone to buffer overflows). These have been replaced with snprintf, which is safer. Over 1000 functions […]