Skip to content
Browse files

Endspurt vor dem 23C3

git-svn-id: http://infon.googlecode.com/svn/trunk@138 8171fb75-e542-0410-96e4-03d5dd800671
  • Loading branch information...
1 parent 4ff6d4d commit 8e808e5472eac697b98b422c7cdeb2459e33ff3e @dividuum committed Dec 21, 2006
Showing with 16 additions and 12 deletions.
  1. +2 −2 client.c
  2. +1 −1 config.lua
  3. +2 −2 infond.lua
  4. +0 −2 lua-5.1.1/src/lvm.c
  5. +1 −1 misc.c
  6. +1 −1 misc.h
  7. +1 −1 null_gui.c
  8. +1 −1 player.lua
  9. +2 −0 rules/default.lua
  10. +5 −1 server.c
View
4 client.c
@@ -129,7 +129,7 @@ static void client_handle_packet(packet_t *packet) {
client_creature_from_network(packet);
break;
case PACKET_QUIT_MSG:
- info("Server wants us to disconnect:\n%.*s",
+ infomsg("Server wants us to disconnect:\n%.*s",
packet->len, packet->data);
client_destroy("done");
break;
@@ -295,7 +295,7 @@ void file_loop(int delta) {
// more data needed?
case 1:
- ret = evbuffer_read(in_buf, clientfd, 4096);
+ ret = evbuffer_read(in_buf, clientfd, 64);
if (ret < 0) {
client_destroy(strerror(errno));
View
2 config.lua
@@ -52,7 +52,7 @@ banner = [[
-- competition = true
-- competition_log = "competition.log"
--- competition_bots = { "bot1.lua", "bot2.lua" }
+-- competition_bots = { { source = "bot1.lua" }, { source = "bot2.lua", log = "bot2.log"} }
-- time_limit = 10 * 60 * 1000
-- maps = { "foo", "foo", "foo" }
-- listenaddr = nil
View
4 infond.lua
@@ -331,8 +331,8 @@ function on_game_started()
competition_done_setup = true
competition_rounds = #maps
disable_joining = "competition mode"
- for _, code in pairs(competition_bots) do
- appendline(competition_log, string.format("joining '%s' as %d", code, start_bot(code)))
+ for _, bot in pairs(competition_bots) do
+ appendline(competition_log, string.format("joining '%s' as %d", bot.source, start_bot(bot.source, bot.log)))
end
end
View
2 lua-5.1.1/src/lvm.c
@@ -374,7 +374,6 @@ static void Arith (lua_State *L, StkId ra, const TValue *rb,
#define cpu_exceeded_grace_cycles 16
static void cpu_limit_exceeded(lua_State *L) {
- lua_assert(G(L)->cpu_exceeded);
luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
L->ci->top = L->top + LUA_MINSTACK;
lua_assert(L->ci->top <= L->stack_last);
@@ -386,7 +385,6 @@ static void cpu_limit_exceeded(lua_State *L) {
lua_pushliteral(L, "cycles exceeded");
lua_set_cycles(L, cpu_exceeded_grace_cycles);
lua_error(L);
- abort();
}
int luaV_execute (lua_State *L) {
View
2 misc.c
@@ -45,7 +45,7 @@ void die(const char *fmt, ...) {
exit(1);
}
-void info(const char *fmt, ...) {
+void infomsg(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
#ifdef WIN32
View
2 misc.h
@@ -23,7 +23,7 @@
void die(const char *fmt, ...);
int yesno(const char *fmt, ...);
-void info(const char *fmt, ...);
+void infomsg(const char *fmt, ...);
#ifdef WIN32
const char *ErrorString(int error);
#endif
View
2 null_gui.c
@@ -32,7 +32,7 @@ static void null_close() {
}
static void null_tick(int gt, int delta) {
- printf("tick %d\n", delta);
+ printf("tick %d %d\n", delta, infon->get_traffic());
}
static void null_world_info_changed(const client_world_info_t *info) {
View
2 player.lua
@@ -48,7 +48,7 @@ do
-- limit string.rep
local orig_string_rep = string.rep
function string.rep(s, n)
- assert(n < 10000, "string.rep's n is limited to 10000")
+ assert(n <= 10000, "string.rep's n is limited to 10000")
return orig_string_rep(s, n)
end
View
2 rules/default.lua
@@ -26,6 +26,8 @@ function onRound()
round_end_text = "Timelimit hit"
elseif num_winner == 1 then
round_end_text = "Timelimit hit. " .. player_get_name(winner) .. " wins the game!"
+ else
+ round_end_text = "Timelimit hit. The game is a draw."
end
end
View
6 server.c
@@ -161,7 +161,11 @@ static void server_readable(int fd, short event, void *arg) {
lua_pushnumber(L, fd);
lua_pushstring(L, line);
free(line);
+
+ // Cycles fuer die Verarbeitung hochsetzen
+ lua_set_cycles(L, 0xFFFFFF);
+ // Input verarbeiten
output_client = client;
if (lua_pcall(L, 2, 0, 0) != 0) {
fprintf(stderr, "error calling on_client_input: %s\n", lua_tostring(L, -1));
@@ -318,7 +322,7 @@ void server_destroy(client_t *client, const char *reason) {
packet_writeXX(&packet, reason, strlen(reason));
server_send_packet(&packet, client);
} else {
- server_writeto(client, "connection terminating: ", 25);
+ server_writeto(client, "connection terminating: ", 24);
server_writeto(client, reason, strlen(reason));
server_writeto(client, "\r\n", 2);
}

0 comments on commit 8e808e5

Please sign in to comment.
Something went wrong with that request. Please try again.