summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJapa Illo2012-03-17 15:29:27 +0100
committerJapa Illo2012-03-17 15:29:27 +0100
commit5322279ee165c09a6a514e865a7527079d950199 (patch)
tree36333db1eaacfe6512dd00b051dc11090ff6ac40
parent6e2272dabb29c00f72d3230b69b78912a1339ceb (diff)
downloadstonesense-5322279ee165c09a6a514e865a7527079d950199.tar.gz
stonesense-5322279ee165c09a6a514e865a7527079d950199.tar.bz2
stonesense-5322279ee165c09a6a514e865a7527079d950199.tar.xz
Added some safeties to the color selection. also put back our old dwarves.
Signed-off-by: Japa Illo <japa.mala.illo@gmail.com>
-rw-r--r--ContentLoader.cpp15
-rw-r--r--main.cpp2
-rw-r--r--resources/creatures/index.txt4
3 files changed, 13 insertions, 8 deletions
diff --git a/ContentLoader.cpp b/ContentLoader.cpp
index 48ed0a0..f143930 100644
--- a/ContentLoader.cpp
+++ b/ContentLoader.cpp
@@ -747,11 +747,12 @@ ALLEGRO_COLOR lookupMaterialColor(int matType,int matIndex)
{
//if it's more than the size of our colorconfigs, then just make a guess based off what DF tells us.
MaterialInfo mat;
- mat.decode(matType, matIndex);
- return al_map_rgb_f(
+ if(mat.decode(matType, matIndex))
+ return al_map_rgb_f(
contentLoader->Mats->color[mat.material->state_color[0]].red,
contentLoader->Mats->color[mat.material->state_color[0]].green,
contentLoader->Mats->color[mat.material->state_color[0]].blue);
+ else return al_map_rgb(255,255,255);
}
if (matIndex < 0)
{
@@ -760,22 +761,24 @@ ALLEGRO_COLOR lookupMaterialColor(int matType,int matIndex)
if (matIndex >= contentLoader->colorConfigs.at(matType).colorMaterials.size())
{
MaterialInfo mat;
- mat.decode(matType, matIndex);
- return al_map_rgb_f(
+ if(mat.decode(matType, matIndex))
+ return al_map_rgb_f(
contentLoader->Mats->color[mat.material->state_color[0]].red,
contentLoader->Mats->color[mat.material->state_color[0]].green,
contentLoader->Mats->color[mat.material->state_color[0]].blue);
+ else return al_map_rgb(255,255,255);
}
if (contentLoader->colorConfigs.at(matType).colorMaterials.at(matIndex).colorSet)
{
return contentLoader->colorConfigs.at(matType).colorMaterials.at(matIndex).color;
}
MaterialInfo mat;
- mat.decode(matType, matIndex);
- return al_map_rgb_f(
+ if(mat.decode(matType, matIndex))
+ return al_map_rgb_f(
contentLoader->Mats->color[mat.material->state_color[0]].red,
contentLoader->Mats->color[mat.material->state_color[0]].green,
contentLoader->Mats->color[mat.material->state_color[0]].blue);
+ else return al_map_rgb(255,255,255);
}
ShadeBy getShadeType(const char* Input)
diff --git a/main.cpp b/main.cpp
index f2335cf..fd6d9e8 100644
--- a/main.cpp
+++ b/main.cpp
@@ -86,6 +86,7 @@ void LogError(const char* msg, ...){
FILE* fp = fopen( "Stonesense.log", "a");
if(fp)
vfprintf( fp, msg, arglist );
+// Core::printerr(msg, arglist);
va_end(arglist);
fclose(fp);
}
@@ -100,6 +101,7 @@ void LogVerbose(const char* msg, ...){
FILE* fp = fopen( "Stonesense.log", "a");
if(fp)
vfprintf( fp, msg, arglist );
+// Core::printerr(msg, arglist);
va_end(arglist);
fclose(fp);
}
diff --git a/resources/creatures/index.txt b/resources/creatures/index.txt
index 2e8e61e..ded7e65 100644
--- a/resources/creatures/index.txt
+++ b/resources/creatures/index.txt
@@ -13,7 +13,7 @@ wild_animals.xml
gobbos.xml
beefmo_domestics.xml
Wildlife.xml
-clothed_Dwarves.xml
-#color_Dwarves.xml
+#clothed_Dwarves.xml
+color_Dwarves.xml
# Dwarves.xml
# Elves.xml \ No newline at end of file