![]() |
Steps Class ReferenceDatabase table Steps.
More...
|
Public Member Functions | |
Steps (Database &, Player &, Area &, long z, long y) | |
~Steps () | |
void | Save () |
Save the object in database. | |
bool | Exists () |
Check if the object already exists in database. | |
long | GetNum () |
Get integer primary key from object. | |
void | AddCoord (long x) |
Static Public Member Functions | |
static db::Steps * | GetStep (Player &, Area &, long z, long y) |
Static Private Member Functions | |
static db::Steps * | GetSteps (Database &, Player &, Area &, long z, long y) |
Private Attributes | |
Player & | m_player |
Area & | m_area |
db::Steps * | m_steps |
Static Private Attributes | |
static steps_t | m_cache |
Definition at line 39 of file Steps.h.
Definition at line 32 of file Steps.cpp.
References GetSteps(), and m_steps.
00033 :Object(db) 00034 ,m_player(pl) 00035 ,m_area(area) 00036 { 00037 m_steps = Steps::GetSteps(db, pl, area, z, y); 00038 }
void Steps::Save | ( | ) | [virtual] |
bool Steps::Exists | ( | ) | [virtual] |
long Steps::GetNum | ( | ) | [virtual] |
void Steps::AddCoord | ( | long | x | ) |
Definition at line 61 of file Steps.cpp.
References m_steps, and Save().
00062 { 00063 Parse pa(m_steps -> xcoords, ":"); 00064 std::string tmp = pa.getword(); 00065 while (tmp.size()) 00066 { 00067 if (atol(tmp.c_str()) == x) 00068 return; 00069 // 00070 tmp = pa.getword(); 00071 } 00072 if (m_steps -> xcoords.size()) 00073 { 00074 m_steps -> xcoords += ":" + Utility::l2string(x); 00075 } 00076 else 00077 { 00078 m_steps -> xcoords = Utility::l2string(x); 00079 } 00080 Save(); 00081 }
Definition at line 104 of file Steps.cpp.
References Area::GetNum(), Player::GetNum(), and m_cache.
Referenced by Player::Seen().
Definition at line 46 of file Steps.cpp.
References Area::GetNum(), Player::GetNum(), and m_cache.
Referenced by Steps().
00047 { 00048 db::Steps *p = m_cache[pl.GetNum()][area.GetNum()][z][y]; 00049 if (p) 00050 return p; 00051 p = new db::Steps(db, pl.GetNum(), area.GetNum(), z, y); 00052 p -> player = pl.GetNum(); 00053 p -> area = area.GetNum(); 00054 p -> zcoord = z; 00055 p -> ycoord = y; 00056 m_cache[pl.GetNum()][area.GetNum()][z][y] = p; 00057 return p; 00058 }
steps_t Steps::m_cache [static, private] |
Player& Steps::m_player [private] |
Area& Steps::m_area [private] |
db::Steps* Steps::m_steps [private] |