[Commits] [wesnoth/wesnoth] 882d82: put simple_rng methods in own file.

GitHub noreply at github.com
Wed Apr 16 17:24:41 UTC 2014


  Branch: refs/heads/1.12
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 882d8271be11ef33f5b76ed2aa711f5c648f3a51
      https://github.com/wesnoth/wesnoth/commit/882d8271be11ef33f5b76ed2aa711f5c648f3a51
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 Apr 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: 217a116910559fefbf2d246a8fd8d0d05332e113
      https://github.com/wesnoth/wesnoth/commit/217a116910559fefbf2d246a8fd8d0d05332e113
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: ad54d3b7f2c072cb04cbfa894781ed16797cba7c
      https://github.com/wesnoth/wesnoth/commit/ad54d3b7f2c072cb04cbfa894781ed16797cba7c
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: f16a8ecc206e9fd8e6c593ec1b7934ddae23fb51
      https://github.com/wesnoth/wesnoth/commit/f16a8ecc206e9fd8e6c593ec1b7934ddae23fb51
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: f003dab34041446f348a07c01500a9d1ea5e853b
      https://github.com/wesnoth/wesnoth/commit/f003dab34041446f348a07c01500a9d1ea5e853b
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: 4ea0582d2d1082e1c31c2ec245390b7c9d26e2ce
      https://github.com/wesnoth/wesnoth/commit/4ea0582d2d1082e1c31c2ec245390b7c9d26e2ce
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: b576385ea5acdfcf29cc6ac2f1c03cfe0cd7fe4c
      https://github.com/wesnoth/wesnoth/commit/b576385ea5acdfcf29cc6ac2f1c03cfe0cd7fe4c
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: 8b89c0112b76278881be07194bb576e4a018d80f
      https://github.com/wesnoth/wesnoth/commit/8b89c0112b76278881be07194bb576e4a018d80f
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: a9ba84d4d1e10d080d5afa40789a93c7458a2e3e
      https://github.com/wesnoth/wesnoth/commit/a9ba84d4d1e10d080d5afa40789a93c7458a2e3e
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: 61fb13db0d172e35c187ea703f7a70d314d49ff4
      https://github.com/wesnoth/wesnoth/commit/61fb13db0d172e35c187ea703f7a70d314d49ff4
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: b7b7a722275cebbb5ce1881c53ee528abebe511a
      https://github.com/wesnoth/wesnoth/commit/b7b7a722275cebbb5ce1881c53ee528abebe511a
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: 5b047962464bd7e8e9afe9fe9c3b67f32e165a2a
      https://github.com/wesnoth/wesnoth/commit/5b047962464bd7e8e9afe9fe9c3b67f32e165a2a
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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.

Conflicts:
	src/race.cpp


  Commit: f6fbde5790be617425112b5cafaf8be922f1dc53
      https://github.com/wesnoth/wesnoth/commit/f6fbde5790be617425112b5cafaf8be922f1dc53
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: b1b8b0d5915028319d1d0dfa48b8b5984799a672
      https://github.com/wesnoth/wesnoth/commit/b1b8b0d5915028319d1d0dfa48b8b5984799a672
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: aabb5b650c688bd8c5ff86f3391c81359883d0dd
      https://github.com/wesnoth/wesnoth/commit/aabb5b650c688bd8c5ff86f3391c81359883d0dd
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: aea7a9dac1cec32ae27e6cf5d7257245261fe7d0
      https://github.com/wesnoth/wesnoth/commit/aea7a9dac1cec32ae27e6cf5d7257245261fe7d0
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: 839d6e384f68531140a6975a8c702e083e554215
      https://github.com/wesnoth/wesnoth/commit/839d6e384f68531140a6975a8c702e083e554215
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: ed49b172e746b770f7cd7e0614ee5e11e3a148a4
      https://github.com/wesnoth/wesnoth/commit/ed49b172e746b770f7cd7e0614ee5e11e3a148a4
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: 83b107f2b2801bff672de3213a42d7899f981165
      https://github.com/wesnoth/wesnoth/commit/83b107f2b2801bff672de3213a42d7899f981165
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: dd653ef838e14a68539620fe81140d99af855972
      https://github.com/wesnoth/wesnoth/commit/dd653ef838e14a68539620fe81140d99af855972
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 Apr 2014)

  Changed paths:
    M src/replay.cpp

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


  Commit: ad18df295f3d318ec4bb4e2f7bbac95d7a897905
      https://github.com/wesnoth/wesnoth/commit/ad18df295f3d318ec4bb4e2f7bbac95d7a897905
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: fe03a227392bb55034df0019ba66f9f9fd5cb0c0
      https://github.com/wesnoth/wesnoth/commit/fe03a227392bb55034df0019ba66f9f9fd5cb0c0
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: a56ac608ed8a484d3606df87719280b7ae4b0e0d
      https://github.com/wesnoth/wesnoth/commit/a56ac608ed8a484d3606df87719280b7ae4b0e0d
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 Apr 2014)

  Changed paths:
    M src/scripting/lua.cpp

  Log Message:
  -----------
  fixup forgotten user_choice in lua.cpp


  Commit: 192bb9ea01c5122eeb570681ed2ab1c30690449d
      https://github.com/wesnoth/wesnoth/commit/192bb9ea01c5122eeb570681ed2ab1c30690449d
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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.)

Conflicts:
	src/race.cpp
	src/tests/test_unit_map.cpp


  Commit: a1ebe02287370106e2adc64bedc007d940da5670
      https://github.com/wesnoth/wesnoth/commit/a1ebe02287370106e2adc64bedc007d940da5670
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: 53065ba3509289c4162a3ca501f94af24f297d07
      https://github.com/wesnoth/wesnoth/commit/53065ba3509289c4162a3ca501f94af24f297d07
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: 1f9ea7539bd4a586b80dd7449cb0528674db1f34
      https://github.com/wesnoth/wesnoth/commit/1f9ea7539bd4a586b80dd7449cb0528674db1f34
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 Apr 2014)

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

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


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

  Changed paths:
    M src/actions/move.cpp

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


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

  Changed paths:
    M src/replay.cpp

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


  Commit: b1d8491aa97b0f8259153d951a226c22afe96112
      https://github.com/wesnoth/wesnoth/commit/b1d8491aa97b0f8259153d951a226c22afe96112
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: 0d34222c79428c808cddd3a0daf0f35979a5f97f
      https://github.com/wesnoth/wesnoth/commit/0d34222c79428c808cddd3a0daf0f35979a5f97f
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: d61a2e68ed19cc644220451d02a131aca49fc21d
      https://github.com/wesnoth/wesnoth/commit/d61a2e68ed19cc644220451d02a131aca49fc21d
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 Apr 2014)

  Changed paths:
    M src/replay.hpp

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


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

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

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


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

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

  Log Message:
  -----------
  change get_user_choice

this commit contains the internal code of 'a third arguemnt for luas sync_choice'
becasue the new code is more tested than the old code.


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

  Changed paths:
    M src/replay.cpp

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


  Commit: 9176d6a1c07a7402e1eb1f00840b805bcffa0657
      https://github.com/wesnoth/wesnoth/commit/9176d6a1c07a7402e1eb1f00840b805bcffa0657
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: 28292ca68a6152afee0cad205b867470fe3778db
      https://github.com/wesnoth/wesnoth/commit/28292ca68a6152afee0cad205b867470fe3778db
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 Apr 2014)

  Changed paths:
    M src/replay.cpp

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


  Commit: 8a57de6fc4ce7434dd98a93fbac401f8ef4e9dd6
      https://github.com/wesnoth/wesnoth/commit/8a57de6fc4ce7434dd98a93fbac401f8ef4e9dd6
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 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: 7b38e8fdb106ebe4c147a0e62ce524caf0536b7b
      https://github.com/wesnoth/wesnoth/commit/7b38e8fdb106ebe4c147a0e62ce524caf0536b7b
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2014-04-16 (Wed, 16 Apr 2014)

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

  Log Message:
  -----------
  fix currently active side quits during action

this fixes a bug, that when we receive a player leave/controller change
during sync_network  called during an action the turn isn't restarted.


  Commit: 11b61cea63d22ee790f5b9e028adca505f50c4f8
      https://github.com/wesnoth/wesnoth/commit/11b61cea63d22ee790f5b9e028adca505f50c4f8
  Author: gfgtdf <tischpapier at gmail.com>
  Date:   2014-04-16 (Wed, 16 Apr 2014)

  Changed paths:
    M src/playturn.cpp

  Log Message:
  -----------
  fix skip_replay part1

In da4cdef146bf5a1b8026f12d6b1caa6c1cd20602 this was broken.
The same needs to be done in playmp_controller.cpp


  Commit: 57c87aefcacba494947908845ec954894436d4ed
      https://github.com/wesnoth/wesnoth/commit/57c87aefcacba494947908845ec954894436d4ed
  Author: gfgtdf <tischpapier at gmail.com>
  Date:   2014-04-16 (Wed, 16 Apr 2014)

  Changed paths:
    M src/playmp_controller.cpp

  Log Message:
  -----------
  fix skip_replay part2

This was broken in da4cdef146bf5a1b8026f12d6b1caa6c1cd20602.


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

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

  Log Message:
  -----------
  removed unused 'do_until' argument

we don't need this parameter anymore because we have the "dependent" key
in commands.


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

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

  Log Message:
  -----------
  remove unused argument


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

  Changed paths:
    M src/playmp_controller.cpp
    M src/playsingle_controller.cpp
    M src/playturn.cpp
    M src/replay.cpp
    M src/replay.hpp
    M src/replay_controller.cpp

  Log Message:
  -----------
  give do_replays return a better name

I forgot what my real intention with this change was, but i still think this is a good change, becasue now people don't have to look up the comments to see what do_replay returns.
So i committed it.


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

  Changed paths:
    M src/CMakeLists.txt
    M src/SConscript
    M src/playmp_controller.cpp
    M src/playsingle_controller.cpp
    M src/playsingle_controller.hpp
    M src/playturn.cpp
    M src/playturn.hpp
    A src/playturn_network_adapter.cpp
    A src/playturn_network_adapter.hpp

  Log Message:
  -----------
  fix bug chat during action

when a player chats while multiple actions from another player are
executed on the local machine we before got an assertion error becasue
replay s add_command expects that there are no other commands yet to be
processed on the replay.
(this was broken at da4cdef146bf5a1b8026f12d6b1caa6c1cd20602)
we now fix this problem by ensuring that there is never more data on the
replay than needed.

for this purpose i wrote that playturn_network_adapter.cpp whose main
purpose it to split incoming [turn]s into smaller [turn]s
we also don't need the backlog anymore because now with playturn_network_adapter we only feed process_network_data with small data pieces that can always be handled at once.

I also removed the replay_ member of turn_info.
Before, we read actions from replay_srouce and wrote actions to recorder.
And after the actions in replay_source has been executed they had been pushed into recorder.
With get_user_choice this doesn't work, because we might end up pushing the 'answer' (the user choice) of a get_user_choice in the recorder while the 'question' (the invoking user action) was in replay_source and then would be pushed onto the recorder after the 'answer', leading to a wrong order in the recorder. This could maybe also have been fixed by always pushing user choices into replay_source, and syncing the replay_source somehow after we enter a user choice, but the way it was done in this commit seemed easier.

note that replay_ and backlog were already made unused in da4cdef146bf5a1b8026f12d6b1caa6c1cd20602 (that was a rather uncomplete commit)
We maybe (i didnt test, just a guess) could also fix this bug by using add_nonundoable_command instead of add_command for nonundoable commands in replay.cpp with add_nonundoable_command  defined as:
config& add_nonundoable_command()
{
	auto c = cfg_.add_child_at("command",config(), pos_);
	pos_++;
	return c;
}
One reason why i decided against it is, that i feared add_child_at to be slow (vector::insert) if there are a lot of entries in cfg_ (for example when we join game that has already run may turns).
With the playturn_network_adapter this shouldn't be an issue anymore, but it also isnt needed anymore.


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

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

  Log Message:
  -----------
  use events::command_disabler in synced context

During the synced context we are in a state 'during an execution of an
event/action' that the savefile format cannot cover. So we use
command_disabler to prevent saving.


  Commit: fbfdc37205c2b897eb71209a108c2b7543aacb4a
      https://github.com/wesnoth/wesnoth/commit/fbfdc37205c2b897eb71209a108c2b7543aacb4a
  Author: gfgtdf <tischpapier at gmail.com>
  Date:   2014-04-16 (Wed, 16 Apr 2014)

  Changed paths:
    M src/server/game.cpp

  Log Message:
  -----------
   temporarily disable check for backwards compatibility

this commit brings backwards compatibility between 1.13.0 and 1.13.0-dev
it should be reverted when 1.13.0 comes out.


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

  Changed paths:
    M src/replay.cpp

  Log Message:
  -----------
  disable get_user_choice during prestart events

get_user_choice usually shows a dialog to the user. Because we shouldn't
use the screen during prestart events i disabled it there.

this commit might contain spelling corrections.


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

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

  Log Message:
  -----------
  allow user_choice in prestart for invisible choices


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

  Changed paths:
    M src/replay_controller.cpp

  Log Message:
  -----------
  fix 21905

we have one events_disabler when starting the replay_controller and a
second when entering the synced context. Thats why we have
events::commands_disabled == 1 and >1 when we are executing an action.


  Commit: cf9bec2fb7706ddd4f106c92cb6d0cc5c3c2fe90
      https://github.com/wesnoth/wesnoth/commit/cf9bec2fb7706ddd4f106c92cb6d0cc5c3c2fe90
  Author: gfgtdf <tischpapier at gmail.com>
  Date:   2014-04-16 (Wed, 16 Apr 2014)

  Changed paths:
    M src/replay.cpp

  Log Message:
  -----------
  use const config& for value check

the intention is to remove the annoying
async=""
dependent=""
undo=""
in replays.


  Commit: 00d317264b0ec5967f2c7f2eddbb17460e5dae72
      https://github.com/wesnoth/wesnoth/commit/00d317264b0ec5967f2c7f2eddbb17460e5dae72
  Author: gfgtdf <tischpapier at gmail.com>
  Date:   2014-04-16 (Wed, 16 Apr 2014)

  Changed paths:
    M src/replay_controller.cpp

  Log Message:
  -----------
  disable RESET_REPLAY during actions

this caused assertion errors.


  Commit: e35ec1b71c0211deeef17c93181c941c15d7934a
      https://github.com/wesnoth/wesnoth/commit/e35ec1b71c0211deeef17c93181c941c15d7934a
  Author: gfgtdf <tischpapier at gmail.com>
  Date:   2014-04-16 (Wed, 16 Apr 2014)

  Changed paths:
    M src/actions/create.cpp

  Log Message:
  -----------
  enable undo recruits/recalls if no rng was used

If we used rng during an acion we can never undo it becasue it is an nonundoable information gain. Also it's technicaly impossible because in mp using rng will result in data send over the network, which cannot be undone. Wedon't need to check whether the unit had traits/names this was becasue that would also have caused rng calls.


  Commit: bd73f46cdc233e803cd9666346945b6cab7d93d8
      https://github.com/wesnoth/wesnoth/commit/bd73f46cdc233e803cd9666346945b6cab7d93d8
  Author: gfgtdf <tischpapier at gmail.com>
  Date:   2014-04-16 (Wed, 16 Apr 2014)

  Changed paths:
    M src/gamestatus.hpp

  Log Message:
  -----------
  removes unused variable

is_determisic_mode_ was accidently placed there during rebasing i think


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

  Changed paths:
    M src/actions/create.cpp
    M src/actions/move.cpp
    M src/synced_context.cpp
    M src/synced_context.hpp

  Log Message:
  -----------
  disallow undo when action was sended

we now disallow undoing actions that we already sended over the network.
We also disallow undoing moves when the rng was invoked like it's done
for recruits/recalls already.


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

  Changed paths:
    M src/synced_context.hpp

  Log Message:
  -----------
  revmoved unused code

this typedef was a leftover from my original plan to pass functions to
run_in_synced_context. I decided to pass strings to
run_in_synced_context at some time.


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

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

  Log Message:
  -----------
  fix host reassignes side during choice

Assume the following situation:
2 Players in the game (A (side 1), B (side 2)), and one Observer (C).
it's A's turn.
A has to do a decision (for example unit advanement), A leaves the game
and B decides to assign side 1 to C.
On Client B: When returning from process_network_data side 1 is now controlled by B,
and then gets then reassigned with the next call of
process_network_data, but that's too late becasue handle_generaic_event
already returned and B does the advancement decision for side 1.
Players C gets the the first [change_controller] (A -> B) and then gets
the second change cntroller (B -> C) before getting B's answer to the
user choice. So when C gets the second [change_controller] he does the
decision himself becasue its C's decision an it has not been received
yet. -> the same decision has been made twice -> OOS.
this fixes this problem, by making the host wait for the servers change
controller in this case


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

  Changed paths:
    M src/ai/actions.cpp
    M src/synced_context.cpp
    M src/synced_context.hpp

  Log Message:
  -----------
  remove the 'only_attacks' random mode

i came to the conclusion, that the lag for asking the server for a new
seed is neglectable. So we don't need this mode.


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

  Changed paths:
    M src/synced_context.hpp

  Log Message:
  -----------
  remove outdated comments.

Conflicts:
	src/synced_context.hpp


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

  Changed paths:
    M src/synced_context.cpp

  Log Message:
  -----------
  don't call user_interace during screenlock


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

  Changed paths:
    M src/actions/create.cpp

  Log Message:
  -----------
  don't use sycned checkup for wml things

i think it's better if we seperate wml things from core things here. Not
that it casues OOS or similar, but because it makes things easier.


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

  Changed paths:
    M src/actions/create.cpp

  Log Message:
  -----------
  remove a checksum

we already do a checksum in place_recruit so we don't need this one.


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

  Changed paths:
    M src/mp_game_utils.cpp
    M src/playcampaign.cpp

  Log Message:
  -----------
  fix 21866


Compare: https://github.com/wesnoth/wesnoth/compare/9396f20e5925...7ee5a2e074db


More information about the Commits mailing list