DBArray::DBArray(ArrayID id, const boost::shared_ptr<Query>& query) : _query(query) { SystemCatalog::getInstance()->getArrayDesc(id, _desc); if (query) { query->sharedLock(getRealName()); } }
void FontManager::loadFontWithName(const std::string &fontName, const int pointSize) { AssetHelper helper; TTF_Font *font = nullptr; font = TTF_OpenFont(helper.fullAssetPathForFile(fontName).c_str(), pointSize); SDL_assert(font != nullptr); SDL_Log("Loaded font %s", fontName.c_str()); fonts.insert(std::pair<std::string, TTF_Font*>(getRealName(fontName, pointSize), font)); }
std::string JSONConfig::getDebugNameForLocalVar(const std::string &func, const std::string &var) const { const auto &f = impl->getConfigFunctionByNameOrEmptyFunction(func); auto v = f.locals.getObjectByName(var); if (!v) { v = f.parameters.getObjectByName(var); } return v && v->isFromDebug() ? v->getRealName() : std::string(); }
DBArray::DBArray(ArrayDesc const& desc, const boost::shared_ptr<Query>& query) : _desc(desc), _query(query) { _desc.setPartitioningSchema(SystemCatalog::getInstance()->getPartitioningSchema(desc.getId())); if (query) { query->sharedLock(getRealName()); } }
TTF_Font *FontManager::getFontWithName(const std::string &fontName, const int pointSize) { std::string realName = getRealName(fontName, pointSize); std::map<std::string, TTF_Font *>::iterator finder = fonts.find(realName); if(finder == fonts.end()) { SDL_Log("Couldn't load font: %s, loading now", fontName.c_str()); loadFontWithName(fontName, pointSize); } return fonts.at(realName); }
string Item::getName(bool plural, bool blind) const { string suff = uses > -1 && displayUses && inspected ? string(" (") + convertToString(uses) + " uses left)" : ""; if (fire.isBurning()) suff.append(" (burning)"); if (getShopkeeper()) suff += " (" + convertToString(getPrice()) + (plural ? " zorkmids each)" : " zorkmids)"); if (blind) return getBlindName(plural); if (isIdentified(*name)) return getRealName(plural) + suff; else return getVisibleName(plural) + suff; }
/* * This method checks to see if the two CKIRCProtocols are equal to * one another based on the values they represent and *not* on the * actual pointers themselves. If they are equal, then this method * returns true, otherwise it returns false. */ bool CKIRCProtocol::operator==( const CKIRCProtocol & anOther ) const { bool equal = true; if ((getHostname() != anOther.getHostname()) || (getPort() != anOther.getPort()) || (mCommPort != anOther.mCommPort) || (isLoggedIn() != anOther.isLoggedIn()) || (getPassword() != anOther.getPassword()) || (getNickname() != anOther.getNickname()) || (getUserHost() != anOther.getUserHost()) || (getUserServer() != anOther.getUserServer()) || (getRealName() != anOther.getRealName()) || (mChannelList != anOther.mChannelList) || (mResponders != anOther.mResponders)) { equal = false; } return equal; }
void Uniform::loadLocation(){ if (glIsProgram(shader) == GL_FALSE){ DebugUtility::log_err("ERROR: Called loadLocation of uniform %s before its shader was successfully linked\n", name.c_str()); return; } if (!isStruct()){ std::string realName = getRealName(); location = glGetUniformLocation(shader, realName.c_str()); if (location == -1u) { DebugUtility::log_err("ERROR: Failed to load location of uniform %s\n", realName.c_str()); } else{ } } else { for (auto c : children){ c->loadLocation(); } } }
/* * Because there are times when it's useful to have a nice * human-readable form of the contents of this instance. Most of the * time this means that it's used for debugging, but it could be used * for just about anything. In these cases, it's nice not to have to * worry about the ownership of the representation, so this returns * a CKString. */ CKString CKIRCProtocol::toString() const { CKString retval = "< IRC Host="; retval += getHostname(); retval += ", "; retval += " IRC Port="; retval += getPort(); retval += ", "; retval += " CommPort="; retval += mCommPort.toString(); retval += ", "; retval += " isLoggedIn? "; retval += (isLoggedIn() ? "Yes" : "No"); retval += ", "; retval += " Password="******" Nickname="; retval += getNickname(); retval += " UserHost="; retval += getUserHost(); retval += " UserServer="; retval += getUserServer(); retval += " RealName="; retval += getRealName(); retval += " ChannelList: ["; CKStringNode *i = NULL; for (i = mChannelList.getHead(); i != NULL; i = i->getNext()) { if (i->getPrev() != NULL) { retval += ", "; } retval += (*i); } retval += "]>\n"; return retval; }
std::string JSONConfig::getDebugNameForGlobalVar(const std::string &var) const { auto v = impl->config.globals.getObjectByName(var); return v && v->isFromDebug() ? v->getRealName() : std::string(); }
void plainconf::parseLine(const char *fileName, int lineNumber, const char *sLine) { const int MAX_NAME_LENGTH = 4096; char name[MAX_NAME_LENGTH] = {0}; char value[MAX_NAME_LENGTH] = {0}; const char *attr = NULL; XmlNode *pNode = NULL; XmlNode *pCurNode = (XmlNode *)gModuleList.back(); const char *p = sLine; const char *pEnd = sLine + strlen(sLine); bool bNameSet = false; for (; p < pEnd; ++p) { //"{" is a beginning of a block only if it is the last char of a line if (*p == '{' && pEnd - p == 1) { if (strlen(name) > 0) { const char *pRealname = getRealName(name); if (pRealname) { pNode = new XmlNode; pNode->init(pRealname, &attr); //Remove space in the end of the value such as "module cache {", value will be "cache" removeSpace(value, 1); if (strlen(value) > 0) pNode->setValue(value, strlen(value)); pCurNode->addChild(pNode->getName(), pNode); gModuleList.push_back(pNode); pCurNode = pNode; clearNameAndValue(name, value); break; } else { logToMem(LOG_LEVEL_ERR, "parseline find block name [%s] is NOT keyword in %s:%d", name, fileName, lineNumber); break; } } else { logToMem(LOG_LEVEL_ERR, "parseline found '{' without a block name in %s:%d", fileName, lineNumber); break; } } else if (*p == '}' && p == sLine) { if (gModuleList.size() > 1) { gModuleList.pop_back(); clearNameAndValue(name, value); if (*(p + 1)) { ++p; trimWhiteSpace(&p); parseLine(fileName, lineNumber, p); break; } } else { logToMem(LOG_LEVEL_ERR, "parseline found more '}' in %s:%d", fileName, lineNumber); clearNameAndValue(name, value); break; } } else if ((*p == ' ' || *p == '\t') && value[0] == 0) { bNameSet = true; continue; } else { if (!bNameSet) strcatchr(name, *p, MAX_NAME_LENGTH); else strcatchr(value, *p, MAX_NAME_LENGTH); } } if (name[0] != 0) { const char *pRealname = getRealName(name); if (pRealname) { assert(pNode == NULL); pNode = new XmlNode; pNode->init(pRealname, &attr); if (strlen(value) > 0) pNode->setValue(value, strlen(value)); pCurNode->addChild(pNode->getName(), pNode); } else { //There is no special case in server level //if (memcmp(pCurNode->getName(), SERVER_ROOT_XML_NAME, sizeof(SERVER_ROOT_XML_NAME) - 1) != 0) saveUnknownItems(fileName, lineNumber, pCurNode, name, value); //else // logToMem(LOG_LEVEL_ERR, "%s Server level find unknown keyword [%s], ignored.", SERVER_ROOT_XML_NAME, name ); } } }
void main(int argc, char *argv[]) #endif { char szText[160]; bool bSuccess; short nTries = 0; // Set results of what happens when a call to new fails set_new_handler(badNew); // Call the startup function #ifdef OD32 startup(lpszCmdLine); #else startup(argc, argv); #endif Sleep(500); do { // Attempt to start up the door server process. (No need to check if the door server process is already // running; it does that on its own and shuts down extra copies as needed) bSuccess = CreateProcess(DOOR_SERVER_EXE, NULL, NULL, NULL, false, DETACHED_PROCESS, NULL, NULL, new STARTUPINFO, new PROCESS_INFORMATION); Sleep(1000); nTries++; } while ( bSuccess == false && nTries < 5 ); // Get a handle on the door server's input mailslot hInputSlot = openSlot(-1); // Create this node's output mailslot. hOutputSlot = createSlot( getNode() ); // If unable to open input slot, re-try up to 5 times (intial failure seems to happen on WinXP randomly) // If still failure, this indicates the door server is not running and could not be started, so shut down. nTries = 0; while (hInputSlot == INVALID_HANDLE_VALUE ) { Sleep(500); hInputSlot = openSlot(-1); if ( ++nTries > 5 ) { local("Unable to start door: IPC error"); exitDoor(1); } } // If the output slot for this node is already open, it means the node is already running the door. if ( hOutputSlot == INVALID_HANDLE_VALUE ) { local("Unable to start door: This node is already in use!"); pausePrompt(); exitDoor(1); } // Now that the mailslot handles were successful, call setupExitFunction() to register beforeExit() as the // function called upon exit. setupExitFunction(); // Send an input message to the server, to tell it a user is trying to enter the game. The user's info is // passed as a string in the format below. sprintf(szText, "%d&%c&%d&%s&%s", isSysop(), getGender(), getPlatform(), getAlias(), getRealName()); sendInput(szText, IP_ENTER_GAME); // Handle I/O for the user while (1) { performIO(); } }