forked from github/server
Testing for C90 compatibility
This commit is contained in:
parent
38fd655af9
commit
a9ca16e767
|
@ -172,7 +172,7 @@ endif(CURSES_FOUND)
|
|||
if(IWYU_PATH)
|
||||
# set(C_INCLUDE_WHAT_YOU_USE "${IWYU_PATH} -Xiwyu --no_fwd_decls")
|
||||
else(IWYU_PATH)
|
||||
message(STATUS "Could not find the program include-what-you-use")
|
||||
# message(STATUS "Could not find the program include-what-you-use")
|
||||
endif()
|
||||
|
||||
add_library(version STATIC ${VERSION_SRC})
|
||||
|
@ -204,9 +204,6 @@ add_library(game ${ERESSEA_SRC})
|
|||
target_link_libraries(game ${EXTRA_LIBS} parser version)
|
||||
|
||||
add_executable(eressea ${SERVER_SRC})
|
||||
if (IWYU_PATH)
|
||||
set_property(TARGET eressea PROPERTY C_INCLUDE_WHAT_YOU_USE ${IWYU_PATH})
|
||||
endif(IWYU_PATH)
|
||||
target_link_libraries(eressea
|
||||
game
|
||||
${TOLUA_LIBRARIES}
|
||||
|
@ -275,6 +272,11 @@ target_link_libraries(test_eressea
|
|||
${IniParser_LIBRARIES}
|
||||
)
|
||||
|
||||
set_target_properties(test_eressea eressea PROPERTIES C_STANDARD 90)
|
||||
if (IWYU_PATH)
|
||||
set_target_properties(test_eressea eressea PROPERTIES C_INCLUDE_WHAT_YOU_USE ${IWYU_PATH})
|
||||
endif(IWYU_PATH)
|
||||
|
||||
add_test(server test_eressea)
|
||||
#add_test(NAME E3
|
||||
# WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/game-e3
|
||||
|
|
|
@ -325,6 +325,10 @@ static double peasant_luck_factor(void)
|
|||
return config_get_flt("rules.peasants.peasantluck.factor", PEASANTLUCK);
|
||||
}
|
||||
|
||||
inline int round_births(double growth) {
|
||||
return (int)growth;
|
||||
}
|
||||
|
||||
int peasant_luck_effect(int peasants, int luck, int maxp, double variance)
|
||||
{
|
||||
int births = 0;
|
||||
|
@ -334,7 +338,7 @@ int peasant_luck_effect(int peasants, int luck, int maxp, double variance)
|
|||
mean *= peasant_luck_factor() * peasant_growth_factor();
|
||||
mean *= ((peasants / (double)maxp < .9) ? 1 : PEASANTFORCE);
|
||||
|
||||
births = (int)ceil(normalvariate(mean, variance * mean));
|
||||
births = round_births(normalvariate(mean, variance * mean));
|
||||
if (births <= 0)
|
||||
births = 1;
|
||||
if (births > peasants / 2)
|
||||
|
@ -353,7 +357,7 @@ static void peasants(region * r, int rule)
|
|||
if (peasants > 0 && rule > 0) {
|
||||
int luck = 0;
|
||||
double fraction = peasants * peasant_growth_factor();
|
||||
int births = (int)ceil(fraction);
|
||||
int births = round_births(fraction);
|
||||
attrib *a = a_find(r->attribs, &at_peasantluck);
|
||||
|
||||
if (a != NULL) {
|
||||
|
|
Loading…
Reference in New Issue