00001 /* 00002 SagaEngine library 00003 Copyright (c) 2002-2006 Skalden Studio AS 00004 00005 This software is provided 'as-is', without any express or implied 00006 warranty. In no event will the authors be held liable for any 00007 damages arising from the use of this software. 00008 00009 Permission is granted to distribute the library under the terms of the 00010 Q Public License version 1.0. Be sure to read and understand the license 00011 before using the library. It should be included here, or you may read it 00012 at http://www.trolltech.com/products/qt/licenses/licensing/qpl 00013 00014 The original version of this library can be located at: 00015 http://www.sagaengine.com/ 00016 00017 Rune Myrland 00018 rune@skalden.com 00019 */ 00020 00021 00022 #include "Abilities.hpp" 00023 00024 #ifndef SE_OWN_ABILITIES 00025 00026 namespace se_core { 00027 const short Abilities 00028 ::autoBases_[][ABILITY_COUNT] = { 00029 { 8, 8, 8, 0 }, 00030 { 12, 12, 12, 1 }, 00031 { 16, 16, 16, 2 }, 00032 { 20, 20, 20, 3 }, 00033 { 24, 24, 24, 4 }, 00034 { 28, 28, 28, 5 } 00035 }; 00036 00037 00038 Abilities 00039 ::Abilities() { 00040 for(int i = 0; i < ABILITY_COUNT; ++i) { 00041 modifiers_[i] = 0; 00042 } 00043 setLevel(0); 00044 } 00045 00046 00047 Abilities 00048 ::~Abilities() { 00049 } 00050 00051 00052 void Abilities 00053 ::setLevel(short level) { 00054 for(int i = 0; i < ABILITY_COUNT; ++i) { 00055 bases_[ i ] = autoBases_[ level ][ i ]; 00056 } 00057 } 00058 00059 00060 void Abilities 00061 ::setBases(short* bases) { 00062 for(int i = 0; i < ABILITY_COUNT; ++i) { 00063 bases_[ i ] = bases[ i ]; 00064 } 00065 } 00066 00067 00068 void Abilities 00069 ::setBases(const Abilities* src) { 00070 if(src) { 00071 for(int i = 0; i < ABILITY_COUNT; ++i) { 00072 bases_[ i ] = src->bases_[ i ]; 00073 } 00074 } 00075 else { 00076 for(int i = 0; i < ABILITY_COUNT; ++i) { 00077 bases_[ i ] = 1; 00078 } 00079 } 00080 } 00081 00082 00083 } 00084 00085 #endif // SE_OWN_ABILITIES 00086
Home Page | SagaEngine trunk (updated nightly) reference generated Sun Dec 2 20:06:11 2007 by Doxygen version 1.3.9.1.