First of all, isn't this kinda like saying "I shot my foot off so I want
to make a gun that won't hurt me if I shoot it?" Anyways, I'm not here to
judge morality or intelligence, but to help.
The problem here is that the player is a command that, as the command is
executed, it adds to ch->wait. Before ch->wait expires, they send several
more commands. So their ch->desc->inbuf is filling up with commands. The
game_loop_* function is responsible for pulling the commands out of the
player's inbuf, but only when ch->wait has expired. So if they spam the
same command, then each command will add to ch->wait, the game will wait
until ch->wait expires, process the next command which adds to ch->wait,
etc...
There are several solutions -
1. Tell your players "Tough luck. You shoot yourself in the foot, you
deal with it." This will probably decrease your player count. :-)
2. Remove ch->wait. Who want to wait, anyways? (Just kidding - this
would seriously imbalance the game!)
3. Add a hack to game_loop_* to check through ch->descriptor->inbuf for
the "clear" command, and if it's found, clear the inbuf. This is a genuine
hack, and as such can greatly add to the complexity of the code.
4. Implement a command queue system. Every time the player sends a
command, add it to the queue. Then, each time through game_loop_*, look
through the command queue, and if there are any commands that don't rely on
ch->wait, execute them. Also, get the next command and check to see if it
requires ch->wait. (Or possibly ch->wait[WAIT_FIGHTING] and
ch->wait[WAIT_GLOBAL_COMMINUCATION], etc...) If ch->wait has expired,
perform it, otherwise, don't perform any player commands.
A word of warning - this kind of clear command can greatly unbalance the
game - for example, what happens then the player sets a client based alias
to "kick scout" and "clear" and "kick scout" and "clear", etc.? (Hint,
do_kick will deal damage, do_clear clears ch->wait and the inbuf, do_kick
will deal damage, etc.. all in the space of time it takes the game engine to
loop, effectively giving the player the power to deal major damage above and
beyond their normal capability.)
The functions that control this are all stored in comm.c: game_loop_*
and read_from_buffer(). d->inbuf[] contains all text the player types.
d->incomm[] contains the current command moved out of d->inbuf[].
Questions? Comments?
Tony
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, January 21, 2003 11:33 AM
Subject: question on ch->wait
> A few of players would like to a command to clear everything they typed
> previously, an example:
> kick scout
> kick scout
> kick scout
> kick scout
> kick scout
>
> Whoops 3 more scouts walked in, I wanna run now! But that is impossible
> because I will be kicking the first scout for the next minute or so. So I
> wanted to create a command called 'clear' or something that would delete
> everything that they previously typed in. I was looking at the code and I
> have no idea where the commands are stored, or how it determines if the
> character is in a wait state or not. Can anyone point me in the right
> direction? I would search the archives but they aren't working right now.
> THANKS
>
> --
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>