Skip to content

Commit

Permalink
Made it so the construction menu obeys the scrolling option set by th…
Browse files Browse the repository at this point in the history
…e user.
  • Loading branch information
isharacomix committed Mar 10, 2014
1 parent a4a67e9 commit fd30516
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions SIGNOFF
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ Greg McNew <[email protected]>
NaturesWitness <[email protected]>
CodeHero <[email protected]>
tasetase "Tase" <tase on irc.freenode.net>
Barry Peddycord III <[email protected]>
23 changes: 21 additions & 2 deletions src/construction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ void construction_menu()
bool update_info = true;
int select = 0;
int chosen = 0;
int offset = 0;
long ch;
bool exit = false;

Expand All @@ -129,11 +130,29 @@ void construction_menu()
}
}
// Determine where in the master list to start printing
//int offset = select - 11;
if( OPTIONS["MENU_SCROLL"] ) {
if (available.size() > iMaxY) {
offset = select - (iMaxY - 1) / 2;

if (offset < 0) {
offset = 0;
} else if (offset + iMaxY -2 > available.size()) {
offset = available.size() - iMaxY + 2;
}
}
} else {
if( select < offset ) {
offset = select;
} else if( select >= offset + iMaxY -2 ) {
offset = 1 + select - iMaxY + 2;
}
}

/*//int offset = select - 11;
int offset = 0;
if (select >= iMaxY - 2) {
offset = select - iMaxY + 3;
}
}*/
// Print the constructions between offset and max (or how many will fit)
for (int i = 0; i < iMaxY - 2 && (i + offset) < available.size(); i++) {
int current = i + offset;
Expand Down

0 comments on commit fd30516

Please sign in to comment.