Esempio n. 1
0
ItemLoaderRepo::ItemLoaderRepo()
    : Repository<PropertyLoaderBase<Item> >( mDefault )
{
    int32_t id = AutoId( "plasma_gun" );
    mElements.insert( id, new PlasmaGunLoader() );
    id = AutoId( "guard_plasma_gun" );
    mElements.insert( id, new PlasmaGunLoader() );
    id = AutoId( "pistol" );
    mElements.insert( id, new PistolLoader() );
    id = AutoId( "shotgun" );
    mElements.insert( id, new ShotgunLoader() );
    id = AutoId( "rocket_launcher" );
    mElements.insert( id, new RocketLauncherLoader() );
    id = AutoId( "ion_gun" );
    mElements.insert( id, new IonGunLoader() );
    id = AutoId( "gatling_gun" );
    mElements.insert( id, new GatlingGunLoader() );
    id = AutoId( "gauss_gun" );
    mElements.insert( id, new GaussGunLoader() );
    id = AutoId( "lucky_rocket" );
    mElements.insert( id, new LuckyRocketLoader() );
    id = AutoId("rusty_reaper"); 
    mElements.insert(id, new RustyReaperLoader());
    Init();
}
Esempio n. 2
0
pair<UniqueHandle, UniqueHandle>
MakePipe()
{
#	if YCL_Win32
	::HANDLE h_raw_read, h_raw_write;

	YCL_CallWin32F(CreatePipe, &h_raw_read, &h_raw_write, {}, 0);

	UniqueHandle h_read(h_raw_read), h_write(h_raw_write);

	YCL_CallWin32F(SetHandleInformation, h_write.get(), HANDLE_FLAG_INHERIT,
		HANDLE_FLAG_INHERIT);
	return {std::move(h_read), std::move(h_write)};
#	elif YCL_API_Has_unistd_h
	int fds[2];

	// TODO: Check whether '::socketpair' is available.
	if(::pipe(fds) != 0)
		ThrowFileOperationFailure("Failed getting file size.");

	auto pr(make_pair(UniqueHandle(fds[0]), UniqueHandle(fds[1])));
	auto check([](UniqueHandle& h, const char* msg){
		// NOTE: %O_NONBLOCK is initially cleared on ::pipe results.
		//	See http://pubs.opengroup.org/onlinepubs/9699919799/.
		if(!(h && h->SetNonblocking()))
			ThrowFileOperationFailure(msg);
	});

	check(pr.first, "Failed making pipe for reading."),
	check(pr.second, "Failed making pipe for writing.");
	return pr;
#	else
#	error "Unsupported platform found."
#	endif
}
Esempio n. 3
0
DirectoryFindData::DirectoryFindData(const wstring& name)
	: dir_name(name), find_data()
{
	if(ystdex::rtrim(dir_name, L"/\\").empty())
		dir_name = L'.';
	YAssert(dir_name.back() != '\\', "Invalid argument found.");

	using platform::FileOperationFailure;
	const auto attr(::GetFileAttributesW(dir_name.c_str()));
	yconstexpr const auto& msg("Opening directory failed.");

	if(YB_UNLIKELY(attr == INVALID_FILE_ATTRIBUTES))
		// TODO: Call %::GetLastError to distinguish concreate errors.
		throw FileOperationFailure(EINVAL, std::generic_category(), msg);
	if(attr & FILE_ATTRIBUTE_DIRECTORY)
		dir_name += L"\\*";
	else
		throw FileOperationFailure(ENOTDIR, std::generic_category(), msg);
}
Esempio n. 4
0
RenderableLayer::RenderableLayer()
{
    mIdToRendLayerMap[AutoId( "background" )] = RenderableLayer::Background;
    mIdToRendLayerMap[AutoId( "background_1" )] = RenderableLayer::Background_1;
    mIdToRendLayerMap[AutoId( "corpses" )] = RenderableLayer::Corpses;
    mIdToRendLayerMap[AutoId( "creeps" )] = RenderableLayer::Creeps;
    mIdToRendLayerMap[AutoId( "players" )] = RenderableLayer::Players;
    mIdToRendLayerMap[AutoId( "buildings" )] = RenderableLayer::Buildings;
}
Esempio n. 5
0
bool ItemLoaderRepo::LoadItemFromOneDesc( Json::Value& ItemDesc )
{
    std::string nameStr;
    if( !Json::GetStr( ItemDesc["name"], nameStr ) )
    {
        return false;
    }
    PropertyLoaderBase<Item>& itemLoader = operator()( AutoId( nameStr ) );

    Json::Value& setters = ItemDesc["set"];
    if ( !setters.isArray() )
    {
        return false;
    }
    if ( setters.empty() )
    {
        return true;
    }
    L1( "Load item_loader: %s\n", nameStr.c_str() );
    itemLoader.Load( *setters.begin() );
    return true;
}
Esempio n. 6
0
int fish::getY()
   {
      return plat.getY();
   }
Esempio n. 7
0
int fish::getExp()
   {
      return plat.getExp();
   }
Esempio n. 8
0
 cl_device_id  clutil_platform::get_device_ids(cl_device_type device_type)
 {
     return platform_util->get_device_ids(device_type);
 }
Esempio n. 9
0
int fish::askHP(int ID)
   {
       return plat.askHP(ID);
   }
Esempio n. 10
0
int fish::getID()
   {
       return plat.getID();
   }
Esempio n. 11
0
int fish::getAtt()
   {
      return plat.getAtt();
   }
Esempio n. 12
0
 std::size_t clutil_platform::get_source_size()
 {
     return platform_util->get_source_size();
 }
Esempio n. 13
0
 void clutil_platform::cl_build_programs()
 {
     platform_util->cl_build_programs();
 }
Esempio n. 14
0
 void clutil_platform::cl_create_programs_with_source()
 {
     platform_util->cl_create_programs_with_source();
 }
Esempio n. 15
0
 void clutil_platform::cl_create_context()
 {
     platform_util->cl_create_context();
 }
Esempio n. 16
0
 void  clutil_platform::context_properties()
 {
     platform_util->context_properties();
 }
Esempio n. 17
0
 cl_platform_id  clutil_platform::get_platform_ids()
 {
     return platform_util->get_platform_ids();
 }
Esempio n. 18
0
bool fish::move(int tx,int ty)
   {
      return plat.move(tx,ty);
   }
Esempio n. 19
0
int fish::getMaxHP()
   {
      return plat.getMaxHP();
   }
Esempio n. 20
0
void CollisionComponentLoader::BindValues()
{
    Bind( "radius", func_double( &CollisionComponent::SetRadius ) );
    std::string istr;
    if( Json::GetStr( ( *mSetters )["class"], istr ) )
    {
        Bind<CollisionClass::Type>( &CollisionComponent::SetCollisionClass, mCollisionClass( AutoId( istr ) ) );
    }
    Bind("clip_scene", func_bool(&CollisionComponent::SetClipScene));

}
Esempio n. 21
0
int fish::getSp()
   {
      return plat.getSp();
   }
Esempio n. 22
0
bool fish::increaseStrength()
   {
       return plat.increaseStrength();
   }
Esempio n. 23
0
int fish::askWhat(int x,int y)
   {
       return plat.askWhat(x,y);
   }
Esempio n. 24
0
bool fish::attack(int tx,int ty)
   {
       return plat.attack(tx,ty);
   }
Esempio n. 25
0
bool fish::increaseHealth()
   {
       return plat.increaseHealth();
   }
Esempio n. 26
0
 std::string clutil_platform::get_platforms_info(cl_platform_info name, std::string str)
 {
     return platform_util->get_platforms_info(name, str);
 }
Esempio n. 27
0
bool fish::increaseSpeed()
   {
       return plat.increaseSpeed();
   }
Esempio n. 28
0
int fish::getPoint()
   {
       return plat.getPoint();
   }
Esempio n. 29
0
ComponentFactory::ComponentFactory()
{
    Bind( AutoId( "default_component" ), &CreateComponent<DefaultComponent> );
    SetDefault( AutoId( "default_component" ) );

    Bind( AutoId( "position_component" ), &CreateComponent<PositionComponent> );
    Bind( AutoId( "rotate_component" ), &CreateComponent<RotateComponent> );
    Bind( AutoId( "visual_box_multiplier_component" ), &CreateComponent<render::VisualBoxMultiplierComponent> );
    Bind( AutoId( "move_component" ), &CreateComponent<MoveComponent> );
    Bind( AutoId( "acceleration_component" ), &CreateComponent<AccelerationComponent> );

    Bind( AutoId( "player_controller_component" ), &CreateComponent<PlayerControllerComponent> );
    Bind( AutoId( "target_player_controller_component" ), &CreateComponent<TargetPlayerControllerComponent> );
    Bind( AutoId( "random_controller_component" ), &CreateComponent<RandomControllerComponent> );
    Bind( AutoId( "guard_controller_component" ), &CreateComponent<GuardControllerComponent> );
    Bind( AutoId( "path_controller_component" ), &CreateComponent<PathControllerComponent> );

    Bind( AutoId( "inventory_component" ), &CreateComponent<InventoryComponent> );
    Bind( AutoId( "static_actor_component" ), &CreateComponent<StaticActorComponent> );
    Bind( AutoId( "health_component" ), &CreateComponent<HealthComponent> );

    Bind( AutoId( "collision_component" ), &CreateComponent<CollisionComponent> );
    Bind( AutoId( "shot_collision_component" ), &CreateComponent<ShotCollisionComponent> );
    Bind( AutoId( "wall_collision_component" ), &CreateComponent<WallCollisionComponent> );
    Bind( AutoId( "water_collision_component" ), &CreateComponent<WaterCollisionComponent> );
    Bind( AutoId( "pickup_collision_component" ), &CreateComponent<PickupCollisionComponent> );
    Bind( AutoId( "aoe_collision_component" ), &CreateComponent<AoeCollisionComponent> );
    Bind( AutoId( "bounce_collision_component" ), &CreateComponent<BounceCollisionComponent> );

    Bind( AutoId( "renderable_component" ), &CreateComponent<RenderableComponent> );
    Bind( AutoId( "border_component" ), &CreateComponent<BorderComponent> );

    Bind( AutoId( "remove_on_death_component" ), &CreateComponent<RemoveOnDeathComponent> );
    Bind( AutoId( "explode_on_death_component" ), &CreateComponent<ExplodeOnDeathComponent> );
    Bind( AutoId( "drop_on_death_component" ), &CreateComponent<DropOnDeathComponent> );
    Bind( AutoId( "stop_on_death_component" ), &CreateComponent<StopOnDeathComponent> );
    Bind( AutoId( "score_on_death_component" ), &CreateComponent<ScoreOnDeathComponent> );
    Bind( AutoId( "owner_component" ), &CreateComponent<OwnerComponent> );
    Bind( AutoId( "kill_score_on_death_component" ), &CreateComponent<KillScoreOnDeathComponent> );

    Bind( AutoId( "notify_parent_on_death_component" ), &CreateComponent<NotifyParentOnDeathComponent> );
    Bind( AutoId( "listen_child_death_component" ), &CreateComponent<ListenChildDeathComponent> );
    Bind( AutoId( "pointer_target_controller_component" ), &CreateComponent<PointerTargetControllerComponent> );
    Bind( AutoId( "heat_source_component" ), &CreateComponent<HeatSourceComponent> );

    Bind( AutoId( "fade_out_component" ), &CreateComponent<FadeOutComponent> );

    Bind( AutoId( "explosion_component" ), &CreateComponent<ExplosionComponent> );

    Bind( AutoId( "target_holder_component" ), &CreateComponent<TargetHolderComponent> );
    Bind( AutoId( "buff_holder_component" ), &CreateComponent<BuffHolderComponent> );
    Bind( AutoId( "accuracy_component" ), &CreateComponent<AccuracyComponent> );
    Bind( AutoId( "armor_component" ), &CreateComponent<ArmorComponent> );
    Bind( AutoId( "cloak_component" ), &CreateComponent<CloakComponent> );

    Bind( AutoId( "team_component" ), &CreateComponent<TeamComponent> );
    Bind( AutoId( "flag_collision_component" ), &CreateComponent<ctf::FlagCollisionComponent> );
    Bind( AutoId( "attachable_component" ), &CreateComponent<ctf::AttachableComponent> );
    Bind( AutoId( "flag_carrier_component" ), &CreateComponent<ctf::FlagCarrierComponent> );
    Bind( AutoId( "flag_receiver_component" ), &CreateComponent<ctf::FlagReceiverComponent> );

    Bind( AutoId( "emitter_component" ), &CreateComponent<EmitterComponent> );
    Bind( AutoId( "explode_on_hit_component" ), &CreateComponent<ExplodeOnHitComponent> );
    Bind( AutoId( "detonate_on_hit_component" ), &CreateComponent<DetonateOnHitComponent> );
    Bind( AutoId( "audible_component" ), &CreateComponent<AudibleComponent> );
    Bind( AutoId( "remove_components_on_death_component" ), &CreateComponent<RemoveComponentsOnDeathComponent> );
    Bind( AutoId( "cell_component" ), &CreateComponent<CellComponent> );
    Bind( AutoId( "level_end_component" ), &CreateComponent<LevelEndComponent> );
}
Esempio n. 30
0
int fish::getLevel()
   {
       return plat.getLevel();
   }