News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

[patch] vehikelbauer converts uint32 to sint32

Started by gerw, August 13, 2009, 08:45:50 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gerw

If a vehicle costs 21M - 42M, the cast in vehikelbauer have a wrong result. This should be the 'bug' caused the cheat bus. Or is this the intended behaviour? ;)
Index: bauer/vehikelbauer.cc
===================================================================
--- bauer/vehikelbauer.cc       (revision 2589)
+++ bauer/vehikelbauer.cc       (working copy)
@@ -164,8 +164,8 @@
                        dbg->fatal("vehikelbauer_t::baue()", "cannot built a vehicle with waytype %i", vb->get_waytype());
        }

-       sp->buche(-(sint32)vb->get_preis(), k.get_2d(), COST_NEW_VEHICLE );
-       sp->buche( (sint32)vb->get_preis(), COST_ASSETS );
+       sp->buche(-(sint64)vb->get_preis(), k.get_2d(), COST_NEW_VEHICLE );
+       sp->buche( (sint64)vb->get_preis(), COST_ASSETS );

        return v;
}

prissi

The cheat bus is somehow accepted, although the conversion would be also ok.

gerw

We could add a tool, which gives some money to the player - that would also ease the life of the AI  :D

sojo

Quote from: gerw on August 13, 2009, 03:47:25 PM
We could add a tool, which gives some money to the player - that would also ease the life of the AI  :D
That could be named a bank! ;)
"English is a easy language. But not for me." ;) sojo

follow simutrans_de on Twitter
- A home for Simutrans (in german)

prissi


prissi

The cheat bus seems to be accepted, thus the consent was aparently to keept thing like they are.

Spike

Erm ... no one spoke up on this topic, so we should not jump to conclusions. I'd say we fix the bug, and the players have to use -freeplay, which was intended for money problems.

gerw


sanna

I agree with Hajo, it is a bug, there is a fix, if that fix is acceptable, then by all means apply it.

z9999+

I think way cost and way maintenance cost are also possible to earn money, if you set minus value.

gerw

Quote from: z9999+ on November 05, 2009, 02:03:58 PM
I think way cost and way maintenance cost are also possible to earn money, if you set minus value.
Both are uint32, so no negative value possible. But it maybe depends on the 'long' type:
long get_preis() const { return price; }
long get_wartung() const { return maintenance; }

prissi

There are two threds under Simutrans discussion and scenarios where this was discussed. If most people feel like this is needed I can apply it. I have no preferences on this topic.

z9999+

Try to wrote negative value in .dat file, so that you can see.

prissi