added many MissingAddress exception throws

develop
mizipzor 2010-02-28 02:53:47 +01:00
parent f2dcbc6372
commit 2b1940430f
2 changed files with 29 additions and 11 deletions

@ -76,7 +76,7 @@ namespace DFHack
class MissingAddress : public exception class MissingAddress : public exception
{ {
public: public:
MissingAddress(const char* _address) : address(_address) {} MissingAddress(const char* _address = "UNKNOWN") : address(_address) {}
const std::string address; const std::string address;
virtual const char* what() const throw() virtual const char* what() const throw()

@ -820,7 +820,9 @@ bool API::InitReadConstructions(uint32_t & numconstructions)
{ {
d->constructionsInited = false; d->constructionsInited = false;
numconstructions = 0; numconstructions = 0;
return false;
throw Error::MissingAddress("constructions");
//return false;
} }
} }
@ -872,7 +874,9 @@ bool API::InitReadVegetation(uint32_t & numplants)
{ {
d->vegetationInited = false; d->vegetationInited = false;
numplants = 0; numplants = 0;
return false;
throw Error::MissingAddress();
//return false;
} }
} }
@ -964,7 +968,9 @@ bool API::InitReadCreatures( uint32_t &numcreatures )
{ {
d->creaturesInited = false; d->creaturesInited = false;
numcreatures = 0; numcreatures = 0;
return false;
throw Error::MissingAddress();
//return false;
} }
} }
bool API::InitReadNotes( uint32_t &numnotes ) bool API::InitReadNotes( uint32_t &numnotes )
@ -992,7 +998,9 @@ bool API::InitReadNotes( uint32_t &numnotes )
{ {
d->notesInited = false; d->notesInited = false;
numnotes = 0; numnotes = 0;
return false;
throw Error::MissingAddress();
//return false;
} }
} }
bool API::ReadNote (const int32_t index, t_note & note) bool API::ReadNote (const int32_t index, t_note & note)
@ -1032,7 +1040,9 @@ bool API::InitReadSettlements( uint32_t & numsettlements )
{ {
d->settlementsInited = false; d->settlementsInited = false;
numsettlements = 0; numsettlements = 0;
return false;
throw Error::MissingAddress();
//return false;
} }
} }
bool API::ReadSettlement(const int32_t index, t_settlement & settlement) bool API::ReadSettlement(const int32_t index, t_settlement & settlement)
@ -1093,7 +1103,9 @@ bool API::InitReadHotkeys( )
else else
{ {
d->hotkeyInited = false; d->hotkeyInited = false;
return false;
throw Error::MissingAddress();
//return false;
} }
} }
bool API::ReadHotkeys(t_hotkey hotkeys[]) bool API::ReadHotkeys(t_hotkey hotkeys[])
@ -1285,7 +1297,9 @@ bool API::InitReadNameTables (map< string, vector<string> > & nameTable)
else else
{ {
d->nameTablesInited = false; d->nameTablesInited = false;
return false;
throw Error::MissingAddress();
//return false;
} }
} }
@ -1487,7 +1501,8 @@ bool API::InitViewAndCursor()
} }
else else
{ {
return false; throw Error::MissingAddress();
//return false;
} }
} }
@ -1501,7 +1516,8 @@ bool API::InitViewSize()
} }
else else
{ {
return false; throw Error::MissingAddress();
//return false;
} }
} }
@ -1593,7 +1609,9 @@ bool API::InitReadItems(uint32_t & numitems)
{ {
d->itemsInited = false; d->itemsInited = false;
numitems = 0; numitems = 0;
return false;
throw Error::MissingAddress();
//return false;
} }
} }
bool API::ReadItem (const uint32_t index, t_item & item) bool API::ReadItem (const uint32_t index, t_item & item)