{"action":"created","comment":{"url":"https://api.github.com/repos/cuberite/cuberite/pulls/comments/40496225","id":40496225,"diff_hunk":"@@ -0,0 +1,324 @@\n+\n+#include \"Globals.h\"  // NOTE: MSVC stupidness requires this to be the same across all modules\n+\n+#include \"BrewingRecipe.h\"\n+#include \"Item.h\"\n+\n+#include <fstream>\n+\n+#define BREWING_RECIPE_FILE \"brewing.txt\"\n+\n+\n+\n+\n+\n+typedef std::list<cBrewingRecipe::cRecipe> RecipeList;\n+\n+\n+\n+\n+\n+struct cBrewingRecipe::sBrewingRecipeState\n+{\n+\tRecipeList Recipes;\n+};\n+\n+\n+\n+\n+\n+cBrewingRecipe::cBrewingRecipe()\n+\t: m_pState(new sBrewingRecipeState)\n+{\n+\tReloadRecipes();\n+}\n+\n+\n+\n+\n+\n+cBrewingRecipe::~cBrewingRecipe()\n+{\n+\tClearRecipes();\n+\tdelete m_pState;\n+\tm_pState = nullptr;\n+}\n+\n+\n+\n+\n+\n+void cBrewingRecipe::ReloadRecipes(void)\n+{\n+\tClearRecipes();\n+\tLOGD(\"Loading brewing recipes...\");\n+\n+\tstd::ifstream f(BREWING_RECIPE_FILE, std::ios::in);\n+\tif (!f.good())\n+\t{\n+\t\tLOG(\"Could not open the brewing recipes file \\\"%s\\\". No brewing recipes are available.\", BREWING_RECIPE_FILE);\n+\t\treturn;\n+\t}\n+\n+\tunsigned int LineNum = 0;\n+\tAString ParsingLine;\n+\n+\twhile (std::getline(f, ParsingLine))\n+\t{\n+\t\tLineNum++;\n+\t\tif (ParsingLine.empty())\n+\t\t{\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\t// Remove comments from the line:\n+\t\tsize_t FirstCommentSymbol = ParsingLine.find('#');\n+\t\tif ((FirstCommentSymbol != AString::npos) && (FirstCommentSymbol != 0))\n+\t\t{\n+\t\t\tParsingLine.erase(ParsingLine.begin() + static_cast<const long>(FirstCommentSymbol), ParsingLine.end());","path":"src/BrewingRecipe.cpp","position":78,"original_position":78,"commit_id":"3a35960a1b08fe1aebb4778643a37422f8f084d5","original_commit_id":"3a35960a1b08fe1aebb4778643a37422f8f084d5","user":{"login":"worktycho","id":2102806,"avatar_url":"https://avatars.githubusercontent.com/u/2102806?v=3","gravatar_id":"","url":"https://api.github.com/users/worktycho","html_url":"https://github.com/worktycho","followers_url":"https://api.github.com/users/worktycho/followers","following_url":"https://api.github.com/users/worktycho/following{/other_user}","gists_url":"https://api.github.com/users/worktycho/gists{/gist_id}","starred_url":"https://api.github.com/users/worktycho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/worktycho/subscriptions","organizations_url":"https://api.github.com/users/worktycho/orgs","repos_url":"https://api.github.com/users/worktycho/repos","events_url":"https://api.github.com/users/worktycho/events{/privacy}","received_events_url":"https://api.github.com/users/worktycho/received_events","type":"User","site_admin":false},"body":"My mistake, std::advance increments an lvalue. But its probably still worth using even with the extra two statements to first declare and the increment the iterator, given that the correct form of that cast is `static_cast<std::iterator_traits<AString::iterator>::difference_type(FirstCommentSymbol)`","created_at":"2015-09-26T17:48:44Z","updated_at":"2015-09-26T17:48:44Z","html_url":"https://github.com/cuberite/cuberite/pull/2497#discussion_r40496225","pull_request_url":"https://api.github.com/repos/cuberite/cuberite/pulls/2497","_links":{"self":{"href":"https://api.github.com/repos/cuberite/cuberite/pulls/comments/40496225"},"html":{"href":"https://github.com/cuberite/cuberite/pull/2497#discussion_r40496225"},"pull_request":{"href":"https://api.github.com/repos/cuberite/cuberite/pulls/2497"}}},"pull_request":{"url":"https://api.github.com/repos/cuberite/cuberite/pulls/2497","id":46037640,"html_url":"https://github.com/cuberite/cuberite/pull/2497","diff_url":"https://github.com/cuberite/cuberite/pull/2497.diff","patch_url":"https://github.com/cuberite/cuberite/pull/2497.patch","issue_url":"https://api.github.com/repos/cuberite/cuberite/issues/2497","number":2497,"state":"open","locked":false,"title":"Implemented brewing","user":{"login":"Seadragon91","id":14818618,"avatar_url":"https://avatars.githubusercontent.com/u/14818618?v=3","gravatar_id":"","url":"https://api.github.com/users/Seadragon91","html_url":"https://github.com/Seadragon91","followers_url":"https://api.github.com/users/Seadragon91/followers","following_url":"https://api.github.com/users/Seadragon91/following{/other_user}","gists_url":"https://api.github.com/users/Seadragon91/gists{/gist_id}","starred_url":"https://api.github.com/users/Seadragon91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Seadragon91/subscriptions","organizations_url":"https://api.github.com/users/Seadragon91/orgs","repos_url":"https://api.github.com/users/Seadragon91/repos","events_url":"https://api.github.com/users/Seadragon91/events{/privacy}","received_events_url":"https://api.github.com/users/Seadragon91/received_events","type":"User","site_admin":false},"body":"DO NOT MERGE YET!\r\n\r\nThis implements brewing.\r\n- Brewing stand and window\r\n- [Recipes](https://github.com/Seadragon91/cuberite/blob/brewing/Server/brewing.txt), this file only contains the regular recipes. because the ingredient for a regular and a splash potion (level II -> extended) is the same.\r\n\r\nTODO:\r\n- It would be good to store the current recipes in the class Brewingstand, for quicker lookup.\r\n- Code needs to be reviewed, specially the [`BrewingRecipe.cpp`](https://github.com/Seadragon91/cuberite/blob/brewing/src/BrewingRecipe.cpp)\r\n\r\nDiscussion can be here and in the [forum](http://forum.mc-server.org/showthread.php?tid=1983)","created_at":"2015-09-25T17:35:42Z","updated_at":"2015-09-26T17:48:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"10090a082c3d0f41165c32051ca9a4b6beb565ce","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cuberite/cuberite/pulls/2497/commits","review_comments_url":"https://api.github.com/repos/cuberite/cuberite/pulls/2497/comments","review_comment_url":"https://api.github.com/repos/cuberite/cuberite/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cuberite/cuberite/issues/2497/comments","statuses_url":"https://api.github.com/repos/cuberite/cuberite/statuses/3a35960a1b08fe1aebb4778643a37422f8f084d5","head":{"label":"Seadragon91:brewing","ref":"brewing","sha":"3a35960a1b08fe1aebb4778643a37422f8f084d5","user":{"login":"Seadragon91","id":14818618,"avatar_url":"https://avatars.githubusercontent.com/u/14818618?v=3","gravatar_id":"","url":"https://api.github.com/users/Seadragon91","html_url":"https://github.com/Seadragon91","followers_url":"https://api.github.com/users/Seadragon91/followers","following_url":"https://api.github.com/users/Seadragon91/following{/other_user}","gists_url":"https://api.github.com/users/Seadragon91/gists{/gist_id}","starred_url":"https://api.github.com/users/Seadragon91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Seadragon91/subscriptions","organizations_url":"https://api.github.com/users/Seadragon91/orgs","repos_url":"https://api.github.com/users/Seadragon91/repos","events_url":"https://api.github.com/users/Seadragon91/events{/privacy}","received_events_url":"https://api.github.com/users/Seadragon91/received_events","type":"User","site_admin":false},"repo":{"id":43056018,"name":"cuberite","full_name":"Seadragon91/cuberite","owner":{"login":"Seadragon91","id":14818618,"avatar_url":"https://avatars.githubusercontent.com/u/14818618?v=3","gravatar_id":"","url":"https://api.github.com/users/Seadragon91","html_url":"https://github.com/Seadragon91","followers_url":"https://api.github.com/users/Seadragon91/followers","following_url":"https://api.github.com/users/Seadragon91/following{/other_user}","gists_url":"https://api.github.com/users/Seadragon91/gists{/gist_id}","starred_url":"https://api.github.com/users/Seadragon91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Seadragon91/subscriptions","organizations_url":"https://api.github.com/users/Seadragon91/orgs","repos_url":"https://api.github.com/users/Seadragon91/repos","events_url":"https://api.github.com/users/Seadragon91/events{/privacy}","received_events_url":"https://api.github.com/users/Seadragon91/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Seadragon91/cuberite","description":"A performant C++ Minecraft compatible game server","fork":true,"url":"https://api.github.com/repos/Seadragon91/cuberite","forks_url":"https://api.github.com/repos/Seadragon91/cuberite/forks","keys_url":"https://api.github.com/repos/Seadragon91/cuberite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Seadragon91/cuberite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Seadragon91/cuberite/teams","hooks_url":"https://api.github.com/repos/Seadragon91/cuberite/hooks","issue_events_url":"https://api.github.com/repos/Seadragon91/cuberite/issues/events{/number}","events_url":"https://api.github.com/repos/Seadragon91/cuberite/events","assignees_url":"https://api.github.com/repos/Seadragon91/cuberite/assignees{/user}","branches_url":"https://api.github.com/repos/Seadragon91/cuberite/branches{/branch}","tags_url":"https://api.github.com/repos/Seadragon91/cuberite/tags","blobs_url":"https://api.github.com/repos/Seadragon91/cuberite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Seadragon91/cuberite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Seadragon91/cuberite/git/refs{/sha}","trees_url":"https://api.github.com/repos/Seadragon91/cuberite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Seadragon91/cuberite/statuses/{sha}","languages_url":"https://api.github.com/repos/Seadragon91/cuberite/languages","stargazers_url":"https://api.github.com/repos/Seadragon91/cuberite/stargazers","contributors_url":"https://api.github.com/repos/Seadragon91/cuberite/contributors","subscribers_url":"https://api.github.com/repos/Seadragon91/cuberite/subscribers","subscription_url":"https://api.github.com/repos/Seadragon91/cuberite/subscription","commits_url":"https://api.github.com/repos/Seadragon91/cuberite/commits{/sha}","git_commits_url":"https://api.github.com/repos/Seadragon91/cuberite/git/commits{/sha}","comments_url":"https://api.github.com/repos/Seadragon91/cuberite/comments{/number}","issue_comment_url":"https://api.github.com/repos/Seadragon91/cuberite/issues/comments{/number}","contents_url":"https://api.github.com/repos/Seadragon91/cuberite/contents/{+path}","compare_url":"https://api.github.com/repos/Seadragon91/cuberite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Seadragon91/cuberite/merges","archive_url":"https://api.github.com/repos/Seadragon91/cuberite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Seadragon91/cuberite/downloads","issues_url":"https://api.github.com/repos/Seadragon91/cuberite/issues{/number}","pulls_url":"https://api.github.com/repos/Seadragon91/cuberite/pulls{/number}","milestones_url":"https://api.github.com/repos/Seadragon91/cuberite/milestones{/number}","notifications_url":"https://api.github.com/repos/Seadragon91/cuberite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Seadragon91/cuberite/labels{/name}","releases_url":"https://api.github.com/repos/Seadragon91/cuberite/releases{/id}","created_at":"2015-09-24T09:00:13Z","updated_at":"2015-09-24T09:00:25Z","pushed_at":"2015-09-26T12:57:45Z","git_url":"git://github.com/Seadragon91/cuberite.git","ssh_url":"git@github.com:Seadragon91/cuberite.git","clone_url":"https://github.com/Seadragon91/cuberite.git","svn_url":"https://github.com/Seadragon91/cuberite","homepage":"http://cuberite.org","size":77876,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cuberite:master","ref":"master","sha":"335374376bff16459eb3e3585a93f931e1b3c306","user":{"login":"cuberite","id":8973961,"avatar_url":"https://avatars.githubusercontent.com/u/8973961?v=3","gravatar_id":"","url":"https://api.github.com/users/cuberite","html_url":"https://github.com/cuberite","followers_url":"https://api.github.com/users/cuberite/followers","following_url":"https://api.github.com/users/cuberite/following{/other_user}","gists_url":"https://api.github.com/users/cuberite/gists{/gist_id}","starred_url":"https://api.github.com/users/cuberite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cuberite/subscriptions","organizations_url":"https://api.github.com/users/cuberite/orgs","repos_url":"https://api.github.com/users/cuberite/repos","events_url":"https://api.github.com/users/cuberite/events{/privacy}","received_events_url":"https://api.github.com/users/cuberite/received_events","type":"Organization","site_admin":false},"repo":{"id":11693709,"name":"cuberite","full_name":"cuberite/cuberite","owner":{"login":"cuberite","id":8973961,"avatar_url":"https://avatars.githubusercontent.com/u/8973961?v=3","gravatar_id":"","url":"https://api.github.com/users/cuberite","html_url":"https://github.com/cuberite","followers_url":"https://api.github.com/users/cuberite/followers","following_url":"https://api.github.com/users/cuberite/following{/other_user}","gists_url":"https://api.github.com/users/cuberite/gists{/gist_id}","starred_url":"https://api.github.com/users/cuberite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cuberite/subscriptions","organizations_url":"https://api.github.com/users/cuberite/orgs","repos_url":"https://api.github.com/users/cuberite/repos","events_url":"https://api.github.com/users/cuberite/events{/privacy}","received_events_url":"https://api.github.com/users/cuberite/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cuberite/cuberite","description":"A performant C++ Minecraft compatible game server","fork":false,"url":"https://api.github.com/repos/cuberite/cuberite","forks_url":"https://api.github.com/repos/cuberite/cuberite/forks","keys_url":"https://api.github.com/repos/cuberite/cuberite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cuberite/cuberite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cuberite/cuberite/teams","hooks_url":"https://api.github.com/repos/cuberite/cuberite/hooks","issue_events_url":"https://api.github.com/repos/cuberite/cuberite/issues/events{/number}","events_url":"https://api.github.com/repos/cuberite/cuberite/events","assignees_url":"https://api.github.com/repos/cuberite/cuberite/assignees{/user}","branches_url":"https://api.github.com/repos/cuberite/cuberite/branches{/branch}","tags_url":"https://api.github.com/repos/cuberite/cuberite/tags","blobs_url":"https://api.github.com/repos/cuberite/cuberite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cuberite/cuberite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cuberite/cuberite/git/refs{/sha}","trees_url":"https://api.github.com/repos/cuberite/cuberite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cuberite/cuberite/statuses/{sha}","languages_url":"https://api.github.com/repos/cuberite/cuberite/languages","stargazers_url":"https://api.github.com/repos/cuberite/cuberite/stargazers","contributors_url":"https://api.github.com/repos/cuberite/cuberite/contributors","subscribers_url":"https://api.github.com/repos/cuberite/cuberite/subscribers","subscription_url":"https://api.github.com/repos/cuberite/cuberite/subscription","commits_url":"https://api.github.com/repos/cuberite/cuberite/commits{/sha}","git_commits_url":"https://api.github.com/repos/cuberite/cuberite/git/commits{/sha}","comments_url":"https://api.github.com/repos/cuberite/cuberite/comments{/number}","issue_comment_url":"https://api.github.com/repos/cuberite/cuberite/issues/comments{/number}","contents_url":"https://api.github.com/repos/cuberite/cuberite/contents/{+path}","compare_url":"https://api.github.com/repos/cuberite/cuberite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cuberite/cuberite/merges","archive_url":"https://api.github.com/repos/cuberite/cuberite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cuberite/cuberite/downloads","issues_url":"https://api.github.com/repos/cuberite/cuberite/issues{/number}","pulls_url":"https://api.github.com/repos/cuberite/cuberite/pulls{/number}","milestones_url":"https://api.github.com/repos/cuberite/cuberite/milestones{/number}","notifications_url":"https://api.github.com/repos/cuberite/cuberite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cuberite/cuberite/labels{/name}","releases_url":"https://api.github.com/repos/cuberite/cuberite/releases{/id}","created_at":"2013-07-26T19:56:59Z","updated_at":"2015-09-25T09:13:45Z","pushed_at":"2015-09-26T05:47:56Z","git_url":"git://github.com/cuberite/cuberite.git","ssh_url":"git@github.com:cuberite/cuberite.git","clone_url":"https://github.com/cuberite/cuberite.git","svn_url":"https://github.com/cuberite/cuberite","homepage":"http://cuberite.org","size":169078,"stargazers_count":733,"watchers_count":733,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":236,"mirror_url":null,"open_issues_count":395,"forks":236,"open_issues":395,"watchers":733,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cuberite/cuberite/pulls/2497"},"html":{"href":"https://github.com/cuberite/cuberite/pull/2497"},"issue":{"href":"https://api.github.com/repos/cuberite/cuberite/issues/2497"},"comments":{"href":"https://api.github.com/repos/cuberite/cuberite/issues/2497/comments"},"review_comments":{"href":"https://api.github.com/repos/cuberite/cuberite/pulls/2497/comments"},"review_comment":{"href":"https://api.github.com/repos/cuberite/cuberite/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cuberite/cuberite/pulls/2497/commits"},"statuses":{"href":"https://api.github.com/repos/cuberite/cuberite/statuses/3a35960a1b08fe1aebb4778643a37422f8f084d5"}}}}