[Commits] [wesnoth/wesnoth] 75b61e: don't crash when attempting to configure a level w...

GitHub noreply at github.com
Thu Nov 6 01:23:16 UTC 2014


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 75b61e6401379c5d16ed73fa3e6b5b850b85c061
      https://github.com/wesnoth/wesnoth/commit/75b61e6401379c5d16ed73fa3e6b5b850b85c061
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-11-05 (Wed, 05 Nov 2014)

  Changed paths:
    M src/game_initialization/configure_engine.cpp
    M src/game_initialization/multiplayer.cpp

  Log Message:
  -----------
  don't crash when attempting to configure a level with no sides

A similar assertion failure also exists in mp_create I believe.
It's a bit ugly to have to put this in src/game_initialization/
multiplayer.cpp, but probably the best thing if these classes
aren't going to be robust against corner cases like this.


  Commit: 43e3d37a2122ab40fe9df887d971eab80588ff10
      https://github.com/wesnoth/wesnoth/commit/43e3d37a2122ab40fe9df887d971eab80588ff10
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-11-05 (Wed, 05 Nov 2014)

  Changed paths:
    M data/multiplayer/scenarios/Random_Scenario.cfg
    M data/multiplayer/scenarios/Random_Scenario_Desert.cfg
    M data/multiplayer/scenarios/Random_Scenario_Marsh.cfg
    M data/multiplayer/scenarios/Random_Scenario_Winter.cfg
    M data/multiplayer/scenarios/Random_YAMG_Scenario.cfg
    M src/game_initialization/create_engine.cpp
    M src/game_initialization/create_engine.hpp
    M src/tests/gui/test_gui2.cpp

  Log Message:
  -----------
  fix bug #22484 (fix random map generation in mp create)

As described in bug report, mp create had a bizarre implementation
for random map vs scenario generation. Scenario generation was called
map generation, and map generation was impossible. We fix it and make
it work like it works in the rest of the game.

At time of writing the wiki describes map generation wml as follows:

```
To use the default [generator] your [scenario] tag must contain one of
the following keys:

scenario_generation=default
map_generation=default

If ‘scenario_generation’ is used, the engine will expect for your entire
[scenario] sub tags to be inside a [scenario] tag inside [generator].
Tags outside of this will be ignored. There may be value in this, but at
this writing, it’s not clear. ‘map_generation=default’ is simpler and
more commonly used. It is also necessary to use this key so that you can
regenerate a map in MP game creation. In its use only generator data is
in the [generator] tag, all other [scenario] data is placed outside of it.
The exception is if you are making an initial MP scenario available in MP
game creation, for this a [scenario] tag must appear inside of
[generator], containing the [scenario] subtags you want to use.
See “data/multiplayer/scenarios/Random_Scenario.cfg” for an example.
```

This commit essentially removes the "exception" pointed out above.
After this, the mp create dialog treats map and scenario generation
both in the "random maps" classification, and it handles them normally,
scenario generation replacing the entire scenario, and map generation
replacing only the map data of the scenario.


  Commit: e85eb66f5b2488a5f4db3a9dacf93463e84f07e0
      https://github.com/wesnoth/wesnoth/commit/e85eb66f5b2488a5f4db3a9dacf93463e84f07e0
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-11-05 (Wed, 05 Nov 2014)

  Changed paths:
    M data/multiplayer/scenarios/Random_YAMG_Scenario.cfg

  Log Message:
  -----------
  put YAMG as a map generator rather than as a scenario generator

this way is a lot less buggy, the other way seems to cause
mysterious crashes


  Commit: ab821fcfeb0df5eeb45dccff36a17a7e4f26837d
      https://github.com/wesnoth/wesnoth/commit/ab821fcfeb0df5eeb45dccff36a17a7e4f26837d
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-11-05 (Wed, 05 Nov 2014)

  Changed paths:
    M src/generators/map_generator.cpp

  Log Message:
  -----------
  use the "mapgen" log channel rather than engine, for map generators


  Commit: 2da4c9157a0653b2c10a6d28f7a0c1cd452684c5
      https://github.com/wesnoth/wesnoth/commit/2da4c9157a0653b2c10a6d28f7a0c1cd452684c5
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-11-05 (Wed, 05 Nov 2014)

  Changed paths:
    M src/CMakeLists.txt
    M src/SConscript
    A src/generators/lua_map_generator.cpp
    A src/generators/lua_map_generator.hpp
    M src/generators/map_create.cpp
    M src/wesnoth.cpp

  Log Message:
  -----------
  add lua map generator type


  Commit: ce99658dfeadcb22482bf37375baf44256459912
      https://github.com/wesnoth/wesnoth/commit/ce99658dfeadcb22482bf37375baf44256459912
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-11-05 (Wed, 05 Nov 2014)

  Changed paths:
    M src/generators/lua_map_generator.cpp

  Log Message:
  -----------
  add lua libs for lua map generator, also add bindings for mt rng

Tested to work with this test scenario, and the mainline defaults:

     [label]
   x = {X}
   y = {Y}
   text = {STRING}
     [/label]
[multiplayer]
    id=lua_map_gen
    name= _ "Lua Map Gen Test Scenario"
    description= _ "test test test of lua map gen"
    map_generation="lua"
    [generator]
  id="test"
	config_name="Test Lua Map Generator"
	create_map = << local rng = Rng:create()

			print(rng:draw())
			print(rng:draw())
			print(rng:draw())

			local w = 50
    local h = 40

			map=""
			for y=1,h do
			  local r = rng:draw() % 2
			  for x=1,w do
                      if x == 10 and y == 10 then
                        map = map .. " 1 "
  end
                      if x == (w-10) and y == (h-10) then
                        map = map .. " 2 "
  end
			    if ((x + y) % 2) == r then
   map = map .. "Gg"
			    else
   map = map .. "Md"
			    end
                      if x ~= w then
                        map = map .. ","
                      end
                    end
                    map = map .. "\n"
                  end
                  return map
               >>
    [/generator]

    id = foo
    random_start_time=yes

    {DEFAULT_SCHEDULE}
    [event]
  name=prestart
  {LABEL 25 20 ("Lua map generator")}
    [/event]

    [side]
   [ai]
       villages_per_scout=8
   [/ai]
   id=RBY_Side1
   side=1
   save_id=RBY_Side1
   persistent=yes
   color=red
   team_name=Red
   user_team_name= _ "teamname^Red"
   controller=human
   canrecruit=yes
   shroud=no
   fog=no
   gold=1000000
    [/side]
    [side]
   [ai]
       villages_per_scout=8
   [/ai]
   id=RBY_Side2
   side=2
   save_id=RBY_Side2
   persistent=yes
   color=blue
   team_name=Blue
   user_team_name= _ "teamname^Blue"
   controller=human
   canrecruit=yes
   shroud=no
   fog=no
   gold=1000000
    [/side]
[/multiplayer]


  Commit: d8fcd104aea19c8f93ad15c24bef6c99a8b209c1
      https://github.com/wesnoth/wesnoth/commit/d8fcd104aea19c8f93ad15c24bef6c99a8b209c1
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-11-05 (Wed, 05 Nov 2014)

  Changed paths:
    M src/generators/lua_map_generator.cpp
    M src/generators/lua_map_generator.hpp

  Log Message:
  -----------
  add support to create scenarios in lua also


  Commit: a964bd0e886d5ab0b9ba9635c9cd693e26c97b0a
      https://github.com/wesnoth/wesnoth/commit/a964bd0e886d5ab0b9ba9635c9cd693e26c97b0a
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-11-05 (Wed, 05 Nov 2014)

  Changed paths:
    M src/generators/lua_map_generator.cpp
    M src/generators/lua_map_generator.hpp

  Log Message:
  -----------
  pass the [generator] tag as argument to lua map generator functions


  Commit: 6c85b4f4d80988907f9c45982d1abd49cb24a7f5
      https://github.com/wesnoth/wesnoth/commit/6c85b4f4d80988907f9c45982d1abd49cb24a7f5
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-11-05 (Wed, 05 Nov 2014)

  Changed paths:
    M src/generators/lua_map_generator.cpp

  Log Message:
  -----------
  use our loggers in lua map generator, make a better dtor for Rng


  Commit: c785310f05b1f332050e2b50404ea0558681de71
      https://github.com/wesnoth/wesnoth/commit/c785310f05b1f332050e2b50404ea0558681de71
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-11-05 (Wed, 05 Nov 2014)

  Changed paths:
    M src/game_initialization/create_engine.cpp

  Log Message:
  -----------
  create_engine now catches mapgen_exceptions thrown by generators

It puts those messages in the error_message field of the map entry,
so we get nicer gui handling of the problem.


  Commit: fb793a10ceae80e9a0e5ce7909e31ed462bc29b3
      https://github.com/wesnoth/wesnoth/commit/fb793a10ceae80e9a0e5ce7909e31ed462bc29b3
  Author: Chris Beck <beck.ct at gmail.com>
  Date:   2014-11-05 (Wed, 05 Nov 2014)

  Changed paths:
    M data/multiplayer/scenarios/Random_Scenario.cfg
    M data/multiplayer/scenarios/Random_Scenario_Desert.cfg
    M data/multiplayer/scenarios/Random_Scenario_Marsh.cfg
    M data/multiplayer/scenarios/Random_Scenario_Winter.cfg
    M data/multiplayer/scenarios/Random_YAMG_Scenario.cfg
    M src/CMakeLists.txt
    M src/SConscript
    M src/game_initialization/configure_engine.cpp
    M src/game_initialization/create_engine.cpp
    M src/game_initialization/create_engine.hpp
    M src/game_initialization/multiplayer.cpp
    A src/generators/lua_map_generator.cpp
    A src/generators/lua_map_generator.hpp
    M src/generators/map_create.cpp
    M src/generators/map_generator.cpp
    M src/tests/gui/test_gui2.cpp
    M src/wesnoth.cpp

  Log Message:
  -----------
  Merge pull request #324 from cbeck88/lua_map_generator

Lua map generator


Compare: https://github.com/wesnoth/wesnoth/compare/e0c7bc517524...fb793a10ceae


More information about the Commits mailing list