• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Bug Possible issues caused by GetAttributeN

Hammie

Storm Engine developer
Staff member
Storm Modder
While trying to get New Horizons to work on the open source storm engine I encountered a potential source of bugs and crashes.

There are a few places where GetAttributeN is called directly with an object instead of an (a)ref. This causes the returned value to be undefined/invalid.

I've fixed the issue here: Comparing master...feature/fix-get-attribute · Hammie/new-horizons

Hopefully this can fix some of those random crashes :doff
 

Attachments

  • fix-get-attribute.zip
    66.5 KB · Views: 107
In "PROGRAM\Loc_ai\LAi_groups.c", lines 395 and 399, you've changed "quests" to "&quests". But "quests" is an aref defined a few lines up:
Code:
   aref quests;
   ref PChar = GetMainCharacter();
   makearef(quests, PChar.quest);
So that one may not need to be changed.
The rest are going into the next update - thanks! :onya (I've been doing some work of my own on "quests_common.c" so I've copied your fixed line into my version.)
 
In "PROGRAM\Loc_ai\LAi_groups.c", lines 395 and 399, you've changed "quests" to "&quests". But "quests" is an aref defined a few lines up:

Oops! Good catch!

The rest are going into the next update - thanks! :onya (I've been doing some work of my own on "quests_common.c" so I've copied your fixed line into my version.)

I assumed you are a (win)merge master by now :onya
 
As far as I can see there, you have made these corrections to "officers.c":
Code:
167 - int numtypes = GetAttributesNum(OfficerTypes);
167 + int numtypes = GetAttributesNum(&OfficerTypes);
Code:
174 - type = GetAttributeName(GetAttributeN(OfficerTypes,picked));
175 - if(CheckAttribute(OfficerTypes,type+".EnemyType"))
174 + type = GetAttributeName(GetAttributeN(&OfficerTypes,picked));
175 + if(CheckAttribute(&OfficerTypes,type+".EnemyType"))

There is no "officers.c" in the update because it hasn't changed since the January 2022 installer. The version in the installer has this:
Code:
167 int numtypes = GetAttributesNum(&OfficerTypes);
Code:
174 type = GetAttributeName(GetAttributeN(&OfficerTypes,picked));
175 if(CheckAttribute(&OfficerTypes,type+".EnemyType"))
So if you install the game using the January 2022 installer, you should already have that version.
 
This one on line 195 in GetRandomOfficerType() that I missed previously.

The others are indeed already in a previous release.
 
While trying to get New Horizons to work on the open source storm engine I encountered a potential source of bugs and crashes.

How stable is this engine by now, can it run New Horizons without issues or still a lot left to do ?

Sorry if you have already answered/explained this somewhere... :doff
 
How stable is this engine by now, can it run New Horizons without issues or still a lot left to do ?
Still lots of issues to fix, but it is getting closer to playable. But I'll show it during todays test stream.
 
This one on line 195 in GetRandomOfficerType() that I missed previously.

The others are indeed already in a previous release.
Thanks, @Hammie! I've just re-uploaded the update, now including this version.
 

Attachments

  • officers.c
    8.5 KB · Views: 52
Back
Top