From f030154fe727e25a2afe1f78b3998c2d2dba95e4 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 18 Aug 2009 09:24:15 +0000 Subject: astyle cleanup, corrects not loading of material textures --- src/core/entity.cc | 116 ++++++++++++++++++++++++++--------------------------- 1 file changed, 58 insertions(+), 58 deletions(-) (limited to 'src/core/entity.cc') diff --git a/src/core/entity.cc b/src/core/entity.cc index 0ead5f4..ce313e6 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -78,9 +78,9 @@ void Entity::list() std::string typeindicator; Entity *entity = (*it).second; con_print << " id " << std::setw(4) << entity->id() - << " type " << std::setw(4) << entity->type() - << ":" << std::setw(4) << entity->moduletype() - << " " << entity->label() << std::endl; + << " type " << std::setw(4) << entity->type() + << ":" << std::setw(4) << entity->moduletype() + << " " << entity->label() << std::endl; } con_print << entity_registry.size() << " registered entities" << std::endl; } @@ -88,21 +88,21 @@ void Entity::list() /* ---- class Entity ----------------------------------------------- */ Entity::Entity(const unsigned int flags) : - entity_location(0.0f, 0.0f, 0.0f), - entity_color(1.0f, 1.0f, 1.0f, 1.0f), - entity_color_second(1.0f, 1.0f, 1.0f, 1.0f) + entity_location(0.0f, 0.0f, 0.0f), + entity_color(1.0f, 1.0f, 1.0f, 1.0f), + entity_color_second(1.0f, 1.0f, 1.0f, 1.0f) { entity_id = 0; entity_flags = flags; entity_moduletypeid = 0; entity_speed = 0.0f; - + entity_radius = 0.5f; entity_shape = Diamond; - + entity_created = true; - entity_destroyed = false; + entity_destroyed = false; entity_dirty = false; entity_model = 0; @@ -133,25 +133,25 @@ Entity::Entity(std::istream & is) entity_created = true; entity_destroyed = false; - + memset(entity_extension, 0, sizeof(entity_extension)); } Entity::~Entity() { // delete extensions - for (size_t i =0; i < 4; i++) { + for (size_t i = 0; i < 4; i++) { if (entity_extension[i]) delete entity_extension[i]; - entity_extension[i] = 0; + entity_extension[i] = 0; } // delete entity menus for (Menus::iterator it = menus().begin(); it != menus().end(); it++) { - delete (*it); + delete(*it); } menus().clear(); - + if (entity_zone) entity_zone->remove(this); } @@ -234,19 +234,19 @@ void Entity::set_modelname(const std::string &modelname) void Entity::serialize_server_create(std::ostream & os) const { os << moduletype() << " " - << flags() << " " - << (visible() ? 1 : 0) << " " - << (zone() ? zone()->id() : 0) << " " - << std::setprecision(8) << entity_location << " " - << color() << " " - << color_second() << " " - << shape() << " " - << radius() << " " - << std::setprecision(8) << entity_axis.forward() << " " - << std::setprecision(8) << entity_axis.left() << " " - << "\"" << entity_label << "\" " - << "\"" << entity_name << "\" " - << "\"" << (entity_model ? entity_model->name() : "") << "\" "; + << flags() << " " + << (visible() ? 1 : 0) << " " + << (zone() ? zone()->id() : 0) << " " + << std::setprecision(8) << entity_location << " " + << color() << " " + << color_second() << " " + << shape() << " " + << radius() << " " + << std::setprecision(8) << entity_axis.forward() << " " + << std::setprecision(8) << entity_axis.left() << " " + << "\"" << entity_label << "\" " + << "\"" << entity_name << "\" " + << "\"" << (entity_model ? entity_model->name() : "") << "\" "; } void Entity::receive_server_create(std::istream &is) @@ -271,12 +271,12 @@ void Entity::receive_server_create(std::istream &is) if (entity_zone && !zo) { con_warn << "Received entity " << entity_id << " for unknown zone " << zo << "!" << std::endl; } - + is >> entity_location; is >> entity_color; is >> entity_color_second; - - is >> s; // shape + + is >> s; // shape entity_shape = (Shape) s; is >> entity_radius; @@ -289,23 +289,23 @@ void Entity::receive_server_create(std::istream &is) char c; // read label - while ( (is.get(c)) && (c != '"')); - while ( (is.get(c)) && (c != '"')) - n += c; + while ((is.get(c)) && (c != '"')); + while ((is.get(c)) && (c != '"')) + n += c; entity_label = n; n.clear(); // read name - while ( (is.get(c)) && (c != '"')); - while ( (is.get(c)) && (c != '"')) - n += c; + while ((is.get(c)) && (c != '"')); + while ((is.get(c)) && (c != '"')) + n += c; entity_name = n; n.clear(); // read model name - while ( (is.get(c)) && (c != '"')); - while ( (is.get(c)) && (c != '"')) - n += c; + while ((is.get(c)) && (c != '"')); + while ((is.get(c)) && (c != '"')) + n += c; set_modelname(n); entity_dirty = false; @@ -354,21 +354,21 @@ void Entity::remove_menu(std::string const &label) for (Menus::iterator it = menus().begin(); it != menus().end(); it++) { if (label.compare((*it)->label()) == 0) menus().erase(it); - return; + return; } } /* ---- class EntityDynamic ---------------------------------------- */ EntityDynamic::EntityDynamic(unsigned int flags) : - Entity(flags) + Entity(flags) { entity_state = Normal; entity_timer = 0; } EntityDynamic::EntityDynamic(std::istream & is) : - Entity(is) + Entity(is) { entity_state = Normal; entity_timer = 0; @@ -403,10 +403,10 @@ void EntityDynamic::serialize_server_create(std::ostream & os) const { Entity::serialize_server_create(os); os << roundf(entity_speed * 100.0f) << " " - << entity_state << " "; + << entity_state << " "; if (entity_state != Normal) { - os << entity_timer << " "; + os << entity_timer << " "; } } @@ -434,7 +434,7 @@ void EntityDynamic::receive_client_update(std::istream &is) void EntityDynamic::serialize_server_update(std::ostream & os) const { - os << (visible() ? 1 : 0 ) << " "; + os << (visible() ? 1 : 0) << " "; if (visible()) { os << std::setprecision(8) << location() << " " @@ -442,7 +442,7 @@ void EntityDynamic::serialize_server_update(std::ostream & os) const << axis().left() << " " << roundf(entity_speed * 100.0f) << " " << entity_state << " "; - + if (entity_state != Normal) { os << entity_timer << " "; } @@ -463,7 +463,7 @@ void EntityDynamic::receive_server_update(std::istream &is) is >> entity_speed; entity_speed /= 100.0f; is >> entity_state; - + if (entity_state != Normal) { is >> entity_timer; } else { @@ -477,7 +477,7 @@ void EntityDynamic::receive_server_update(std::istream &is) /*----- EntityControlable ------------------------------------------ */ EntityControlable::EntityControlable(Player *owner, unsigned int flags) : - EntityDynamic(flags) + EntityDynamic(flags) { entity_thrust = 0; entity_movement = 0; @@ -495,7 +495,7 @@ EntityControlable::EntityControlable(Player *owner, unsigned int flags) : } EntityControlable::EntityControlable(std::istream & is) : - EntityDynamic(is) + EntityDynamic(is) { entity_thrust = 0; entity_movement = 0; @@ -521,7 +521,7 @@ void EntityControlable::serialize_server_create(std::ostream & os) const { EntityDynamic::serialize_server_create(os); os << roundf(entity_thrust*100.0f) << " " - << ( entity_owner ? entity_owner->id() : 0) << " "; + << (entity_owner ? entity_owner->id() : 0) << " "; } void EntityControlable::receive_server_create(std::istream &is) @@ -532,16 +532,16 @@ void EntityControlable::receive_server_create(std::istream &is) entity_thrust /= 100.0f; entity_owner = 0; - + int owner_id = 0; is >> owner_id; if (owner_id) { - for (GameInterface::Players::iterator pit = game()->players().begin(); pit != game()->players().end(); pit++ ) { + for (GameInterface::Players::iterator pit = game()->players().begin(); pit != game()->players().end(); pit++) { Player *player = (*pit); if (player->id() == owner_id) { player->add_asset(this); entity_owner = player; - + } } @@ -666,7 +666,7 @@ void EntityControlable::set_afterburner(float afterburner) /*----- EntityGlobe ------------------------------------------------ */ EntityGlobe::EntityGlobe(unsigned int flags) : - Entity(flags) + Entity(flags) { render_texture = 0; entity_rotationspeed = 0; @@ -674,7 +674,7 @@ EntityGlobe::EntityGlobe(unsigned int flags) : } EntityGlobe::EntityGlobe(std::istream & is) : - Entity(is) + Entity(is) { render_texture = 0; entity_rotationspeed = 0; @@ -699,9 +699,9 @@ void EntityGlobe::receive_server_create(std::istream &is) std::string n; char c; - while ( (is.get(c)) && (c != '"')); - while ( (is.get(c)) && (c != '"')) - n += c; + while ((is.get(c)) && (c != '"')); + while ((is.get(c)) && (c != '"')) + n += c; entity_texture = n; n.clear(); -- cgit v1.2.3