Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/commandbuffer.cc4
-rw-r--r--src/core/entity.h43
-rw-r--r--src/core/gameconnection.cc16
-rw-r--r--src/core/info.h14
-rw-r--r--src/core/inventory.h6
-rw-r--r--src/core/item.h11
6 files changed, 58 insertions, 36 deletions
diff --git a/src/core/commandbuffer.cc b/src/core/commandbuffer.cc
index 00a3486..3c7fc35 100644
--- a/src/core/commandbuffer.cc
+++ b/src/core/commandbuffer.cc
@@ -79,7 +79,7 @@ void func_list_info(std::string const &args)
return;
}
- con_print << "Unkown info record '" << typestr << "'" << std::endl;
+ con_print << "Unknown info record '" << typestr << "'" << std::endl;
} else {
// two arguments
@@ -97,7 +97,7 @@ void func_list_info(std::string const &args)
return;
}
- con_print << "Unkown info record '" << typestr << "' for type '" << typestr << "'" << std::endl;
+ con_print << "Unknown info record '" << labelstr << "' for type '" << typestr << "'" << std::endl;
}
}
diff --git a/src/core/entity.h b/src/core/entity.h
index 1bc93a1..5ddce3a 100644
--- a/src/core/entity.h
+++ b/src/core/entity.h
@@ -92,7 +92,7 @@ public:
}
/// pointer to the model, is used client-side
- inline model::Model * model() {
+ inline model::Model * model() const {
return entity_model;
}
@@ -197,23 +197,31 @@ public:
entity_color_second.assign(color);
}
- /// set dirty flag
+ /**
+ * @brief set dirty flag
+ * setting the dirty flag will cause the server to broadcast changes
+ * to the clients.
+ */
inline void set_dirty(const bool dirty = true) {
entity_dirty = dirty;
}
- /// mark the entity as destroyed
+ /**
+ * @brief mark the entity as destroyed
+ * die() should be called by the game module when it needs to destroy an entity,
+ * the game server will broadcast the delete event to the clients.
+ * The game module should not delete an entity directly.
+ */
virtual void die();
- /// runs one game frame for the entity
/**
+ * @brief runs one game frame for the entity
* The default implementation does nothing
*/
virtual void frame(float seconds);
/**
* @brief set the zone the entity is currently in
- *
* this fuction removes the entity from its previous zone
* and removes it to the new one, if it is not 0
*/
@@ -552,8 +560,8 @@ public:
/// set afterburner/reverse
void set_afterburner(float afterburner);
- /// runs one game frame for the entity
/**
+ * @brief runs one game frame for the entity
* The default implementation will set direction() and thrust() to the desired targets
* and calls its parent frame() funcion.
*/
@@ -564,18 +572,27 @@ public:
protected:
/* target_ variables can be set by the client */
- /// target thrust as set by the client
+
+ /**
+ * @brief target thrust as set by the client
+ */
float target_thrust;
- /// target direction as set by the client
- /** target_direction must be in the [-1, 1] range
+
+ /**
+ * @brief target direction as set by the client
+ * target_direction must be in the [-1, 1] range
*/
float target_direction;
- /// target pitch as set by the client
- /** target_pitch must be in the [-1, 1] range
+
+ /**
+ * @brief target pitch as set by the client
+ * target_pitch must be in the [-1, 1] range
*/
float target_pitch;
- /// target roll as set by the client
- /** target_roll must be in the [-1, 1] range
+
+ /**
+ * @brief target roll as set by the client
+ * target_roll must be in the [-1, 1] range
*/
float target_roll;
diff --git a/src/core/gameconnection.cc b/src/core/gameconnection.cc
index 46b50f5..ce33dc6 100644
--- a/src/core/gameconnection.cc
+++ b/src/core/gameconnection.cc
@@ -105,7 +105,7 @@ Info *GameConnection::info(unsigned int id)
return info;
} else {
info = new Info(id);
- info->text().push_back("Requesting information...");
+ info->add_text("Requesting information...");
}
@@ -113,12 +113,11 @@ Info *GameConnection::info(unsigned int id)
if (connection_network) {
//con_debug << "Requesting info for " << info->id() << std::endl;
info->set_timestamp(connection_timestamp);
- info->set_id(0);
-
+
connection_network->send_info_request(info);
connection_network->transmit();
} else {
- info->text().push_back("^RNot connected.");
+ info->add_text("^RNot connected.");
info->set_timestamp(0);
}
return info;
@@ -151,21 +150,18 @@ Info *GameConnection::info(const std::string &type, const std::string &label)
return info;
} else {
// create a new info record and set the label
- info = new Info(infotype);
- info->set_label(label);
- info->text().push_back("Requesting information...");
+ info = new Info(infotype, label);
+ info->add_text("Requesting information...");
}
// send an information request to the server
if (connection_network) {
//con_debug << "Requesting info for " << info->type()->label() << ":" << info->label() << std::endl;
info->set_timestamp(connection_timestamp);
- info->set_id(0);
-
connection_network->send_info_request(info);
connection_network->transmit();
} else {
- info->text().push_back("^RNot connected.");
+ info->add_text("^RNot connected.");
info->set_timestamp(0);
}
return info;
diff --git a/src/core/info.h b/src/core/info.h
index 8b9a89b..8822f2f 100644
--- a/src/core/info.h
+++ b/src/core/info.h
@@ -19,14 +19,14 @@ namespace core
{
/**
- * @brief an information record type
+ * @brief an information card category
* The InfoType groups information records of the same type
*/
class InfoType : public Label
{
public:
/**
- * @brief create a new information record type
+ * @brief create a new information card category
* The constructor automaticly adds the instance to the registry
*/
InfoType(const char* label);
@@ -49,7 +49,7 @@ private:
}; // class InfoType
/**
- * @brief an information record
+ * @brief an information card
* An information record holds extended information about a specific entity or item class.
* This information is exchanged between server and the client, and can be used to build
* HUD widgets.
@@ -61,19 +61,19 @@ public:
typedef std::deque<std::string> Text;
/**
- * @brief create a new server-side information record
+ * @brief create a new server-side information card
* This constructor assigns an id
*/
Info(const InfoType *type);
/**
- * @brief create a new client-side information record
+ * @brief create a new client-side information card
* This constructor doesn not assign an id
*/
Info(const InfoType *type, const std::string & label);
/**
- * @brief create a new client-side information record
+ * @brief create a new client-side information card
*/
Info(const unsigned int id);
@@ -107,7 +107,7 @@ public:
}
/// text description
- inline Text & text() {
+ inline const Text & text() const {
return info_text;
}
diff --git a/src/core/inventory.h b/src/core/inventory.h
index a451dc7..da30715 100644
--- a/src/core/inventory.h
+++ b/src/core/inventory.h
@@ -47,12 +47,12 @@ public:
/**
* @brief removes all items from the inventory and delete them
- */
+ */
void clear();
/**
- * @brief search the inventory for a specific item type
- */
+ * @brief search the inventory for a specific item type
+ */
Item *find(const Info *info);
private:
diff --git a/src/core/item.h b/src/core/item.h
index 21eae87..397d259 100644
--- a/src/core/item.h
+++ b/src/core/item.h
@@ -19,6 +19,8 @@ namespace core
class Item
{
public:
+ enum Flags { Mount = 1, Trade = 2 };
+
Item(const Info *info);
~Item();
@@ -31,10 +33,15 @@ public:
inline int amount() const { return item_amount; }
/**
- * @brief information record
+ * @brief information card
*/
inline const Info *info() const { return item_info; }
+ /**
+ * @brief flags
+ */
+ inline int flags() const { return item_flags; }
+
/* ---- mutators ----------------------------------------------- */
/**
@@ -45,6 +52,8 @@ public:
private:
const Info *item_info;
int item_amount;
+
+ int item_flags;
};
} // namespace core