forked from github/server
commit
b82bc0bb9c
|
@ -14,8 +14,10 @@ local function ponnuki_brain(u)
|
||||||
u:add_notice("Eine Botschaft von " .. tostring(u) .. ": " ..jokes[i])
|
u:add_notice("Eine Botschaft von " .. tostring(u) .. ": " ..jokes[i])
|
||||||
local d = math.random(6)
|
local d = math.random(6)
|
||||||
local r = u.region:next(d-1)
|
local r = u.region:next(d-1)
|
||||||
u:clear_orders()
|
if r.terrain == 'glacier' then
|
||||||
u:add_order("NACH " .. directions[d])
|
u:clear_orders()
|
||||||
|
u:add_order("NACH " .. directions[d])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ponnuki.init()
|
function ponnuki.init()
|
||||||
|
@ -26,11 +28,18 @@ function ponnuki.init()
|
||||||
local home = get_region(-67, -5)
|
local home = get_region(-67, -5)
|
||||||
local f = get_faction(666)
|
local f = get_faction(666)
|
||||||
if home and f then
|
if home and f then
|
||||||
u = unit.create(f, home, 1, "illusion")
|
if home.terrain~="glacier" then
|
||||||
u.id = atoi36("ponn")
|
home.terrain="glacier"
|
||||||
u.name = "Ponnuki"
|
home.name = 'Magrathea'
|
||||||
u.info = "Go, Ponnuki, Go!"
|
end
|
||||||
u:set_racename("Ritter von Go")
|
u = unit.create(f, home, 1, "template")
|
||||||
|
if u then
|
||||||
|
u.id = atoi36("ponn")
|
||||||
|
u.name = "Ponnuki"
|
||||||
|
u.info = "Go, Ponnuki, Go!"
|
||||||
|
u.race_name = "Ritter von Go"
|
||||||
|
print(u:show())
|
||||||
|
end
|
||||||
else
|
else
|
||||||
eressea.log.error("Ponnuki cannot find Magrathea")
|
eressea.log.error("Ponnuki cannot find Magrathea")
|
||||||
end
|
end
|
||||||
|
|
|
@ -121,7 +121,7 @@ const char *parameters[MAXPARAMS] = {
|
||||||
"TEMP",
|
"TEMP",
|
||||||
"FLIEHE",
|
"FLIEHE",
|
||||||
"GEBAEUDE",
|
"GEBAEUDE",
|
||||||
"GIB", /* F<EFBFBD>r HELFE */
|
"GIB", /* HELFE GIB */
|
||||||
"KAEMPFE",
|
"KAEMPFE",
|
||||||
"DURCHREISE",
|
"DURCHREISE",
|
||||||
"BEWACHE",
|
"BEWACHE",
|
||||||
|
|
|
@ -57,7 +57,7 @@ int unicode_utf8_trim(utf8_t *buf)
|
||||||
if (op == buf && iswspace(wc)) {
|
if (op == buf && iswspace(wc)) {
|
||||||
++result;
|
++result;
|
||||||
}
|
}
|
||||||
else if (iswprint(wc)) {
|
else if (wc>255 || !iscntrl(wc)) {
|
||||||
if (op != ip) {
|
if (op != ip) {
|
||||||
memmove(op, ip, size);
|
memmove(op, ip, size);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,8 @@ int unicode_utf8_trim(utf8_t *buf)
|
||||||
lc = op;
|
lc = op;
|
||||||
ts = 0;
|
ts = 0;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
++result;
|
++result;
|
||||||
}
|
}
|
||||||
ip += size;
|
ip += size;
|
||||||
|
|
|
@ -123,6 +123,17 @@ static void test_unicode_compare(CuTest *tc)
|
||||||
CuAssertIntEquals(tc, 1, unicode_utf8_strcasecmp("bacdefg123", "ABCDEFG123"));
|
CuAssertIntEquals(tc, 1, unicode_utf8_strcasecmp("bacdefg123", "ABCDEFG123"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_unicode_farsi_nzwj(CuTest *tc) {
|
||||||
|
const char str[] = { 0xe2, 0x80, 0x8c, 0xd8, 0xa7, 0xd9, 0x84, 0xd8, 0xaf,
|
||||||
|
0xdb, 0x8c, 0xd9, 0x86, 0x20, 0xd9, 0x85, 0xd8, 0xad, 0xd9, 0x85, 0xd8,
|
||||||
|
0xaf, 0x20, 0xd8, 0xb1, 0xd9, 0x88, 0xd9, 0x85, 0xdb, 0x8c, 0xe2, 0x80,
|
||||||
|
0x8e, 0xe2, 0x80, 0x8e, 0x00 };
|
||||||
|
char name[64];
|
||||||
|
strcpy(name, str);
|
||||||
|
CuAssertIntEquals(tc, 0, unicode_utf8_trim(name));
|
||||||
|
CuAssertStrEquals(tc, str, name);
|
||||||
|
}
|
||||||
|
|
||||||
CuSuite *get_unicode_suite(void)
|
CuSuite *get_unicode_suite(void)
|
||||||
{
|
{
|
||||||
CuSuite *suite = CuSuiteNew();
|
CuSuite *suite = CuSuiteNew();
|
||||||
|
@ -132,5 +143,6 @@ CuSuite *get_unicode_suite(void)
|
||||||
SUITE_ADD_TEST(suite, test_unicode_utf8_to_other);
|
SUITE_ADD_TEST(suite, test_unicode_utf8_to_other);
|
||||||
SUITE_ADD_TEST(suite, test_unicode_utf8_to_ucs);
|
SUITE_ADD_TEST(suite, test_unicode_utf8_to_ucs);
|
||||||
SUITE_ADD_TEST(suite, test_unicode_compare);
|
SUITE_ADD_TEST(suite, test_unicode_compare);
|
||||||
|
SUITE_ADD_TEST(suite, test_unicode_farsi_nzwj);
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue