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

Some minor code bugs #1

Closed
nckstwrt opened this issue Jan 10, 2024 · 3 comments
Closed

Some minor code bugs #1

nckstwrt opened this issue Jan 10, 2024 · 3 comments
Assignees

Comments

@nckstwrt
Copy link

nckstwrt commented Jan 10, 2024

I love TriSpace and am currently modifying it and playing around with it. Here are some quick bugs I've found before I completely forget:

In starmap.c:

static GLuint sunTextures[2];

^ You have 3 suns so this is currently overflowing - should be [3]

In spacedust.c:

                spacedust[i].x = spacedust[i].x * cosf(angle) - spacedust[i].y * sinf(angle);
                spacedust[i].y = spacedust[i].x * sinf(angle) + spacedust[i].y * cosf(angle);

^ You want to be saving the result of what the new spacedust[i].x should be and assigning it after calc'ing spacedust[i].y. Currently if you roll in circles you'll see the stardust gradually gets closer to the middle (and that's because the new .x is being used to create the new .y)

In equipui.c:

    char buffer[29];
    char name[21];
    char status[4];

^ You are currently overflowing these buffers.
e.g.

sprintf(buffer, "%-19s %4d %4s", name, getPriceForEquipment(i), status);

19+1+4+1+4+1(null terminator) = 30
This happens in other areas too - no need to be quite so tight with our stack on FunKey (so could just make all string arrays [100] :) )

main.c

transferCargo(&player.hold, &stationHold, uiTradeCursor, &starSystem.info, 1);

^ This should be passing &starSystem.info.characteristics not &starSystem.info for these calls to transferCargo

TriSpace is absolutely brilliant - thanks for all the work you clearly put into this and for releasing the source.

-Nick (aka LordEnum)

@robbi-blechdose
Copy link
Owner

Thank you, those are all good catches!
I'll get to fixing them when I have the time and release a bugfix update then.
I'm also very happy to hear you're enjoying the game! 😁

@robbi-blechdose robbi-blechdose self-assigned this Jan 13, 2024
@robbi-blechdose
Copy link
Owner

Looking at my dev branch, the issues in main.c and starmap.c have already been fixed.

@robbi-blechdose
Copy link
Owner

I've fixed all of these and ran the game through valgrind.
The fixes are incorporated into the 1.1.0 release.
Thanks again for your help!

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