{"action":"created","issue":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/12385","labels_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/12385/labels{/name}","comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/12385/comments","events_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/12385/events","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/12385","id":76628652,"number":12385,"title":"[CR]Make map caches 3D","user":{"login":"Coolthulhu","id":1878860,"avatar_url":"https://avatars.githubusercontent.com/u/1878860?v=3","gravatar_id":"","url":"https://api.github.com/users/Coolthulhu","html_url":"https://github.com/Coolthulhu","followers_url":"https://api.github.com/users/Coolthulhu/followers","following_url":"https://api.github.com/users/Coolthulhu/following{/other_user}","gists_url":"https://api.github.com/users/Coolthulhu/gists{/gist_id}","starred_url":"https://api.github.com/users/Coolthulhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Coolthulhu/subscriptions","organizations_url":"https://api.github.com/users/Coolthulhu/orgs","repos_url":"https://api.github.com/users/Coolthulhu/repos","events_url":"https://api.github.com/users/Coolthulhu/events{/privacy}","received_events_url":"https://api.github.com/users/Coolthulhu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-05-15T07:14:29Z","updated_at":"2015-05-19T09:30:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/12385","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/12385","diff_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/12385.diff","patch_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/12385.patch"},"body":"The biggest problem with #6820 is vehicles: they require changing the caching system to allow multi-z-level caches.\r\n\r\nI decided to go with an array of cache structs accessed through a getter (to get the proper array index and possibly do z-level bounds checks). I could change it to 3D arrays if this is a better solution.\r\n\r\nI probably won't be making a separate set of behaviors for 2D caches here, just make them not be generated except for the current z-level."},"comment":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/comments/103416135","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/12385#issuecomment-103416135","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/12385","id":103416135,"user":{"login":"Coolthulhu","id":1878860,"avatar_url":"https://avatars.githubusercontent.com/u/1878860?v=3","gravatar_id":"","url":"https://api.github.com/users/Coolthulhu","html_url":"https://github.com/Coolthulhu","followers_url":"https://api.github.com/users/Coolthulhu/followers","following_url":"https://api.github.com/users/Coolthulhu/following{/other_user}","gists_url":"https://api.github.com/users/Coolthulhu/gists{/gist_id}","starred_url":"https://api.github.com/users/Coolthulhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Coolthulhu/subscriptions","organizations_url":"https://api.github.com/users/Coolthulhu/orgs","repos_url":"https://api.github.com/users/Coolthulhu/repos","events_url":"https://api.github.com/users/Coolthulhu/events{/privacy}","received_events_url":"https://api.github.com/users/Coolthulhu/received_events","type":"User","site_admin":false},"created_at":"2015-05-19T09:30:40Z","updated_at":"2015-05-19T09:30:40Z","body":"So don't change the cache to pointers and instead allocate all maps on the heap or both allocate map on the heap and reference caches through pointers?\r\n\r\nIt wouldn't be hard to change the map to just keep `unique_ptr`s of the caches and it probably wouldn't noticeably affect locality (different z-level caches are usually processed separately anyway).\r\nIt would avoid possible future bugs when someone creates a tinymap not knowing the risks and someone else merges it before checking for it (after testing on a compiler that wouldn't complain)."}}