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

feat(code): Custom outfit/ship prices and sell type #122

Open
wants to merge 49 commits into
base: experimental
Choose a base branch
from

Conversation

TheGiraffe3
Copy link

@TheGiraffe3 TheGiraffe3 commented Nov 2, 2024

Enhancement

Summary

A re-PR to Delta of endless-sky#6404.

See the original PR for more details.

Examples

pricing outfits "remnant broken jump drives"
  import
  location
    government "Remnant"
  conditions
    has "Remnant Bounty Hunter: completed"
  
  value
    "Jump Drive (Broken)" 1000000
pricing outfits "remnant broken jump drives"
  import
  location
    government "Remnant"
  conditions
    has "Remnant Bounty Hunter: completed"
  
  offset
    "Jump Drive (Broken)" 0.1%

Testing Done

None so far, though the original PR was tested throughly.

This is a squash-merge to a Delta branch of the pull request endless-sky#6404

Co-authored-by: Hurleveur <[email protected]>
Co-authored-by: Hurleveur <[email protected]>
Co-authored-by: Ben Hauch <[email protected]>
Co-authored-by: tibetiroka <[email protected]>
Co-authored-by: warp-core <[email protected]>
Co-authored-by: Amazinite <[email protected]>
Co-authored-by: EjoThims <[email protected]>
@Zitchas
Copy link
Member

Zitchas commented Nov 2, 2024

Awesome! Thanks for taking this on!

I'm not sure what the problem is at the moment, and there isn't anything by GitHub actions in the files right now.
Checks should pass now.
@TheGiraffe3
Copy link
Author

TheGiraffe3 commented Nov 2, 2024

Looks like ship support may be harder than I thought it would be.
TheGiraffe3#31

Checks are failing on one problem and don't seem to be giving an error message.
@TheGiraffe3 TheGiraffe3 changed the title feat(code): Custom outfit prices and sell type feat(code): Custom outfit/ship prices and sell type Nov 4, 2024
@TheGiraffe3 TheGiraffe3 marked this pull request as ready for review November 4, 2024 10:54
@TheGiraffe3
Copy link
Author

Does anybody have ideas on how to fix the failing checks?
It appears that they don't like CustomOutfitSaleManager::customOutfitSales but I'm pretty sure I defined it correctly, and I'm not sure how to redefine it.

@Zitchas
Copy link
Member

Zitchas commented Nov 4, 2024

I'm going to take a look at it, but my coding skill is weak. Might need to get a better coder to take a look at offer advice.

@Zitchas
Copy link
Member

Zitchas commented Nov 4, 2024

OK, Visual Studio provides a bit more detail:
error : undefined symbol: private: static class std::map<enum CustomOutfitSale::SellType, class CustomOutfitSale, struct std::less<enum CustomOutfitSale::SellType>, class std::allocator<struct std::pair<enum CustomOutfitSale::SellType const, class CustomOutfitSale>>> CustomOutfitSaleManager::customOutfitSales

And a list of places that it is referenced by (CustomSaleManager 38, 147, 53) (referenced 5 more times beyond that, but it only lists those)

Followed by the similar error:

error : undefined symbol: private: static class std::map<enum CustomShipSale::SellType, class CustomShipSale, struct std::less<enum CustomShipSale::SellType>, class std::allocator<struct std::pair<enum CustomShipSale::SellType const, class CustomShipSale>>> CustomShipSaleManager::customShipSales

in CustomSaleManager.cpp L65, 154, 80; and referenced 5 more times.

I hope this is helpful info, anyway.

Doing a search for the error message turned up this stackoverflow article:
https://stackoverflow.com/questions/20439003/clang-linking-error-for-c-static-class-undefined-symbols

@TheGiraffe3
Copy link
Author

TheGiraffe3 commented Nov 4, 2024

That gave me a really random idea, so we'll see if it's that.
I think maybe the problem is that functions were private and not accessible by others.

This whole section will need to be moved up... if it works.
@Zitchas
Copy link
Member

Zitchas commented Nov 4, 2024

@Hurleveur I know you're busy and can't do a deep dive on code or anything, but if you could take a look and offer a few pointers or insight sometime, it'd be much appreciated.

edit: TheGiraffe3: Don't hold up your work waiting for Hurleveur, as there's really no timeline as to when they may be able to provide some advice. It may be weeks or months. But they're probably the most familiar with how it works, so hopefully someday they'll be able to comment.

edit: I just downloaded your recent changes and ran it through VS's build process, and it's turning up the exact same errors as before.

I'm not sure why, but something in my head is nagging me thinking that those things being private is fine, but there needs to be something public but internal to those sections that calls them and makes their stuff available to be called.

@Hurleveur
Copy link
Member

There's not really an easy way to fix it, I could explain but someone would need a good setup to use for debugging along with understanding of what's going on in order to resolve it.
It could be broken due to smth else changing in the game or bad conflict management on my part.
The different integration tests allow knowing what exactly is broken but figuring out how requires knowing how they interact with one another.

@Zitchas
Copy link
Member

Zitchas commented Nov 4, 2024

I think for the moment, I'm more concerned about the build failures than the integration tests. Both are important, I know; but picking a place to start, the build failures seems the logical place.

@warp-core
Copy link

warp-core commented Nov 4, 2024

static class fields need to be initialised outside of the class definition. Or, they can be made inline and initialised inside the class definition.

@warp-core
Copy link

warp-core commented Nov 4, 2024

You only need to make CustomOutfitSaleManager:customOutfitSales and CustomShipSaleManager::customShipSales inline, not any of the methods.

@Zitchas
Copy link
Member

Zitchas commented Nov 22, 2024

Hmmm, the one error that generates comes from here:

 Warning: Unrecognized condition expression:
file "D:/a/Endless-Sky-Delta/Endless-Sky-Delta/data/custom sales.txt"
L53:   pricing outfits "Remnant Jump Drives"
L57:     conditions
L58:       1 = 1

data/custom sales.txt Outdated Show resolved Hide resolved
@TheGiraffe3
Copy link
Author

Yet it had worked before...
I'll try it; I had assumed that no condition would also cause an error.

source/PlayerInfo.cpp Outdated Show resolved Hide resolved
source/PlayerInfo.cpp Outdated Show resolved Hide resolved
@Zitchas
Copy link
Member

Zitchas commented Dec 17, 2024

Yes, Github does things in strange ways, sometimes...

In any case, I'm happy to see this moving along again. Looking forward to having it.

Not sure why Ubuntu thought it was fine, though.
@Zitchas
Copy link
Member

Zitchas commented Jan 2, 2025

How's it working now?

@TheGiraffe3
Copy link
Author

TheGiraffe3 commented Jan 3, 2025

Outfit sales are working perfectly. Ship sales, though, have problems, presumably because they're not allowed to be in stock the way outfits are.
So this is either waiting for me to figure out how to implement ship stock and then reimplement custom outfit sales, or remove the ship stock implementation altogether.
But I'm not sure we want ship stock; and it's been rejected upstream a number of times.

So essentially right now this PR does the exact same thing as 6404, with some extra code that doesn't work.

@Zitchas
Copy link
Member

Zitchas commented Jan 3, 2025

OK, thanks for the update!

While I'd certainly like both outfits and ships, it doesn't have to be all together. So I'd be inclined to say if ships are being problematic while outfits are working perfectly, then strip out the ships part and work on that in a new PR, and the outfit section here can be merged.

That being said, could you expand on "ship stock" a bit? Do you mean having limited numbers of ships, like we do with outfits temporarily if we sell some outfits that aren't normally available somewhere?

@TheGiraffe3
Copy link
Author

Yes. One of the main problems, if I remember correctly, was getting the Cloaking Device off the Arfecta and keeping both of them.

@Hurleveur
Copy link
Member

I dont know if it's a good idea to do both at first, you'd have many more potential bugs
I did test this a lot but that was ages ago

@Zitchas
Copy link
Member

Zitchas commented Jan 12, 2025

Ok. Ship stock seems like something that would be useful and good basically all the time except for that one ship. So, nice to have, but not essential.

Idea: how hard do you think it might be too create exceptions? Basically a ship attribute that specifies that it can't be sold for resale, only for scrap. (As in the ship when sold is gone forever, leaving outfits.)

@Zitchas
Copy link
Member

Zitchas commented Feb 2, 2025

Since the ship side seems to have a few problems and challenges, could you strip out the ship side and have this just be outfits please?

@Zitchas Zitchas added this to the v0.10.11.6-Delta milestone Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants