GithubHelp home page GithubHelp logo

Crash about betterreforges HOT 4 CLOSED

valks-terraria-mods avatar valks-terraria-mods commented on July 24, 2024
Crash

from betterreforges.

Comments (4)

Catbuttes avatar Catbuttes commented on July 24, 2024

It looks as though you are going beyond your defined array bounds when you are trying to access them via rand.Next. As an example, in reforge.cs you have the definition

static int[] accessoryModifiers = { PrefixID.Warding, PrefixID.Menacing, PrefixID.Quick, PrefixID.Lucky, PrefixID.Arcane };

which has a length of 5. You then access it using

int index = rand.Next(0, accessoryModifiers.Length);
                return accessoryModifiers[index];

which will return a value between 0-5 inclusive for a total of 6 options. As C# indexes arrays from 0, if you attempt to access the element at array.Length then you are always going to be beyond the bounds of the array. in the given example, you want to change the call to rand.Next to

int index = rand.Next(0, accessoryModifiers.Length-1);
                return accessoryModifiers[index];

This will need doing in all places where you are making references to arrays as any one of them could cause a crash.

from betterreforges.

valkyrienyanko avatar valkyrienyanko commented on July 24, 2024

I did what you said.

After further testing I found out that the Lightning Aura Rod (Summon) crashes when given a mythical modifier but not demonic modifier but the Flameburst Rod (Summon) can take either mythical or demonic modifier without crashing.

Every other damage type seems fine with no crashes.

from betterreforges.

valkyrienyanko avatar valkyrienyanko commented on July 24, 2024

It seems like the array.Length - 1 code you suggested had no effect on the crash and in fact just took away 1 from the actual array and never went out side bounds in the first place.

from betterreforges.

valkyrienyanko avatar valkyrienyanko commented on July 24, 2024

The mystical modifier seems to be like the only issue here so I replaced it with the demonic modifier and am no longer get any problems.

from betterreforges.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.