Planeshift
WeatherManager Class Reference

This class handles generation of any and all weather events in the game, including rain, snow, locust storms, day/night cycles, etc. More...

#include <weathermanager.h>

Public Member Functions

void BroadcastGameTime ()
 
void BroadcastGameTimeSuperclients ()
 
int GetGameTODDay ()
 
int GetGameTODHour ()
 
int GetGameTODMinute ()
 
int GetGameTODMonth ()
 
int GetGameTODYear ()
 
void HandleWeatherEvent (psWeatherGameEvent *event)
 
void Initialize ()
 
void QueueNextEvent (int delayticks, int eventtype, int eventvalue, int duration, int fade, const char *sector, psSectorInfo *si, uint clientnum=0, int r=0, int g=0, int b=0)
 
void SaveGameTime ()
 
void SendClientGameTime (int cnum)
 
void SetGameTime (int hour, int minute)
 
void StartGameTime ()
 Look into the database for the saved time. More...
 
void StartWeather (psSectorInfo *si, unsigned int type=0)
 Starts automatic weather in a sector Allocates new events for snow, rain and fog. More...
 
void StopWeather (psSectorInfo *si, unsigned int type=0)
 Stops automatic weather in a sector Puts all events from the automatic weather (rain and snow for now) in the sector into the ignored array, removing them from the events array. More...
 
void UpdateClient (uint32_t cnum)
 
 WeatherManager (CacheManager *cachemanager)
 
 ~WeatherManager ()
 

Protected Attributes

CacheManagercacheManager
 
csArray< psWeatherGameEvent * > events
 
CS::Threading::Mutex eventsMutex
 
int gameTimeDay
 
int gameTimeHour
 
int gameTimeMinute
 
int gameTimeMonth
 
int gameTimeYear
 
csArray< psWeatherGameEvent * > ignored
 Used for overriding commands like /rain. More...
 
csRandomGen * randomgen
 

Detailed Description

This class handles generation of any and all weather events in the game, including rain, snow, locust storms, day/night cycles, etc.

Definition at line 48 of file weathermanager.h.

Constructor & Destructor Documentation

WeatherManager::WeatherManager ( CacheManager cachemanager)
WeatherManager::~WeatherManager ( )

Member Function Documentation

void WeatherManager::BroadcastGameTime ( )
void WeatherManager::BroadcastGameTimeSuperclients ( )
int WeatherManager::GetGameTODDay ( )
inline

Definition at line 97 of file weathermanager.h.

int WeatherManager::GetGameTODHour ( )
inline

Definition at line 93 of file weathermanager.h.

int WeatherManager::GetGameTODMinute ( )
inline

Definition at line 89 of file weathermanager.h.

int WeatherManager::GetGameTODMonth ( )
inline

Definition at line 101 of file weathermanager.h.

int WeatherManager::GetGameTODYear ( )
inline

Definition at line 105 of file weathermanager.h.

void WeatherManager::HandleWeatherEvent ( psWeatherGameEvent event)
void WeatherManager::Initialize ( )
void WeatherManager::QueueNextEvent ( int  delayticks,
int  eventtype,
int  eventvalue,
int  duration,
int  fade,
const char *  sector,
psSectorInfo si,
uint  clientnum = 0,
int  r = 0,
int  g = 0,
int  b = 0 
)
void WeatherManager::SaveGameTime ( )
void WeatherManager::SendClientGameTime ( int  cnum)
void WeatherManager::SetGameTime ( int  hour,
int  minute 
)
void WeatherManager::StartGameTime ( )

Look into the database for the saved time.

This starts the event pushing for the time.

void WeatherManager::StartWeather ( psSectorInfo si,
unsigned int  type = 0 
)

Starts automatic weather in a sector Allocates new events for snow, rain and fog.

Parameters
siThe sector in which we start the automatic weather
typeThe weather type we will start. The default 0 does it for all.
void WeatherManager::StopWeather ( psSectorInfo si,
unsigned int  type = 0 
)

Stops automatic weather in a sector Puts all events from the automatic weather (rain and snow for now) in the sector into the ignored array, removing them from the events array.

Parameters
siThe sector in which we stop the automatic weather
typeThe weather type we will stop. The default 0 does it for all.
void WeatherManager::UpdateClient ( uint32_t  cnum)

Member Data Documentation

CacheManager* WeatherManager::cacheManager
protected

Definition at line 131 of file weathermanager.h.

csArray<psWeatherGameEvent*> WeatherManager::events
protected

Definition at line 129 of file weathermanager.h.

CS::Threading::Mutex WeatherManager::eventsMutex
protected

Definition at line 128 of file weathermanager.h.

int WeatherManager::gameTimeDay
protected

Definition at line 122 of file weathermanager.h.

int WeatherManager::gameTimeHour
protected

Definition at line 121 of file weathermanager.h.

int WeatherManager::gameTimeMinute
protected

Definition at line 120 of file weathermanager.h.

int WeatherManager::gameTimeMonth
protected

Definition at line 123 of file weathermanager.h.

int WeatherManager::gameTimeYear
protected

Definition at line 124 of file weathermanager.h.

csArray<psWeatherGameEvent*> WeatherManager::ignored
protected

Used for overriding commands like /rain.

Definition at line 126 of file weathermanager.h.

csRandomGen* WeatherManager::randomgen
protected

Definition at line 119 of file weathermanager.h.


The documentation for this class was generated from the following file: