Author: cazfi Date: Wed Jun 29 12:24:34 2016 New Revision: 33109 URL: http://svn.gna.org/viewcvs/freeciv?rev=33109&view=rev Log: Correceted the way sdl-clients calculate production change penalty.
See bug #24807 Modified: branches/S2_5/client/gui-sdl/wldlg.c Modified: branches/S2_5/client/gui-sdl/wldlg.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-sdl/wldlg.c?rev=33109&r1=33108&r2=33109&view=diff ============================================================================== --- branches/S2_5/client/gui-sdl/wldlg.c (original) +++ branches/S2_5/client/gui-sdl/wldlg.c Wed Jun 29 12:24:34 2016 @@ -1,4 +1,4 @@ -/********************************************************************** +/*********************************************************************** Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -286,47 +286,46 @@ flush_dirty(); } -/* - * Find if two targets are the same class (unit, imprv. , wonder). - * This is needed by calculation of change production shields penalty. - * [similar to are_universals_equal()] - */ -static bool are_the_same_class(const struct universal one, - const struct universal two) +/************************************************************************** + Find if two targets are the same class (unit, imprv. , wonder). + This is needed by calculation of change production shields penalty. + [similar to are_universals_equal()] +**************************************************************************/ +static bool are_prods_same_class(const struct universal one, + const struct universal two) { if (one.kind != two.kind) { return FALSE; } - if (VUT_UTYPE == one.kind) { - return one.value.utype == two.value.utype; - } + if (VUT_IMPROVEMENT == one.kind) { if (is_wonder(one.value.building)) { return is_wonder(two.value.building); - } - return (one.value.building == two.value.building); - } + } else { + return !is_wonder(two.value.building); + } + } + return FALSE; } -/* - * Change production in editor shell, callculate production shields penalty and - * refresh production progress label - */ +/************************************************************************** + Change production in editor shell, calculate production shields penalty and + refresh production progress label +**************************************************************************/ static void change_production(struct universal prod) { - - if(!are_the_same_class(pEditor->currently_building, prod)) { - if(pEditor->stock != pEditor->pCity->shield_stock) { - if(are_the_same_class(pEditor->pCity->production, prod)) { - pEditor->stock = pEditor->pCity->shield_stock; + if (!are_prods_same_class(pEditor->currently_building, prod)) { + if (pEditor->stock != pEditor->pCity->shield_stock) { + if (are_prods_same_class(pEditor->pCity->production, prod)) { + pEditor->stock = pEditor->pCity->shield_stock; } } else { pEditor->stock = - city_change_production_penalty(pEditor->pCity, prod); - } - } - + city_change_production_penalty(pEditor->pCity, prod); + } + } + pEditor->currently_building = prod; refresh_production_label(pEditor->stock); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits