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

Reverting PR #4264

Conversation

tornadia
Copy link
Contributor

Pull Request Prelude

Changes Proposed

Fixes #4263
Reverts https://github.com/otland/forgottenserver/pull/3495/files

Issues addressed: 4263

@EPuncker
Copy link
Contributor

@danyelvarejao can you check this please

@ranisalt
Copy link
Member

ranisalt commented Dec 12, 2022

Summary of changes:

Before: if either force load or reloading AND the monster is not loaded, then load. That means that if the monster was already loaded, then forceLoad has no effect.

After: forceLoad is enough to load the monster, even if it was already loaded. Read it as if (forceLoad || (reloading && monsters.find(it.first) != monsters.end())) {

@danyelvarejao
Copy link
Contributor

I think it should be like @ranisalt said.

if (forceLoad || (reloading && monsters.find(it.first) != monsters.end())) {

@tornadia
Copy link
Contributor Author

I think it should be like @ranisalt said.

if (forceLoad || (reloading && monsters.find(it.first) != monsters.end())) {

It literally makes no difference to wrap that statement around parentheses as that is what the order of operators is already doing, i.e. BEDMAS/PEDMAS in math, AND (&&) operators have precedence over OR (||)

@ranisalt
Copy link
Member

For reference: https://en.cppreference.com/w/cpp/language/operator_precedence

It would be good to wrap for clarity, it's not that obvious

Copy link
Member

@ranisalt ranisalt left a comment

Choose a reason for hiding this comment

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

To whoever merges this, please add a proper commit message

@EPuncker EPuncker merged commit ec1a624 into otland:master Apr 5, 2023
@EPuncker
Copy link
Contributor

EPuncker commented Apr 5, 2023

To whoever merges this, please add a proper commit message

I love chatGTP

EPuncker pushed a commit to EPuncker/forgottenserver that referenced this pull request May 23, 2023
This commit updates the monster loading behavior to now fully consider the 'forceLoad' flag, regardless of whether the monster was already loaded or not. Previously, if the monster was already loaded, the 'forceLoad' flag had no effect. Now, the updated behavior reads as follows: "if (forceLoad || (reloading && monsters.find(it.first) != monsters.end()))", meaning that if 'forceLoad' is set to true, the monster will be loaded even if it was already loaded before. This change improves the consistency and flexibility of the monster loading system.
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.

PR#3495 broke forceMonsterTypesOnLoad
4 participants