Re: [Freeciv-Dev] Bug in savegame loading?
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Trent Piepho wrote:
> On Thu, 11 Mar 1999, David Pfitzner wrote:
> > Possibly compare the old value (in the unit struct) to
> > a newly calculated value, and re-send a PACKET_INCITE_COST
> > if different (to popup a new confirmation with the new
> > cost).
>
> That would be annoying. Each time a player spends some money, the bribe cost
> changes. Imagine a lagged player trying to bribe a unit when the enemy keeps
> buying things for his cities. You might have to try 5 or 6 times.
Well, you could have the server only send a new PACKET_INCITE_COST
if the cost has gone up. (If it has gone down, the player
already agreed to a higher cost, so should be happy with
a discount.) But then there could still be a problem for
a lagged player trying to bribe from someone who kept selling
things...
> Why not
> just say that the cost is calculated when the player attempts to bribe the
> units or city, and that it is good until the player says yes or no?
Yeah, I guess that is reasonable. Its unlikely that you
will get a case where a player waits a long time before
starting to bribe and accepting.
I guess I'm worried about a hacked client which sends
PACKET_DIPLOMAT_ACTION:DIPLOMAT_BRIBE without a preceeding
PACKET_INCITE_INQ. That could then use a bribe cost which
was calculated many turns previously. Ok, there are probably
many ways in which a hacked client can subvert the server,
but it would be nice to fix them where possible.
(You could set the bribe_cost to a flag value at the
start of a turn and complain of a bribe attempt if
the value is still the flag value. (That is, if
PACKET_DIPLOMAT_ACTION:DIPLOMAT_BRIBE before
PACKET_INCITE_INQ.))
Even stranger things can happen in the (admittedly unlikely)
case that two player both try to bribe the same unit belonging
to a third player. With different costs when they start to
bribe, and various orders for pressing ok. Hmm, when a unit
is bribed, does it keep the same id? (Can't check right now.)
But probably not worth worrying about (as long as there are
no core dumps etc involved, which I don't think there are here).
> Before I
> added the bit with PACKET_INCITE_INQ the bribe cost was sent to the client
> with every unit update, however the server only calculated it at the beginning
> of the turn. So if you took the enemy capital, his units wouldn't get any
> cheaper.
Yeah, the current situation is better than before.
I suggest we just delete the unnecessary calls to
unit_bribe_cost(), and for now rely on the client to do
the right thing. That is, the cost is set at the
time when PACKET_INCITE_INQ is received by the server.
Regards,
-- David
|
|