[wesnoth-commits] [wesnoth/wesnoth] af579c: add '/roll N' command to games and game lobbies

Artem Khrapov noreply at github.com
Fri Dec 4 13:18:02 UTC 2020


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: af579c6bf1e2546fb6671db553508dd8b199c65c
      https://github.com/wesnoth/wesnoth/commit/af579c6bf1e2546fb6671db553508dd8b199c65c
  Author: kabachuha <artemkhrapov2001 at yandex.ru>
  Date:   2020-12-04 (Fri, 04 Dec 2020)

  Changed paths:
    M src/chat_command_handler.hpp
    M src/chat_events.cpp
    M src/server/wesnothd/server.cpp
    M src/server/wesnothd/server.hpp

  Log Message:
  -----------
  add '/roll N' command to games and game lobbies

Adds '/roll N' command which gets a random number between 1 and N and prints it as "$username rolled a die [1 - $N] and got $value." to the game creation lobby chat or just to the sender otherwise (so not to flood the main chat).

The roll handler uses a uniform distribution generator, however with an additional mt rng from std library instead of the built-in wesnoth rng as the uniform distribution generator can use only a specially formatted rng engine.


  Commit: f84cfde76fae6d55350bf4a5c0173baceabc75aa
      https://github.com/wesnoth/wesnoth/commit/f84cfde76fae6d55350bf4a5c0173baceabc75aa
  Author: kabachuha <artemkhrapov2001 at yandex.ru>
  Date:   2020-12-04 (Fri, 04 Dec 2020)

  Changed paths:
    M src/server/wesnothd/server.cpp

  Log Message:
  -----------
  remove doubled checks for game membership

If the player is a part of the game, their ptr is valid, so the is_member call is useless.


Compare: https://github.com/wesnoth/wesnoth/compare/3bc5badbf365...f84cfde76fae



More information about the Commits mailing list