Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
KoduConditionHear.ccGo to the documentation of this file.00001 // INCLUDES 00002 // tekkotsu library 00003 #include "DualCoding/ShapeRoot.h" 00004 00005 // tekkodu library 00006 #include "Kodu/KoduWorld.h" 00007 #include "Kodu/General/GeneralMacros.h" 00008 #include "Kodu/Primitives/KoduConditionHear.h" 00009 #include "Kodu/KoduDiscover.h" 00010 00011 namespace Kodu { 00012 00013 bool KoduConditionHear::evaluate(const KoduWorld& kWorldState) { 00014 for (size_t i = 0; i < state.heard_utt.size(); i++) { 00015 KoduState::utterance utt = state.heard_utt[i]; 00016 std::map<int,player_identity>::iterator player = KoduDiscover::players.find(utt.hostAddr); 00017 if (utt.phrase == said 00018 && player != KoduDiscover::players.end() 00019 && (objType == "" || KoduType::strs[(player->second).type] == objType)) { 00020 //TODO also check color 00021 return true; 00022 } 00023 } 00024 return false; 00025 } 00026 00027 void KoduConditionHear::reinitialize() { 00028 KoduCondition::reinitialize(); 00029 } 00030 00031 //************* temp fix 00032 const DualCoding::ShapeRoot KoduConditionHear::getTargetObject() { 00033 return ObjectKeeper::tempObject; 00034 } 00035 //************* 00036 00037 00038 void KoduConditionHear::printAttrs() const { 00039 KoduCondition::printAttrs(); 00040 // not enabled? 00041 PRINT_ATTRS("Not enabled", notModifierEnabled); 00042 // object color and type 00043 std::cout << "Object color and type: " << objColor << " " << objType << std::endl; 00044 std::cout << "Said string: '" << said << "'" << std::endl; 00045 } 00046 00047 00048 } // namespace |
Tekkotsu v5.1CVS |
Generated Mon May 9 04:58:43 2016 by Doxygen 1.6.3 |