{"action":"created","issue":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/15268","repository_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA","labels_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/15268/labels{/name}","comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/15268/comments","events_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/15268/events","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/15268","id":131810934,"number":15268,"title":"[CR] Refactor morale_point a bit","user":{"login":"codemime","id":11905613,"avatar_url":"https://avatars.githubusercontent.com/u/11905613?v=3","gravatar_id":"","url":"https://api.github.com/users/codemime","html_url":"https://github.com/codemime","followers_url":"https://api.github.com/users/codemime/followers","following_url":"https://api.github.com/users/codemime/following{/other_user}","gists_url":"https://api.github.com/users/codemime/gists{/gist_id}","starred_url":"https://api.github.com/users/codemime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codemime/subscriptions","organizations_url":"https://api.github.com/users/codemime/orgs","repos_url":"https://api.github.com/users/codemime/repos","events_url":"https://api.github.com/users/codemime/events{/privacy}","received_events_url":"https://api.github.com/users/codemime/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-06T02:46:31Z","updated_at":"2016-02-08T02:41:05Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/15268","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/15268","diff_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/15268.diff","patch_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/15268.patch"},"body":"The refactoring is fairly small: moved all that belongs (exclusively) to the `morale_point` class from the `player` class into it's own file and encapsulated that. That reduced duplication a bit and increased testability and cohesion. It's also a basement for further refactorings. My point is that current implementation of morale system is a bit overburdened. Too many calls of the `morale_level()` are made. Each of which recalculates whole morale over and over again and look for the same traits over and over again. It's quite costly and quite unnecessary. New morale level can be calculated only once per tick and then simply cached. I'd suggest further refactorings to achieve th"},"comment":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/comments/181168939","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/15268#issuecomment-181168939","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/15268","id":181168939,"user":{"login":"codemime","id":11905613,"avatar_url":"https://avatars.githubusercontent.com/u/11905613?v=3","gravatar_id":"","url":"https://api.github.com/users/codemime","html_url":"https://github.com/codemime","followers_url":"https://api.github.com/users/codemime/followers","following_url":"https://api.github.com/users/codemime/following{/other_user}","gists_url":"https://api.github.com/users/codemime/gists{/gist_id}","starred_url":"https://api.github.com/users/codemime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codemime/subscriptions","organizations_url":"https://api.github.com/users/codemime/orgs","repos_url":"https://api.github.com/users/codemime/repos","events_url":"https://api.github.com/users/codemime/events{/privacy}","received_events_url":"https://api.github.com/users/codemime/received_events","type":"User","site_admin":false},"created_at":"2016-02-08T02:41:05Z","updated_at":"2016-02-08T02:41:05Z","body":"Everything looks pretty clean and simple now. I suppose this stage can be merged."}}