• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Creating a pull request on github

Itutorial

Legendary OT User
Joined
Dec 23, 2014
Messages
2,329
Solutions
68
Reaction score
1,007
I can't figure it out. Anyone able to make a tutorial or explain it here? I have some fixes I want to introduce to TFS but I just cannot figure it out.

If someone has the time this is a fix for the sightline code by @zbizu

Code:
//get a line between two points
//based on Xiaolin Wu algorithm
std::vector< std::pair<int, int> > get2DLine(int x0, int y0, int x1, int y1)
{
    std::vector< std::pair<int, int> > line;
    if (x0 == x1 && y0 == y1) {
        return line;
    }

    bool isSteep = std::abs(y1 - y0) > std::abs(x1 - x0);
    if (isSteep) {
        std::swap(x0, y0);
        std::swap(x1, y1);
    }

    if (x0 > x1) {
        std::swap(x0, x1);
        if (y0 < y1) {
            std::swap(y0, y1);
        }
    }

    float dx = x1 - x0;
    float dy = y1 - y0;
    double grad = 1.0;

    if (dx != 0) {
        grad = dy * 1.0 / dx;
    }

    if (grad < 0) {
        grad = grad * -1;
    }

    double interY = y0 + grad; //first y - intersection for the main loop

    if (isSteep) {
        for (int y = x0 + 1; y < x1; y++) {
            if (interY < 0) {
                interY = interY * -1;
            }
            int newX = std::floor(interY);
            int newY = y;
            line.push_back({ newX, newY });
            interY += grad;
        }
    }
    else {
        for (int x = x0 + 1; x < x1; x++) {
            if (interY < 0) {
                interY = interY * -1;
            }
            int newX = x;
            int newY = std::floor(interY);
            line.push_back({ newX, newY });
            interY += grad;
        }
    }

    // now we need to perform a jump between floors to see if everything is clear (literally)
    return line;
}
 
I can't figure it out. Anyone able to make a tutorial or explain it here? I have some fixes I want to introduce to TFS but I just cannot figure it out.

If someone has the time this is a fix for the sightline code by @zbizu

Code:
//get a line between two points
//based on Xiaolin Wu algorithm
std::vector< std::pair<int, int> > get2DLine(int x0, int y0, int x1, int y1)
{
    std::vector< std::pair<int, int> > line;
    if (x0 == x1 && y0 == y1) {
        return line;
    }

    bool isSteep = std::abs(y1 - y0) > std::abs(x1 - x0);
    if (isSteep) {
        std::swap(x0, y0);
        std::swap(x1, y1);
    }

    if (x0 > x1) {
        std::swap(x0, x1);
        if (y0 < y1) {
            std::swap(y0, y1);
        }
    }

    float dx = x1 - x0;
    float dy = y1 - y0;
    double grad = 1.0;

    if (dx != 0) {
        grad = dy * 1.0 / dx;
    }

    if (grad < 0) {
        grad = grad * -1;
    }

    double interY = y0 + grad; //first y - intersection for the main loop

    if (isSteep) {
        for (int y = x0 + 1; y < x1; y++) {
            if (interY < 0) {
                interY = interY * -1;
            }
            int newX = std::floor(interY);
            int newY = y;
            line.push_back({ newX, newY });
            interY += grad;
        }
    }
    else {
        for (int x = x0 + 1; x < x1; x++) {
            if (interY < 0) {
                interY = interY * -1;
            }
            int newX = x;
            int newY = std::floor(interY);
            line.push_back({ newX, newY });
            interY += grad;
        }
    }

    // now we need to perform a jump between floors to see if everything is clear (literally)
    return line;
}


Use git in command line.
In linux/mac it's fairly easy do install.
On windows. I don't know. I never used it on windows and I don't have PC to test it.

As I remember it should be like this:

1. Fork repo (make your own copy)

2. Clone your repository on PC
3. Edit file on your PC
4. "git add edited_file_path"

5. Git commit - update your local copy of repository in PC
'git commit -m "I changed important file"'

6. Git push - it will update your copy of repository in github servers

7. Create pull request - ask TFS team to merge yours changes
 
Last edited:

Similar threads

Back
Top