From f4289660d6a8d48c3421357d43425c5aa27001ed Mon Sep 17 00:00:00 2001 From: driAn Date: Wed, 1 Nov 2006 20:57:12 +0000 Subject: [PATCH] keep alive git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@459 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/client.cpp | 11 +++++++++++ source/src/clients2c.cpp | 5 +++++ source/src/cube.h | 1 + source/src/protos.h | 1 + source/src/server.cpp | 1 - source/src/serverutil.cpp | 1 + source/src/weapon.cpp | 8 +++++--- source/src/worldio.cpp | 5 +++++ source/vcpp/cube.suo | Bin 26112 -> 26112 bytes 9 files changed, 29 insertions(+), 4 deletions(-) diff --git a/source/src/client.cpp b/source/src/client.cpp index 3dc747fe..91288921 100644 --- a/source/src/client.cpp +++ b/source/src/client.cpp @@ -204,6 +204,17 @@ void sendpackettoserv(void *packet) else localclienttoserver((ENetPacket *)packet); } +void c2skeepalive() +{ + if(clientnum<0 || !clienthost) return; + if(lastmillis-lastupdate<40) return; + + ENetEvent event; + while(clienthost!=NULL && enet_host_service(clienthost, &event, 0)>0) {}; // fixme + + lastupdate = SDL_GetTicks(); +}; + extern string masterpwd; void c2sinfo(dynent *d) // send update to the server diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index 1c5b1d86..1ee7e1cc 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -680,6 +680,11 @@ void localservertoclient(uchar *buf, int len) // processes any updates from th getint(p); break; }; + + case SV_NOP: + { + getint(p); break; + }; // End add diff --git a/source/src/cube.h b/source/src/cube.h index d11c1837..90ef9bc8 100644 --- a/source/src/cube.h +++ b/source/src/cube.h @@ -317,6 +317,7 @@ enum SV_BOTITEMPICKUP, SV_BOT2CLIENTDMG, SV_DIEDBYBOT, SV_GETMASTER, SV_MASTERCMD, SV_PWD, + SV_NOP, SV_EXT, }; diff --git a/source/src/protos.h b/source/src/protos.h index 79865ace..5b1f028f 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -69,6 +69,7 @@ extern bool allowedittoggle(); extern void sendpackettoserv(void *packet); extern void gets2c(); extern void c2sinfo(dynent *d); +extern void c2skeepalive(); extern void neterr(char *s); extern void initclientnet(); extern bool netmapstart(); diff --git a/source/src/server.cpp b/source/src/server.cpp index 8f4d47d1..075d363d 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -992,7 +992,6 @@ void serverslice(int seconds, unsigned int timeout) // main server update, cal if(configsets.length()) // EDIT: AH { nextcfgset(); - mapreload = true; changemap(); ctfbroadcast = true; } diff --git a/source/src/serverutil.cpp b/source/src/serverutil.cpp index d1e7b077..35224020 100644 --- a/source/src/serverutil.cpp +++ b/source/src/serverutil.cpp @@ -68,6 +68,7 @@ char msgsizesl[] = // size inclusive message token, 0 for variable SV_BOTITEMPICKUP, 3, SV_BOT2CLIENTDMG, 5, SV_DIEDBYBOT, 2, SV_GETMASTER, 0, SV_MASTERCMD, 3, SV_PWD, 0, + SV_NOP, 1, SV_EXT, 0, -1 }; diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index fdb87656..035f86b3 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -16,7 +16,7 @@ guninfo guns[NUMGUNS] = { S_SHOTGUN, S_RSHOTGUN, 2400, 1000, 6, 0, 0, 1, 35, 7, 9, 9, false, "shotgun" }, //reload time is for 1 shell from 7 too powerful to 6 { S_SUBGUN, S_RSUBGUN, 1650, 80, 17, 0, 0, 70, 15, 30, 1, 2, true, "subgun" }, { S_SNIPER, S_RSNIPER, 1950, 1500, 72, 0, 0, 60, 50, 5, 4, 4, false, "sniper" }, - { S_ASSAULT, S_RASSAULT, 2000, 130, 20, 0, 0, 20, 40, 20, 0, 2, true, "assault" }, //recoil was 44 + { S_ASSAULT, S_RASSAULT, 2000, 130, /*20*/25, 0, 0, 20, 40, 20, 0, 2, true, "assault" }, //recoil was 44 { S_NULL, S_NULL, 1000, 1200, 150, 20, 6, 1, 1, 1, 3, 1, "grenade" }, }; @@ -67,6 +67,7 @@ void weapon(int gun) void shiftweapon(int i) { + if(player1->weaponchanging) return; int gun; switch(player1->gunselect) { @@ -75,8 +76,9 @@ void shiftweapon(int i) case GUN_GRENADE: gun=G_GRENADE; break; default: gun=G_PRIMARY; break; }; - gun += i; - weapon(gun); + gun += i; + weapon(gun); + for(int j = 0; j <= G_NUM && !player1->weaponchanging; j++) { gun += i > 0 ? 1 : -1; weapon(gun); } } COMMAND(weapon, ARG_1INT); diff --git a/source/src/worldio.cpp b/source/src/worldio.cpp index e1e33140..bde7df35 100644 --- a/source/src/worldio.cpp +++ b/source/src/worldio.cpp @@ -285,6 +285,7 @@ void load_world(char *mname) // still supports all map formats that have }; free(world); setupworld(hdr.sfactor); + c2skeepalive(); char texuse[256]; loopi(256) texuse[i] = 0; sqr *t = NULL; @@ -349,6 +350,7 @@ void load_world(char *mname) // still supports all map formats that have if(!SOLID(s)) texuse[s->utex] = texuse[s->ftex] = texuse[s->ctex] = 1; }; gzclose(f); + c2skeepalive(); calclight(); settagareas(); conoutf("read map %s (%d milliseconds)", cgzname, SDL_GetTicks()-lastmillis); @@ -363,8 +365,11 @@ void load_world(char *mname) // still supports all map formats that have execfile(pcfname); execfile(mcfname); int xs, ys; + c2skeepalive(); loopi(256) if(texuse) lookuptexture(i, xs, ys); + c2skeepalive(); preload_mapmodels(); + c2skeepalive(); }; COMMANDN(savemap, save_world, ARG_1STR); diff --git a/source/vcpp/cube.suo b/source/vcpp/cube.suo index 7c46c290b01c23b024622b4dc29321087a619d4a..becf95691a9cdcda44a98860371515056b7c1dae 100644 GIT binary patch delta 1706 zcmd^9%}*0i5TDt$(AE~A1=~WAh5}M(pnxFKs^v>G7-}Oi6-y9>D5%hs3Xz15m}oq3 zfl;Gg1Vc0!qmqqyFi}iActE2kP5c8)xNt@j>TIp0WRH5%_cFWh&HQ$LZ$92muHfVf zKD!}Ix2My*V8e|?zZ++iM=*uvv^G^{)oR*zF|6zm&`0l6&Z{?~(dbbCAaAM@=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