summaryrefslogtreecommitdiff
path: root/Userland/Games/Spider
AgeCommit message (Collapse)Author
2023-05-05LibGUI: Make `Application`'s construction fallibleLucas CHOLLET
The pattern to construct `Application` was to use the `try_create` method from the `C_OBJECT` macro. While being safe from an OOM perspective, this method doesn't propagate errors from the constructor. This patch make `Application` use the `C_OBJECT_ABSTRACT` and manually define a `create` method that can bubble up errors from the construction stage. This commit also removes the ability to use `argc` and `argv` to create an `Application`, only `Main`'s `Arguments` can be used. From a user point of view, the patch renames `try_create` => `create`, hence the huge number of modified files.
2023-04-21Spider: Fix crash when completing a deckJamie Mansfield
This resolves a regression caused by 8a48246ed1a93983668a25f5b9b0af0e745e3f04.
2023-04-19LibGUI+Userland: Make Window::*add_menu take name using new stringKarol Kosek
2023-03-06Everywhere: Stop using NonnullRefPtrVectorAndreas Kling
This class had slightly confusing semantics and the added weirdness doesn't seem worth it just so we can say "." instead of "->" when iterating over a vector of NNRPs. This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
2023-02-01Spider: Make double-click skip the new-game animationSam Atkins
2023-02-01Spider: Use a single State enum instead of a series of booleansSam Atkins
2023-01-26LibGfx: Remove `try_` prefix from bitmap creation functionsTim Schumacher
Those don't have any non-try counterpart, so we might as well just omit it.
2023-01-22LibCards+Games: Return ErrorOr from CardStack::add_all_grabbed_cards()Sam Atkins
...and CardGame::pick_up_cards_from_stack() which is its only caller.
2023-01-22LibCards+Games: Return ErrorOr from deck-creation factory functions :^)Sam Atkins
Also, be smarter about appending cards to the deck: we can unchecked_append them to the deck, since we already ensured enough capacity earlier.
2023-01-22LibCards+Game: Return ErrorOr from CardGame::drop_cards_on_stack()Sam Atkins
2023-01-22LibCards+Games+GamesSettings: Return ErrorOr from CardStack::push()Sam Atkins
Very few of these calls can propagate their errors yet, but one step at a time. :^)
2023-01-15Spider: Confirm ending the current game in more situationsSam Atkins
As for Solitaire, we previously had a warning when trying to exit Spider while a game was in progress. This adds the same functionality to other actions that would end the current game: Starting a new one, or changing the number of suits. When changing the number of suits, we do apply the setting, so it will take effect for the next game that is started.
2023-01-12LibCore+Userland: Make Core::Timer::create_repeating() return ErrorOrSam Atkins
The FIXMEs must flow!
2023-01-07LibGUI+Userland: Rename `try_load_from_gml()` -> `load_from_gml()` :^)Sam Atkins
It's the only one, so the `try` prefix is unnecessary now.
2023-01-06LibGUI+Everywhere: Use fallible Window::set_main_widget() everywhere :^)Sam Atkins
Rip that bandaid off! This does the following, in one big, awkward jump: - Replace all uses of `set_main_widget<Foo>()` with the `try` version. - Remove `set_main_widget<Foo>()`. - Rename the `try` version to just be `set_main_widget` because it's now the only one. The majority of places that call `set_main_widget<Foo>()` are inside constructors, so this unfortunately gives us a big batch of new `release_value_but_fixme_should_propagate_errors()` calls.
2023-01-06Spider: Highlight valid target stack when hovering over itSam Atkins
This is largely copied and pasted from Solitaire. Moving this into LibCards somehow would be nice but I can't think of a nice way to do so right now.
2023-01-06Spider: Make Game creation fallibleSam Atkins
2023-01-06Spider: Save and load u32 config values as u32sSam Atkins
2023-01-06LibCards+Games: Make `CardGame::add_stack()` fallibleSam Atkins
And while we're at it, handle the CardStack allocation (and failure thereof) internally.
2023-01-05Games: Add a Cards Settings menu item to Hearts, Solitaire, and SpiderTimothy Flynn
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-11-01Everywhere: Mark dependencies of most targets as PRIVATETim Schumacher
Otherwise, we end up propagating those dependencies into targets that link against that library, which creates unnecessary link-time dependencies. Also included are changes to readd now missing dependencies to tools that actually need them.
2022-10-25Userland: Let applications make use of make_command_palette_action()demostanis
2022-10-15Spider: Make the last move undoableGunnar Beutner
The lets the user undo the last card move. Card moves which cause cards to be moved to the waste stack cannot be undone.
2022-10-12Userland: Properly populate GENERATED_SOURCESAli Mohammad Pur
We previously put the generated headers in SOURCES, which did not mark them as GENERATED (and did not produce a proper dependency). This commit moves all generated headers into GENERATED_SOURCES, and removes useless header SOURCES.
2022-10-10LibCards+Games: Remove concept of a CardStack being focusedSam Atkins
This was only used for asking the stack if it is the one we are moving cards from. We now have a better way to do that, by comparing against `CardGame::moving_cards_source_stack()`, which doesn't require manually telling a stack that it is/isn't focused.
2022-10-10Spider: Use CardGame dragging functionalitySam Atkins
2022-10-10LibCards+Games: Move `mark_intersecting_stacks_dirty()` to CardGameSam Atkins
As part of this, made a const overload for `Card::rect()`. We need the non-const one too as it's used for modifying the position of a card that's being dragged. I plan on changing that soon but we'll see.
2022-10-10LibCards+Spider: Move `ensure_top_card_is_visible()` logic to CardStackSam Atkins
2022-10-10LibCards+Games: Rename "draw" methods to "paint" for claritySam Atkins
"Draw" is already a card-game term so using it for graphics was confusing me a lot!
2022-10-10LibCards+Games: Make CardGame responsible for managing CardStacksSam Atkins
Just moving some code around really.
2022-10-10LibCards+Games: Move "create a deck" logic to LibCardsSam Atkins
`create_standard_deck()` is the usual 52-card deck, but more custom setups (such as Spider's multiples-of-one-suit) can be created by passing suit counts to `create_deck()`.
2022-08-22LibCards+Games: Replace card "value" int with a Rank enumSam Atkins
Because `card->value() == 11` is a lot less clear than `card->rank() == Cards::Rank::Queen`, and also safer. Put this, along with the `Suit` enum, in the `Cards` namespace directly instead of inside `Cards::Card`. Slightly less typing that way.
2022-08-22Spider: Migrate to CardGameSam Atkins
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-06-28Applications: Remove usages of deprecated implicit conversionsFrHun
These deprecated conversions are currently in place to make the system compile, but they are to be removed soon. This prepares that.
2022-05-29Everywhere: Fix a bunch of typosLinus Groh
2022-05-13LibGUI+Userland: Make Dialog::ExecResult an enum classSam Atkins
2022-03-18LibCards+Games: Change name of card type to card suitLenny Maiorani
Playing cards have a `suit` such as `hearts`/`diamonds`, not a `type`. Make the internal naming consistent with the way playing cards are typically named.
2022-03-18Libraries: Change enums to enum classes in LibCardsLenny Maiorani
2022-03-18Games: Add reload icon to 'New Game' actionsLinus Groh
2022-02-24LibGUI+Apps: Convert Statusbar Labels to Segmentsthankyouverycool
Segments inherit from Button and let us add clickable widgets to status bars. This patch also adds proportional, fixed and autosized modes for segments and lets the status bar consume all non-clickable segments for override text.
2022-02-16Games: Use default constructors/destructorsLenny Maiorani
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
2022-02-13Userland: Run gml-formatIdan Horowitz
This brings the existing GML files up to spec with the new requirements
2022-02-11LibConfig: Rename pledge_domains(String) => pledge_domain(String)Vitaly Dyachkov
pledge_domains() that takes only one String argument was specifically added as a shortcut for pledging a single domain. So, it makes sense to use singular here.
2022-02-07Meta+Userland: Run the GML formatter on CI and pre-commitkleines Filmröllchen
Now that the GML formatter is both perserving comments and also mostly agrees to the existing GML style, it can be used to auto-format all the GML files in the system. This commit does not only contain the scripts for running the formatting on CI and the pre-commit hook, but also initially formats all the existing GML files so that the hook is successfull.
2022-01-08Spider: Add functionality to automatically move cards to valid stacksNeolyum
This commit adds the possibility to use the secondary mouse button to let the game move the selected card(s) to the next valid stack.
2022-01-02Spider: Redraw completely when drawing cardsJamie Mansfield
Spider was only updating the new bounding box area after drawing cards from the deck - leaving behind a sliver of the old deck. This was a regression, as the game previously used the old bounding box, introduced by GH-11153.
2021-12-24Spider: Add animation when drawing cardsNihal Jere
2021-12-18Spider: Convert to try_create_default_iconAstraeus-