GitHub PullRequestReviewCommentEvent at 2014-02-28 14:03:42
Repository: MCServer
Actor: madmaxoft
Payload: {"comment":{"url":"https://api.github.com/repos/mc-server/MCServer/pulls/comments/10164547","id":10164547,"diff_hunk":"@@ -762,6 +762,94 @@ void cCraftingRecipes::NormalizeIngredients(cCraftingRecipes::cRecipe * a_Recipe\n \t\tRecipe->m_Ingredients.push_back(*itrS);\n \t}\n \tRecipe->m_Ingredients.insert(Recipe->m_Ingredients.end(), MatchedSlots.begin(), MatchedSlots.end());\n+\n+\n+\t// Henceforth is code to handle fireworks\n+\t// We use Recipe instead of a_Recipe because we want the wildcard ingredients' slot numbers as well, which was just added previously\n+\n+\tif (Recipe->m_Result.m_ItemType == E_ITEM_FIREWORK_ROCKET)\n+\t{\n+\t\tfor (cRecipeSlots::const_iterator itr = Recipe->m_Ingredients.begin(); itr != Recipe->m_Ingredients.end(); ++itr)\n+\t\t{\n+\t\t\tswitch (itr->m_Item.m_ItemType)\n+\t\t\t{\n+\t\t\t\tcase E_ITEM_FIREWORK_STAR:\n+\t\t\t\t{\n+\t\t\t\t\t// Result was a rocket, found a star - copy star data to rocket data\n+\t\t\t\t\tint GridID = (itr->x + a_OffsetX) + a_GridStride * (itr->y + a_OffsetY);\n+\t\t\t\t\tRecipe->m_Result.m_FireworkItem.CopyFrom(a_CraftingGrid[GridID].m_FireworkItem);\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t\tcase E_ITEM_GUNPOWDER:\n+\t\t\t\t{\n+\t\t\t\t\t// Gunpowder - increase flight time\n+\t\t\t\t\tRecipe->m_Result.m_FireworkItem.m_FlightTimeInTicks += 20;\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t\tcase E_ITEM_PAPER: break;\n+\t\t\t\tdefault: LOG(\"Unexpected item in firework rocket recipe, was the crafting file fireworks section changed?\"); break;\n+\t\t\t}\n+\t\t}\n+\t}\n+\telse if (Recipe->m_Result.m_ItemType == E_ITEM_FIREWORK_STAR)\n+\t{\n+\t\tfor (cRecipeSlots::const_iterator itr = Recipe->m_Ingredients.begin(); itr != Recipe->m_Ingredients.end(); ++itr)\n+\t\t{\n+\t\t\tswitch (itr->m_Item.m_ItemType)\n+\t\t\t{\n+\t\t\t\tcase E_ITEM_FIREWORK_STAR:\n+\t\t\t\t{\n+\t\t\t\t\t// Result was star, found another star - probably adding fade colours, but copy data over anyhow\n+\t\t\t\t\tint GridID = (itr->x + a_OffsetX) + a_GridStride * (itr->y + a_OffsetY);\n+\t\t\t\t\tRecipe->m_Result.m_FireworkItem.CopyFrom(a_CraftingGrid[GridID].m_FireworkItem);\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t\tcase E_ITEM_DYE:\n+\t\t\t\t{\n+\t\t\t\t\tint GridID = (itr->x + a_OffsetX) + a_GridStride * (itr->y + a_OffsetY);\n+\n+\t\t\t\t\t// Found a dye in ingredients...\n+\t\t\t\t\tfor (cRecipeSlots::const_iterator itrnumerodos = Recipe->m_Ingredients.begin(); itrnumerodos != Recipe->m_Ingredients.end(); ++itrnumerodos)\n+\t\t\t\t\t{\n+\t\t\t\t\t\t// Loop through ingredients. Can we find a star?\n+\t\t\t\t\t\tif (itrnumerodos->m_Item.m_ItemType == E_ITEM_FIREWORK_STAR)\n+\t\t\t\t\t\t{\n+\t\t\t\t\t\t\t// Yes, this is definately adding fade colours, unless crafting.txt was changed :/\n+\t\t\t\t\t\t\tfor (cRecipeSlots::const_iterator itrnumerotres = Recipe->m_Ingredients.begin(); itrnumerotres != Recipe->m_Ingredients.end(); ++itrnumerotres)\n+\t\t\t\t\t\t\t{\n+\t\t\t\t\t\t\t\t// Loop again, can we find dye?\n+\t\t\t\t\t\t\t\tif (itrnumerotres->m_Item.m_ItemType == E_ITEM_DYE)\n+\t\t\t\t\t\t\t\t{\n+\t\t\t\t\t\t\t\t\t// Yep, push back fade colour and exit the loop\n+\t\t\t\t\t\t\t\t\t// There is a potential for flexibility here - we can move the goto out of the loop, so we can add multiple dyes (∴ multiple fade colours)","path":"src/CraftingRecipes.cpp","position":69,"original_position":69,"commit_id":"f09db323e9d7a0d040558fc3d3a8bfe535b8eeef","original_commit_id":"f09db323e9d7a0d040558fc3d3a8bfe535b8eeef","user":{"login":"madmaxoft","id":4388386,"avatar_url":"https://avatars.githubusercontent.com/u/4388386","gravatar_id":"c43b1605321176ee0ee18b359bb1fae4","url":"https://api.github.com/users/madmaxoft","html_url":"https://github.com/madmaxoft","followers_url":"https://api.github.com/users/madmaxoft/followers","following_url":"https://api.github.com/users/madmaxoft/following{/other_user}","gists_url":"https://api.github.com/users/madmaxoft/gists{/gist_id}","starred_url":"https://api.github.com/users/madmaxoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madmaxoft/subscriptions","organizations_url":"https://api.github.com/users/madmaxoft/orgs","repos_url":"https://api.github.com/users/madmaxoft/repos","events_url":"https://api.github.com/users/madmaxoft/events{/privacy}","received_events_url":"https://api.github.com/users/madmaxoft/received_events","type":"User","site_admin":false},"body":"Don't upload in UTF-8, upload in ASCII.","created_at":"2014-02-28T14:03:42Z","updated_at":"2014-02-28T14:03:42Z","html_url":"https://github.com/mc-server/MCServer/pull/731#discussion_r10164547","pull_request_url":"https://api.github.com/repos/mc-server/MCServer/pulls/731","_links":{"self":{"href":"https://api.github.com/repos/mc-server/MCServer/pulls/comments/10164547"},"html":{"href":"https://github.com/mc-server/MCServer/pull/731#discussion_r10164547"},"pull_request":{"href":"https://api.github.com/repos/mc-server/MCServer/pulls/731"}}}}