[CF-Devel] x11 client experience display patch
alfie at leaflock.homeip.net
alfie at leaflock.homeip.net
Wed Mar 20 06:40:05 CST 2002
I wrote a quick kludge to display experience similar to the gtk client.
I don't know if this should be in the official version, but some other
players might find it useful. Enjoy. :)
Index: x11.c
===================================================================
RCS file: /cvsroot/crossfire/client/x11/x11.c,v
retrieving revision 1.6
diff -c -r1.6 x11.c
*** x11.c 15 Jan 2002 07:33:01 -0000 1.6
--- x11.c 20 Mar 2002 12:11:07 -0000
***************
*** 1076,1082 ****
stathint.x=INV_WIDTH + WINDOW_SPACING;
stathint.y=0;
stathint.width=GAME_WIDTH;
! stathint.height=100;
stathint.min_width=stathint.max_width=stathint.width;
stathint.min_height=stathint.max_height=stathint.height;
stathint.flags=PPosition | PSize;
--- 1076,1082 ----
stathint.x=INV_WIDTH + WINDOW_SPACING;
stathint.y=0;
stathint.width=GAME_WIDTH;
! stathint.height=140;
stathint.min_width=stathint.max_width=stathint.width;
stathint.min_height=stathint.max_height=stathint.height;
stathint.flags=PPosition | PSize;
***************
*** 1107,1112 ****
--- 1107,1114 ----
void draw_stats(int redraw) {
char buff[MAX_BUF];
static char last_name[MAX_BUF]="", last_range[MAX_BUF]="";
+ int i;
+ char *s;
if (strcmp(cpl.title, last_name) || redraw) {
strcpy(last_name,cpl.title);
***************
*** 1236,1241 ****
--- 1238,1270 ----
XDrawImageString(display,win_stats,
gc_stats,10,94, buff,strlen(buff));
}
+
+ if (redraw) {
+ i = 0;
+ } else {
+ for (i=0; i<MAX_SKILL; i++) {
+ if (cpl.stats.skill_level[i] != last_stats.skill_level[i] ||
+ cpl.stats.skill_exp[i] != last_stats.skill_exp[i])
+ break;
+ }
+ }
+
+ if (i < MAX_SKILL) {
+ *buff = '\0';
+ s = buff;
+ for (i=0; i<MAX_SKILL; i++) {
+ last_stats.skill_level[i] = cpl.stats.skill_level[i];
+ last_stats.skill_exp[i] = cpl.stats.skill_exp[i];
+ s += sprintf(s,"%.3s: %5d (%d) ", skill_names[i], cpl.stats.skill_exp[i],
+ cpl.stats.skill_level[i]);
+ if ((i % 2) == 1) {
+ XDrawImageString(display,win_stats,gc_stats,10,
+ 108 + (14 * (i / 2)), buff,strlen(buff));
+ *buff = '\0';
+ s = buff;
+ }
+ }
+ }
}
/***********************************************************************
***************
*** 2645,2650 ****
--- 2674,2680 ----
load_defaults(); /* Load these first, so they can get overwritten by
* command line options.
*/
+ want_skill_exp=1;
for (on_arg=1; on_arg<argc; on_arg++) {
if (!strcmp(argv[on_arg],"-display")) {
if (++on_arg == argc) {
More information about the crossfire
mailing list