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

About mixing builds

I'm not sure about null aP, but I think no rAP data refers to a reference to an object or data member of an object returning no data.

How exactly the 'object' type works in this interpreter is a little unclear to me, but from what I can tell it's similar enough to a regular struct to cause some major confusion. It has data members, all public (I don't see any kind of class structure to set it otherwise), you access them in the regular way you'd directly access a struct data member, but it seems to you can declare an "object" of type object and arbitrarily assign data members to it implicitly.

If you're used to real C or C++ this must strike you as profoundly absurd, but it seems to be the case. What's more, these data members seem to have little or no type checking at all. That is, you can assign an int to sea.sun.angle and later assign a string to the same member without the interpreter making so much as a squawk.. But if you later call up that data member expecting an integer value it can cause all sorts of unexpected behaviours, and not necessarily outright errors. Which, as any programmer will tell you, is the worst sort of bug to fix.

So far as I've seen there are two "pointer like" pointers, called ref and aRef. ref seems to be a pointer to an "object" of type object, whereas aRef is a pointer to a specific member of an object, and possibly it's "sub-members" as well, I've seen it so used. By the way, accessing data members with the ref and aRef pointers also uses the "direct" syntax of periods, instead of the normal -> that pointers to structs and classes use in C++.

Hope this helps
 
So "null ap" cuold be a null pointer, and "no rAP data" could be a not intitialized ref or aref var?

by the way, the object "class" (remember: i'm used to JAVA, sry) seems to be like a hashtable of hashtables, i mean. you make a map between Key and Value, and everytime you call Key it returns Value. It's no importance what type Value has, the thing is that to recover the valu you must know it's type and assign it to the right var. There is a block with usefull funcs in keywords.c.

<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
bool CheckAttribute(aref obj, string attrname);
return true if attribute attrname exists, else returns false
void DeleteAttribute(aref obj, string attrname);
deletes attribute attrname
void CopyAttributes(aref copyto, aref copyfrom);
Copies the value of copyfrom into copyto
int GetAttributesNum(aref arobj);
return number of attributes of arobj. useful to iterate over an object
aref GetAttributeN(aref arobj, int n);
gets Nth attribute of arobj, as if it was an array. useful to iterate over an object
string GetAttributeName(aref arefattr)
gets name of arefattr attribute, remember that arefattr is a pointer
string GetAttributeValue(aref attr);
gets value of attribute, the same as attr, useful to iterate over an object
</div>

I'm still trying to find the difference between LoadSegment and #include
 
As you like, I leave you to the help of more experienced coders, your questions are apparently beyond me.

You may note however, that a "hashtable" as you refer to even must take note of the size of a variable or data member. You may also know that an integer takes 4 bytes generally while a float takes 8 bytes. Thus indexing memory with no regard for type checking is dangerous at best. I am not familiar with Java however, struck me as too limited a language, so your meaning may be vastly different from what I understand it to be. For instance, you use the term API quite outside the common understanding I'm aware of..

Cheers <img src="style_emoticons/<#EMO_DIR#>/happy.gif" style="vertical-align:middle" emoid="^_^" border="0" alt="happy.gif" />
 
Hashtable is the name of a java class (java.util.Hashtable)

it works this way:
there are two Vectors (java.util.Vector) (a resizeable array)
the first is called Keys while the second is called Values
each time you add something to the Hashtable you put an Object in Keys and an Object in Values
Object is the superclass of every JAVA class, so everything could be stored in a Hashtable and everything could be a Key
to recover a Value, you call get(Key) and it returns a java.lang.Object object, and if you still need the class functionality you can cast it to its class.

Why do you think JAVA is "too limited"?
 
I see, so it seems that this hashtable class is equivalent to what we'd have in C++ as an array of pointers. However, in C++ atleast, a pointer must point to a certain data type to be dereferenced. So while you could index this array of pointers you couldn't change what type a pointer pointed too. There are void pointers true, but these must be cast explicitly to a certain type before being dereferenced.

Perhaps you don't have these types contraints in JAVA by some force majeure hidden away in a parent class somewhere in the hierarchy, I can't tell. A similar force majeure is apparently at work in the interpreter of the storm engine, however there is still the risk of confusing data types in a single member and thus experiencing unexpected behaviours in the program.

It was meant to be a benign observation, simply noting a difference between the game engine code and real C or C++.
 
In java, everything that's not a primitive value is passed as a pointer, so, an array of Objects is an array of pointers. that's the way it works, you can redefine a pointer to another thing, including different classes (like object class in the engine) as far as i know you can only get an attribute by calling it by Obj.Attr or by an aref var, and this should be first initialized to "point" to that attribute

it doesn't matter, we both know what the object is, why are we talkin in circles about objects? i don't know... <img src="style_emoticons/<#EMO_DIR#>/dunno.gif" style="vertical-align:middle" emoid=":shrug" border="0" alt="dunno.gif" />

and please, can somebody tell me what is the difference between #include and LoadSegment?
(i'm considering the posibility to attach this queston to my signature!)
 
#include is a C and C++ preprocessor macro, it does just that, includes the file (copies it's contents) into the file it's called when the preprocessor is run.

LoadSegment seems to temporarily load a file into interpreter memory, you can then call functions from that file until you unload the segment.
 
<!--quoteo(post=274440:date=Aug 21 2008, 12:45 PM:name=Dr. Maturin)--><div class='quotetop'>QUOTE (Dr. Maturin @ Aug 21 2008, 12:45 PM) <a href="index.php?act=findpost&pid=274440"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->#include is a C and C++ preprocessor macro, it does just that, includes the file (copies it's contents) into the file it's called when the preprocessor is run.

LoadSegment seems to temporarily load a file into interpreter memory, you can then call functions from that file until you unload the segment.<!--QuoteEnd--></div><!--QuoteEEnd-->

yes, i alredy knew that, my question is about advantages and disadvantages of usin either... As far as i could see, NK changed some functions from one to another method, and i was wandering why. is there any difference when you use the function only there?
 
btw, What do you think about those files that assigns lots of things? (like *_init.c files)

I've been thinking in a way to make them a bit more clear.
First of all, we should make a header like this
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
#ifndef Island_init_h
#define Island_init_h 0

#define MAX_ISLANDS 3
string IslandsFiles[MAX_ISLANDS];

IslandsFiles[0] = "Oxbay";
IslandsFiles[1] = "Redmond";
IslandsFiles[2] = "Douwesen";

#endif
</div>
then we should make a folder called files and a file per entry in the previous code, like
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
// FILES\Oxbay.c
int initIsland(ref locator, int n)
{
//process to init Oxbay...
return n+1;
}
</div>
and finally, our Islands_init.c should be like
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
#include "Islands_init.h"

void InitIslands()
{
int n = 0;
ISLANDS_QUANTITY = 0;

for (int i = 0; i < MAX_ISLANDS; i++)
{
DeleteAttribute(&Islands, "");

Islands.id = "";
Islands.reload_enable = true;
Islands.visible = true;
}
// Create temp module for enumerate locators
object locator;
CreateEntity(&locator,"locator");
for (int i = 0; i < MAX_ISLANDS; i++)
{
if (LoadSegment("FILES\"+IslandFiles+".c"))
{
n = initIsland(&locator, n);
}
}

ISLANDS_QUANTITY = n;

// delete temp module
DeleteClass(&locator);
}
</div>

that could make easier to add or remove Islands, ships, models, etc

what do you think about that?
 
I would say that I'm not at liberty to give a definitive answer on that. You may want to ask Pieter his opinion, or one of the honchos, I wouldn't presume.
 
This is getting all <i>waaay</i> over my head. I have no real knowledge of proper coding at all.
If anything, Pirate_KK is the person who might be able to answer some of your questions.
No me though. <img src="style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
 
Back
Top