-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add paintTileMapPort to support world map tile painting (Develop) #4767
base: develop
Are you sure you want to change the base?
Add paintTileMapPort to support world map tile painting (Develop) #4767
Conversation
(no getTileMapPort yet)
Split up doSetTile_char() and doGetTile_char() for non-graphics mode tile grabbing
return true; | ||
} | ||
|
||
static bool doSetTile_map_port_default(const Pen &pen, int x, int y, int32_t * df::graphic_map_portst::*texpos_field) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of doSetTile_default()
is to enable GuiHooks
- it's the default implementation called if no hooks are defined. Since you don't appear to be worried about GuiHooks for your new functions (which is probably fine), you can likely drop the _default
functions.
Also, I would opt for consistent capitalization within function names, e.g. doSetTileMapPort
or doSetMapPortTile
. The _default
suffix is a special case for GuiHooks, to indicate we're defining "our" default implementation of a function that could be overridden.
which maps does this cover? |
{ "paintTileMapPort", screen_paintTileMapPort }, | ||
{ "readTileMapPort", screen_readTileMapPort }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs docs in Lua API.rst
if (lua_gettop(L) >= 4 && !lua_isnil(L, 4)) | ||
{ | ||
if (lua_type(L, 4) == LUA_TSTRING) | ||
pen.ch = lua_tostring(L, 4)[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if it's a zero-length string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will still be safe, since the string is null-terminated, but it will set pen.ch
to 0, which may or may not be what you want.
if (tile == 0) | ||
tile = vp->screentexpos_interface[index]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be checked first since it is the "default" layer
You are now able to paint world map tiles!
Closes #4703