The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: gerw on August 13, 2009, 08:45:50 am

Title: [patch] vehikelbauer converts uint32 to sint32
Post by: gerw on August 13, 2009, 08:45:50 am
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? ;)
Code: [Select]
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_****ETS );
+       sp->buche(-(sint64)vb->get_preis(), k.get_2d(), COST_NEW_VEHICLE );
+       sp->buche( (sint64)vb->get_preis(), COST_****ETS );
 
        return v;
 }
Title: Re: [patch] vehikelbauer converts uint32 to sint32
Post by: prissi on August 13, 2009, 02:19:06 pm
The cheat bus is somehow accepted, although the conversion would be also ok.
Title: Re: [patch] vehikelbauer converts uint32 to sint32
Post by: 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
Title: Re: [patch] vehikelbauer converts uint32 to sint32
Post by: sojo on August 13, 2009, 05:19:38 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! ;)
Title: Re: [patch] vehikelbauer converts uint32 to sint32
Post by: prissi on September 05, 2009, 08:34:05 pm
How to proceed now? Keep it as it is?
Title: Re: [patch] vehikelbauer converts uint32 to sint32
Post by: prissi on November 04, 2009, 09:44:31 pm
The cheat bus seems to be accepted, thus the consent was aparently to keept thing like they are.
Title: Re: [patch] vehikelbauer converts uint32 to sint32
Post by: Spike on November 05, 2009, 09:06:17 am
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.
Title: Re: [patch] vehikelbauer converts uint32 to sint32
Post by: gerw on November 05, 2009, 10:25:08 am
I also don't like all those "intended bugs"...
Title: Re: [patch] vehikelbauer converts uint32 to sint32
Post by: sanna on November 05, 2009, 01:37:55 pm
I agree with Hajo, it is a bug, there is a fix, if that fix is acceptable, then by all means apply it.
Title: Re: [patch] vehikelbauer converts uint32 to sint32
Post by: 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.
Title: Re: [patch] vehikelbauer converts uint32 to sint32
Post by: gerw on November 05, 2009, 03:18:20 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:
Code: [Select]
long get_preis() const { return price; }
long get_wartung() const { return maintenance; }
Title: Re: [patch] vehikelbauer converts uint32 to sint32
Post by: prissi on November 05, 2009, 03:23:11 pm
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.
Title: Re: [patch] vehikelbauer converts uint32 to sint32
Post by: z9999+ on November 05, 2009, 03:30:13 pm
Try to wrote negative value in .dat file, so that you can see.
Title: Re: [patch] vehikelbauer converts uint32 to sint32
Post by: prissi on November 21, 2009, 09:16:06 pm
Ok, added to trunk