[Commits] [wesnoth/wesnoth] 0f9ad0: put simple_rng methods in own file.

GitHub noreply at github.com
Wed Apr 2 22:38:46 UTC 2014


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 0f9ad019c6a070d6ed98e10c5876893cd7493efd
      https://github.com/wesnoth/wesnoth/commit/0f9ad019c6a070d6ed98e10c5876893cd7493efd
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-03-31 (Mon, 31 Mar 2014)

  Changed paths:
    M src/CMakeLists.txt
    M src/SConscript
    M src/random.cpp
    A src/simple_rng.cpp

  Log Message:
  -----------
  put simple_rng methods in own file.


  Commit: bf4935da84c45d5138018f49887256ca5f84f0a8
      https://github.com/wesnoth/wesnoth/commit/bf4935da84c45d5138018f49887256ca5f84f0a8
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-01 (Tue, 01 Apr 2014)

  Changed paths:
    M src/CMakeLists.txt
    M src/SConscript
    A src/random_new.cpp
    A src/random_new.hpp
    A src/random_new_deterministic.cpp
    A src/random_new_deterministic.hpp
    A src/random_new_synced.cpp
    A src/random_new_synced.hpp

  Log Message:
  -----------
  add new rng

the plan is to have random_new::generator which can be a rng_synced or not dependng on whether we are in a synced context (for example select events are no synced context)

this commit is part of pr 121.


  Commit: ea7521af2bee6889fac46f30e944c0f8863c12ff
      https://github.com/wesnoth/wesnoth/commit/ea7521af2bee6889fac46f30e944c0f8863c12ff
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-01 (Tue, 01 Apr 2014)

  Changed paths:
    M src/SConscript
    A src/replay_helper.cpp
    A src/replay_helper.hpp

  Log Message:
  -----------
  add replay_helper class

the main intention was to make the file replay.cpp smaller during writing pr 121.
also in order to use synced_context::run_in_synced_context this is useful.
(replay_helper.cpp was already accidently moved into makelist.txt in a pevious commit (add new rng))


  Commit: fef7c49e83495a9142bcf002c887d400f472e19d
      https://github.com/wesnoth/wesnoth/commit/fef7c49e83495a9142bcf002c887d400f472e19d
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-01 (Tue, 01 Apr 2014)

  Changed paths:
    M src/CMakeLists.txt
    M src/SConscript
    A src/config_assign.cpp
    A src/config_assign.hpp

  Log Message:
  -----------
  add config_of function

in the file config_assign.cpp/hpp, it can be use similar to boost's boost::assign for config object.
I don't use it that much, but i found it useful especialy to pass or return a config that just contains one or two childs.


  Commit: 8f00786fb6509956a3a5f6eddeeebb0f4ee58743
      https://github.com/wesnoth/wesnoth/commit/8f00786fb6509956a3a5f6eddeeebb0f4ee58743
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-01 (Tue, 01 Apr 2014)

  Changed paths:
    M src/replay.cpp
    M src/replay.hpp

  Log Message:
  -----------
  add functions in replay

these will be used in synced_context.cpp.

this commit is part of pr 121.


  Commit: fc8c15e46a9aa9326fa96e53efa74a6cb7deb9e4
      https://github.com/wesnoth/wesnoth/commit/fc8c15e46a9aa9326fa96e53efa74a6cb7deb9e4
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/CMakeLists.txt
    M src/SConscript
    A src/synced_checkup.cpp
    A src/synced_checkup.hpp
    A src/synced_commands.cpp
    A src/synced_commands.hpp
    A src/synced_context.cpp
    A src/synced_context.hpp

  Log Message:
  -----------
  add synced_context class

the intention  is to fix #20871 and implement #21697, to sync
prestart/start events, and to implement
http://forums.wesnoth.org/viewtopic.php?f=6&t=39611 in the next patches,

the intention of synced_checkup is to replace random .. set/get_random_results.
Because set/get_random_results didn't have much to do with random, since it was only used to compare unit checksums and attacker damage to replays.

the intention of synced_commands is to move code out of do_replay_handle and make it callable from other places too so that we can just call the same function taht was called from replay in the simple cases (with synced_context::run_in_synced_command).

the object set_scontext_synced can be used to enter the synced context which enables synced_checkup and make the random calls synced.
Or we can use run_in_synced_context which is normaly easier than set_scontext_synced.
we can check wether we are in a synced context with get_syced_state to make addidional checks to detect oos (the other intention of that is to implement #21697 ).

this commit is part of pf 121.


  Commit: 25d4f2bca4d99171e75fb0198c7d05f6a78a42d8
      https://github.com/wesnoth/wesnoth/commit/25d4f2bca4d99171e75fb0198c7d05f6a78a42d8
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/playturn.cpp

  Log Message:
  -----------
  give a better error message.

when a player leaves a mp game during a lua call and the other player
pressed escape, lua catches the error that should exit the game, idk
wether i can fix that but at least i can give a better error message.


  Commit: dbf3331e9a99e75ca0c16009169eebeddb9c1db1
      https://github.com/wesnoth/wesnoth/commit/dbf3331e9a99e75ca0c16009169eebeddb9c1db1
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/multiplayer_connect_engine.cpp

  Log Message:
  -----------
  use rand() instead of get_random() for side shuffle

1) i think it's better to use a simple rand function for things that are
never synced, because everyone knows that rand() isn't synced.
2) my plan is to delete the get_random() function.


  Commit: 3ba075a0084b39e1186e1fb9304aa5f4e3e99c39
      https://github.com/wesnoth/wesnoth/commit/3ba075a0084b39e1186e1fb9304aa5f4e3e99c39
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/replay_controller.cpp

  Log Message:
  -----------
  fixes wrong side during end turn events in replay

this didn't matter before because turn end event weren't synced before.

this commit is part or pr 121


  Commit: e5428b9c0f0ef9be9fabd10142abb28cf96d9a51
      https://github.com/wesnoth/wesnoth/commit/e5428b9c0f0ef9be9fabd10142abb28cf96d9a51
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/play_controller.cpp

  Log Message:
  -----------
  fix a bug when players leave in mp.

as pointed out by EliDupree:
http://www.wesnoth.org/irclogs/2014/03/%23wesnoth-dev.2014-03-19.log

init_side_done_ should be false if we wait for a init_side and true otherwise.
This fixes a bug that init side would happen twice when a player leaves durign a side turn event that uses mp_sync

this commit is part of pr 121


  Commit: 70d68e20f771b1ef064e6174afa57adbd26b1b35
      https://github.com/wesnoth/wesnoth/commit/70d68e20f771b1ef064e6174afa57adbd26b1b35
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

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

  Log Message:
  -----------
  serverside code for the new rng.

I decided to implement the check for require_random in the client instead of the server to fix a possible OOS:
to reproduce (assume a server check like "user->first == owner_"  for require_random in the servercode):

[event]
name = "turn end"
[set_variable]
name=v1
rand= "1..8"
[/set_variable]
[/event]
[event]
name = "moveto"
[message]
side_for=2
message="adfsd"
[/message]
[set_variable]
name=v2
rand= "1..8"
[/set_variable]
[/event]

Do the following: (in a 2p scenario, with no hidden sides):
1) move side 1 leader
2) ignore the message on side 2
3) click end turn on side 1
4) then click on the message on side 2.
5) ->>OOS.

the reason is, the when the rand for v2 is executed on side 1 the
current_side on the  server is side 1 and when rand for v2 is executed
on side 2 the serversided current_side is side 2 => the server accepted
both require_random

this commit is part of pr 121.


  Commit: 75d81ee49cb6fa7657c2ab56390620112ff76253
      https://github.com/wesnoth/wesnoth/commit/75d81ee49cb6fa7657c2ab56390620112ff76253
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/actions/attack.cpp
    M src/game_events/action_wml.cpp
    M src/race.cpp
    M src/race.hpp
    M src/unit.cpp
    M src/unit.hpp

  Log Message:
  -----------
  use new synced_context: use new rng

the plan is, that random_new::generator will be a object that does synced random calls during a synced context and otherwise not,
so that we cannot create OOS anymore by using random in unsynced actions like select event

the intention is also to unfy random calls for attacks and random calls and for other actions like traits and [set_variable] rand= .

the synced random generator will be set with the set_scontext_synced object.

the new rng will be similar to the old rng used for attacks becasue it will ask the server for a new seed for every new user action (=recruit, attack...) that requires random numbers.

Previously there were 2 different random generators, one for attacks, and one for other things, pr 121 is supposed to fix the problems with the "sending data over teh network first" an we try to throw the old rng for non attack things out. So that attacks and other tings use the same rng.

We use a new random generator which is automaticly synced during the execution of scned_context::run_in_scned_context, and otherwise not. So we cannot cause oos anymore by using rand= from an unsnced command like "select"
Alternativeley we can also set the new random synced by using the new RAII object set_sconext_sycned, this happens for example during prestart events.
Unlike the old random generator, the new random generator is not determinstic by default because it asks the server (or itself in a SP game) for a new seed, at every side command (attack, move, recruit ...) that requires random, similar to how the previous rand for attacks worked (it doesn't ask at the beginning, just the first time it is needed unlinke how attacks worked before). That way i can also use the same rng for attacks and for other random choices.

I also plan to move the code from set/get_random_results to syncec_checkup.cpp later.

this commit is part of pr 121.


  Commit: da4cdef146bf5a1b8026f12d6b1caa6c1cd20602
      https://github.com/wesnoth/wesnoth/commit/da4cdef146bf5a1b8026f12d6b1caa6c1cd20602
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/playmp_controller.cpp
    M src/playturn.cpp
    M src/replay.cpp

  Log Message:
  -----------
  use synced_context: fix mp observers

with the new synced_context system, the old code would bring code in the wrong order onto the replay if we received data during get_user_choice
which now could be called during turn_info::handle_turn.

also previous code would fail to process
[turn]
[command]
[move]
x = 3,4,5
y = 4,3,3
[/move]
[/command]
[/turn]
[turn]
[command]
dependent = yes
[input]
[/input]
[/command]
[/turn]
because [input] would be processed after [move] was processed, but
[move] need [input] on the replay to work properly.
(if luas sync_choice was called from a moveto event)

this commit is part or pr 121.


  Commit: 1f794e03d850fed177a44b71b41c4c8c4d47a10a
      https://github.com/wesnoth/wesnoth/commit/1f794e03d850fed177a44b71b41c4c8c4d47a10a
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/game_events/action_wml.cpp
    M src/persist_var.cpp
    M src/replay.cpp
    M src/replay.hpp

  Log Message:
  -----------
  use synced_context: change get_user_input

previously and afterwards there can be 2 ways an action(attack, rectuit, move...) can be executed, the first way is that the action runs on the local client, and the action is sended over the network as soon as it is completed, this happends in recruits, moves, recall, and some more. The second way is that the action is sended over the network first and is then executed on all cielents simultaniously, this happends in attack events, and similar happends in prestart/start events. This is also why mp_sync didn work in this actions before: side 2 noticed that it needs data from side 1 but side 1 did send the execeution of the action before it generated the user_input data. That's why side 2 doesnt have the user input data at this point. Previously there was one special and very bugged case when the code waited for remote input before calling get_user_choice: [get_global_variable].

This commit moves (and fixes) the "waiting" from persist_var.cpp into get_user_choice so that the caller of get_user_choice don't have to worry about it. With this we can also use get_user_choice if we already sended data over the network. And we can enable the mp_sync in attack related events and prestart events. The intention of this commit is to fix fix http://gna.org/bugs/?20871.

the plan is to sync start and prestart events, so we don't need to check for that anymore,
we also don't need to pass the rng because we can use call random_new::generator->..

this commit is part of pr 121


  Commit: 7d3a42c7fa231c12b6b251045b01133586edddec
      https://github.com/wesnoth/wesnoth/commit/7d3a42c7fa231c12b6b251045b01133586edddec
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/play_controller.cpp
    M src/play_controller.hpp
    M src/playsingle_controller.cpp
    M src/playsingle_controller.hpp
    M src/replay_controller.cpp

  Log Message:
  -----------
  use synced context: sync the turn ... events and prestart events.

by using set_scontext_synced and recording brefore doing that.

we split fire_prestart and fire_preload becasue prestart runs in a synced context and fire preload not.

we also dont need recorder.pre_replay anymore becasue of the changes to the rng.

the line synced_context::run_in_synced_context("auto_shroud", replay_helper::get_auto_shroud(true));
was accidently placed in this commit and should rather be in the commit called "use synced_context in undo and rest"
this commit is part of pr 121.


  Commit: 821dbd1cb85ce46c88715496a18766424824a6c3
      https://github.com/wesnoth/wesnoth/commit/821dbd1cb85ce46c88715496a18766424824a6c3
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/actions/attack.cpp
    M src/ai/actions.cpp
    M src/dialogs.cpp
    M src/mouse_events.cpp
    M src/playmp_controller.cpp
    M src/playturn.cpp
    M src/random.cpp
    M src/replay.cpp
    M src/replay.hpp
    M src/rng.hpp
    M src/whiteboard/manager.cpp

  Log Message:
  -----------
  use synced_context

these commit uses the synced_context in replays in and in attacks.
we also don't need to use expected_advanaments anymore, because advancements now run through get_user_choice.
Which was not posible before, because get_user_choice didn't work during attacks.

the main intention of these commits is to fix gna.org/bugs/?20871, gna.org/bugs/?21697, some OOS erros related to use of multiple
[get_global_variable] with different sides in one event.
To remove the deterministic random for traits and similar as discusssed
here http://forums.wesnoth.org/viewtopic.php?f=6&t=39611. And to sync
start end prestart events.

the file synced_commands.cpp is mosty code moved from replay.cpp with the main intention to make do_replay.cpp smaller. But also to be able to call run_in_synced_context from non replay if posible,
so that we can just use the same function syned_context::run_in_scned_context that we call during replays, but in most cases this won't be possible.

the file synced_checkup.cpp was written to replace get/set_random_results from rnadom.cpp which was used to check wether unit checksums and attacks results match the ones in the replay. And wasn't realy related to random.

We also use the new random generator which is automaticly synced during
the execution of scned_context::run_in_scned_context, and otherwise not.
So we cannot cause oos anymore by using rand= from an unsnced command
like "select"
Alternativeley we can also set the new random synced by using the new
RAII object set_sconext_sycned, this happens for example during prestart
events.
Unlike the old random generator, the new random generator is not
determinstic by default because it asks the server (or itself in a SP
game) for a new seed, at every side command (attack, move, recruit ...)
that requires random ,similar to how the previous rand for attacks
worked (it doesnt ask at the beginning, just the first time it is needed
unlinke how attacks worked before). That way we can also unify the rng
for attacks and for other random choices.

this commit breaks ai's advancement aspects, i'll bring it back in a later commit.

this commit is part of pr 121.


  Commit: d0ded837af1a6e159cb3a40fbb9106aa50813c91
      https://github.com/wesnoth/wesnoth/commit/d0ded837af1a6e159cb3a40fbb9106aa50813c91
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/actions/move.cpp
    M src/actions/move.hpp
    M src/ai/actions.cpp
    M src/menu_events.cpp
    M src/mouse_events.cpp
    M src/replay.cpp
    M src/replay.hpp
    M src/replay_helper.cpp
    M src/replay_helper.hpp
    M src/synced_commands.cpp

  Log Message:
  -----------
  use synced_context in moves

In order to get the same move results that we got during the game in replay, we now save continue_move/skip_sighed in the replay.
We also call move_unit now with replay_dest = NULL, is_replay = false during replay.
So during replays we now execute the same code, that we execute during the normal game. That also means that, the variable replay_ in move.cpp is now always false. which means there is some unused code now in move.cpp
i still hesitate to remove this code because it somehow seems to be too easy to do it like this, but i have found no bugs.
i suppose, that is_replay_ if a leftover from a time when visibility wasn't calculated normally during replays.
in a later commit i also put skip_ally_sighted in the replay data.

I don't use run_in_synced_context for moves because some methods use the returnvalue of move_unit. Instead i splitted move_unit into move_unit_and_recod and move_unit_from_replay, because using 'if' isn't possible for set_scontext_synced. And i don't want to record a move if nothing happend. Also i think a very small code duplicate for one 'if' less is a very fair trade.

this commit is part of pr 121.


  Commit: 1465f0c664cd7b3fc9884b1b7c1044be999df7b7
      https://github.com/wesnoth/wesnoth/commit/1465f0c664cd7b3fc9884b1b7c1044be999df7b7
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/actions/create.cpp
    M src/actions/create.hpp
    M src/ai/actions.cpp
    M src/menu_events.cpp
    M src/replay.cpp
    M src/replay.hpp
    M src/synced_commands.cpp
    M src/whiteboard/recall.cpp

  Log Message:
  -----------
  use synced_context in recruits/recalls

we use ignore_error_function to get the same behavior as before. that means we allow to pass an invalid recall and just nothing happens in this case. We also don't put anything on the recorder, because run_in_sycned_context removes it from the recorder if we weren't successful, as intended.


  Commit: bce9467f3012a7e94660ddab47e3bebb56d51ccb
      https://github.com/wesnoth/wesnoth/commit/bce9467f3012a7e94660ddab47e3bebb56d51ccb
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/replay.cpp
    M src/replay.hpp

  Log Message:
  -----------
  add third argument to recorder.user_input

the third argument is from_side which is part of a contruct to prevent cheating in mp.


  Commit: 2b56c85dfba960810225af47ebe30d6ba246de00
      https://github.com/wesnoth/wesnoth/commit/2b56c85dfba960810225af47ebe30d6ba246de00
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/replay.cpp

  Log Message:
  -----------
  remove unused replay.cpp::type_by_index


  Commit: 59a78cadf54231dfce67fea63395b9c2aa20a497
      https://github.com/wesnoth/wesnoth/commit/59a78cadf54231dfce67fea63395b9c2aa20a497
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/actions/undo.cpp
    M src/actions/undo.hpp
    M src/ai/actions.cpp
    M src/dialogs.cpp
    M src/game_events/menu_item.cpp
    M src/menu_events.cpp
    M src/replay.cpp
    M src/replay.hpp

  Log Message:
  -----------
  use synced_context in undo and rest

in undos we have to do it differently in different actions becasue in moves we just show the move (ro save performance i guess) but in other actions (recall/recruit) we also fire the events again.

"Rest" means: lua_ai, disband, fire_event (right click menus), update_shroud manualy.

this commit is part of pr 121.


  Commit: 116afcda09dafe54b3744ee7dd6567580c3fe36a
      https://github.com/wesnoth/wesnoth/commit/116afcda09dafe54b3744ee7dd6567580c3fe36a
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/synced_context.cpp

  Log Message:
  -----------
  add from_side check for require_random

"from_side" is an attribute whose only purpose is to enable a check by
the server that a package is really sended by the side given in
"from_side", if thats not the case, the server sets an attribute
"side_invalid". The main purpose of this contruct is to disallow
cheating in mp.


  Commit: 19cf6f5cd3f8dcd0913c6a3a755d2d8249218e88
      https://github.com/wesnoth/wesnoth/commit/19cf6f5cd3f8dcd0913c6a3a755d2d8249218e88
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/scripting/lua.cpp

  Log Message:
  -----------
  adding wesnoth.is_synced() #21697


  Commit: 632ef2d68143759e5bf2c7653f346acc7f9f3ef2
      https://github.com/wesnoth/wesnoth/commit/632ef2d68143759e5bf2c7653f346acc7f9f3ef2
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/actions/create.cpp
    M src/editor/editor_controller.cpp
    M src/editor/editor_controller.hpp
    M src/game.cpp
    M src/gamestatus.cpp
    M src/gamestatus.hpp
    M src/generators/yamg/yamg_params.cpp
    M src/mouse_events.cpp
    M src/multiplayer.cpp
    M src/race.cpp
    M src/random.cpp
    M src/random.hpp
    M src/replay.cpp
    M src/replay.hpp
    R src/rng.hpp
    M src/tests/test_unit_map.cpp

  Log Message:
  -----------
  removed unused rng code.

i also replaced set_random_results/get_random_results with
synced_checkup in recruit_checksums in create.cpp.

i don't see a reason why we shouldn't use the checkup when calling
place_recruit from wml, since the wml is called on all clients. Just
like a normal recruit. (if we are in an unsynced context then checkup
doesnt have any effect anyway.)


  Commit: db9c46ce70f7698186a473500267920ed1a587c9
      https://github.com/wesnoth/wesnoth/commit/db9c46ce70f7698186a473500267920ed1a587c9
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/replay.cpp
    M src/replay_controller.cpp

  Log Message:
  -----------
  stop replay when we have reached the end.

the old code used to execute one last [end_turn] after the end of the
replay was reached, This doesn't work because the wml might require
[message][option] or similar during "turn end" events and we don't have
the data for that.


  Commit: d511933dedc6fe801a6f0d5cf6e5831181858f85
      https://github.com/wesnoth/wesnoth/commit/d511933dedc6fe801a6f0d5cf6e5831181858f85
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/actions/attack.cpp
    M src/actions/attack.hpp
    M src/ai/actions.cpp
    M src/synced_commands.cpp

  Log Message:
  -----------
  bring back unit_advancements_aspect

by moving code from synced_commands.cpp to actions/attack.cpp so that it
can be directly called from ai/actions.cpp


  Commit: bd837f4d3464076d77bfc13fc36168630e4f6cea
      https://github.com/wesnoth/wesnoth/commit/bd837f4d3464076d77bfc13fc36168630e4f6cea
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/mouse_events.cpp
    M src/mouse_events.hpp

  Log Message:
  -----------
  removed unused code


  Commit: e7aae5a00f100fffa17819e983948affac3a3098
      https://github.com/wesnoth/wesnoth/commit/e7aae5a00f100fffa17819e983948affac3a3098
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/actions/move.cpp

  Log Message:
  -----------
  added a check for unit's destination in moves


  Commit: 8a539e0b5d100a4533857370e11bd70fed1c3ea3
      https://github.com/wesnoth/wesnoth/commit/8a539e0b5d100a4533857370e11bd70fed1c3ea3
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/replay.cpp

  Log Message:
  -----------
  correct the value of pos_ in replays.


  Commit: 838446c1ef0384f2da88c969115d48f01c5ecc3a
      https://github.com/wesnoth/wesnoth/commit/838446c1ef0384f2da88c969115d48f01c5ecc3a
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

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

  Log Message:
  -----------
  rearrange comments and debuglogs


  Commit: 0b60e2ca4504bd8f26e09d3deec7a19207d7bcd6
      https://github.com/wesnoth/wesnoth/commit/0b60e2ca4504bd8f26e09d3deec7a19207d7bcd6
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/actions/move.cpp
    M src/actions/move.hpp
    M src/replay_helper.cpp
    M src/replay_helper.hpp
    M src/synced_commands.cpp

  Log Message:
  -----------
  add skip_ally_sighted to replay

because this can affect the result of a move, we need this data in the
replay.


  Commit: 32a0583c1a766714b06973319cf6a51388742d1a
      https://github.com/wesnoth/wesnoth/commit/32a0583c1a766714b06973319cf6a51388742d1a
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/replay.hpp

  Log Message:
  -----------
  add comment in replay.hpp


  Commit: 33d61fadff46103aef2dfac7a9da130cef7ca92a
      https://github.com/wesnoth/wesnoth/commit/33d61fadff46103aef2dfac7a9da130cef7ca92a
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/replay.cpp
    M src/replay.hpp

  Log Message:
  -----------
  removed unused code


  Commit: 3b86c955616c6b4b0fd9ca6807413924ad40c907
      https://github.com/wesnoth/wesnoth/commit/3b86c955616c6b4b0fd9ca6807413924ad40c907
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/replay.cpp
    M src/replay.hpp
    M src/scripting/lua.cpp

  Log Message:
  -----------
  a third argument for lua wesnoth.synchronize_choice

luas sync_choice now takes a third parameter which is a array of number
that determines on which sides the function will be evaluated, if you
use this parameter you'll also get a table back, the passed function
will then be executed on all passed sides simulaniously (you don't have
to wait for the other side before you can make your input) example:
[code]
[event]
name = "start"
[lua]
code = <<

local result = wesnoth.synchronize_choice(
function()
local option1 = T.option { message = "No", T.command { T.set_variable {
name = "input1", value = "No"}}}
local option2 = T.option { message = "Yes", T.command { T.set_variable {
name = "input1", value = "Yes"}}}

wesnoth.fire(T.message{ message =  "Are you sure you want to play this
game?", option1, option2})
return { value = wesnoth.get_variable("input1") }
end,
function()
return { value = math.random(30) }
end, {1,2})

wesnoth.message("Player 1 wants to play: " .. result[1].value)
wesnoth.message("Player 2 wants to play: " .. result[2].value)

>>
[/lua]
[/event]
[/code]
note, that wesnoth is still a turn based strategy game and it's most
likeley a bad idea to require user input from sides when it's not their
turn because they might be afk.
so it might be better to use it during [start] events

we replace lua_settop by lua_pushvalue because we want to be able to
call the function multiple times in case one controller controlls more
than one of the passed sides.


  Commit: 1fc539ecbf2717bc325dfa16f87e6e0b6eb48e1c
      https://github.com/wesnoth/wesnoth/commit/1fc539ecbf2717bc325dfa16f87e6e0b6eb48e1c
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/replay.cpp

  Log Message:
  -----------
  removed unused replay_source_manager


  Commit: 56a4630db1a5f2e729256edf7cf2c109c8e7a29a
      https://github.com/wesnoth/wesnoth/commit/56a4630db1a5f2e729256edf7cf2c109c8e7a29a
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/replay.cpp
    M src/synced_context.cpp
    M src/synced_context.hpp

  Log Message:
  -----------
  don't send data if it's not needed

thsi code used the variable is_simulaneously, is_simultaneously_ is true
when we have aready sended data over the network, this variable is used
in get_user_choice so that when we make a local choice we only send it
immediately over the network if did already send data over the network.


  Commit: de77f6b9243ec8c01a270d6758f48c96e3c1a2f3
      https://github.com/wesnoth/wesnoth/commit/de77f6b9243ec8c01a270d6758f48c96e3c1a2f3
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/replay.cpp

  Log Message:
  -----------
  removed outcommented code in replay.cpp + add comments


  Commit: 01f38ca46e2acb59a49818c757f196fd4f0f480b
      https://github.com/wesnoth/wesnoth/commit/01f38ca46e2acb59a49818c757f196fd4f0f480b
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/actions/attack.cpp
    M src/actions/attack.hpp
    M src/dialogs.cpp
    M src/dialogs.hpp
    M src/menu_events.cpp
    M src/replay.cpp

  Log Message:
  -----------
  removed dialogs::advance_unit

i already wrote  another version of that code in actions/attacks.cpp
thats uses get_user_choice for advancement choices.
the only function left thats used dialogs::advance_unit was the code for
the :unit advance=n debug command, now that code uses
attack.cpp::advance_unit_at too.


  Commit: 8495ebceae14422c90afb8cb9b0e1d516e291cc5
      https://github.com/wesnoth/wesnoth/commit/8495ebceae14422c90afb8cb9b0e1d516e291cc5
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M src/gamestatus.cpp
    M src/gamestatus.hpp
    M src/synced_context.cpp

  Log Message:
  -----------
  implement the deterministic mode for sp. part1

I don't really know much about the gamestatus cpp/hpp file, so i just
copied from the difficulty code (to create the random_mode attribute).

I add the deterministic mode to the ui in another commit.


  Commit: b4847d95e75cf4420f3ea3256fccfc4cac271439
      https://github.com/wesnoth/wesnoth/commit/b4847d95e75cf4420f3ea3256fccfc4cac271439
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-02 (Wed, 02 Apr 2014)

  Changed paths:
    M data/gui/default/window/campaign_dialog.cfg
    M src/game_controller.cpp
    M src/gui/dialogs/campaign_selection.cpp
    M src/gui/dialogs/campaign_selection.hpp

  Log Message:
  -----------
  implement the deterministic mode for sp. part2

the player can now choose whether he want to play a new SP game in the
deterministic mode where he'll get the same results when he reloads a
game.

i think it would also be nice to enable the deterministic mode for MP for players with verybad network connection, because that would result in less network traffic but more options to cheat.
but i currently don't know enough about the mp connect code to that.


  Commit: 8617a02a88a38d8fe01ee0a3672d75fc5fe72924
      https://github.com/wesnoth/wesnoth/commit/8617a02a88a38d8fe01ee0a3672d75fc5fe72924
  Author: gfgtdf <tischpapier at gmail.com>
  Date:   2014-04-03 (Thu, 03 Apr 2014)

  Changed paths:
    M data/gui/default/window/campaign_dialog.cfg
    M src/CMakeLists.txt
    M src/SConscript
    M src/actions/attack.cpp
    M src/actions/attack.hpp
    M src/actions/create.cpp
    M src/actions/create.hpp
    M src/actions/move.cpp
    M src/actions/move.hpp
    M src/actions/undo.cpp
    M src/actions/undo.hpp
    M src/ai/actions.cpp
    A src/config_assign.cpp
    A src/config_assign.hpp
    M src/dialogs.cpp
    M src/dialogs.hpp
    M src/editor/editor_controller.cpp
    M src/editor/editor_controller.hpp
    M src/game.cpp
    M src/game_controller.cpp
    M src/game_events/action_wml.cpp
    M src/game_events/menu_item.cpp
    M src/gamestatus.cpp
    M src/gamestatus.hpp
    M src/generators/yamg/yamg_params.cpp
    M src/gui/dialogs/campaign_selection.cpp
    M src/gui/dialogs/campaign_selection.hpp
    M src/menu_events.cpp
    M src/mouse_events.cpp
    M src/mouse_events.hpp
    M src/multiplayer.cpp
    M src/multiplayer_connect_engine.cpp
    M src/persist_var.cpp
    M src/play_controller.cpp
    M src/play_controller.hpp
    M src/playmp_controller.cpp
    M src/playsingle_controller.cpp
    M src/playsingle_controller.hpp
    M src/playturn.cpp
    M src/race.cpp
    M src/race.hpp
    M src/random.cpp
    M src/random.hpp
    A src/random_new.cpp
    A src/random_new.hpp
    A src/random_new_deterministic.cpp
    A src/random_new_deterministic.hpp
    A src/random_new_synced.cpp
    A src/random_new_synced.hpp
    M src/replay.cpp
    M src/replay.hpp
    M src/replay_controller.cpp
    A src/replay_helper.cpp
    A src/replay_helper.hpp
    R src/rng.hpp
    M src/scripting/lua.cpp
    M src/server/game.cpp
    M src/server/game.hpp
    M src/server/server.cpp
    A src/simple_rng.cpp
    A src/synced_checkup.cpp
    A src/synced_checkup.hpp
    A src/synced_commands.cpp
    A src/synced_commands.hpp
    A src/synced_context.cpp
    A src/synced_context.hpp
    M src/tests/test_unit_map.cpp
    M src/unit.cpp
    M src/unit.hpp
    M src/whiteboard/manager.cpp
    M src/whiteboard/recall.cpp

  Log Message:
  -----------
  Merge pull request #121 from gfgtdf/sync_2

sync, attack events, start/prestart and more

sync attack events, sync start/prestart, fix  gna.org/bugs/?20871, partly implement gna.org/bugs/?21697 fixing OOS related to [get_global_variable], unify the rng for attacks and other things, implement a third argument for wesnoth.synchronize_choice, implement the deterministic mode for sp. See https://github.com/wesnoth/wesnoth/pull/121 for full descrition.


Compare: https://github.com/wesnoth/wesnoth/compare/a928ce76de33...8617a02a88a3


More information about the Commits mailing list