Tangaria icon indicating copy to clipboard operation
Tangaria copied to clipboard

Send_flush() potential problem

Open igroglaz opened this issue 3 years ago • 0 comments

https://github.com/draconisPW/PWMAngband/issues/460

I've fixed it pretty dirty.. not sure about 100% reliability of the fix as you can be REALLY unlucky one day with this feature..

int Send_flush(struct player *p, bool fresh, char delay)
{
    connection_t *connp = get_connp(p, "flush");
    if (connp == NULL) return 0;

    /* Hack -- don't display animations if fire_till_kill is enabled */
    // To ensure that rng won't bring fatal chance we also flush every half-turn
    // Tests: !one_in_8 works with 60 speed & 4.4 shots/turn with Long bow max distance;
    // but we will use !one_in_9 just in case.
    if (p->firing_request && (!one_in_(8) || p->game_turn.turn % 32 == 0))
        delay = 0;

    return Packet_printf(&connp->c, "%b%c%c", (unsigned)PKT_FLUSH, (int)fresh, (int)delay);
}

posting this ticket just in case.. so won't forget to look into it later.

igroglaz avatar Jun 15 '22 16:06 igroglaz