* Introduce DepositComponent for resource deposits

Resource deposits now store balance data in DepositComponent.
This obsoletes database definitions in game.sql.
* Variable absolute height for inventory fillbars depending on res
* Remove get_resource_deposit_resources, use DepositComponent
* random.choice(a) instead of a[randint(0, len(a)-1)]
* Clean up savegame template SQL

The datatypes used (INT, TEXT, REAL, BLOB) were extracted from
the sqlite documentation at http://www.sqlite.org/datatype3.html .

BOOL was kept as semantic type, it is represented by NUMERIC.

This commit is not intended to change behavior of any sort.
* Evict city, ship, and groundunit names to own database

Also cleaned up the syntax a bit.
* Change attribute order in some tables
* Split message table into two (actual message text and properties)
* also clean up balance.sql a bit
Fixed ticket #1381.

Implemented system in which Message has a type that determines what happens on click.

I was using current_page instead of _cur_entry. Changed current_page to current_mode to clarify what it's used for. That wasn't the only problem, but clicks on message notifications now open their relevant logbook page.

Known bug:
If you move the cursor to the left edge of the screen so that the screen scrolls, then click on a message, the logbook will pop up and the screen will continue scrolling left until you close the logbook.

Removed debug logging and commented-out code.

Message displayed status is now saved to fix a bug where when a game was loaded, all previous messages would be displayed any time a new message was displayed.

Incremented SAVEGAMEREVISION.
Fixed ticket #1386 by adding a building_in_range() condition.
Various message fixes

Cast messages to unicode to ensure they are always unicode instead of str.
Changed messages to logbook messages instead of independent functions in tutorial.yaml.
Changed all calls to messagewidget.add, messagewidget.add_custom, and messagewidget._add_message to use keyword arguments to make refactoring easier. Also removed deprecated argument creation_tick.
Minor code fixes.
Removed an extraneous variable.
Fixed #TODO: update message history on new game messages, not on sending a chat line
Added a couple clarifying comments.
Made x and y message parameters default to None. Moved most important message parameters (id, messagetext) to front.
Removed a misleading comment.
Refactored a ton to eliminate the "displayed" boolean.

Logbook messages can now be duplicates of each other and still be saved correctly.

Known bugs:
The message history is wiped on reload. I think this was already the case.

Changed savegameupgrader.py again because I eliminated the "displayed" boolean.
Added table logbook_messages ( message STRING ) for compatibility.
Fixed suggestions.
* Replace most instances of "len(L) > 0" with "L"

This uses "if L" and "while L" and "assert L" now instead of
"if len(L) > 0", "while len(L) > 0", and "assert len(L) > 0".

"return len(L) > 0" was not modified.
I am not sure whether "return bool(L)" would be an improvement here.
Fixed totycro's suggestions
- added cautionary comment to logbook load function
- made messagewidget button event callback code more robust
* Replace most instances of "len(L) == 0" with "not L"

This uses "if not L" and "assert not L" now instead of
"if len(L) == 0" and "assert len(L) == 0".
* Replace most instances of "if len(L)" with "if L"
Optimized _building_in_range_of() loop.
Thanks to nihathrael.
Merge pull request #68 from desophos/scenario_improvements

Scenario improvements

I'm glad to hereby be able to conclude this long optimisation and improvement phase. Great work, desophos!
Fixed ticket #1768.
Added inhabitants_min variable to settler.