Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upRemove optional maxitems from map::add_item{,_at} #10700
Conversation
kevingranade
added
the
(S2 - Confirmed)
label
Jan 1, 2015
This comment has been minimized.
This comment has been minimized.
|
Also, it occurs to me I should've named the branch "add-items-ate-my-chunks-of-meat". Because it did. |
KA101
self-assigned this
Jan 1, 2015
narc0tiq
referenced this pull request
Jan 1, 2015
Merged
Update active items periodically instead of constantly. #10599
KA101
merged commit 54e5e52
into
CleverRaven:master
Jan 1, 2015
1 check passed
default
This has been rescheduled for testing as the 'master' branch has been updated.
kevingranade
removed
the
(S2 - Confirmed)
label
Jan 1, 2015
narc0tiq
deleted the
narc0tiq:add-items-ate-my-cookies
branch
Jan 1, 2015
This comment has been minimized.
This comment has been minimized.
|
Oh crap, thanks a ton for fixing this. I blew about an hour trying to |
This comment has been minimized.
This comment has been minimized.
|
Yeah, it took a while just to find a good reproduction, but then afterwards On Thu, Jan 1, 2015 at 8:27 PM, Kevin Granade notifications@github.com
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
narc0tiq commentedJan 1, 2015
It turns out the parameter wasn't really being useful anymore. It's an artifact from when the
add_item_atcode would actually perform item overflow itself -- later, that got moved up intomap::add_item_or_charges, but the parameter was kept... with a simple "return;" in place of the overflow code.Ordinarily, this wouldn't be a problem -- the only way to call into
map::add_itemwas frommapitself, namely frommap::add_item_or_charges. Which checked for overflow and didn't even call intoadd_itemif it would enter that code path.However, recently,
map::add_itemgot made public (#10293) so it could be used to bypass terrain flag checks (specifically, theNOITEMchecks that would cause items to spill over into adjacent tiles. Remember gas pumps with their fuel next to them? Yeah, that bug). When the new calls toadd_itemwere added, they omitted the optional parameter, so the code defaulted to... 64.This was still not a problem! Most functions using this were doing it in mapgen, where the aforementioned fuel was placed onto the aforementioned gas pump, or similar places -- there would only ever be one (or, very rarely, two) items in the given tile. The evil bug would still not be activated until...
...active item processing needed a faster way to insert items back into the map (#10599). So it used
map::add_item_at, because that's nice and quick. It makes perfect sense, too: there's no need to check most potential issues with dropping items into the given tile because we got the items from that tile -- ergo, they are supposed to be there.BUT:
Edit: Oh, I missed a reference: http://smf.cataclysmdda.com/index.php?topic=9022.0