Additional restriction on ship switching
-
- Bounty Hunter
- Posts: 137
- Joined: Tue Jan 31, 2006 12:46 am
Additional restriction on ship switching
There have been a discussion at the general modding forum about the "feature" that allows a player to fill a ship with cargo, switch to a lighter one and fly to another place to recover the first vessel and sell the cargo aboard.
We seemed to have an agreement the right thing to do is to not allow switch to another vessel if the cargo in the hold doesn't fit in the new one, but after looking the code, we discovered the change cannot be done in python, but in c++ function buyShip, who could be found in source basecomputer.cpp, so I'm opening this request in this forum.
Though this was initially related to the pu mod, I think this is a bug/cheat that must be ironed out in main vs also, and should be simple enough.
We seemed to have an agreement the right thing to do is to not allow switch to another vessel if the cargo in the hold doesn't fit in the new one, but after looking the code, we discovered the change cannot be done in python, but in c++ function buyShip, who could be found in source basecomputer.cpp, so I'm opening this request in this forum.
Though this was initially related to the pu mod, I think this is a bug/cheat that must be ironed out in main vs also, and should be simple enough.
-
- Elite Venturer
- Posts: 718
- Joined: Wed Mar 07, 2007 9:05 pm
- Location: Rimward of Eden
I don't really think this is the bug/exploit. I think the problem is that ship transportation is free and carries no risk . It should have a cost even in system.
On a tangent, is all of your cargo save together or is each ship's cargo saved separately i.e. can you fill multiple ships (dodo,llama,plowshare) or just fill the largest?
Edit: and the cost of ship transportation should be based on the weight of cargo among other things, lowering the exploitness of the 'exploit'
On a tangent, is all of your cargo save together or is each ship's cargo saved separately i.e. can you fill multiple ships (dodo,llama,plowshare) or just fill the largest?
Edit: and the cost of ship transportation should be based on the weight of cargo among other things, lowering the exploitness of the 'exploit'
-
- Bounty Hunter
- Posts: 186
- Joined: Mon Aug 06, 2007 2:34 am
- Location: Cambs
We raised the issue in the Economic Niggles thread that it really takes a lot of planning out of the game that we can transport ships instantly too, there should be some real world delay to getting ships transported so that we can't just have one special ship for each purpose that's always available to us.
Quite how to implement this or what constitutes a realistic delay escapes me though, it seems to be at odds with the current missions.
Quite how to implement this or what constitutes a realistic delay escapes me though, it seems to be at odds with the current missions.
Save The Economy
http://vegastrike.sourceforge.net/forum ... hp?t=10605
My boxes: Dual Opteron 280s, Geforce 7600, 2GB RAM, but waiting for a new PSU! grrr...
500 MHz Compaq laptop that gives DC electric burns
http://vegastrike.sourceforge.net/forum ... hp?t=10605
My boxes: Dual Opteron 280s, Geforce 7600, 2GB RAM, but waiting for a new PSU! grrr...
500 MHz Compaq laptop that gives DC electric burns
-
- Bounty Hunter
- Posts: 186
- Joined: Mon Aug 06, 2007 2:34 am
- Location: Cambs
Hehe what about if we request the ship to be brought in system, we take on the mission that we need it for... and then we have to meet the requested ship in system and do a docking manuever with it to take over control? It might impact on your mission slightly whilst still giving you realistic options?
Save The Economy
http://vegastrike.sourceforge.net/forum ... hp?t=10605
My boxes: Dual Opteron 280s, Geforce 7600, 2GB RAM, but waiting for a new PSU! grrr...
500 MHz Compaq laptop that gives DC electric burns
http://vegastrike.sourceforge.net/forum ... hp?t=10605
My boxes: Dual Opteron 280s, Geforce 7600, 2GB RAM, but waiting for a new PSU! grrr...
500 MHz Compaq laptop that gives DC electric burns
-
- Bounty Hunter
- Posts: 137
- Joined: Tue Jan 31, 2006 12:46 am
We have discussed that already in http://vegastrike.sourceforge.net/forum ... hp?t=10501
and there was a consensus it overcomplicated things. We're looking for a feasible solution, and the simpler we come with was that. My personal opinion is that it is also the right one.
and there was a consensus it overcomplicated things. We're looking for a feasible solution, and the simpler we come with was that. My personal opinion is that it is also the right one.
-
- Elite Venturer
- Posts: 718
- Joined: Wed Mar 07, 2007 9:05 pm
- Location: Rimward of Eden
-
- Bounty Hunter
- Posts: 137
- Joined: Tue Jan 31, 2006 12:46 am
I think I almost get it. This is the code that puts the cargo in the new unit:
I modified it to return false in case that newPart->CanAddCargo(c) failed, and it worked. It's only a test, I know you loose the cargo already moved.
A slightly more refined version of this should be enough.
Code: Select all
for (int i=playerUnit->numCargo()-1;i>=0;--i) {
Cargo c = playerUnit->GetCargo(i);
if ((c.mission!=0&&j==0)||(c.mission==0&&j==1&&c.GetCategory().find("upgrades")!=0)) {
for (int k=c.quantity;k>0;--k) {
c.quantity=k;
if (newPart->CanAddCargo(c)) {
newPart->AddCargo(c);
playerUnit->RemoveCargo(i,c.quantity,true);
break;
}
}
}
Code: Select all
for (int i=playerUnit->numCargo()-1;i>=0;--i) {
Cargo c = playerUnit->GetCargo(i);
if ((c.mission!=0&&j==0)||(c.mission==0&&j==1&&c.GetCategory().find("upgrades")!=0)) {
for (int k=c.quantity;k>0;--k) {
c.quantity=k;
if (newPart->CanAddCargo(c)) {
newPart->AddCargo(c);
playerUnit->RemoveCargo(i,c.quantity,true);
break;
}
// Test code
else {printf("Test 2\n"); return false;}
}
}
-
- Bounty Hunter
- Posts: 137
- Joined: Tue Jan 31, 2006 12:46 am
It seems to work.
I'm attaching a diff file with the change to be revised by developers.
As you could note, there is a printf call that should be replaced with a better feedback to inform the user about the failure condition.
One more point. The function exits with a false value, like when the player has not enough credits to buy. Python scripts using this function should not assume this is the only reason of failure.
I'm attaching a diff file with the change to be revised by developers.
As you could note, there is a printf call that should be replaced with a better feedback to inform the user about the failure condition.
One more point. The function exits with a false value, like when the player has not enough credits to buy. Python scripts using this function should not assume this is the only reason of failure.
You do not have the required permissions to view the files attached to this post.