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

Changing the law

Grey Roger

Sea Dog
Staff member
Administrator
Storm Modder
My current project is to overhaul the way attacks on ships are classed as legal or not. At present, either sinking, looting or capturing an enemy ship is piracy unless you have a Letter of Marque from a nation hostile to the target. If you do, it's a legal attack if you fly any non-pirate flag hostile to the target. If you have only a British LoM but Britain and Holland are both at war with France, you can legally attack under a Dutch flag.

In reality, it was legal to sink an enemy ship without a LoM or naval commission - in fact, at one time, it was not only legal to attack an enemy ship, it was illegal not to attack. Later the law was changed so that civilian ships were no longer required to put themselves at risk, that's what the navy was for; but it was still legal to try. But taking prizes, whether capturing the entire ship or just confiscating cargo, did require a LoM or naval commission. And the attack had to be made under true colours. So, if you have only a British LoM but Britain and Holland are both at war with France, attacking under a Dutch flag is illegal, you have to fly a British flag.

True colours can be any of:
. Personal flag
. Flag of your served nation
. Flag of any nation you serve
Those aren't the same! Your served nation is by default the nation you chose when you started the game. If you start as a Dutch merchant, your served nation is Holland even though you have no LoM. You then buy a British LoM; your served nation is now Britain and you are in the service of Britain. Then you buy a Dutch LoM as well; your served nation is now Personal because you have multiple LoM's, and you are in the service of both Britain and Holland.

First step: change the rules for a legal attack in "nations.c" to check that you are in the service of your current flag nation and that it's hostile to the target. Flying a pirate flag is automatically piracy, and now, so is flying a personal flag if your served nation is Pirate. That only happens if you've been branded a pirate, either by choice of nation at game start or because you've committed multiple acts of piracy. Your personal flag tells the rest of the world who you are; you're a convicted pirate and now you've just admitted it! This is done. Additionally, in "cabinfight_dialog.c", if you tell the enemy captain that you intend to take his cargo, ship or money, and you aren't flying the flag of a hostile nation for which you have a LoM or naval commission, he'll warn you that it's an act of piracy and you'll have the option to release him instead. Otherwise you'll go to the ransack screen as usual.

Now in progress: check for piracy in "PROGRAM\INTERFACE\transfer_goods.c" and "transfer_main.c". I'll probably want to move all the stuff in "nations.c" about bad things which happen if you've committed piracy into a separate function which can then be called in "transfer_goods.c" and "transfer_main.c" if you're looting or capturing a ship illegally - but I need to be careful not to do it if you're transferring goods or officers between two of your own ships! (Why not simply check in "ransack.c"? Because that will be called after a boarding action. Sinking an enemy ship will be legal without a LoM, and that includes boarding provided you don't then try to take cargo or install an officer, you just board and then leave. You can take crew, rescuing them from a ship that you're about to sink.)
 
Progress! The checks for piracy are working. If any of them triggers, an attribute is set on the player. The files in "PROGRAM\INTERFACE" don't penalise you for piracy; that's done when you've finished doing things to the enemy ship and control returns to 'UpdateRMRelation', which checks if that attribute is set and applies the usual penalty for piracy if it is. Also, if the attribute is set once, other checks in "INTERFACE" files don't happen - you're not going to be penalised more than once for pirating the same ship.

There are also a couple of checks in various places where you can either capture a fort or otherwise raid a colony, because that's piracy if you don't have a LoM even if you don't then go on to loot the store or assign a new governor. And the usual exceptions still apply - any attack under a pirate or false flag is piracy, any attack against a pirate ship or fort is not.

If the captain surrenders, he may protest if you tell him what you're going to do and he thinks it's piracy. He has a choice of things to say and for one of them, I couldn't resist dropping in another film quote - it's not from a film about the age of sail but it's too good a line not to use:
you_are_pirates.jpg

And I've managed to put warnings into "ransack_main.c" if you don't have a LoM and are about to either capture the ship or go into its hold:
capture_warning.jpg cargo_warning.jpg

Testing is now under way. A bit more tweaking, and then this lot is going into the next update.
 
One side effect of all this is the fixing of a small bug which has been around for ages.

In "transfer_characters.c", function 'CheckProceedShipAssignment', there is a sequence of checks on an officer whom you want to put in command of a ship. If a check fails, you get a warning message and a choice to continue anyway. If the check passes, it goes to the next check; if it's gone through all the checks then the transfer goes ahead. I added another check to give a warning if putting an officer onto a captured ship would be piracy.

In "ransack_main.c", function 'SwapProcess', there is a single check on whether the officer being swapped onto another ship has high enough leadership and sailing skills to command the ship. I copied and modified the code from 'CheckProceedShipAssignment' to turn it into a multiple check so that you'll get a warning if swapping with a captured ship would be piracy. And then I found that I couldn't repeatedly swap back and forth - not exactly a game-breaking problem, you won't want to do that very often, and anyway you can exit the swap interface, then click the swap button again, and then swap back if you want. But I don't want my additions to lose any existing functionality.

The problem was with the code I'd copied from 'CheckProceedShipAssignment'. I fixed it for swapping. And then I remembered that there's already a similar problem with assigning officers. Once you assign an officer to a ship, you can't assign a different captain, nor assign secondary officers such as a gunner, except by exiting the assignment interface, clicking the "Assign officer" button again and starting anew. After applying the same fix to 'CheckProceedShipAssignment' as I did for 'SwapProcess', I can now assign a captain, replace him with another captain, and assign secondary officers, all in one pass without having to quit the assignment interface.
 
Back
Top