Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

passenger transport

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Neo_Jesus
Above Average
Above Average
Posts: 19
Joined: Tue Apr 08, 2008 8:44 am

passenger transport

Post by Neo_Jesus »

you know the other day i was transporting passengers and i couldnt help but notice its really not worth any credits.. now i know this has been brought up befor... but i felt i have to ask. now that oolite is java is it possible to script and oxp that would make it more like cargo. like the more missions you did the more rich your customers would get. willing to pay larger prices for a safer or more scenic trip you know.. i just find it fun to taxi but i feel that 5 tons hull subtraction should atleast be worth something ya know.

once again sorry i know this has been brought up befor.. just figured i would throw it out there now that its on java.
krombart
Competent
Competent
Posts: 52
Joined: Tue May 20, 2008 9:25 am

Post by krombart »

There doesn't seem to be a interface to changing the prices for passagener transports, or asking for how many missions have been done.
krombart
Competent
Competent
Posts: 52
Joined: Tue May 20, 2008 9:25 am

Post by krombart »

Actually there is a reputation system for passenger transport, but it is only used for evaluating, wether a contract is displayed at all. It does not enter the fee and premium calculation.
krombart
Competent
Competent
Posts: 52
Joined: Tue May 20, 2008 9:25 am

Post by krombart »

Grab yourself a copy of the oolite-dev-source-1.71.2.tar.bz2

Learn how to compile oolite for your system

Then make the following changes to Universe.m in src/Core

At line 6573 there should look like

Code: Select all

- (NSArray *) passengersForSystem:(Random_Seed) s_seed atTime:(double) current_time
three lines down you see

Code: Select all

int player_repute = [player passengerReputation];
after that line add

Code: Select all

       float fee_factor = 1;
	unsigned f = 0;
	if( player_repute < 0 ) {
	  for( f = 0; f < -player_repute; f++ ) fee_factor /= 1.17;
	} else {
	  for( f = 0; f < player_repute; f++ ) fee_factor *= 1.17;
	}
search for the line fee=cunningFee(fee) down in that routine.
add the line

Code: Select all

	fee = (OOCreditsQuantity) floor( fee* fee_factor);
above the line fee=cunningFee(fee).

With good reputation your fees should triple, with bad reputation your fees should go down to one third.
krombart
Competent
Competent
Posts: 52
Joined: Tue May 20, 2008 9:25 am

Post by krombart »

After testing this I noticed that I got payed twice the amount, I was promised .... hmmm maybe I have to look into this.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

krombart wrote:
.
just one question

Code: Select all

unsigned f;
is bound to produce an error, unless this is something about cocoa i dont understand, i cant see how the compiler can figure out what f is, unless of course it assumes that an int is meant. The way it would work in C++, my compiler would give me an error, right there...

Are you aware of what the socalled basic types is, such as int,float,double what theire properties are and so on ?..

Further more i think it is ill advice to have people compile new local versions of Oolite, while they might not understand some fundamental things about object orientated programming.

Cheers Frame
Bounty Scanner
Number 935
krombart
Competent
Competent
Posts: 52
Joined: Tue May 20, 2008 9:25 am

Post by krombart »

I've seen this in the source code of oolite.

And HEY! Don't tell me not to compile my own local version of oolite!

That's what OPEN SOURCE is good for.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

krombart wrote:
I've seen this in the source code of oolite.

And HEY! Don't tell me not to compile my own local version of oolite!

That's what OPEN SOURCE is good for.
i did´nt tell you not to... ;-), just said i think it is i´ll advice, especially when the lines you tell him to add have an error.

So my search program which is ultra edit 8.1, damn good program too...

cant find

Code: Select all

unsigned f;
anywhere in the oolite source code, and if i read your post correct, this is actually something you tell him to add, so its your code at witch i´m pointing out there is a flaw in.

namely this piece of code

Code: Select all

 float fee_factor = 1; 
   unsigned f = 0; 
   if( player_repute < 0 ) { 
     for( f = 0; f < -player_repute; f++ ) fee_factor /= 1.17; 
   } else { 
     for( f = 0; f < player_repute; f++ ) fee_factor 
this is no where to be found in the oolite source code...
but allow me to correct it

it should be

Code: Select all

unsigned int f;
Bounty Scanner
Number 935
krombart
Competent
Competent
Posts: 52
Joined: Tue May 20, 2008 9:25 am

Post by krombart »

e.g. Universe.m Line 330
User avatar
Cmdr James
Commodore
Commodore
Posts: 1357
Joined: Tue Jun 05, 2007 10:43 pm
Location: Berlin

Post by Cmdr James »

Code: Select all

	unsigned i;
	for (i = 0; i < 256; i++)  [system_names[i] release];
He is correct, it is there, and compiles. I think I would tend to agree that it is more normal to see unsigned int.

I guess Frame could not find it because the variable is

Code: Select all

i
not

Code: Select all

f
.
krombart
Competent
Competent
Posts: 52
Joined: Tue May 20, 2008 9:25 am

Post by krombart »

I don't know what happend, as the price which is displayed in the gui screen and the price put in the savegame both simply take the value calculated above.

But with the following modification to the _original_ Universe.m it seems to work.

Put

Code: Select all

				unsigned f = 0;
				if( player_repute > 0 ) {
				  for( f = 0; f < player_repute; f++ ) fee = fee * 117 / 100;
				} else {
				  for( f = 0; f < -player_repute; f++ ) fee = fee * 117 / 100;
				}
just before the line

Code: Select all

fee = cunningFee( fee );
best regards.

(Happy to have passenger contracts for up to 5000 Cr if you did well.)

PS.: I choose f as loop counter, to avoid name clashes.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

krombart wrote:
And HEY! Don't tell me not to compile my own local version of oolite!

That's what OPEN SOURCE is good for.
Not if we want to continue to play the same game.

If everybody would start to modify his game (the game code itself, I'm not talking about adding OXPs!), then there would quite quickly be nothing more to talk about in this forum, because there would no longer be a common base for us to build on.

So while an expert programmer might want to modify parts of the game code on his own private machine, and at any time be fully aware of the changes he has made and the resulting differences to anybody else's game, it is certainly not advisable to make this the behaviour for the usual player, who tends to forget that he is running a "custom" code, and will start to blame the programmers for behaviour that is seemingly different to what they tell him should be.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

krombart wrote:
I don't know what happend, as the price which is displayed in the gui screen and the price put in the savegame both simply take the value calculated above.

But with the following modification to the _original_ Universe.m it seems to work.

Put

Code: Select all

				unsigned f = 0;
				if( player_repute > 0 ) {
				  for( f = 0; f < player_repute; f++ ) fee = fee * 117 / 100;
				} else {
				  for( f = 0; f < -player_repute; f++ ) fee = fee * 117 / 100;
				}
just before the line

Code: Select all

fee = cunningFee( fee );
best regards.

(Happy to have passenger contracts for up to 5000 Cr if you did well.)

PS.: I choose f as loop counter, to avoid name clashes.
okay i´m sry then.. and yeah i searched for unsigned f;
But i´ll stick to that it is not something you are supposed to do, just because you find it in Oolite source code, dont mean its canon.

And i bet the compiler Assumes you meant an INT... which is bad, if you wanted a float. Also i bet there are different compilers out there, that might not all assume this, but there usually are standards so it should be pretty safe.

i just ran a test in Visual Studio...

Where i did not tell it that it where an int
after that i set f = 1.01f

SO I´m getting this warning, ofcourse

Code: Select all

"somepath\nointtest\nointtest\nointtest.cpp(10) : warning C4244: '=' : conversion from 'float' to 'unsigned int', possible loss of data"
Which would be bad, ofcourse especially if we where doing some OpenGL that relies heavely on floats..

Regarding name clashes... its allways good to reuse allready declared "variables", if you are not still inside the scope of the for loop which uses the same varible..

Why, cause it saves memory. an INT takes up a measely 4 bytes, but 4 bytes there, and 4 bytes there make megabyte.. ;-)..

And i´m with McLane 100%..
Bounty Scanner
Number 935
krombart
Competent
Competent
Posts: 52
Joined: Tue May 20, 2008 9:25 am

Post by krombart »

Code: Select all

Not if we want to continue to play the same game. 
 
If everybody would start to modify his game (the game code itself, I'm not talking about adding OXPs!), then there would quite quickly be nothing more to talk about in this forum, because there would no longer be a common base for us to build on. 
 
So while an expert programmer might want to modify parts of the game code on his own private machine, and at any time be fully aware of the changes he has made and the resulting differences to anybody else's game, it is certainly not advisable to make this the behaviour for the usual player, who tends to forget that he is running a "custom" code, and will start to blame the programmers for behaviour that is seemingly different to what they tell him should be.
I disagree. If I want to have a targeting computer or increasing fees with better reputation, I want to have it. Period. If you are not willing to code it, I have to do it myself. (And I don't want to dispute arguments like: "It would be a too easy game with it.". I don't want to discuss about that, I just want the feature ( and it could be done in a way, that you can turn it off. )

I agree to you, that I can't blame the original authors for bugs appearing in the game with my modifications. If I want to report bugs, I have to use the original game. ( And I did bug reporting only for the original game. )

I also disagree that there would be no common base. The common base would always be the original game. Why not let have people fun with their own flavour of the game?
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Post by Svengali »

So, is it a suggestion for the game? :-)
Post Reply