Virtual U.org
Get Personal Training on VU Today
    
Top shadow
 
 register/help
User Name:

Password:

OLOC.CPP Source File
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

OLOC.CPP

Go to the documentation of this file.
00001 //Filename    : OLoc.cpp
00002 //Description : Location Class Definition
00003 
00004 // ES library header file
00005 #include <OVgaBuf.h>
00006 
00007 // CU header file
00008 #include <ODefTile.h>                             // for Def::BIG
00009 #include <OFirm.h>
00010 #include <OFirmA.h>                               // for ::select_obj
00011 
00012 #include "OLoc.h"
00013 
00014 //temp
00015 #include <OFirmRes.h>
00016 
00017 //----------- Define constants -------------//
00018 //----------- Define static variables -------------//
00019 //----------- Define static functions -------------//
00020 //----------- Define static class member variables -------------//
00021 Firm  *Location::selected_object=0;
00022 
00023 //----------- Begin of function Location Constructor -----//
00028 Location::Location() {
00029     object = 0;
00030     //selected_object = 0;
00031     is_selected = false;
00032 }
00033 
00034 //------------- End of function Location Constructor -----//
00035 
00036 //----------- Begin of function Location Destructor ------//
00038 Location::~Location() {
00039 
00040 }
00041 
00042 //------------- End of function Location Destructor ------//
00043 
00044 //----------- Begin of function Location::init --------//
00046 void Location::init() {
00047 }
00048 
00049 //------------- End of function Location::init --------//
00050 
00051 //----------- Begin of function Location::deinit --------//
00053 void Location::deinit() {
00054 }
00055 
00056 //------------- End of function Location::deinit --------//
00057 
00058 //----------- Begin of function Location::get ------//
00061 void  Location::paint_object(short tileType, int x, int y, Rect *clip, VgaBuf *vgaBuf) {
00062 #ifdef DEBUG_SELECT_MAP
00063     if ( is_selected &&  tileType == 1 )
00064         Firm::firm_res.get_bitmap(DefTile::MARK_BMP)->paint(tileType, x+4,y+2,clip,vgaBuf);
00065 #endif
00066 
00067     if ( object )
00068         object->paint(tileType, x,y,clip,vgaBuf);
00069 }
00070 
00071 //------------- End of function Location::get ------//
00072 
00073 //----------- Begin of function Location::get ------//
00076 void  Location::paint_terrain(short tileType, int x, int y, Rect *clip, VgaBuf *vgaBuf) {
00077     //temp grass
00078     firm_res.get_bitmap(DefTile::GRASS_BMP)->paint(tileType, x,y,clip,vgaBuf);
00079 }
00080 
00081 //------------- End of function Location::get ------//
00082 
00083 //----------- Begin of function Location::get ------//
00086 void Location::set_object(Firm *f) {
00087     object = f;
00088 }
00089 
00090 //------------- End of function Location::get ------//
00091 
00092 //----------- Begin of function Location::get ------//
00095 bool Location::is_object() {
00096     return object != NULL;
00097 }
00098 
00099 //------------- End of function Location::get ------//
00100 
00101 //----------- Begin of function Location::get ------//
00104 bool Location::select_object(short tileType, short locx, short locy, int mx, int my) {
00105     if (object && object->select_me(tileType, locx, locy, mx, my) ) {
00106         if ( selected_object != object ) {
00107             if( selected_object )
00108                 selected_object->is_selected = false;     // reset last sel.
00109             selected_object = object;
00110         }
00111         else {
00112             selected_object = NULL;
00113         }
00114         return true;
00115     }
00116     return false;
00117 
00118 #ifdef DEBUG_SELECT_MAP
00119     //temp
00120     is_selected = !is_selected;
00121 #endif
00122 }
00123 
00124 //------------- End of function Location::get ------//

Generated on Fri Aug 23 01:38:03 2002 for VirtualU by doxygen1.2.17