示例#1
0
/**
 * Returns if the mouse is over "pannel map" - the circular minimap area on top left.
 * @param x Pannel map circle start X coordinate.
 * @param y Pannel map circle start Y coordinate.
 * @return
 */
TbBool mouse_is_over_pannel_map(ScreenCoord x, ScreenCoord y)
{
    long cmx,cmy;
    long px,py;
    cmx = GetMouseX();
    cmy = GetMouseY();
    px = (cmx-(x+PANNEL_MAP_RADIUS));
    py = (cmy-(y+PANNEL_MAP_RADIUS));
    return (LbSqrL(px*px + py*py) < PANNEL_MAP_RADIUS);
}
示例#2
0
/**
 * Returns if the mouse is over "pannel map" - the circular minimap area on top left.
 * @param x Pannel map circle start X coordinate.
 * @param y Pannel map circle start Y coordinate.
 * @return
 */
TbBool mouse_is_over_pannel_map(ScreenCoord x, ScreenCoord y)
{
    long cmx,cmy;
    long px,py;
    cmx = GetMouseX();
    cmy = GetMouseY();
    int units_per_px;
    units_per_px = (16*status_panel_width + 140/2) / 140;
    px = (cmx-(x+PANNEL_MAP_RADIUS*units_per_px/16));
    py = (cmy-(y+PANNEL_MAP_RADIUS*units_per_px/16));
    return (LbSqrL(px*px + py*py) < PANNEL_MAP_RADIUS*units_per_px/16);
}
示例#3
0
long computer_check_for_expand_room_kind(struct Computer2 *comp, struct ComputerCheck * check, RoomKind rkind, long max_slabs, long around_start)
{
    struct Dungeon *dungeon;
    dungeon = comp->dungeon;
    {
        struct RoomStats *rstat;
        rstat = room_stats_get_for_kind(rkind);
        // If we don't have money for the room - don't even try
        // Check price for two slabs - after all, we don't want to end up having nothing
        if (2*rstat->cost >= dungeon->total_money_owned) {
            return 0;
        }
    }
    MapSubtlCoord max_radius;
    // Don't allow the room to be made into long, narrow shape
    max_radius = 3 * slab_subtile(LbSqrL(max_slabs),2) / 4;
    struct Room *room;
    long i;
    unsigned long k;
    i = dungeon->room_kind[rkind];
    k = 0;
    while (i != 0)
    {
        room = room_get(i);
        if (room_is_invalid(room))
        {
          ERRORLOG("Jump to invalid room detected");
          break;
        }
        i = room->next_of_owner;
        // Per-room code
        if ((room->slabs_count > 0) && (room->slabs_count < max_slabs)) {
            if (computer_check_for_expand_specific_room(comp, check, room, max_radius, around_start)) {
                SYNCDBG(6,"The %s index %d will be expanded",room_code_name(room->kind),(int)room->index);
                return 1;
            }
        }
        // Per-room code ends
        k++;
        if (k > ROOMS_COUNT)
        {
          ERRORLOG("Infinite loop detected when sweeping rooms list");
          break;
        }
    }
    return 0;
}