remove unicode from autoseed (races are always english tokens)

This commit is contained in:
Enno Rehling 2021-02-24 18:48:12 +01:00
parent 9f9b6f4faf
commit f48551ebcb
2 changed files with 32 additions and 45 deletions

View file

@ -9,42 +9,42 @@ include_directories (${TOLUA_INCLUDE_DIR})
include_directories (${LUA_INCLUDE_DIR}) include_directories (${LUA_INCLUDE_DIR})
include_directories (${INIPARSER_INCLUDE_DIR}) include_directories (${INIPARSER_INCLUDE_DIR})
IF(DEFINED ERESSEA_VERSION) if(DEFINED ERESSEA_VERSION)
set_source_files_properties(kernel/version.c PROPERTIES set_source_files_properties(kernel/version.c PROPERTIES
COMPILE_DEFINITIONS ERESSEA_VERSION="${ERESSEA_VERSION}") compile_definitions ERESSEA_VERSION="${ERESSEA_VERSION}")
ENDIF() endif()
IF(DEFINED ERESSEA_BUILDNO) if(DEFINED ERESSEA_BUILDNO)
set_source_files_properties(kernel/version.c PROPERTIES set_source_files_properties(kernel/version.c PROPERTIES
COMPILE_DEFINITIONS ERESSEA_BUILDNO="${ERESSEA_BUILDNO}") COMPILE_DEFINITIONS ERESSEA_BUILDNO="${ERESSEA_BUILDNO}")
ENDIF() endif()
IF (CMAKE_COMPILER_IS_GNUCC) if (CMAKE_COMPILER_IS_GNUCC)
add_compile_options(-Wvla) add_compile_options(-Wvla)
ENDIF() endif()
IF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wsign-compare -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long) add_compile_options(-Wsign-compare -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long)
ELSEIF(MSVC) elseif(MSVC)
add_compile_options(/WX /MP) add_compile_options(/WX /MP)
# set(EXTRA_C_FLAGS /WX /MP /D_CRT_SECURE_NO_WARNINGS /D_USE_MATH_DEFINES) # set(EXTRA_C_FLAGS /WX /MP /D_CRT_SECURE_NO_WARNINGS /D_USE_MATH_DEFINES)
set(CMAKE_EXE_LINKER_FLAGS_DEBUG set(CMAKE_EXE_LINKER_FLAGS_DEBUG
"${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrt.lib") "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrt.lib")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE set(CMAKE_EXE_LINKER_FLAGS_RELEASE
"${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib") "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib")
ELSE() else()
MESSAGE(STATUS "unknown compiler ${CMAKE_C_COMPILER_ID}") message(STATUS "unknown compiler ${CMAKE_C_COMPILER_ID}")
ENDIF() endif()
IF(CMAKE_COMPILER_IS_CLANG) if(CMAKE_COMPILER_IS_CLANG)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wtautological-compare -Weverything") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wtautological-compare -Weverything")
MESSAGE(STATUS "compiler is clang: ${CMAKE_C_COMPILER_ID}") message(STATUS "compiler is clang: ${CMAKE_C_COMPILER_ID}")
ELSEIF(CMAKE_COMPILER_IS_GCC) elseif(CMAKE_COMPILER_IS_GCC)
EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -dumpversion execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION) OUTPUT_VARIABLE GCC_VERSION)
IF (GCC_VERSION VERSION_GREATER 4.9) if (GCC_VERSION VERSION_GREATER 4.9)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wfloat-conversion") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wfloat-conversion")
ENDIF() endif()
ENDIF(CMAKE_COMPILER_IS_CLANG) endif(CMAKE_COMPILER_IS_CLANG)
string(REGEX REPLACE "/W[3|4]" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") string(REGEX REPLACE "/W[3|4]" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
@ -57,23 +57,23 @@ add_subdirectory(triggers)
add_subdirectory(modules) add_subdirectory(modules)
add_subdirectory(races) add_subdirectory(races)
MACRO(ADD_LUA_MODULE MODULE_NAME FILES) macro(ADD_LUA_MODULE MODULE_NAME FILES)
ADD_LIBRARY (${MODULE_NAME} SHARED ${FILES}) add_library (${MODULE_NAME} SHARED ${FILES})
SET_TARGET_PROPERTIES(${MODULE_NAME} set_target_properties(${MODULE_NAME}
PROPERTIES PROPERTIES
PREFIX "" PREFIX ""
) )
ENDMACRO(ADD_LUA_MODULE) endmacro(ADD_LUA_MODULE)
MACRO(TOLUA_BINDING PKGFILE FILES) macro(TOLUA_BINDING PKGFILE FILES)
ADD_CUSTOM_COMMAND( add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${PKGFILE}.c OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${PKGFILE}.c
DEPENDS ${FILES} ${PKGFILE} DEPENDS ${FILES} ${PKGFILE}
COMMAND ${TOLUA_EXECUTABLE} COMMAND ${TOLUA_EXECUTABLE}
ARGS -o ${CMAKE_CURRENT_SOURCE_DIR}/${PKGFILE}.c ${PKGFILE} ARGS -o ${CMAKE_CURRENT_SOURCE_DIR}/${PKGFILE}.c ${PKGFILE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
) )
ENDMACRO(TOLUA_BINDING) endmacro(TOLUA_BINDING)
TOLUA_BINDING(log.pkg util/log.h) TOLUA_BINDING(log.pkg util/log.h)
TOLUA_BINDING(locale.pkg bind_locale.h) TOLUA_BINDING(locale.pkg bind_locale.h)

View file

@ -133,6 +133,11 @@ newfaction *read_newfactions(const char *filename)
} }
nf->password = str_strdup(password); nf->password = str_strdup(password);
nf->race = rc_find(race); nf->race = rc_find(race);
if (nf->race == NULL) {
log_error("new faction has unknown race '%s'.\n", race);
free(nf);
continue;
}
if (alliances != NULL) { if (alliances != NULL) {
struct alliance *al = findalliance(alliance); struct alliance *al = findalliance(alliance);
if (al == NULL) { if (al == NULL) {
@ -145,24 +150,6 @@ newfaction *read_newfactions(const char *filename)
else { else {
nf->allies = NULL; nf->allies = NULL;
} }
if (nf->race == NULL) {
/* if the script didn't supply the race as a token, then it gives us a
* race in the default locale (which means that itis a UTF8 string) */
nf->race = findrace(race, default_locale);
if (nf->race == NULL) {
char buffer[32];
size_t outbytes = sizeof(buffer) - 1;
size_t inbytes = strlen(race);
unicode_latin1_to_utf8(buffer, &outbytes, race, &inbytes);
buffer[outbytes] = 0;
nf->race = findrace(buffer, default_locale);
if (nf->race == NULL) {
log_error("new faction has unknown race '%s'.\n", race);
free(nf);
continue;
}
}
}
nf->lang = get_locale(lang); nf->lang = get_locale(lang);
assert(nf->race && nf->email && nf->lang); assert(nf->race && nf->email && nf->lang);
nfi = &newfactions; nfi = &newfactions;