Health description each round, like rom?

Posted by Jeryx on Sun 03 Oct 2004 11:05 AM — 8 posts, 28,149 views.

#0
One of the things I enjoyed greatly with ROM was each round of battle, you saw the short health description of your opponent, like X has a few cuts, X is bleeding freely, etc.
My players are also yelling at me to get this done, as they dislike having to manually look at the mob every few rounds to see their progress.
So, my questions are,

1. where in the code is the text for the last round compiled to send out

2. what is the name of that string, that shows wounds

3. How difficult would it be to tack it back in there to display at the end of every round?
Canada #1
You wanna make flush_buffer look like this:
bool flush_buffer( DESCRIPTOR_DATA *d, bool fPrompt )
{
    char buf[MAX_INPUT_LENGTH];
    extern bool mud_down;

    ch = d->original ? d->original : d->character;
    if (ch && ch->fighting && ch->fighting->who)
    	show_condition(ch, ch->fighting->who);

    /*
     * If buffer has more than 4K inside, spit out .5K at a time   -Thoric
     */
    if ( !mud_down && d->outtop > 4096 )
    {
	memcpy( buf, d->outbuf, 512 );
	d->outtop -= 512;
USA #2
Woah. It seems to be that it doesn't belong there at all! Why not put it in violence_update so that it actually goes out with the rounds, and not connect it to flushing the buffer which is really a completely separate concept?
Canada #3
Thats where it is in SWR, thats why I put it there, and I don't have any kind of problem with it, and I've never heard any complaints about from anyone else.
USA #4
It's just wrong, though. It may seem to be correct because the buffer simply *happens* to be flushed at the end of an update cycle, but it simply does not belong in the flushing of the buffer because that is not what flushing the buffer should do. I realize this is somewhat going in circles, but if a low-level function is meant to flush the buffer then it should do just that and not something else - especially something not at all related to network connectivity.
Canada #5
I happen to agree. For coding "philosophy", everything has its own place. I barely found that, I of course first looked in violence_update myself, but didn't see it there, so I grep'ed.

A communication module should do just that, but looking through flush_buffer, it has some other things that seem misplaced, snooping, IMO.

Either way, that is a simple solution for a newbie-ish coder, which was my intent. I would like to like to redo the whole way that the server communicates with the client, but not alot of time, so that seems a little far off at this point.

A more appropriate place may be
                                        }
                                }
                        }
                }
         <----------- Here 
        }
		
        return;
}
at the end of violence update, but I haven't tested it.
USA #6
Yes, I would have put it there in violence_update as well. Or at least somewhere at the end of processing somebody's fight round.

One of the thing that bothers me a lot about the SMAUG code base is precisely how much you find things in places they really don't belong. This is fine for 'ad hoc' solutions but as soon as you start building on the system, the complexity increases dramatically. Add to that the problem of redundancy in SMAUG, and making changes to fundamentals can be a true monster at points.

Snooping is a hard one, though. It probably belongs somewhere down low, I think, but not quite as low as flushing the buffer.
#7
I found a snippet here
http://www.geocities.com/TimesSquare/Labyrinth/2695/smaug/snippets.html
called Autoglance that works quite nicely. I have also updated do_score in player.c to display the new flag along with the other "auto" flags. not too bad for someone who dont know C++ :)