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

Unique->MonsterType mapping is not position independant #6822

Open
AJenbo opened this issue Nov 19, 2023 · 3 comments
Open

Unique->MonsterType mapping is not position independant #6822

AJenbo opened this issue Nov 19, 2023 · 3 comments

Comments

@AJenbo
Copy link
Member

AJenbo commented Nov 19, 2023

Operating System

Windows x64

DevilutionX version

1.5.1

Describe

Modifying the order of monsters will cause the unique monsters type to point to the incorrect monster as it does not search by ID but instead just indexes directly into the table.

image

To Reproduce

Order the monsdat.tsv by one of the columns alphabetically should give some interesting unique monsters :)

Expected Behavior

No response

Additional context

No response

@qndel qndel changed the title Unique->MonsterTyep mapping is not position independant Unique->MonsterType mapping is not position independant Nov 19, 2023
@DakkJaniels
Copy link
Contributor

So should an id column be added to maintain order?

@AJenbo
Copy link
Member Author

AJenbo commented Nov 20, 2023

There already is an ID colum (at least in the TSV data), we just need to search the array for the right monster rather then just assuming that it's on MonsterData[MT_BASEMONSTER]

for (auto &baseMonster : MonsterData) {
   if (baseMonster.ID == MT_BASEMONSTER)
    // oh here it is
}

If it's not in the struct then it need to be added and we need to parse for it. We should probably also add a MT_CUSTOMMONSTER or something like that so new monsters won't have to pretend to be some original monster type.

On a related not currently the game will crash and burn if you try to cut down the list. So we probably should handle cases where a monster type isn't found (but just concluding that there won't be a Snotspill quest if there is no Fallen Ones, or something to that effect.

@AJenbo
Copy link
Member Author

AJenbo commented Nov 20, 2023

... looks like we do need to add it :)

reader.advance(); // Skip the first column (monster ID).

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

No branches or pull requests

2 participants