//----------------------------------------------------------------- void LevelScript::interruptPlan() { Planner::interruptPlan(); //NOTE: checkActive is before unBusyUnits to allow script // make busy unwanted fishes room()->checkActive(); room()->unBusyUnits(); }
void SMWServer::playerCreatesRoom(uint64_t playerID, const void* data) { if (!players.count(playerID)) return; Player* player = &players[playerID]; if (player->currentRoomID || player->isPlaying) return; // input NewRoomPackage pkg; memcpy(&pkg, data, sizeof(NewRoomPackage)); // create Room room(roomCreateID, pkg.name, pkg.password, player); room.setGamemode(pkg.gamemodeID, pkg.gamemodeGoal); rooms[roomCreateID] = room; player->currentRoomID = roomCreateID; player->isPlaying = false; // output NewRoomCreatedPackage package(roomCreateID); player->sendData(&package, sizeof(NewRoomCreatedPackage)); log("New room by %s : {id: %d; name: %s; pw: %s}", player->toString().c_str(), room.roomID, room.name, room.password); roomCreateID++; // increase global ID }
int Castle::Unblock() { vector<int> coordinate(3); for(int i = min_.x ; i <= max_.x; i++) for(int j = min_.y ; j <= max_.y; j++) for(int k = min_.z ; k <= max_.z; k++) { coordinate[0] = i; coordinate[1] = j; coordinate[2] = k; int jj; if(!room_index_[coordinate] && (jj = OneNeighbor(i, j, k)) != -1) { int nn = room_.size(); room_index_[coordinate] = nn; switch(jj) { case 0: coordinate[1] = j + 1; break; case 1: coordinate[1] = j - 1; break; case 2: coordinate[0] = i - 1; break; case 3: coordinate[0] = i + 1; break; case 4: coordinate[2] = k + 1; break; case 5: coordinate[2] = k - 1; break; } int n = room_index_[coordinate]; room_[n].door(jj ^ 1, nn); room_[n].k_door(room_[n].k_door() + 1); Room room(i, j, k, rand() % MaxDoor(i, j, k) + 1); room.door(jj, n); room_.push_back(room); // cout << " Unblock: " << nn << " " << i << " " << j << " " << k << endl; return nn; } } return 0; }
void SMWServer::playerCreatesRoom(uint64_t playerID, const void* data, size_t dataLength) { if (!players.count(playerID)) return; Player* player = &players[playerID]; if (player->currentRoomID || player->isPlaying) return; if (dataLength != sizeof(NetPkgs::NewRoom)) { printf("[error] Corrupt package arrived from %lu\n", playerID); return; } // input NetPkgs::NewRoom pkg; memcpy(&pkg, data, dataLength); // create Room room(roomCreateID, pkg.name, pkg.password, player); room.setGamemode(pkg.gamemodeID, pkg.gamemodeGoal); rooms[roomCreateID] = room; player->currentRoomID = roomCreateID; player->isPlaying = false; // output NetPkgs::NewRoomCreated package(roomCreateID); player->sendData(&package, sizeof(NetPkgs::NewRoomCreated)); log("New room by %s : {id: %d; name: %s; pw: %s}", player->toString().c_str(), room.roomID, room.name, room.password); roomCreateID++; // increase global ID }
GlobalVariables::GlobalVariables() { #define DECL_BT( T ) class_##T = new Class; #include "DeclBaseClass.h" #include "DeclParmClass.h" #undef DECL_BT #define DECL_BT( T ) type_##T = new Type_<T>( class_##T ); class_##T->types << type_##T; type_##T->aryth = true; type_##T->_len = 8 * sizeof( T ); type_##T->_ali = 8 * sizeof( T ); type_##T->_pod = 1; #include "DeclArytTypes.h" #undef DECL_BT #define DECL_BT( T ) type_##T = new Type( class_##T ); class_##T->types << type_##T; #define DONT_WANT_DeclArytTypes_h #include "DeclBaseClass.h" #undef DONT_WANT_DeclArytTypes_h #undef DECL_BT type_Type ->_len = 64; type_Type ->_ali = 32; type_Type ->_pod = 1; type_Void ->_len = 0; type_Void ->_ali = 1; type_Void ->_pod = 1; type_Error ->_len = 0; type_Error ->_ali = 1; type_Error ->_pod = 1; type_Def ->_len = 64; type_Def ->_ali = 32; type_Def ->_pod = 1; type_Class ->_len = 64; type_Class ->_ali = 32; type_Class ->_pod = 1; type_SurdefList->_len = 64; type_SurdefList->_ali = 32; type_SurdefList->_pod = 1; type_Varargs ->_len = 64; type_Varargs ->_ali = 32; type_Varargs ->_pod = 1; type_Bool ->_len = 1; type_Bool ->_ali = 1; type_ST = sizeof( void * ) == 8 ? type_SI64 : type_SI32; ptr_size = 8 * sizeof( void * ); main_parsing_context = 0; ip_snapshot = 0; pc = 0; main_scope[ "void" ] = Variable{ room( cst( type_Void, 0, 0 ) ) }; }
t_graph create_graph(int order) { t_graph g; int i; g = malloc(GSIZE(order)); g->order = order; for (i=0; i<order; i++) { room(g,i) = malloc(sizeof(struct s_som)); room(g,i)->som = i; room(g,i)->cost = 0; succ(g,i) = pred(g,i) = NULL; } return g; }
Jid JabberResourceService::bestChatJid(const Chat &chat) const { if (!chat) return Jid{}; auto chatType = m_chatTypeManager->chatType(chat.type()); if (!chatType) return Jid{}; if (chatType->name() == "Contact") { Q_ASSERT(1 == chat.contacts().size()); return bestContactJid(chat.contacts().toContact()); } if (chatType->name() == "Room") { auto details = qobject_cast<ChatDetailsRoom *>(chat.details()); Q_ASSERT(details); return Jid::parse(details->room()); } return Jid{}; }
void Character::initialize(const SCENEid &sceneId, const OBJECTid &dummyCameraId, const ROOMid &terrianRoomId){ // Since character size seems to be invisible from users, we had to set it ourselves. character_height = 120.0f; m_sceneId = sceneId; m_dummyCameraId = dummyCameraId; m_terrianRoomId = terrianRoomId; //load character FnScene scene(sceneId); m_actorId = scene.LoadCharacter("Lyubu2"); m_actor.ID(m_actorId); //put on terrian FnRoom room(terrianRoomId); room.AddObject(m_actorId); m_fDir3[0] = 1; m_fDir3[1] = 0; m_fDir3[2] = 0; m_uDir3[0] = 0, m_uDir3[1] = 0; m_uDir3[2] = 1; m_fPos3[0] = 3569.0; m_fPos3[1] = -3208.0; m_fPos3[2] = 0; m_actor.SetDirection(m_fDir3, m_uDir3); m_actor.SetTerrainRoom(terrianRoomId, 400.f); m_actor.PutOnTerrain(m_fPos3, 200); m_actor.SetPosition(m_fPos3); //set up action ACTIONid idleId = m_actor.GetBodyAction(NULL, "Idle"); ACTIONid runId = m_actor.GetBodyAction(NULL, "Run"); ACTIONid walkId = m_actor.GetBodyAction(NULL, "Walk"); m_mapAction2Name.insert(std::pair<ACTIONid, std::string>(idleId, "Idle")); m_mapAction2Name.insert(std::pair<ACTIONid, std::string>(runId, "Run")); m_mapAction2Name.insert(std::pair<ACTIONid, std::string>(walkId, "Walk")); m_mapIndex2Action.insert(std::pair<ActionType, ACTIONid>(ACTION_IDLE, idleId)); m_mapIndex2Action.insert(std::pair<ActionType, ACTIONid>(ACTION_RUN, runId)); m_mapIndex2Action.insert(std::pair<ActionType, ACTIONid>(ACTION_WALK, walkId)); m_mapState2Action.insert(std::pair<MotionState, ACTIONid>(MotionState::IDLE, idleId)); m_mapState2Action.insert(std::pair<MotionState, ACTIONid>(MotionState::MOVE_BACKWARD, runId)); m_mapState2Action.insert(std::pair<MotionState, ACTIONid>(MotionState::MOVE_FORWARD, runId)); m_mapState2Action.insert(std::pair<MotionState, ACTIONid>(MotionState::MOVE_LEFT, runId)); m_mapState2Action.insert(std::pair<MotionState, ACTIONid>(MotionState::MOVE_LEFT_BACKWARD, runId)); m_mapState2Action.insert(std::pair<MotionState, ACTIONid>(MotionState::MOVE_LEFT_FORWARD, runId)); m_mapState2Action.insert(std::pair<MotionState, ACTIONid>(MotionState::MOVE_RIGHT, runId)); m_mapState2Action.insert(std::pair<MotionState, ACTIONid>(MotionState::MOVE_RIGHT_BACKWARD, runId)); m_mapState2Action.insert(std::pair<MotionState, ACTIONid>(MotionState::MOVE_RIGHT_FORWARD, runId)); m_curActionId = idleId; m_actor.SetCurrentAction(NULL, 0, m_curActionId); m_actor.Play(START, 0.0f, FALSE, TRUE); m_curState = MotionState::IDLE; m_preState = MotionState::IDLE; m_rotateVel = 10; m_moveVel = 10; }
/** * Add model at scene. * @param new_model new object * @param new_unit driver for the object or NULL * @return model index * @throws LogicException when room is not created yet */ int LevelScript::addModel(Cube *new_model, Unit *new_unit) { std::auto_ptr<Cube> ptr_model(new_model); std::auto_ptr<Unit> ptr_unit(new_unit); ptr_model->takeDialogs(dialogs()); return room()->addModel(ptr_model.release(), ptr_unit.release()); }
void Castle::GenerateLobby() { Room room(0, 0, 0, (k_room_ > 1 ? rand() % MaxDoor(0, 0, 0) + 1 : 0)); room.k_door(0); room_.push_back(room); room_.push_back(room); room_count_[1] = 1; vector<int> coordinate(3, 0); room_index_[coordinate] = 1; }
LinkedList<Room> Room::createRooms() { //create rooms up until ROOMS is reached LinkedList<Room> roomList; for(int i= 1; i < 11; i++){ Room room(i+100); roomList.push(room); } return roomList; }
JabberRoomChat *JabberRoomChatService::getRoomChat(const QString &id) const { for (auto &&roomChat : m_chats) { auto details = myRoomChatDetails(roomChat->chat()); if (details && details->room() == id) return roomChat; } return nullptr; }
void rooms(View* view, int lastInd = 0) { vector<View::ListElem> options; vector<PlayerControl::RoomInfo> roomList = PlayerControl::getRoomInfo(); for (auto& elem : roomList) options.push_back(elem.name); auto index = view->chooseFromList("Rooms", options, lastInd); if (!index) return; room(view, roomList[*index]); rooms(view, *index); }
void Lobby::StartGame() { std::shared_ptr<GameRoom> room(new GameRoom(this, players_per_game_)); for (auto c : waiting_) { if (room->players() < players_per_game_) { room->AddPlayer(c); c->AssignRoom(room); } } rooms_.insert(room); LOG_DEBUG(logger_, "Starting Game!"); room->Run(); }
void init(void){ float luz_ambiente[] = {0.45, 0.45, 0.45, 1.0}; float luz0_especular[] = {1.0, 1.0, 1.0, 1.0}; float luz0_difusa[] = {0.35, 0.35, 0.35, 1.0}; float luz0_posicion[] = {200.0, 200.0, 200.0, 1.0}; float luz0_direccion[] = {0.0, 0.0, 0.0}; float reflectancia[] = {0.5, 0.5, 0.5, 1.0}; float bases[5]={69.6, 63.15, 51.3, 39.5, 35.95}; float basesT[6]={82.45, 77.4, 64.05, 52.5, 47.25, 30.0}; float altura=300.0; float color1[]= {0.0, 0.0, 0.0, 1.0}; float color2[]= {0.7, 0.0, 0.0, 1.0}; float basesX[5], basesTX[6], alturaX; ratio=(GLfloat)winWidth/(GLfloat)winHeight; Vx=Vz=0.0; Vy=30.0; Vtheta=3*PI/2.0; glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(winWidth, winHeight); glutInitWindowPosition(30, 50); glutCreateWindow("Animacion"); glShadeModel(GL_SMOOTH); glFrontFace(GL_CCW); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glEnable(GL_LIGHTING); glLightModelfv(GL_LIGHT_MODEL_AMBIENT,luz_ambiente); glEnable(GL_COLOR_MATERIAL); glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE); glMaterialfv(GL_FRONT, GL_SPECULAR, reflectancia); glMateriali(GL_FRONT, GL_SHININESS, 60); glLightfv(GL_LIGHT0,GL_DIFFUSE,luz0_difusa); glLightfv(GL_LIGHT0,GL_DIFFUSE,luz_ambiente); glLightfv(GL_LIGHT0,GL_SPECULAR,luz0_especular); glLightfv(GL_LIGHT0,GL_POSITION,luz0_posicion); glLightfv(GL_LIGHT0,GL_SPOT_DIRECTION,luz0_direccion); glEnable(GL_LIGHT0); //lista room Lroom=glGenLists(1); glNewList(Lroom,GL_COMPILE); room(LADO); glEndList(); //lista jet Ljet=glGenLists(1); glNewList(Ljet,GL_COMPILE); jet(); glEndList(); //lista castle1 Lcastle=glGenLists(1); copiaVec(basesX,bases,5); escalaVec(0.1, basesX, 5); copiaVec(basesTX,basesT,6); escalaVec(0.1, basesTX, 6); alturaX = 0.1*altura; glNewList(Lcastle,GL_COMPILE); castillo(basesX, basesTX, alturaX, color1, color2); glEndList(); }
size_t cbuf::write(const char* src, size_t size) { size_t bytes_available = room(); size_t size_to_write = (size < bytes_available) ? size : bytes_available; size_t size_written = size_to_write; if(_end >= _begin && size_to_write > (size_t) (_bufend - _end)) { size_t top_size = _bufend - _end; memcpy(_end, src, top_size); _end = _buf; size_to_write -= top_size; src += top_size; } memcpy(_end, src, size_to_write); _end = wrap_if_bufend(_end + size_to_write); return size_written; }
void QtJoinMUCWindow::handleJoin() { if (ui.room->text().isEmpty() || !ui.room->hasAcceptableInput()) { QToolTip::showText(ui.room->mapToGlobal(QPoint()), tr("Please enter a valid room address."), ui.room); return; } if (ui.nickName->text().isEmpty() || !ui.nickName->hasAcceptableInput()) { QToolTip::showText(ui.nickName->mapToGlobal(QPoint()), tr("Please enter a valid nickname."), ui.nickName); return; } lastSetNick = Q2PSTRING(ui.nickName->text()); std::string password = Q2PSTRING(ui.password->text()); JID room(Q2PSTRING(ui.room->text())); uiEventStream->send(boost::make_shared<JoinMUCUIEvent>(room, password, lastSetNick, ui.joinAutomatically->isChecked(), !ui.instantRoom->isChecked())); hide(); }
void QtJoinMUCWindow::handleJoin() { if (ui.room->text().isEmpty()) { // TODO: Error return; } if (ui.nickName->text().isEmpty()) { // TODO: Error return; } lastSetNick = Q2PSTRING(ui.nickName->text()); std::string password = Q2PSTRING(ui.password->text()); JID room(Q2PSTRING(ui.room->text())); uiEventStream->send(boost::make_shared<JoinMUCUIEvent>(room, password, lastSetNick, ui.joinAutomatically->isChecked(), !ui.instantRoom->isChecked())); hide(); }
int main(int argc, char **argv) { if(argc==2) { srand(time(NULL)); room maze[COLS][ROWS]; room (*ptr)[ROWS] = maze; init(ptr); dw(ptr, 0,0); toFile(ptr, argv[1]); return 0; } else { puts("NEED FILE PATH"); return 1; } }
bool Weave::LoadWeave() { // Open the input file std::ifstream fin(WEAVE_FILE); if (!fin.is_open()) { bug("Unable to open weave file for reading", 0); return false; } // Read in the founts while (!fin.eof()) { // Read in the values int vnum; fin >> vnum; int positivePower; fin >> positivePower; int orderPower; fin >> orderPower; long attunedID; fin >> attunedID; // Basic error checking if (fin.fail() && !fin.eof()) { bug("Failed to fully read weave file", 0); return false; } // Look up the room ROOM_INDEX_DATA * room(get_room_index(vnum)); if (room == NULL) { bug("Missing room referenced in weave file [vnum: %d]", vnum); continue; } // Build the ley info positivePower = URANGE(Fount::PowerMin, positivePower, Fount::PowerMax); orderPower = URANGE(Fount::PowerMin, orderPower, Fount::PowerMax); LeyInfo leyInfo(room, orderPower, positivePower); // Set up the ley group if (room->ley_group == NULL) room->ley_group = new LeyGroup(leyInfo); else room->ley_group->SetFount(leyInfo); room->ley_group->SetAttunedID(attunedID); } return true; }
void check_waterwheel_charging(OBJ_DATA & obj) { static const int DurationStep(20); // Verify that the object is a crystal and the waterwheel is in a room if (obj.contains == NULL || obj.contains->material != material_lookup("crystal") || obj.contains->item_type != ITEM_GEM) return; // Verify that the waterwheel is in a room ROOM_INDEX_DATA * room(get_room_for_obj(obj)); if (room == NULL) return; // Check for existing effect AFFECT_DATA * paf(get_obj_affect(obj.contains, gsn_constructwaterwheel)); if (paf == NULL) { // First time, add the effect AFFECT_DATA af = {0}; af.where = TO_OBJECT; af.type = gsn_constructwaterwheel; af.level = obj.level; af.duration = DurationStep; af.bitvector = ITEM_HUM; affect_to_obj(obj.contains, &af); if (room != NULL) act("Inside the waterwheel, $p begins to emit a faint humming sound.", room->people, obj.contains, NULL, TO_ALL); return; } // Increase the duration int maxCharge(obj.level * 5); if (paf->duration + DurationStep < maxCharge) { paf->duration += DurationStep; act("$p's hum intensifies slightly as it absorbs the river's energy.", room->people, obj.contains, NULL, TO_ALL); return; } paf->duration = maxCharge; if (number_bits(1) == 0) act("From inside the waterwheel, $p hums steadily, unable to absorb any more power.", room->people, obj.contains, NULL, TO_ALL); }
void BSPNode::render(sf::RenderWindow* window) { sf::RectangleShape shape(sf::Vector2f((float)_bounds.width, (float)_bounds.height)); shape.setPosition(_bounds.left, _bounds.top); shape.setFillColor(sf::Color(_r, _g, _b, 255)); shape.setOutlineColor(sf::Color::Black); shape.setOutlineThickness(5.0f); sf::RectangleShape room(sf::Vector2f((float)_room.width, (float)_room.height)); room.setPosition(_room.left, _room.top); room.setFillColor(sf::Color::White); //window->draw(shape); window->draw(room); }
void display (void) { glClearColor (0.0,0.0,0.0,1.0); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); // GLfloat mat_shininess[] = { 50.0 }; /*GLfloat ambientLight[] = { 0.2f, 0.2f, 0.2f, 1.0f }; GLfloat diffuseLight[] = { 0.8f, 0.8f, 0.8, 1.0f }; GLfloat specularLight[] = { 0.5f, 0.5f, 0.5f, 1.0f }; GLfloat position[] = { -1.5f, 1.0f, -4.0f, 1.0f }; glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight); glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight); glLightfv(GL_LIGHT0, GL_SPECULAR, specularLight); glLightfv(GL_LIGHT0, GL_POSITION, position); */ GLfloat DiffuseLight[] = {dlr, dlg, dlb}; //set DiffuseLight[] to the specified values GLfloat AmbientLight[] = {alr, alg, alb}; //set AmbientLight[] to the specified values glLightfv (GL_LIGHT0, GL_DIFFUSE, DiffuseLight); //change the light accordingly // glLightfv (GL_LIGHT1, GL_SPECULAR, AmbientLight); //change the light accordingly GLfloat LightPosition[] = {lx,ly,lz,lw}; //set the LightPosition to the specified values // GLfloat LightPosition2[] = {15.0, 15.0, 0.0, 1.0}; glLightfv (GL_LIGHT0, GL_POSITION, LightPosition); //change the light accordingly //glLightfv (GL_LIGHT1, GL_POSITION, LightPosition2); //glFogi(GL_FOG_MODE, GL_EXP2); //glFogfv(GL_FOG_COLOR,fogColor); //glFogf (GL_FOG_DENSITY, density); //glFogf(GL_FOG_START, 1); //glHint(GL_FOG_HINT,GL_NICEST); gluLookAt(eyex,eyey,eyez,lookx,looky,lookz,0.0,1.0,0.0); // cube2(); room(); // sphere(); cube3(); glutSwapBuffers(); angle=angle+0.05; }
void init(void){ GLfloat luz_ambiente[] = {0.45, 0.45, 0.45, 1.0}; GLfloat luz0_especular[] = {1.0, 1.0, 1.0, 1.0}; GLfloat luz0_difusa[] = {0.35, 0.35, 0.35, 1.0}; GLfloat luz0_posicion[] = {200.0, 200.0, 200.0, 1.0}; GLfloat luz0_direccion[] = {0.0, 0.0, 0.0}; GLUquadricObj *Qflat; glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); glutInitWindowSize(winWidth, winHeight); glutInitWindowPosition(100, 100); glutCreateWindow("Objeto 3D compuesto"); glColor3f(1.0, 1.0, 1.0); Qflat = gluNewQuadric(); gluQuadricDrawStyle(Qflat, GLU_FILL); gluQuadricNormals(Qflat, GLU_SMOOTH); gluQuadricOrientation(Qflat, GLU_INSIDE); gluQuadricTexture(Qflat, GL_TRUE); ratio=(GLfloat)winWidth/(GLfloat)winHeight; Vx=0.0; Vz=235.0; Vy=30.0; Vtheta=3*PI/2.0; //luz y sombreado glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glEnable(GL_LIGHTING); glLightModelfv(GL_LIGHT_MODEL_AMBIENT,luz_ambiente); glEnable(GL_COLOR_MATERIAL); glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE); glMateriali(GL_FRONT, GL_SHININESS, 60); glLightfv(GL_LIGHT0,GL_DIFFUSE,luz0_difusa); glLightfv(GL_LIGHT0,GL_SPECULAR,luz0_especular); glLightfv(GL_LIGHT0,GL_POSITION,luz0_posicion); glLightfv(GL_LIGHT0,GL_SPOT_DIRECTION,luz0_direccion); glEnable(GL_LIGHT0); //lista room Lroom=glGenLists(1); glNewList(Lroom,GL_COMPILE); room(LADO); glEndList(); //lista casa Lcasa=glGenLists(1); glNewList(Lcasa,GL_COMPILE); casa(200); glEndList(); }
TEST(TestBookingCalendar, testFindRoomInTwoDate) { std::vector<std::string> date; BookingCalendar calendar(2015); Hotel hotel; for (int i = 0; i < 4; i++) { Room room(1+i, 5*(i+1), 200, 4, 405); hotel.pushRoomToDatabase(room); } calendar.reserveRoom(hotel.getRoomByIndex(0), 2015, 12, 12); calendar.reserveRoom(hotel.getRoomByIndex(1), 2015, 12, 12); calendar.reserveRoom(hotel.getRoomByIndex(2), 2015, 12, 12); calendar.reserveRoom(hotel.getRoomByIndex(1), 2015, 12, 14); calendar.reserveRoom(hotel.getRoomByIndex(1), 2015, 12, 16); calendar.reserveRoom(hotel.getRoomByIndex(0), 2015, 12, 15); calendar.findRoomByDateRange(hotel.getRoomByIndex(1), 2015, 12, 10, 2015, 12, 20, date); EXPECT_EQ(3, date.size()); }
void handle_waterwheel_destruction(OBJ_DATA & obj) { // Verify a room ROOM_INDEX_DATA * room(get_room_for_obj(obj)); if (room == NULL) return; // Load up the remains and transfer the contents OBJ_DATA * remains(create_object(get_obj_index(OBJ_VNUM_WATERWHEEL_REMAINS), 0)); remains->level = obj.level; for (OBJ_DATA * item(obj.contains); item != NULL; item = obj.contains) { obj_from_obj(item); obj_to_obj(item, remains); } obj_to_room(remains, room); }
static void PASCAL PushMLHist (void) { char *ml; int i, e; for (e = MLSIZE - 1; e >= 0; e--) if (MLBuf[e] != ' ') break; /* e = index of the last non-space char */ if (e < 0) return; if ((ml = MLHistory[MLHistNew] = room (e + 2)) != NULL) { for (i = 0; i <= e; i++) *ml++ = MLBuf[i]; *ml = '\0'; /* terminate the string */ MLHistNew = (MLHistNew + 1) & MLHISTMASK; if (MLHistOld == MLHistNew) { /* the history is full. This old entry needs to be discarded */ free (MLHistory[MLHistOld]); MLHistOld = (MLHistOld + 1) & MLHISTMASK; } } } /* PushMLHist */
Expr Ast_Def::_parse_in( ParsingContext &context ) const { std::set<String> res; if ( context.parent ) { std::set<String> avail; avail.insert( name ); get_potentially_needed_ext_vars( res, avail ); } // Def *c = new Def( this ); // SI64 ptr = SI64( ST( c ) ); Expr out = room( cst( ip->type_Def, 64, &ptr ) ); out->flags |= Inst::SURDEF; if ( stat ) out->flags |= Inst::STATIC; return context.reg_var( name, out, true ); }
static int PASCAL mswopen () { static BOOL FirstTime = TRUE; if (FirstTime) { int x; revexist = TRUE; eolexist = TRUE; strcpy (sres, "MSWIN"); /* $SRES emacs variable */ strcpy(os, "MSWIN"); /* $OS emacs variable */ MLBuf = (char*)room(MLSIZE); for (x = 0; x < MLSIZE;) MLBuf[x++] = ' '; FirstTime = FALSE; } UpdateRow = -1; UpdateCol.rightmost = -1; UpdateCol.leftmost = HUGE; /* empty range */ return 0; } /* mswopen */
void RoomMenu::upload_file(const QString &path) { auto file = std::make_shared<QFile>(path); QFileInfo info(*file); if(!file->open(QIODevice::ReadOnly)) { MessageBox::critical(tr("Error opening file"), tr("Couldn't open %1: %2").arg(info.fileName()).arg(file->errorString()), parentWidget()); return; } const QString &type = QMimeDatabase().mimeTypeForFile(info).name(); auto reply = room_.session().upload(*file, type, info.fileName()); QPointer<matrix::Room> room(&room_); // This closure captures 'file' to ensure its outlives the network request connect(reply, &matrix::ContentPost::success, [file, room, info, type](const QString &uri) { if(!room) return; room->send_file(uri, info.fileName(), type, info.size()); }); QPointer<QWidget> parent(parentWidget()); connect(reply, &matrix::ContentPost::error, [parent, info](const QString &msg) { MessageBox::critical(tr("Error uploading file"), tr("Couldn't upload %1: %2").arg(info.fileName()).arg(msg), parent); }); }