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

Adding locations without editing locations_init.c

<!--QuoteBegin-Pieter Boelen+Aug 17 2005, 04:05 PM--><div class='quotetop'>QUOTE(Pieter Boelen @ Aug 17 2005, 04:05 PM)</div><div class='quotemain'><!--QuoteEBegin-->I am getting error reports with this new functionality as it is in the modpack:

RUNTIME ERROR - file: locations\locations_init.c; line: 188
Invalid function call
RUNTIME ERROR - file: locations\locations_init.c; line: 188
function 'LocationInitModLocations' stack error
RUNTIME ERROR - file: locations\locations_init.c; line: 188
Invalid function call
RUNTIME ERROR - file: locations\locations_init.c; line: 188
function 'LocationInitModLocations' stack error

Could you please look into this, Inez? I suppose it's got to do with me not merging it properly... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
<div align="right">[snapback]128356[/snapback]</div><!--QuoteEnd--></div><!--QuoteEEnd-->
Check this
int n = GetMainCharacter().numlocations;

to
int n = sti(GetMainCharacter().numlocations);

or

ref pc = GetMainCharacter();
int n = sti(pc.numlocations);

And extern function can take param
so it must be
init.....(int n)
{
}
 
Very Nice! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />

I really like the the light frigate for its combination of speed carrying capacity, firepower and manuverability. I liked the orginal look, but this is better.

Pieter, I look forward to more new ships in the modpack.

<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/duel_pa.gif" style="vertical-align:middle" emoid=":ixi" border="0" alt="duel_pa.gif" />
 
Alexus, I don't think that extern functions can take parameters - (they can, but it doesn't work correctly) each time the file is read the number of parameter values that POTC expects increases by one. This was discussed in the <a href="http://forum.piratesahoy.net/index.php?showtopic=5890" target="_blank">Tips and Tricks thread</a>, too. If you can tell me how to do it I'd be thankful.
 
<!--QuoteBegin-Pieter Boelen+Sep 1 2005, 07:07 AM--><div class='quotetop'>QUOTE(Pieter Boelen @ Sep 1 2005, 07:07 AM)</div><div class='quotemain'><!--QuoteEBegin-->Looks like a Greek helmet thing on the back. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/razz.gif" style="vertical-align:middle" emoid=":razz" border="0" alt="razz.gif" />
<div align="right">[snapback]129496[/snapback]</div><!--QuoteEnd--></div><!--QuoteEEnd-->
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/yes.gif" style="vertical-align:middle" emoid=":yes" border="0" alt="yes.gif" /> I also managed to paint it on as a figurehead!
 
<!--QuoteBegin-Jason+Sep 1 2005, 09:25 AM--><div class='quotetop'>QUOTE(Jason @ Sep 1 2005, 09:25 AM)</div><div class='quotemain'><!--QuoteEBegin-->Very Nice!   <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />

I really like the the light frigate for its combination of speed carrying capacity, firepower and manuverability.  I liked the orginal look, but this is better.  ...
  <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/duel_pa.gif" style="vertical-align:middle" emoid=":ixi" border="0" alt="duel_pa.gif" />
<div align="right">[snapback]129502[/snapback]</div><!--QuoteEnd--></div><!--QuoteEEnd-->

Thank you Jason!
I'm thinking I might want to revisit the war galleon and make some improvements.

Inez, sorry for hijacking. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/oops3.gif" style="vertical-align:middle" emoid=":eek:ops2" border="0" alt="oops3.gif" />
This should be on a seperate thread. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" />
 
To ALexusB: Thanks a lot for you help. It wasn't really needed anymore; the bug was fixed already (turned out it was a stupid mistake of my own; I commented out some code the game was looking for, so the game looked for it, didn't find it and caused trouble). But thank you ever so much anyway. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/doff.gif" style="vertical-align:middle" emoid=":doff" border="0" alt="doff.gif" />
 
Hispaniola? You're using the additional islands mod then. The most recent modpack version hasn't been made compatible with the new islands yet. What release are you using? Look in Post Build 12 Version.txt in your PotC folder and tell me what date is there.
 
Inez, that's a _sweet_ mod there, and an excellent blueprint too! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />

Re: externs.
Externs can take params, but they can only be externed -once-. That is, they will only work in the file they are declared in.
Also, IIRC that means they can't be in loadsegmented files, just #included ones--but I may be wrong, and maybe unloadsegment does clear the extern's params.

So if you only call the extern from one place (and declare it in that same place) you'll be OK.
 
<!--QuoteBegin-NathanKell+Sep 9 2005, 01:48 AM--><div class='quotetop'>QUOTE(NathanKell @ Sep 9 2005, 01:48 AM)</div><div class='quotemain'><!--QuoteEBegin-->So if you only call the extern from one place (and declare it in that same place) you'll be OK.
<div align="right">[snapback]130061[/snapback]</div><!--QuoteEnd--></div><!--QuoteEEnd-->
But I've tried that and it's *not* ok - first time I call it it works and second time it asks for more (or was that less?) parameters.
 
Are you including or loadsegment-ing the file?
You mean the following:

file:init.c
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->extern void something(int n);
void proc(n)
{
loadseg("something.c");
something(n);
unloadseg("something.c")
}<!--c2--></div><!--ec2-->
file seadogs.c
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->#include init.c
void main()
{
proc(5);
proc(6);
}<!--c2--></div><!--ec2-->
will cause an error?
 
Loadsegmenting - that's the whole point of it: I go through the directory and dynamically load every file in it - so I can add new files without changing the code.
 
Back
Top