freg
0.3
Free-Roaming Elementary Game
|
World provides global physics and shred connection. More...
#include <World.h>
Public Slots | |
void | SetReloadShreds (int direction) |
void | PhysEvents () |
Signals | |
void | Notify (QString) const |
void | GetString (QString &) const |
void | Updated (int, int, int) |
void | UpdatedAll () |
void | UpdatedAround (int x, int y, int z, int range) |
void | StartMove (int) |
void | Moved (int) |
Emitted when world active zone moved to int direction. More... | |
void | UpdatesEnded () |
This is emitted when a pack of updates is complete. More... | |
void | NeedPlayer (int, int, int) |
void | StartReloadAll () |
void | FinishReloadAll () |
void | ExitReceived () |
Public Member Functions | |
World (QString world_name, bool *error) | |
~World () | |
Block * | GetBlock (int x, int y, int z) const |
Shred * | GetShred (int i, int j) const |
Shred * | GetShredByPos (int x, int y) const |
Shred * | GetNearShred (Shred *, dirs dir) const |
int | Enlightened (int x, int y, int z) const |
int | Enlightened (int x, int y, int z, dirs dir) const |
Provides lighting of block side, not all block. More... | |
int | SunLight (int x, int y, int z) const |
int | FireLight (int x, int y, int z) const |
int | LightMap (int x, int y, int z) const |
Use Enlightened instead, which is smart wrapper of this. More... | |
int | ClampX (int x) const |
int | ClampY (int y) const |
int | ClampZ (int z) const |
void | SunShineVertical (int x, int y, int z=HEIGHT-2, int level=MAX_LIGHT_RADIUS) |
void | SunShineHorizontal (int x, int y, int z) |
void | Shine (int x, int y, int z, int level) |
If init is false, light will not spread from non-invisible blocks. More... | |
void | RemoveSunLight (int x, int y, int z) |
bool | GetEvernight () const |
QString | WorldName () const |
bool | Focus (int x, int y, int z, int *x_targ, int *y_targ, int *z_targ, dirs dir) const |
False on error, true if focus is received to _targ successfully. More... | |
int | NumShreds () const |
bool | ShredInCentralZone (long longi, long lati) const |
long | Longitude () const |
long | Latitude () const |
const WorldMap * | GetMap () const |
QByteArray * | GetShredData (long longi, long lati) const |
void | SetShredData (QByteArray *, long longi, long lati) |
bool | DirectlyVisible (int x_from, int y_from, int z_from, int x_to, int y_to, int z_to) const |
bool | Visible (int x_from, int y_from, int z_from, int x_to, int y_to, int z_to) const |
At least one side of block is visible. More... | |
bool | Move (int x, int y, int z, dirs dir) |
Check and move. More... | |
void | Jump (int x, int y, int z, dirs dir) |
times_of_day | PartOfDay () const |
int | TimeOfDay () const |
This returns seconds from start of current day. More... | |
ulong | Time () const |
Returns time in seconds since world creation. More... | |
QString | TimeOfDayStr () const |
int | MiniTime () const |
Returns number of physics steps since second start. More... | |
int | Damage (int x, int y, int z, int level, int dmg_kind) |
Returns damaged block result durability. More... | |
void | DestroyAndReplace (int x, int y, int z) |
Does not check target block durability. More... | |
bool | Build (Block *thing, int x, int y, int z, int dir=UP, Block *who=nullptr, bool anyway=false) |
Returns true on successfull build, otherwise false. More... | |
bool | Inscribe (int x, int y, int z) |
Returns true on success. Gets a string and inscribes block. More... | |
bool | Drop (Block *from, int x_to, int y_to, int z_to, int src, int dest, int num) |
Returns true on success. More... | |
bool | Get (Block *to, int x_from, int y_from, int z_from, int src, int dest, int num) |
bool | InBounds (int x, int y) const |
bool | InBounds (int x, int y, int z) const |
int | GetBound () const |
int | SetNote (QString note) |
int | ChangeNote (QString note, int note_id) |
QString | GetNote (int note_id) const |
void | ReloadAllShreds (long lati, long longi, int new_x, int new_y, int new_z) |
QMutex * | GetLock () |
void | Lock () |
bool | TryLock () |
void | Unlock () |
Static Public Member Functions | |
static dirs | TurnRight (dirs dir) |
static dirs | TurnLeft (dirs dir) |
static dirs | Anti (dirs dir) |
static bool | InVertBounds (int z) |
Private Member Functions | |
bool | SetFireLightMap (int level, int x, int y, int z) |
void | AddFireLight (int x, int y, int z, int level) |
void | RemoveFireLight (int x, int y, int z) |
void | ReEnlighten (int x, int y, int z) |
Called when block is moved. More... | |
void | ReEnlightenAll () |
void | ReEnlightenTime () |
void | ReEnlightenMove (dirs) |
Called from ReloadShreds(int), enlightens only needed shreds. More... | |
void | UpShine (int x, int y, int z_bottom) |
void | UpShineInit (int x, int y, int z_bottom) |
void | CrossUpShine (int x, int y, int z_bottom) |
int | ShredPos (int x, int y) const |
can_move_results | CanMove (int x, int y, int z, int x_to, int y_to, int z_to, dirs dir) |
This CAN move blocks, but not xyz block. More... | |
void | NoCheckMove (int x, int y, int z, int x_to, int y_to, int z_to, dirs dir) |
bool | Exchange (Block *block_from, Block *block_to, int src, int dest, int num) |
Returns true if block_from can be put into block_to. More... | |
void | SetNumActiveShreds (int num) |
void | DeleteAllShreds () |
Also saves all shreds. More... | |
void | LoadAllShreds () |
void | ReloadShreds () |
void | run () override |
Shred ** | FindShred (int x, int y) const |
World (const World &)=delete | |
World & | operator= (const World &)=delete |
Private Attributes | |
const QString | worldName |
const WorldMap | map |
QSettings | settings |
ulong | time |
int | timeStep |
Shred ** | shreds |
long | longitude |
long | latitude |
int | numShreds |
size of loaded zone More... | |
int | numActiveShreds |
size of active zone More... | |
QMutex | mutex |
const bool | evernight |
long | newLati |
long | newLongi |
int | newX |
int | newY |
int | newZ |
volatile dirs | toResetDir |
UP for no reset, DOWN for full reset, NSEW for side shift. More... | |
int | sunMoonFactor |
ShredStorage * | shredStorage |
bool | initial_lighting |
QList< QString > | notes |
World provides global physics and shred connection.
Designed to be single.
|
privatedelete |
|
private |
Definition at line 55 of file Lighting-inertia.cpp.
|
private |
int World::ClampX | ( | int | x | ) | const |
int World::ClampY | ( | int | y | ) | const |
int World::ClampZ | ( | int | z | ) | const |
|
private |
Definition at line 106 of file Lighting-inertia.cpp.
int World::Damage | ( | int | x, |
int | y, | ||
int | z, | ||
int | level, | ||
int | dmg_kind | ||
) |
|
private |
void World::DestroyAndReplace | ( | int | x, |
int | y, | ||
int | z | ||
) |
bool World::DirectlyVisible | ( | int | x_from, |
int | y_from, | ||
int | z_from, | ||
int | x_to, | ||
int | y_to, | ||
int | z_to | ||
) | const |
bool World::Drop | ( | Block * | from, |
int | x_to, | ||
int | y_to, | ||
int | z_to, | ||
int | src, | ||
int | dest, | ||
int | num | ||
) |
int World::Enlightened | ( | int | x, |
int | y, | ||
int | z | ||
) | const |
Definition at line 199 of file Lighting-inertia.cpp.
int World::Enlightened | ( | int | x, |
int | y, | ||
int | z, | ||
dirs | dir | ||
) | const |
Provides lighting of block side, not all block.
Definition at line 206 of file Lighting-inertia.cpp.
|
signal |
|
signal |
int World::FireLight | ( | int | x, |
int | y, | ||
int | z | ||
) | const |
Definition at line 217 of file Lighting-inertia.cpp.
bool World::Focus | ( | int | x, |
int | y, | ||
int | z, | ||
int * | x_targ, | ||
int * | y_targ, | ||
int * | z_targ, | ||
dirs | dir | ||
) | const |
bool World::Get | ( | Block * | to, |
int | x_from, | ||
int | y_from, | ||
int | z_from, | ||
int | src, | ||
int | dest, | ||
int | num | ||
) |
QByteArray * World::GetShredData | ( | long | longi, |
long | lati | ||
) | const |
|
signal |
bool World::Inscribe | ( | int | x, |
int | y, | ||
int | z | ||
) |
int World::LightMap | ( | int | x, |
int | y, | ||
int | z | ||
) | const |
Use Enlightened instead, which is smart wrapper of this.
Definition at line 43 of file Lighting-inertia.cpp.
int World::MiniTime | ( | ) | const |
bool World::Move | ( | int | x, |
int | y, | ||
int | z, | ||
dirs | dir | ||
) |
|
signal |
Emitted when world active zone moved to int direction.
|
signal |
|
private |
|
signal |
times_of_day World::PartOfDay | ( | ) | const |
|
private |
Called when block is moved.
Called when one block is moved, built or destroyed.
Definition at line 140 of file Lighting-inertia.cpp.
|
private |
Definition at line 159 of file Lighting-inertia.cpp.
|
private |
Called from ReloadShreds(int), enlightens only needed shreds.
Definition at line 167 of file Lighting-inertia.cpp.
|
private |
Definition at line 150 of file Lighting-inertia.cpp.
void World::ReloadAllShreds | ( | long | lati, |
long | longi, | ||
int | new_x, | ||
int | new_y, | ||
int | new_z | ||
) |
|
private |
Definition at line 56 of file Lighting-inertia.cpp.
void World::RemoveSunLight | ( | int | x, |
int | y, | ||
int | z | ||
) |
|
private |
Definition at line 48 of file Lighting-inertia.cpp.
void World::SetShredData | ( | QByteArray * | data, |
long | longi, | ||
long | lati | ||
) |
void World::Shine | ( | int | x, |
int | y, | ||
int | z, | ||
int | level | ||
) |
If init is false, light will not spread from non-invisible blocks.
Makes block emit shining.
Receives only non-sun light as level, from 1 to F.
Definition at line 60 of file Lighting-inertia.cpp.
bool World::ShredInCentralZone | ( | long | longi, |
long | lati | ||
) | const |
|
signal |
|
signal |
int World::SunLight | ( | int | x, |
int | y, | ||
int | z | ||
) | const |
Definition at line 213 of file Lighting-inertia.cpp.
void World::SunShineHorizontal | ( | int | x, |
int | y, | ||
int | z | ||
) |
void World::SunShineVertical | ( | int | x, |
int | y, | ||
int | z = HEIGHT-2 , |
||
int | level = MAX_LIGHT_RADIUS |
||
) |
Definition at line 79 of file Lighting-inertia.cpp.
ulong World::Time | ( | ) | const |
int World::TimeOfDay | ( | ) | const |
|
signal |
|
signal |
|
signal |
|
signal |
This is emitted when a pack of updates is complete.
|
private |
Definition at line 130 of file Lighting-inertia.cpp.
|
private |
Definition at line 122 of file Lighting-inertia.cpp.
bool World::Visible | ( | int | x_from, |
int | y_from, | ||
int | z_from, | ||
int | x_to, | ||
int | y_to, | ||
int | z_to | ||
) | const |
|
private |
|
private |
|
private |