Skip to content

Send_flush() potential problem #116

Description

@igroglaz

draconisPW#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions