… | |
… | |
132 | static void |
132 | static void |
133 | clear_map (player *pl) |
133 | clear_map (player *pl) |
134 | { |
134 | { |
135 | memset (&pl->ns->lastmap, 0, sizeof (pl->ns->lastmap)); |
135 | memset (&pl->ns->lastmap, 0, sizeof (pl->ns->lastmap)); |
136 | |
136 | |
|
|
137 | pl->ns->force_newmap = false; |
|
|
138 | |
137 | if (pl->ns->newmapcmd == 1) |
139 | if (pl->ns->newmapcmd == 1) |
138 | pl->ns->send_packet ("newmap"); |
140 | pl->ns->send_packet ("newmap"); |
139 | |
141 | |
140 | pl->ns->floorbox_reset (); |
142 | pl->ns->floorbox_reset (); |
141 | } |
143 | } |
… | |
… | |
146 | { |
148 | { |
147 | client &socket = *pl->ns; |
149 | client &socket = *pl->ns; |
148 | object *ob = pl->ob; |
150 | object *ob = pl->ob; |
149 | char buf[MAX_BUF]; /* eauugggh */ |
151 | char buf[MAX_BUF]; /* eauugggh */ |
150 | |
152 | |
151 | if (socket.current_map != ob->map) |
153 | if (socket.force_newmap) |
152 | { |
154 | { |
|
|
155 | // force newmap is used for clients that do not redraw their map |
|
|
156 | // after image uploads. |
153 | socket.current_map = ob->map; |
157 | socket.current_map = ob->map; |
154 | |
|
|
155 | clear_map (pl); |
158 | clear_map (pl); |
|
|
159 | } |
|
|
160 | else if (socket.current_map != ob->map) |
|
|
161 | { |
|
|
162 | clear_map (pl); |
|
|
163 | socket.current_map = ob->map; |
156 | |
164 | |
157 | if (socket.mapinfocmd) |
165 | if (socket.mapinfocmd) |
158 | { |
166 | { |
159 | if (ob->map && ob->map->path[0]) |
167 | if (ob->map && ob->map->path[0]) |
160 | { |
168 | { |
… | |
… | |
562 | * This is what takes care of it. We tell the client how things worked out. |
570 | * This is what takes care of it. We tell the client how things worked out. |
563 | * I am not sure if this file is the best place for this function. however, |
571 | * I am not sure if this file is the best place for this function. however, |
564 | * it either has to be here or init_sockets needs to be exported. |
572 | * it either has to be here or init_sockets needs to be exported. |
565 | */ |
573 | */ |
566 | void |
574 | void |
567 | AddMeCmd (char *buf, int len, client * ns) |
575 | AddMeCmd (char *buf, int len, client *ns) |
568 | { |
576 | { |
|
|
577 | // face caching is mandatory |
|
|
578 | if (!ns->facecache) |
|
|
579 | { |
|
|
580 | ns->send_drawinfo ( |
|
|
581 | "\n" |
|
|
582 | "\n" |
|
|
583 | "***\n" |
|
|
584 | "*** WARNING:\n" |
|
|
585 | "*** Your client does not support face/image caching,\n" |
|
|
586 | "*** or it has been disabled. Face caching is mandatory\n" |
|
|
587 | "*** so please enable it or use a newer client.\n" |
|
|
588 | "***\n" |
|
|
589 | "*** Look at your client preferences:\n" |
|
|
590 | "***\n" |
|
|
591 | "*** CFPlus: all known versions automatically enable the facecache.\n" |
|
|
592 | "*** cfclient: use the -cache commandline option.\n" |
|
|
593 | "*** cfclient: map will not redraw automatically (bug).\n" |
|
|
594 | "*** gcfclient: use -cache commandline option, or enable\n" |
|
|
595 | "*** gcfclient: Client=>Configure=>Map & Image=>Cache Images.\n" |
|
|
596 | "*** jcrossclient: your client is broken, use CFPlus or gcfclient.\n" |
|
|
597 | "***\n" |
|
|
598 | "***\n", |
|
|
599 | NDI_RED |
|
|
600 | ); |
|
|
601 | |
|
|
602 | if (strstr (ns->version, "jcrossclient")) |
|
|
603 | /* let them, for now*/; |
|
|
604 | else |
|
|
605 | { |
|
|
606 | ns->flush (); |
|
|
607 | //ns->destroy (); |
|
|
608 | } |
|
|
609 | //ns->facecache = true; |
|
|
610 | } |
|
|
611 | |
569 | INVOKE_CLIENT (ADDME, ns, ARG_DATA (buf, len)); |
612 | INVOKE_CLIENT (ADDME, ns, ARG_DATA (buf, len)); |
570 | } |
613 | } |
571 | |
614 | |
572 | /** Reply to ExtendedInfos command */ |
615 | /** Reply to ExtendedInfos command */ |
573 | void |
616 | void |
… | |
… | |
681 | snprintf (temp, sizeof (temp), "%d", i); |
724 | snprintf (temp, sizeof (temp), "%d", i); |
682 | strcat (cmdback, temp); |
725 | strcat (cmdback, temp); |
683 | } |
726 | } |
684 | |
727 | |
685 | ns->send_packet (cmdback); |
728 | ns->send_packet (cmdback); |
|
|
729 | } |
|
|
730 | |
|
|
731 | /** |
|
|
732 | * client requested an image. send it rate-limited |
|
|
733 | * before flushing. |
|
|
734 | */ |
|
|
735 | void |
|
|
736 | AskFaceCmd (char *buf, int len, client *ns) |
|
|
737 | { |
|
|
738 | ns->askface.push_back (atoi (buf)); |
686 | } |
739 | } |
687 | |
740 | |
688 | /** |
741 | /** |
689 | * Tells client the picture it has to use |
742 | * Tells client the picture it has to use |
690 | * to smooth a picture number given as argument. |
743 | * to smooth a picture number given as argument. |
… | |
… | |
1251 | << uint8 (extendedinfos) |
1304 | << uint8 (extendedinfos) |
1252 | << uint8 (eentrysize); |
1305 | << uint8 (eentrysize); |
1253 | |
1306 | |
1254 | estartlen = esl.length (); |
1307 | estartlen = esl.length (); |
1255 | } |
1308 | } |
1256 | else |
|
|
1257 | { |
|
|
1258 | /* suppress compiler warnings */ |
|
|
1259 | ewhatstart = 0; |
|
|
1260 | ewhatflag = 0; |
|
|
1261 | estartlen = 0; |
|
|
1262 | } |
|
|
1263 | |
1309 | |
1264 | /* x,y are the real map locations. ax, ay are viewport relative |
1310 | /* x,y are the real map locations. ax, ay are viewport relative |
1265 | * locations. |
1311 | * locations. |
1266 | */ |
1312 | */ |
1267 | ay = 0; |
1313 | ay = 0; |