[wesnoth-commits] [wesnoth/wesnoth] 1a46be: Use an independent ID for the database's GAME_ID c...

Pentarctagon noreply at github.com
Wed Feb 26 13:38:46 UTC 2020


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 1a46bea02760e8ba3775828a128ecefc6c00f105
      https://github.com/wesnoth/wesnoth/commit/1a46bea02760e8ba3775828a128ecefc6c00f105
  Author: Pentarctagon <pentarctagon at tutamail.com>
  Date:   2020-02-26 (Wed, 26 Feb 2020)

  Changed paths:
    M src/server/game.cpp
    M src/server/game.hpp
    M src/server/server.cpp

  Log Message:
  -----------
  Use an independent ID for the database's GAME_ID column.

Currently, wesnothd uses the game instance's `id_` value when inserting into the game_info, game_player_info, and game_modification_info tables.  However, this value is unique only per game instance, not per scenario.  This then results in problems when handling MP campaigns, which re-use the same game instance for multiple scenarios.  Incrementing the game instance's `id_` was determined to not be suitable since it's used in a boost multi-index, and instead creating a brand new game instance for each scenario in an MP campaign is complex without being especially useful beyond this case.

This commit instead adds a separate `db_id_` value to each game instance, which can be incremented without causing any issues since it's used nowhere else, and is what will be inserted into the database.  This means the `db_id_` is unique per scenario, and therefore resolves the below two issues.

Fixes #4281
Fixes #4341





More information about the Commits mailing list