Skip to content
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

Copy/paste single elements #4737

Merged
merged 7 commits into from
Nov 14, 2016
Merged

Conversation

Broxzier
Copy link
Member

This PR adds a copy/paste ability to the tile inspector, a feature requested on NEDesigns. One element can be copied to the in-game clipboard at a time, and the clipboard will get cleared when a new map is loaded.

@Broxzier Broxzier force-pushed the copy_element branch 2 times, most recently from 74cdfd6 to cfe7784 Compare October 31, 2016 22:13
}

static void window_tile_inspector_paste_element(rct_window *w) {
rct_map_element *const pastedElement = map_element_insert(windowTileInspectorTileX, windowTileInspectorTileY, tileInspectorCopiedElement.base_height, 0);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably returns NULL when the limit has been reached. I've got to test this out, and display an error when that happens.

@@ -570,6 +578,10 @@ void window_tile_inspector_open() {
window_tile_inspector_auto_set_buttons(window);
}

void window_tile_inspector_clear_clipboard() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opening braces of functions should go onto their own line. (I'm leaving this comment once, but it applies to every instance in this PR, of course.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gymnasiast Whoops, will fix it when I get home.

@duncanspumpkin
Copy link
Contributor

Your copy and paste images, did you make them yourself?

@Broxzier
Copy link
Member Author

Broxzier commented Nov 1, 2016

@duncanspumpkin: Yes, I made the copy icon from scratch, and the paste one based on: http://icons.veryicon.com/ico/Application/Toolbar%20Icons/Paste.ico First I simply applied the game pallet to the ico file to get the correct colours, then drew this one by hand too, and copied one page from the copy icon onto it.

@Broxzier
Copy link
Member Author

Broxzier commented Nov 10, 2016

In case anyone is willing to test this, the 64-bit build can be downloaded here. As this was quite straightforward I don't expect many issues. If someone can take a look at where the clipboard gets cleared, then that would be nice. I tried to find all locations where a new park is loaded (and found a lot of duplicated code while doing so).

@Margen67
Copy link
Contributor

Margen67 commented Nov 11, 2016

Pasted park entrances have an ID of -1 and crash the game if guests enter through it.

@Broxzier
Copy link
Member Author

All non-central park entrances have a park index of -1, and I am unable to reproduce this crash. Everything seems to work fine, even when I make a guest make contact with the entrance.

@Margen67
Copy link
Contributor

They have to enter through it not just touch it

@Broxzier
Copy link
Member Author

Broxzier commented Nov 12, 2016

@Margen67: I'm still unable to reproduce the crash. Park entrance is indeed -1, because it's looking for the park entrance array using its position as the key, but it can't find anything, hence why it's -1.
Setup example
All guests in the picture walked through it. I'll keep on trying different things, but if you can provide an example, that would be helpful. Got it to work, there was still a footpath element.
Even leaving through a copied entrance seems to work fine:
Entrance

I'm not entirely sure if this is really a bug to do with the tile inspector, it sounds more like something that has to do with the peeps (code I barely touched).

It gets stuck here: https://github.com/OpenRCT2/OpenRCT2/blob/develop/src/peep/peep.c#L8083-L8088

@Broxzier
Copy link
Member Author

With the last fix, the game does not crash anymore (they turn around when reaching it), however guests are able to exit through it, and then will get stuck if there is no path leading from the copied entrance to their entry point. Personally I don't think this is important enough to be fixed (at this point at least).

@IntelOrca IntelOrca merged commit 4d7f529 into OpenRCT2:develop Nov 14, 2016
@Broxzier Broxzier deleted the copy_element branch December 26, 2016 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants