summaryrefslogtreecommitdiff
path: root/GUI.cpp
diff options
context:
space:
mode:
authorJapa Illo2012-03-08 09:37:54 +0530
committerJapa Illo2012-03-08 09:37:54 +0530
commit96bbfa604d1835df993602cbf46ca6bb0a28e6bd (patch)
tree38d46683531ef118bae33b244475e6203683c891 /GUI.cpp
parent50bbecc544aa227fb7bfc4a5c90c6b27369d8bcd (diff)
downloadstonesense-96bbfa604d1835df993602cbf46ca6bb0a28e6bd.tar.gz
stonesense-96bbfa604d1835df993602cbf46ca6bb0a28e6bd.tar.bz2
stonesense-96bbfa604d1835df993602cbf46ca6bb0a28e6bd.tar.xz
Got rid of some warnings, cleaned up the sprite drawing routine, and added ability to select sprites according to individual items.
Todo: add ability to have a sprite according to just the item class. Signed-off-by: Japa Illo <japa.mala.illo@gmail.com>
Diffstat (limited to 'GUI.cpp')
-rw-r--r--GUI.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/GUI.cpp b/GUI.cpp
index d5f4014..cc54e45 100644
--- a/GUI.cpp
+++ b/GUI.cpp
@@ -507,11 +507,11 @@ void drawDebugCursorAndInfo(WorldSegment * segment, DFHack::Core * c)
{
if(b->inv->Weapons[ind].matt.type < 0)
continue;
- const char* matName = lookupMaterialTypeName(b->inv->Weapons[ind].matt.type);
- const char* subMatName = lookupMaterialName(b->inv->Weapons[ind].matt.type,b->inv->Weapons[ind].matt.index);
+ MaterialInfo mat;
+ mat.decode(b->inv->Weapons[ind].matt.type,b->inv->Weapons[ind].matt.index);
draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
- " %s%s%s - %s/%s",
- matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"",
+ " %s - %s/%s",
+ mat.getToken().c_str(),
ENUM_KEY_STR(item_type, item_type::WEAPON),
get_item_subtype(item_type::WEAPON,ind));
}
@@ -524,11 +524,11 @@ void drawDebugCursorAndInfo(WorldSegment * segment, DFHack::Core * c)
{
if(b->inv->Armor[ind].matt.type < 0)
continue;
- const char* matName = lookupMaterialTypeName(b->inv->Armor[ind].matt.type);
- const char* subMatName = lookupMaterialName(b->inv->Armor[ind].matt.type,b->inv->Armor[ind].matt.index);
+ MaterialInfo mat;
+ mat.decode(b->inv->Armor[ind].matt.type,b->inv->Armor[ind].matt.index);
draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
- " %s%s%s - %s/%s",
- matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"",
+ " %s - %s/%s",
+ mat.getToken().c_str(),
ENUM_KEY_STR(item_type, item_type::ARMOR),
get_item_subtype(item_type::ARMOR,ind));
}
@@ -541,11 +541,11 @@ void drawDebugCursorAndInfo(WorldSegment * segment, DFHack::Core * c)
{
if(b->inv->Shoes[ind].matt.type < 0)
continue;
- const char* matName = lookupMaterialTypeName(b->inv->Shoes[ind].matt.type);
- const char* subMatName = lookupMaterialName(b->inv->Shoes[ind].matt.type,b->inv->Shoes[ind].matt.index);
+ MaterialInfo mat;
+ mat.decode(b->inv->Shoes[ind].matt.type,b->inv->Shoes[ind].matt.index);
draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
- " %s%s%s - %s/%s",
- matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"",
+ " %s - %s/%s",
+ mat.getToken().c_str(),
ENUM_KEY_STR(item_type, item_type::SHOES),
get_item_subtype(item_type::SHOES,ind));
}
@@ -558,11 +558,11 @@ void drawDebugCursorAndInfo(WorldSegment * segment, DFHack::Core * c)
{
if(b->inv->Shield[ind].matt.type < 0)
continue;
- const char* matName = lookupMaterialTypeName(b->inv->Shield[ind].matt.type);
- const char* subMatName = lookupMaterialName(b->inv->Shield[ind].matt.type,b->inv->Shield[ind].matt.index);
+ MaterialInfo mat;
+ mat.decode(b->inv->Shield[ind].matt.type,b->inv->Shield[ind].matt.index);
draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
- " %s%s%s - %s/%s",
- matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"",
+ " %s - %s/%s",
+ mat.getToken().c_str(),
ENUM_KEY_STR(item_type, item_type::SHIELD),
get_item_subtype(item_type::SHIELD,ind));
}
@@ -575,11 +575,11 @@ void drawDebugCursorAndInfo(WorldSegment * segment, DFHack::Core * c)
{
if(b->inv->Helm[ind].matt.type < 0)
continue;
- const char* matName = lookupMaterialTypeName(b->inv->Helm[ind].matt.type);
- const char* subMatName = lookupMaterialName(b->inv->Helm[ind].matt.type,b->inv->Helm[ind].matt.index);
+ MaterialInfo mat;
+ mat.decode(b->inv->Helm[ind].matt.type,b->inv->Helm[ind].matt.index);
draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
- " %s%s%s - %s/%s",
- matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"",
+ " %s - %s/%s",
+ mat.getToken().c_str(),
ENUM_KEY_STR(item_type, item_type::HELM),
get_item_subtype(item_type::HELM,ind));
}
@@ -592,11 +592,11 @@ void drawDebugCursorAndInfo(WorldSegment * segment, DFHack::Core * c)
{
if(b->inv->Gloves[ind].matt.type < 0)
continue;
- const char* matName = lookupMaterialTypeName(b->inv->Gloves[ind].matt.type);
- const char* subMatName = lookupMaterialName(b->inv->Gloves[ind].matt.type,b->inv->Gloves[ind].matt.index);
+ MaterialInfo mat;
+ mat.decode(b->inv->Gloves[ind].matt.type,b->inv->Gloves[ind].matt.index);
draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
- " %s%s%s - %s/%s",
- matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"",
+ " %s - %s/%s",
+ mat.getToken().c_str(),
ENUM_KEY_STR(item_type, item_type::GLOVES),
get_item_subtype(item_type::GLOVES,ind));
}
@@ -609,11 +609,11 @@ void drawDebugCursorAndInfo(WorldSegment * segment, DFHack::Core * c)
{
if(b->inv->Pants[ind].matt.type < 0)
continue;
- const char* matName = lookupMaterialTypeName(b->inv->Pants[ind].matt.type);
- const char* subMatName = lookupMaterialName(b->inv->Pants[ind].matt.type,b->inv->Pants[ind].matt.index);
+ MaterialInfo mat;
+ mat.decode(b->inv->Pants[ind].matt.type,b->inv->Pants[ind].matt.index);
draw_textf_border(font, al_map_rgb(255,255,255), 2, (i++*al_get_font_line_height(font)), 0,
- " %s%s%s - %s/%s",
- matName?matName:"Unknown",subMatName?"/":"",subMatName?subMatName:"",
+ " %s - %s/%s",
+ mat.getToken().c_str(),
ENUM_KEY_STR(item_type, item_type::PANTS),
get_item_subtype(item_type::PANTS,ind));
}