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 upZ-level update: lots of overloads #11705
Conversation
Coolthulhu
added some commits
Mar 4, 2015
This comment has been minimized.
This comment has been minimized.
|
Just stating the obvious here, but I hope this get merged soon, because 1) It's awesome and 2) A big PR like this tend to get unmergeable very quick. |
This comment has been minimized.
This comment has been minimized.
|
Agreed! |
BevapDin
reviewed
Mar 21, 2015
| @@ -8668,7 +8668,8 @@ point game::look_around(WINDOW *w_info, const point pairCoordsFirst) | |||
| const int offset_x = (u.posx() + u.view_offset_x) - getmaxx(w_terrain) / 2; | |||
| const int offset_y = (u.posy() + u.view_offset_y) - getmaxy(w_terrain) / 2; | |||
|
|
|||
| int lx = u.posx() + u.view_offset_x, ly = u.posy() + u.view_offset_y; | |||
| int lx = u.posx() + u.view_offset_x, ly = u.posy() + u.view_offset_y, lz = u.posz() + 0; | |||
| tripoint lp( lx, ly, lz ); | |||
This comment has been minimized.
This comment has been minimized.
BevapDin
Mar 21, 2015
Contributor
You could avoid the overriding of lp below by using this neat reference trick:
tripoint lp( u.posx() + u.view_offset_x, ... );
int &lx = lp.x;
int &ly = lp.y;
int &lz = lp.z;If you write to lx, it will automatically update lp because lx and lp.x are the same place in memory.
BevapDin
reviewed
Mar 21, 2015
| return it->second.first; | ||
| } | ||
|
|
||
| debugmsg( "vehicle part cache cache indicated vehicle not found: %d %d %d", p.x, p.y, p.z ); |
This comment has been minimized.
This comment has been minimized.
BevapDin
Mar 21, 2015
Contributor
"cache cache"? Is that something like a cache of a cache, it caches caches? (-:
This comment has been minimized.
This comment has been minimized.
BevapDin
reviewed
Mar 21, 2015
| nulfield = field(); | ||
| return nulfield; | ||
| } | ||
|
|
||
| int lx, ly; | ||
| submap *const current_submap = get_submap_at( x, y, lx, ly ); | ||
| submap *const current_submap = get_submap_at( p.x, p.y, p.z, lx, ly ); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Coolthulhu
Mar 21, 2015
Author
Contributor
Had a bit of "branching hell" there for a while. Some of the changes are from earlier branches (before I created some of the useful overloads).
This comment has been minimized.
This comment has been minimized.
|
This looks fine. Does not really belong in this PR, just some things I noticed (should probably addressed, if at all, after this has been merged to prevent conflicts): Have you noticed that Having the look up of the submap and the calculation of the submap local coordinates
Similar some functions that take a furniture / terrain / trap id string (e.g. This might reduce the code size a bit: make if( !inbounds( p ) ) {
return false; // or whatever
}
int lx, ly;
submap *const current_submap = get_submap_at( p, lx, ly );One can write: int lx, ly;
submap *const current_submap = get_submap_at( p, lx, ly );
if( current_submap == nullptr ) {
return false; // or whatever
}Nah, probably not a good idea. |
Coolthulhu
added some commits
Mar 22, 2015
This comment has been minimized.
This comment has been minimized.
|
Merge please before it gets un-mergeable... |
Coolthulhu commentedMar 21, 2015
Quite a bit of overloads. No in-game effect yet.
Includes #11472
Doesn't yet implement everything in #6818 but is close.