It does, however highlight a possible problem in stock code, which should be addressed before this patch is done.
It is in act.offensive.c in the ACMD(do_flee) function, where it selects a direction to flee in. If you add more directions, then there is less likelihood of successfully fleeing. To keep the odds of success the same, you should keep the ratio of attempts:directions the same, and this was 1:1 before the patch. Therefore, the attempts to find a direction should probably match NUM_OF_DIRS:
Code:
send_to_char(ch, "You are in pretty bad shape, unable to flee!\r\n");
return;
}
- for (i = 0; i < 6; i++) {
+ for (i = 0; i < NUM_OF_DIRS; i++) { /* Make as many attempts as there are directions */
attempt = rand_number(0, NUM_OF_DIRS - 1); /* Select a random direction */
if (CAN_GO(ch, attempt) &&
!ROOM_FLAGGED(EXIT(ch, attempt)->to_room, ROOM_DEATH)) {
Comments
Nice patch, thanks
Nice patch, thanks sedition.
It does, however highlight a possible problem in stock code, which should be addressed before this patch is done.
It is in act.offensive.c in the ACMD(do_flee) function, where it selects a direction to flee in. If you add more directions, then there is less likelihood of successfully fleeing. To keep the odds of success the same, you should keep the ratio of attempts:directions the same, and this was 1:1 before the patch. Therefore, the attempts to find a direction should probably match NUM_OF_DIRS:
Code:
return;
}
- for (i = 0; i < 6; i++) {
+ for (i = 0; i < NUM_OF_DIRS; i++) { /* Make as many attempts as there are directions */
attempt = rand_number(0, NUM_OF_DIRS - 1); /* Select a random direction */
if (CAN_GO(ch, attempt) &&
!ROOM_FLAGGED(EXIT(ch, attempt)->to_room, ROOM_DEATH)) {