Remove debugging leftovers oops

This commit is contained in:
UnknownShadow200 2018-04-06 08:33:48 +10:00
parent 1cf621d9f6
commit 7e92d18f40
4 changed files with 26 additions and 14 deletions

View File

@ -255,8 +255,6 @@ namespace ClassicalSharp.Gui.Widgets {
}
bool Show(BlockID block) {
//if (block == Block.Air) return false;
if (block < Block.CpeCount) {
int count = game.SupportsCPEBlocks ? Block.CpeCount : Block.OriginalCount;
return block < count;

View File

@ -4,7 +4,7 @@
<ProjectGuid>{BEB1C785-5CAD-48FF-A886-876BF0A318D4}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Exe</OutputType>
<OutputType>WinExe</OutputType>
<RootNamespace>ClassicalSharp</RootNamespace>
<AssemblyName>ClassicalSharp</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>

View File

@ -99,7 +99,6 @@ namespace ClassicalSharp {
internal static void CleanupMainDirectory() {
string mapPath = Path.Combine(Program.AppDirectory, "maps");
Console.WriteLine(mapPath);
if (!Directory.Exists(mapPath))
Directory.CreateDirectory(mapPath);

View File

@ -588,9 +588,18 @@ void TableWidget_MakeDescTex(TableWidget* widget, BlockID block) {
TableWidget_UpdateDescTexPos(widget);
}
bool TableWidget_Show(BlockID block) {
if (block == BLOCK_AIR) return false;
bool TableWidget_RowEmpty(Int32 i) {
BlockID[] map = game.Inventory.Map;
int max = Math.Min(i + ElementsPerRow, map.Length);
Int32 j;
for (j = i; j < max; j++) {
if (Inventory_Map[j] != BLOCK_AIR) return false;
}
return true;
}
bool TableWidget_Show(BlockID block) {
if (block < BLOCK_CPE_COUNT) {
Int32 count = Game_UseCPEBlocks ? BLOCK_CPE_COUNT : BLOCK_ORIGINAL_COUNT;
return block < count;
@ -601,11 +610,14 @@ bool TableWidget_Show(BlockID block) {
void TableWidget_RecreateElements(TableWidget* widget) {
widget->ElementsCount = 0;
Int32 count = Game_UseCPE ? BLOCK_COUNT : BLOCK_ORIGINAL_COUNT, i;
for (i = 0; i < count; i++) {
BlockID block = Inventory_Map[i];
if (TableWidget_Show(block)) {
widget->ElementsCount++;
for (i = 0; i < count;) {
if ((i % widget->ElementsPerRow) == 0 && TableWidget_RowEmpty(i)) {
i += widget->ElementsPerRow; continue;
}
BlockID block = Inventory_Map[i];
if (TableWidget_Show(block)) { widget->ElementsCount++; }
i++;
}
widget->RowsCount = Math_CeilDiv(widget->ElementsCount, widget->ElementsPerRow);
@ -614,10 +626,13 @@ void TableWidget_RecreateElements(TableWidget* widget) {
Int32 index = 0;
for (i = 0; i < count; i++) {
BlockID block = Inventory_Map[i];
if (TableWidget_Show(block)) {
widget->Elements[index++] = block;
if ((i % widget->ElementsPerRow) == 0 && TableWidget_RowEmpty(i)) {
i += widget->ElementsPerRow; continue;
}
BlockID block = Inventory_Map[i];
if (TableWidget_Show(block)) { widget->Elements[index++] = block; }
i++;
}
}
@ -734,7 +749,7 @@ bool TableWidget_HandlesMouseDown(GuiElement* elem, Int32 x, Int32 y, MouseButto
if (Elem_HandlesMouseDown(&widget->Scroll, x, y, btn)) {
return true;
} else if (widget->SelectedIndex != -1) {
} else if (widget->SelectedIndex != -1 && widget->Elements[widget->SelectedIndex] != BLOCK_AIR) {
Inventory_SetSelectedBlock(widget->Elements[widget->SelectedIndex]);
widget->PendingClose = true;
return true;