• 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!

Fixed Some errors with ship min crew and cannons

Tingyun

Corsair
Storm Modder
@Levis While testing the new trade winds system I'm getting a lot of errors when I check my error log. Several different ones, not sure if they are relavant to the changes or need to be fixed. Uploading file.

Most seem to be missed qty errors with several different lines.

EDIT: checking another error log from more tests, seems to be lines 1492, 1496, 1500, 1504 in Sea_AI/AIship are giving the following errors: missed attribute qty, and also sometimes no rap data

EDIT2: Looks like something wrong with the code for not having enough crew for the cannons. EDIT I have 667 crew, test ship (royal man of war) is min 203 max 1112. Maybe it is harmless error reports, not sure.

Line 1496-1504 are the last 3 parts below

if( crewratio < minCrewRatio)
{
float canqty = clampf(Bring2Range(0.01, 1.0, 0.01, minCrewRatio, crewratio));
//if(ismch) logit("can qty ratio " + canqty);

curqty = sti(rCharacter.ship.Cannons.Borts.cannonf.qty);
if(curqty > 0) curqty = iclamp(1, curqty, makeint(canqty * curqty));
rCharacter.ship.Cannons.Borts.cannonf.curqty = curqty;

curqty = sti(rCharacter.ship.Cannons.Borts.cannonb.qty);
if(curqty > 0) curqty = iclamp(1, curqty, makeint(canqty * curqty));
rCharacter.ship.Cannons.Borts.cannonb.curqty = curqty;

curqty = sti(rCharacter.ship.Cannons.Borts.cannonl.qty);
if(curqty > 0) curqty = iclamp(1, curqty, makeint(canqty * curqty));
rCharacter.ship.Cannons.Borts.cannonl.curqty = curqty;

curqty = sti(rCharacter.ship.Cannons.Borts.cannonr.qty);
if(curqty > 0) curqty = iclamp(1, curqty, makeint(canqty * curqty));
rCharacter.ship.Cannons.Borts.cannonr.curqty = curqty;
}
 
I had some problems with this before when making the new captain function. Please upload a savegame so I can replicate it and try to fix it.
 
Thanks Levis. Same test save as in the other cannon thread.

Note this one occurs with another of my test saves as well. Both were starting ships that I had never done anything in port to, if that matters. Both generate those error logs repeatedly. Will attach an error log from just now.
 

Attachments

  • cannons.rar
    510.1 KB · Views: 94
  • error.log
    38.3 KB · Views: 89
Do you have this problem with all starting ships?
I can't yet open the savegame (tonight I can), if you have some time please run DumpAttributes(pchar); and post the results of that.
 
@Levis yes during the captain generation tests I used maybe 5 different new ships. Every single one of them has an error log completely filled with those errors repeating one after another over and over again.

As soon as I can reach my computer (in a few hours) I will do the dump attributes and post it here. :)
 
@Levis: Did you change anything in the calls to "set base whatever" to set the ship stats?
I recall you tried to get rid of that before, but that caused disappearing crew on a New Game. Could that be it?
 
@Levis: Did you change anything in the calls to "set base whatever" to set the ship stats?
I recall you tried to get rid of that before, but that caused disappearing crew on a New Game. Could that be it?
as far as I know I haven't ....
I do know I had this excact same problem with enemy ships first once I used give ship to player. So I had to call a resetcannons function first to make sure the attributes where filled.
I'm going to test this a bit more.
@Tingyun if you are going to test again please try the following:

- Make a new game
- Go to your ship
- Go to the world map
- Go to an empty piece of sea
- Clear your errorlog
- Now see if new entries appear


I think this might be caused by coastal raiders instead
 
Will do Levis, as soon as I am in front of the computer. Thanks so much for all the bug hunting you are doing. :)
 
I do know I had this excact same problem with enemy ships first once I used give ship to player. So I had to call a resetcannons function first to make sure the attributes where filled.
That sounds odd. My quest captains always seemed to work fine and I don't think I ever needed to call that function of them. :unsure
 
That sounds odd. My quest captains always seemed to work fine and I don't think I ever needed to call that function of them. :unsure
I don't know for quest characters. but for encounters the force_ship function returned a ship without any canon data setup.
 
On the way to running the requested test, a bunch of AI naval (french) coastraiders spawned in port, and attacked my ship. They gave a different set of errors, for different lines in the same file, again repeated over and over

RUNTIME ERROR - file: sea_ai\AIShip.c; line: 1511
missed attribute: qty
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 1511
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 1512
missed attribute: qty
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 1512
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 1513
missed attribute: qty
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 1513
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 1514
missed attribute: qty
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 1514
no rAP data

Will still run rest of tests in a moment

EDIT: Odd I keep geting those lines as errors now. But I haven't done anything to my files except installing the opium sickness thing, very confused why it isn't the same lines. Maybe because different starting ship or something?
 
@Levis

Same errors when sitting in an open stretch of sea with no AI ships anywhere.

I get the lines quotes in my last post, 1511-1514, with a naval light brig starting ship.

The previous errors of a couple of lines before were with the 1st rate royal man of war.
 
@Levis

The new errors are from the "else" term

else
{
//if(ismch) logit("reset to max canqty");
rCharacter.ship.Cannons.Borts.cannonf.curqty = rCharacter.ship.Cannons.Borts.cannonf.qty;
rCharacter.ship.Cannons.Borts.cannonb.curqty = rCharacter.ship.Cannons.Borts.cannonb.qty;
rCharacter.ship.Cannons.Borts.cannonl.curqty = rCharacter.ship.Cannons.Borts.cannonl.qty;
rCharacter.ship.Cannons.Borts.cannonr.curqty = rCharacter.ship.Cannons.Borts.cannonr.qty;
}

So same error basically, missing the qty, it just depends on how much crew you have as to which line gets the error.

And it does appear to be the player ship.
 
@Levis

Testing Ansel's saved game, which doesn't have the cannon loop error, my framerates are back to 60.

They are about 12-13 when the cannon error is occuring. I think it looping continously is causing the low framerates. Somehow Ansel's ship doesn't have the same bug.
 
Place in:
..\PROGRAM\Characters

This should fix it. No idea why it's needed now but at least the data is set now.
I still think somewhere a check has slipped in which asks for this data which shouldn't be in there because I feel like the FPS on sea has dropped again.
But maybe someone else can confirm this.

If you wat to fix it in a current savegame run this in console:
Code:
pchar.Ship.cannons.borts = true; //Levis: making sure cannons are set up right
    ResetCannons(pchar); //Levis: making sure cannons are set up right
 

Attachments

  • characters_init.c
    33.2 KB · Views: 87
Thank you so much Levis! :) You are AMAZING.

As for FPS, before, I was at 12 FPS at sea. With this fix, I am back to close to 60, occasionally dropping a bit below that. It might be lower FPS than before, I can't remember, but I know you have made it much better for me. :)
 
Back
Top