Unicode tile loader now checks return value of mbtowc but doesn't know what to do...
authorMartin Read <martin@blackswordsonics.com>
Sat, 8 Feb 2014 17:09:25 +0000 (17:09 +0000)
committerMartin Read <martin@blackswordsonics.com>
Sat, 8 Feb 2014 17:09:25 +0000 (17:09 +0000)
display-nc.cc

index e697857..c5af9f0 100644 (file)
@@ -248,6 +248,7 @@ static void draw_world(void)
 static void load_unicode_tiles()
 {
     int i;
+    int j;
     {
         wchar_t wch[2];
         wch[0] = L'@';
@@ -270,7 +271,11 @@ static void load_unicode_tiles()
         wchar_t wch[2];
         /* policy decision: for now we don't support use of combining
          * characters for terrain. */
-        mbtowc(wch, terrain_props[i].unicode, 4);
+        j = mbtowc(wch, terrain_props[i].unicode, 4);
+        if (j != 1)
+        {
+            /// welp. someone didn't see the above warning
+        }
         wch[1] = 0;
         setcchar(terrain_tiles + i, wch,
                  colour_data[terrain_props[i].colour].attr,
@@ -281,7 +286,11 @@ static void load_unicode_tiles()
         wchar_t wch[2];
         /* policy decision: for now we don't support use of combining
          * characters for tiles. */
-        mbtowc(wch, permobjs[i].unicode, 4);
+        j = mbtowc(wch, permobjs[i].unicode, 4);
+        if (j != 1)
+        {
+            /// welp. someone didn't see the above warning
+        }
         wch[1] = 0;
         setcchar(permobj_tiles + i, wch, 0, 0, NULL);
     }
@@ -1000,12 +1009,19 @@ void get_player_action(Action *act)
             break;
         case 'W':
             {
-                int slot = inv_select(POCLASS_ARMOUR, "wear", 1);
-                if (slot != SLOT_CANCEL)
+                if (u.armour != NO_OBJ)
                 {
-                    act->cmd = WEAR_ARMOUR;
-                    act->details[0] = slot;
-                    return;
+                    print_msg("You are already wearing armour.\n");
+                }
+                else
+                {
+                    int slot = inv_select(POCLASS_ARMOUR, "wear", 1);
+                    if (slot != SLOT_CANCEL)
+                    {
+                        act->cmd = WEAR_ARMOUR;
+                        act->details[0] = slot;
+                        return;
+                    }
                 }
             }
             break;