{"action":"created","issue":{"url":"https://api.github.com/repos/vcmi/vcmi/issues/209","repository_url":"https://api.github.com/repos/vcmi/vcmi","labels_url":"https://api.github.com/repos/vcmi/vcmi/issues/209/labels{/name}","comments_url":"https://api.github.com/repos/vcmi/vcmi/issues/209/comments","events_url":"https://api.github.com/repos/vcmi/vcmi/issues/209/events","html_url":"https://github.com/vcmi/vcmi/pull/209","id":175618848,"number":209,"title":"Fix save desyncs","user":{"login":"ArseniyShestakov","id":9513350,"avatar_url":"https://avatars.githubusercontent.com/u/9513350?v=3","gravatar_id":"","url":"https://api.github.com/users/ArseniyShestakov","html_url":"https://github.com/ArseniyShestakov","followers_url":"https://api.github.com/users/ArseniyShestakov/followers","following_url":"https://api.github.com/users/ArseniyShestakov/following{/other_user}","gists_url":"https://api.github.com/users/ArseniyShestakov/gists{/gist_id}","starred_url":"https://api.github.com/users/ArseniyShestakov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArseniyShestakov/subscriptions","organizations_url":"https://api.github.com/users/ArseniyShestakov/orgs","repos_url":"https://api.github.com/users/ArseniyShestakov/repos","events_url":"https://api.github.com/users/ArseniyShestakov/events{/privacy}","received_events_url":"https://api.github.com/users/ArseniyShestakov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-09-07T22:09:36Z","updated_at":"2016-09-10T19:04:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/vcmi/vcmi/pulls/209","html_url":"https://github.com/vcmi/vcmi/pull/209","diff_url":"https://github.com/vcmi/vcmi/pull/209.diff","patch_url":"https://github.com/vcmi/vcmi/pull/209.patch"},"body":"Many small related fixes already made it into develop. These are remaining large changes that far from perfect, but so far they fix all major desyncs. In case you can find any desync in newly created game please post backtrace from within CLoadIntegrityValidator::read.\r\n\r\nI would happily accept suggestions on:\r\n\r\n- Code style / formatting / etc.\r\n- ~~Thoughts on better place for RNG since CCallbackBase is questionable.~~\r\n- Where to move CGameState::battleGetBattlefieldType since it's not really related to battle itself. Probably we need different class / file exclusively for adventure map mechanics.\r\n\r\nMore information on changes available on [mantis#2459](http://bugs.vcmi.eu/view.php?id=2459). There is still some potencial desyncs that will affect multiplayer game, but so far I was only work on single client problems only."},"comment":{"url":"https://api.github.com/repos/vcmi/vcmi/issues/comments/246129824","html_url":"https://github.com/vcmi/vcmi/pull/209#issuecomment-246129824","issue_url":"https://api.github.com/repos/vcmi/vcmi/issues/209","id":246129824,"user":{"login":"ArseniyShestakov","id":9513350,"avatar_url":"https://avatars.githubusercontent.com/u/9513350?v=3","gravatar_id":"","url":"https://api.github.com/users/ArseniyShestakov","html_url":"https://github.com/ArseniyShestakov","followers_url":"https://api.github.com/users/ArseniyShestakov/followers","following_url":"https://api.github.com/users/ArseniyShestakov/following{/other_user}","gists_url":"https://api.github.com/users/ArseniyShestakov/gists{/gist_id}","starred_url":"https://api.github.com/users/ArseniyShestakov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArseniyShestakov/subscriptions","organizations_url":"https://api.github.com/users/ArseniyShestakov/orgs","repos_url":"https://api.github.com/users/ArseniyShestakov/repos","events_url":"https://api.github.com/users/ArseniyShestakov/events{/privacy}","received_events_url":"https://api.github.com/users/ArseniyShestakov/received_events","type":"User","site_admin":false},"created_at":"2016-09-10T19:04:45Z","updated_at":"2016-09-10T19:04:45Z","body":"> There are other ways to do that. Firstly, this function takes rng as argument and it doesn't matter how it's called internally - neither needs to be changed.\r\n\r\nAs I said I rebased my own changes and accidentally patched other code that I shouldn't touch.\r\n\r\n> Alternatively you coudl create rng as singleton (static variable?) and not pass it around at all, but it looks like overkill. All we need it to unify rng calls once.\r\n\r\nActually idea is quite opposite: we need to make sure that nobody accidentally use wrong RNG ever. This is needed since unfortunately a lot of server-side, map objects and battlle code is a mess that need massive refactoring. For instance:\r\n\r\n* Some map object functions only used from within CGameState only.\r\n* Some used on server-side only.\r\n* Some used both within gamestate and server-side code.\r\n* Something probably even used by both client and server.\r\n\r\nProblem that gamestate RNG should be only used from code that apply changes for all clients and server-side RNG state should be secret. It's would be even better if we could simply limit any access to  GS RNG the way so you simply can't use it wrong way, but with codebase we have now this is not possible.\r\n\r\nAlso anything static is super evil..."}}
{"actor":{"display_login":"ArseniyShestakov"}}