示例#1
0
文件: cave.c 项目: zu-gabe/Game
/*
 * Retrieve player table information for the given player id.
 */
void get_player_info (db_t *database, int player_id, struct Player *player)
{
  db_result_t *result = db_query(database,
	"SELECT * FROM " DB_TABLE_PLAYER " WHERE playerID = %d", player_id);

  if (!db_result_next_row(result))
    throwf(SQL_EXCEPTION, "get_player_info: player %d not found", player_id);

  player->player_id = player_id;
  player->name = db_result_get_string(result, "name");
  player->tribe = db_result_get_string(result, "tribe");
  player->max_caves = db_result_get_int(result, "takeover_max_caves");
  player->locale = db_result_get_string(result, "language");
  player->locale_id = get_locale_id(player->locale);
  get_science_list(result, player->science);
}
示例#2
0
文件: l10n.c 项目: oblalex/horus
void locale_init(char* code)
{
    int locale_id = get_locale_id(code);

#ifdef _WIN_
    CP_OLD = GetConsoleCP();
    if (CP_OLD == 866)
        SetConsoleCP(1251);

    LC_ALL_OLD = getenv(LC_ALL_VAR);

    char var[20];
    sprintf(var, LC_ALL_VAR "=%s\0", locales[locale_id]);
    putenv(var);
#else
    setlocale(LC_ALL, locales[locale_id]);
#endif

	bindtextdomain(PACKAGE, LOCALEDIR);
	textdomain(PACKAGE);
}