Injabie3 / LLSIF-Helper

A program to help LLSIF gamers calculate things. WIP
1 stars 1 forks source link

error returning #12

Closed abuneri closed 8 years ago

abuneri commented 8 years ago

im wondering if we could change the way we check for data being invalid? for example...

//Function to set difficulty
//Function returns 0 if difficulty was set correctly.
//Function returns 1 if difficulty could not be set.
int scoreMatch::setDifficulty(int diff)
{
    if (diff >= 1 && diff <= 4)     //only sets difficulty to the corresponding integers, 1 to 4
        difficulty = diff;
    else
        return 1;
    return 0;
}

could just be a void function and in the "else" statement we could set diff = -1; we be nice to have a global way to look for error input as this "-1" method was already implemented in some spots

Injabie3 commented 8 years ago

Completely up to you. If you read the base class interface, I'm using all void functions to set member fields, but if you want me to change it to reflect an error as -1, it's easy to do. I just have to modify the interface a little though, of couse.

abuneri commented 8 years ago

cool, i checked out the Base class and theere were no instances of the old method yet (of coursee since its a new source file) and you hadn't indicated you were going to use that method in the interface. i changed it to the "-1" method in the scorematch/tokencollection source files and updated the interface as well! case closed(for now, at least)!

Injabie3 commented 8 years ago

Sounds good, I'll reference this issue later when I update the base class. You can assume any set function that I do in the base class returns an int: 0 for OK, -1 for error.