From b825b78015d8877932acd06a09108fc533e0ae43 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Mon, 6 Nov 2006 16:08:58 +0000 Subject: [PATCH] no message git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@496 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/client.cpp | 2 +- source/src/clientextras.cpp | 4 ++-- source/src/clientgame.cpp | 2 +- source/src/command.cpp | 2 +- source/src/main.cpp | 4 +++- source/src/menus.cpp | 2 +- source/src/renderextras.cpp | 2 +- source/src/server.cpp | 17 +++++++++-------- source/src/tools.h | 5 +++-- source/src/weapon.cpp | 3 +-- 10 files changed, 23 insertions(+), 20 deletions(-) diff --git a/source/src/client.cpp b/source/src/client.cpp index 1a1bc1df..19844ddf 100644 --- a/source/src/client.cpp +++ b/source/src/client.cpp @@ -353,7 +353,7 @@ void gets2c() // get updates from the server case ENET_EVENT_TYPE_RECEIVE: if(disconnecting) conoutf("attempting to disconnect..."); - else localservertoclient(event.channelID, event.packet->data, event.packet->dataLength); + else localservertoclient(event.channelID, event.packet->data, (int)event.packet->dataLength); enet_packet_destroy(event.packet); break; diff --git a/source/src/clientextras.cpp b/source/src/clientextras.cpp index 52d94310..a163b1ef 100644 --- a/source/src/clientextras.cpp +++ b/source/src/clientextras.cpp @@ -21,7 +21,7 @@ void renderclient(dynent *d, bool team, char *mdlname, float scale) int oldaniminterpt = -1; float speed = 100.0f; float mz = d->o.z-d->eyeheight+1.55f*scale; - int basetime = -((int)d&0xFFF); + int basetime = -((int)(size_t)d&0xFFF); if(d->state==CS_DEAD) { loopv(physents) if(physents[i]->state==GIB && physents[i]->owner==d) return; @@ -184,7 +184,7 @@ void sendmap(char *mapname) putint(p, mapsize); if(65535 - p.length() < mapsize) { - conoutf("map %s is too large to send", (int)mapname); + conoutf("map %s is too large to send", mapname); delete[] mapdata; enet_packet_destroy(packet); return; diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 1e5c1fbb..cbe11c8c 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -701,7 +701,7 @@ void showmastermenu(int m) // 0=kick, 1=ban loopv(players) { - if(players[i]) menumanual(menu, i, players[i]->name, (char *) i); // ugly hack + if(players[i]) menumanual(menu, i, players[i]->name, (char *)(size_t)i); // ugly hack }; menuset(menu); }; diff --git a/source/src/command.cpp b/source/src/command.cpp index 5630f9b1..a2805cf0 100644 --- a/source/src/command.cpp +++ b/source/src/command.cpp @@ -246,7 +246,7 @@ void complete(char *s) s_strcat(s, t); }; if(!s[1]) return; - if(!completesize) { completesize = strlen(s)-1; completeidx = 0; }; + if(!completesize) { completesize = (int)strlen(s)-1; completeidx = 0; }; int idx = 0; enumerate(*idents, ident, id, if(strncmp(id.name, s+1, completesize)==0 && idx++==completeidx) diff --git a/source/src/main.cpp b/source/src/main.cpp index f08d84bf..7b855ec6 100644 --- a/source/src/main.cpp +++ b/source/src/main.cpp @@ -205,7 +205,7 @@ int main(int argc, char **argv) { bool dedicated = false; int fs = SDL_FULLSCREEN, depth = 0, bpp = 0, fsaa = 0, par = 0, uprate = 0, maxcl = 4; - char *sdesc = "", *ip = "", *master = NULL, *passwd = "", *maprot = NULL; + char *sdesc = "", *ip = "", *master = NULL, *passwd = ""; islittleendian = *((char *)&islittleendian); #define log(s) puts("init: " s) @@ -325,7 +325,9 @@ int main(int argc, char **argv) log("mainloop"); int ignore = 5, grabmouse = 0; +#ifdef _DEBUG int lastflush = 0; +#endif for(;;) { static int curmillis = 0, frames = 0; diff --git a/source/src/menus.cpp b/source/src/menus.cpp index 2c16bd76..e2d9d3b4 100644 --- a/source/src/menus.cpp +++ b/source/src/menus.cpp @@ -243,7 +243,7 @@ bool menukey(int code, bool isdown) if(vmenu==1) connects(getservername(menusel)); else if(vmenu==3 || vmenu==4) { - int cn = (int)action; + int cn = (int)(size_t)action; mastercommand(vmenu==3 ? MCMD_KICK : MCMD_BAN, cn); purgemenu(vmenu); menuset(-1); diff --git a/source/src/renderextras.cpp b/source/src/renderextras.cpp index a124c51c..74139019 100644 --- a/source/src/renderextras.cpp +++ b/source/src/renderextras.cpp @@ -605,7 +605,7 @@ void renderphysents() case GIB: default: { - uint n = (((4*(uint)p)+(uint)p->timetolife)%3)+1; + uint n = (((4*(uint)(size_t)p)+(uint)p->timetolife)%3)+1; s_sprintf(model)("misc/gib0%u", n); int t = lastmillis-p->millis; if(t>p->timetolife-2000) diff --git a/source/src/server.cpp b/source/src/server.cpp index 7f549335..818463dc 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -98,7 +98,7 @@ void sendpacket(int n, int chan, ENetPacket *packet) case ST_TCPIP: { enet_peer_send(clients[n]->peer, chan, packet); - bsend += packet->dataLength; + bsend += (int)packet->dataLength; break; }; @@ -1243,7 +1243,7 @@ void serverslice(int seconds, unsigned int timeout) // main server update, cal client &c = addclient(); c.type = ST_TCPIP; c.peer = event.peer; - c.peer->data = (void *)c.clientnum; + c.peer->data = (void *)(size_t)c.clientnum; c.ismaster = c.isauthed = false; char hn[1024]; s_strcpy(c.hostname, (enet_address_get_host(&c.peer->address, hn, sizeof(hn))==0) ? hn : "unknown"); @@ -1256,8 +1256,8 @@ void serverslice(int seconds, unsigned int timeout) // main server update, cal case ENET_EVENT_TYPE_RECEIVE: { - brec += event.packet->dataLength; - int cn = (int)event.peer->data; + brec += (int)event.packet->dataLength; + int cn = (int)(size_t)event.peer->data; if(valid_client(cn)) process(event.packet, cn, event.channelID); if(event.packet->referenceCount==0) enet_packet_destroy(event.packet); break; @@ -1265,13 +1265,14 @@ void serverslice(int seconds, unsigned int timeout) // main server update, cal case ENET_EVENT_TYPE_DISCONNECT: { - if(!valid_client((int)event.peer->data)) break; - client &c = *clients[(int)event.peer->data]; + int cn = (int)(size_t)event.peer->data; + if(!valid_client(cn)) break; + client &c = *clients[cn]; printf("disconnected client (%s)\n", c.hostname); clientscore *sc = findscore(c, true); if(sc) *sc = c.score; - zapclient((int)event.peer->data); - sendf(-1, 1, "rii", SV_CDIS, (int)event.peer->data); + zapclient(cn); + sendf(-1, 1, "rii", SV_CDIS, cn); event.peer->data = (void *)-1; break; }; diff --git a/source/src/tools.h b/source/src/tools.h index 98b46ed6..0354e1d5 100644 --- a/source/src/tools.h +++ b/source/src/tools.h @@ -384,8 +384,9 @@ struct databuf T *buf; int len, maxlen; uchar flags; - - databuf(T *buf, int maxlen) : buf(buf), len(0), maxlen(maxlen), flags(0) {}; + + template + databuf(T *buf, U maxlen) : buf(buf), len(0), maxlen((int)maxlen), flags(0) {}; const T &get() { diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 53a375b3..bdf140d7 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -106,7 +106,7 @@ void setscope(bool activate) void altaction(int activate) { //if(player1->gunselect == GUN_SNIPER && player1->state!=CS_DEAD) togglescope(); - if(player1->gunselect == GUN_SNIPER && player1->state!=CS_DEAD) setscope(activate); + if(player1->gunselect == GUN_SNIPER && player1->state!=CS_DEAD) setscope(activate!=0); } COMMAND(altaction, ARG_1INT); @@ -504,7 +504,6 @@ void explode_nade(physent *i) void shootv(int gun, vec &from, vec &to, dynent *d, bool local, int nademillis) // create visual effect from a shot { playsound(guns[gun].sound, d==player1 ? NULL : &d->o); - int pspeed = 25; switch(gun) { case GUN_KNIFE: