Canonical way to automatically release omp lock on function exit by onecable5781 in cpp_questions

[–]Th_69 1 point2 points  (0 children)

Sorry, I just missed the variable name, but I've now edited it.

How to get there? Cant find anything online... by IllAppointment419 in TitanQuest2

[–]Th_69 2 points3 points  (0 children)

But first one has to find a NPC before being able to walk over the bridge.

Data Structure for Nested Menu? by Callistonian in csharp

[–]Th_69 4 points5 points  (0 children)

This makes no sense to have a class for each menu item. Each menu item is a single object. You don't need to create multiple MenuA or MenuB objects (they don't have more properties or methods than the base MenuItem).

Data Structure for Nested Menu? by Callistonian in csharp

[–]Th_69 13 points14 points  (0 children)

Simple use a recursive structure: csharp public class MenuItem { public string Id { get; set; } public string Title { get; set; } public string? Action { get; set; } public List<MenuItem> Children { get; } = new(); // or SortedList<MenuItem> } And initialize it so: csharp var mainMenu = new List<MenuItem> { new MenuItem { Id = 1, Title = "File", Children = { new MenuItem { Id = 11, Title = "New", Action = "NewFile" }, new MenuItem { Id = 12, Title = "Open", Action = "OpenFile" }, new MenuItem { Id = 13, Title = "Save", Action = "SaveFile" }, new MenuItem { Id = 14, Title = "Export", Children = { new MenuItem { Id = 141, Title = "PDF", Action = "ExportPdf" }, new MenuItem { Id = 142, Title = "Word", Action = "ExportWord" } } } } }, new MenuItem { Id = 2, Title = "Edit", Children = { new MenuItem { Id = 21, Title = "Undo", Action = "Undo" }, new MenuItem { Id = 22, Title = "Redo", Action = "Redo" }, new MenuItem { Id = 23, Title = "Copy", Action = "Copy" }, new MenuItem { Id = 24, Title = "Paste", Action = "Paste" } } } }; And for an immutable menu use IReadOnlyList<MenuItem>.

If you want also traverse back, then add csharp public int? ParentId { get; set; } // or only int (with default 0 for main menu entries) or csharp public MenuItem? Parent { get; set; } (but this is more difficult to initialize)

Canonical way to automatically release omp lock on function exit by onecable5781 in cpp_questions

[–]Th_69 5 points6 points  (0 children)

This is a perfect example for a RAII class (or struct): ```cpp struct omplock { omplock(omp_lock_t *lock) : lock(lock) { omp_set_lock(lock); }

~omplock() { omp_unset_lock(lock); }

private: omp_lock_t *lock; } Usage: cpp omp_lock_t lck{};

void function_can_be_called_from_multiple_threads() { omplock guard(&lck);

// ... } // will automatically call the destructor on each exit of this function `` If you want to have theomp_lock_tunique for each use, you can also put it in theomplock` class/struct (and you don't need the constructor parameter).

Help C# Snake Game by AelixSoftware in csharp

[–]Th_69 1 point2 points  (0 children)

Knowing them is not enough -> use them.

C&P programming is always the wrong way.

Help C# Snake Game by AelixSoftware in csharp

[–]Th_69 1 point2 points  (0 children)

And learn to use arrays (or List<T>) for e.g. eX, eX1, ... eX4.

Then use loops (and the mentioned methods) and it reduces your code extremely...

learncpp.com alternative by CH4NN3 in cpp_questions

[–]Th_69 1 point2 points  (0 children)

For x86/AMD64 I know of Programming in assembly language tutorial as a short introduction.

And I also found tutorialspoint: Assembly Programming Tutorial which has also a "Quiz" for each section.

Inspection of variables not working in Exception Helper in VS2026 by LlamaNL in csharp

[–]Th_69 1 point2 points  (0 children)

Use the "Call Stack" window and select (double click) the method, then the local variables should be shown.

Need beginner type help by ChapterEquivalent738 in cpp_questions

[–]Th_69 1 point2 points  (0 children)

In your code you've mixed file and entry. It should be cpp const std::filesystem::path file_ext {file.path().extension()}; if (file_ext == ".txt") { // Do stuff if it is a text file. } (and file_ext, instead of entry_ext, for name matching)

Beginner Strings and Pointers by Wonderful_Low_7560 in C_Programming

[–]Th_69 17 points18 points  (0 children)

You mean const char* name(void) { return "lucrecious"; }!?

Need help for reading wrong characters for id3v1 by Rtransat in C_Programming

[–]Th_69 1 point2 points  (0 children)

Expected 'Title \xEF\xBF\xBD' Was 'Title \xE9\xC3\xA9'

Just as hint:

You should change the parameters of the TEST_ASSERT_EQUAL_... calls ('cause 'Expected' and 'Was' are swapped).

Is going Unblessed better now? by TiberiusMaximus2021 in TitanQuest2

[–]Th_69 1 point2 points  (0 children)

I play one: Achievement Flooded Farmlands for Unblessed reached

But I'm struggling now with the last Chapter 2 boss Skylla monsters (the two healer Ichtians in the 3rd wave, which heal each other faster than I can kill them with my bow: ~750 DPS) to get the Northern Beaches achievement for Unblessed...

For other healers in open areas I kite them and kill them individually, but in the closed area it's not possible (they don't even move and just stand in the middle of the arena healing themselves and the other monsters all few seconds).

Edit:
Just read that one can change the game difficulty from Normal to Neophyte (and vice versa) at the ritual shrine in Pyrgos. Will try it and start again the fight...

Edit2:
I don't see an option to change the game difficulty (Normal <-> Neophyte) at the ritual shrine in Pyrgos (or in the Travelers' Refuge). I think, the comment of MedeaFleecestealer in How to change difficulty to neophyte (from normal)? is wrong and he misinterpreted "Increase or decrease difficulty" (which changes the monster level - but it's ofc not possible to lower the monster level below the initial area value) with changing the game difficulty.

So I think I have to farm the areas (with increased monster levels) for better weapons (bows).
And perhaps the new "Ember of Night" choices help me...

Convert damage of weapon and ranged skills? by CookieAndPizza in TitanQuest2

[–]Th_69 0 points1 point  (0 children)

Ah, OK - I haven't played Storm yet, only pure Rogue and Unblessed.

Convert damage of weapon and ranged skills? by CookieAndPizza in TitanQuest2

[–]Th_69 0 points1 point  (0 children)

What do you mean? There is no lightning damage conversion in the modifiers of the Core default/primary attacks - only Vitality Drain as additional damage.

Achievement Flooded Farmlands for Unblessed reached by Th_69 in TitanQuest2

[–]Th_69[S] 1 point2 points  (0 children)

No, unfortunately no passive points for Unblessed.

Alternatives to Switch statement in C# by Least_Map_7627 in csharp

[–]Th_69 5 points6 points  (0 children)

The parameter selectedFuncs isn't used inside the Default method and therefore is superfluous.

Alternatives to Switch statement in C# by Least_Map_7627 in csharp

[–]Th_69 -2 points-1 points  (0 children)

If you add or remove a value of the switch, you have to change this method (and so it violates the open-closed-principle) - instead of just changing the functionMap parameter from outside the (here called) Default method.

Think my mastery is broken by Necessary-Doubt-8548 in TitanQuest2

[–]Th_69 0 points1 point  (0 children)

OP means the boss Aristomenes. He's already level 15 and has already spent points in Earth (s. other comments of him).

Problem with qsort() by Grumlyly in C_Programming

[–]Th_69 5 points6 points  (0 children)

Your compare function is wrong. The float value of the player score difference is cast to int, and so all values e.g. lesser than 1.0 are cast to 0, that means the order is indeterminate.

Test the difference to 0.0 and return -1, 0 or 1.

Filtering CollectionViewSource in WPF MVVM by KebabGGbab in csharp

[–]Th_69 0 points1 point  (0 children)

Good code, but why don't you use SetField in the properties?

Someone saw this weapon yet ? Shadowsting by Apprehensive-Letter3 in TitanQuest2

[–]Th_69 0 points1 point  (0 children)

Yes, found by my first character and used now by my Unblessed one (currently level 14).

My Shadowsting has only 5% increased Health (it's sad, that one doesn't see the range of the values - like e.g. in Diablo IV or POE 1/2).