sortloot details
The sortloot classification routine had some inappropriate casts to 'coordxy' for things had nothing to do with map coordinates. I was going to change the relevant fields to 'short' but that seems iffy for 'indx' so I changed them all to 'int'.
This commit is contained in:
@@ -786,17 +786,18 @@ enum InputState {
|
||||
struct sortloot_item {
|
||||
struct obj *obj;
|
||||
char *str; /* result of loot_xname(obj) in some cases, otherwise null */
|
||||
int indx; /* signed int, because sortloot()'s qsort comparison routine
|
||||
assumes (a->indx - b->indx) might yield a negative result */
|
||||
xint16 orderclass; /* order rather than object class; 0 => not yet init'd */
|
||||
xint16 subclass; /* subclass for some classes */
|
||||
xint16 disco; /* discovery status */
|
||||
/* these need to be signed; 'indx' should be big enough to hold a count
|
||||
of the largest pile of items, the others would fit within char */
|
||||
int indx; /* index into original list (used as tie-breaker) */
|
||||
int orderclass; /* order rather than object class; 0 => not yet init'd */
|
||||
int subclass; /* subclass for some classes */
|
||||
int disco; /* discovery status */
|
||||
};
|
||||
typedef struct sortloot_item Loot;
|
||||
|
||||
typedef struct strbuf {
|
||||
int len;
|
||||
char * str;
|
||||
char *str;
|
||||
char buf[256];
|
||||
} strbuf_t;
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ loot_classify(Loot *sort_item, struct obj *obj)
|
||||
k = 1 + (int) (p - classorder);
|
||||
else
|
||||
k = 1 + (int) strlen(classorder) + (oclass != VENOM_CLASS);
|
||||
sort_item->orderclass = (coordxy) k;
|
||||
sort_item->orderclass = k;
|
||||
/* subclass designation; only a few classes have subclasses
|
||||
and the non-armor ones we use are fairly arbitrary */
|
||||
switch (oclass) {
|
||||
@@ -210,13 +210,13 @@ loot_classify(Loot *sort_item, struct obj *obj)
|
||||
k = 1; /* any non-zero would do */
|
||||
break;
|
||||
}
|
||||
sort_item->subclass = (coordxy) k;
|
||||
sort_item->subclass = k;
|
||||
/* discovery status */
|
||||
k = !seen ? 1 /* unseen */
|
||||
: (discovered || !OBJ_DESCR(objects[otyp])) ? 4
|
||||
: (objects[otyp].oc_uname) ? 3 /* named (partially discovered) */
|
||||
: 2; /* undiscovered */
|
||||
sort_item->disco = (coordxy) k;
|
||||
sort_item->disco = k;
|
||||
}
|
||||
|
||||
/* sortloot() formatting routine; for alphabetizing, not shown to user */
|
||||
|
||||
Reference in New Issue
Block a user