Plodding

I’m steadily picking away at strtSpawn.cpp – one of the largest strat host modules.

I’ve almost completely severed the … fascinating … set of reciprocal queries that were going on between the map and strat host trying to decide when a player was despawned. This may have the sweet side-effect of curing the old “waiting for mission results” bug.

One of the things that I decided to do is switch from pointer (PostedWeapon*) to reference (PostedWeapon&) passing in the functions I have to work on. The amount of code this has wound up eliminating took me by surprise…

It turns out that lots of strat functions have return values solely incase you pass them a null pointer, in which case they complain and return FALSE.

Using a reference eliminates 3-6 lines of code from these functions. It also reveals that a lot of functions were doing complex marshalling, that complex subroutines existed solely, against the theoretical possibility a subroutine might fail. I’ve commented out nearly 700 lines of code that existed purely for teh purpose of dealing with the theoretical possibility. I say theoretically because in every case so far the code flow has been pretty much:

Pointer* p = Lookup(id) ;
if ( p == NULL )
  return false ;
if ( function(p) == false )
{
  /* report */
  return false ;
}
...
bool function(Pointer* p)
{
  if ( p == NULL )
  {
    /* report */
    return false ;
  }
  ...
  return true ;
}

Which tends to boil down succinctly to

Pointer* p = Lookup(id) ;
if ( p == NULL )
  return false ;
function(p) ;
 
...
bool function(Pointer& p)
{
  ...
}

At the moment, the code is non-functional. I’ve got to wrap up reconnecting the resupply system, the absence of which currently prevents me from building the host. But I’m hoping I can plow through it and get it running for Monday.

That does not mean TOEs on Monday, it means Monday I get to find how horribly all of my changes crash. If I get this stage finished by Monday, it should be Wednesday before I get it “running”. Then I have to start making sure it works according to spec.

Of course; that’s assuming that the crash problem of the first two iterations isn’t waiting for me – with nasty, sharp, pointy teeth.

4 Comments

Man oh man. Flashbacks to refereeing coder fights.

…@/

coder fights? is that a lot like cripple fights?

No it’s more like bum fights.

They can be killed…

Leave a Reply

Name and email address are required. Your email address will not be published.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

You may use these HTML tags and attributes:

<a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <pre> <q cite=""> <s> <strike> <strong> 

%d bloggers like this: