Replace some unsigned int with std::size_t in the LinkEvent

This commit is contained in:
Victor Levasseur
2015-08-17 23:11:10 +02:00
parent 79bfa079aa
commit a1cf27fe3c
3 changed files with 11 additions and 11 deletions

View File

@@ -42,14 +42,14 @@ const EventsList * LinkEvent::GetLinkedEvents(const gd::Project & project) const
return events;
}
void LinkEvent::ReplaceLinkByLinkedEvents(gd::Project & project, EventsList & eventList, unsigned int indexOfTheEventInThisList)
void LinkEvent::ReplaceLinkByLinkedEvents(gd::Project & project, EventsList & eventList, std::size_t indexOfTheEventInThisList)
{
//Finding what to link to.
const EventsList * eventsToInclude = GetLinkedEvents(project);
if ( eventsToInclude != NULL )
{
unsigned int firstEvent = IncludeAllEvents() ? 0 : GetIncludeStart();
unsigned int lastEvent = IncludeAllEvents() ? eventsToInclude->size() - 1 : GetIncludeEnd();
std::size_t firstEvent = IncludeAllEvents() ? 0 : GetIncludeStart();
std::size_t lastEvent = IncludeAllEvents() ? eventsToInclude->size() - 1 : GetIncludeEnd();
//Check bounds
if ( firstEvent >= eventsToInclude->size() )

View File

@@ -45,17 +45,17 @@ public:
/**
* Set the number of the first and last event to be included ( Meaningful only if includeAll was set to false, see SetIncludeAllEvents )
*/
void SetIncludeStartAndEnd(unsigned int includeStart_, unsigned int includeEnd_) { includeStart = includeStart_; includeEnd = includeEnd_; };
void SetIncludeStartAndEnd(std::size_t includeStart_, std::size_t includeEnd_) { includeStart = includeStart_; includeEnd = includeEnd_; };
/**
* Get the number of the first event to be included. (Meaningful only if includeAll was set to false, see SetIncludeAllEvents)
*/
unsigned int GetIncludeStart() const { return includeStart; };
std::size_t GetIncludeStart() const { return includeStart; };
/**
* Get the number of the last event to be included. (Meaningful only if includeAll was set to false, see SetIncludeAllEvents)
*/
unsigned int GetIncludeEnd() const { return includeEnd; };
std::size_t GetIncludeEnd() const { return includeEnd; };
/**
* The link event must always be preprocessed.
@@ -75,7 +75,7 @@ public:
* When implementing a platform with a link event, you should call this function when preprocessing the events
* (See gd::EventMetadata::codeGeneration).
*/
void ReplaceLinkByLinkedEvents(gd::Project & project, EventsList & eventList, unsigned int indexOfTheEventInThisList);
void ReplaceLinkByLinkedEvents(gd::Project & project, EventsList & eventList, std::size_t indexOfTheEventInThisList);
virtual bool IsExecutable() const { return true; };
@@ -97,8 +97,8 @@ public:
private:
gd::String target; ///< The name of the external events (or scene) to be included
bool includeAll; ///< If set to true, all the events of the target should be included
unsigned int includeStart; ///< If includeAll is set to false, represents the number of the first event of the target to included.
unsigned int includeEnd; ///< If includeAll is set to false, represents the number of the last event of the target to included.
std::size_t includeStart; ///< If includeAll is set to false, represents the number of the first event of the target to included.
std::size_t includeEnd; ///< If includeAll is set to false, represents the number of the last event of the target to included.
bool linkWasInvalid; ///< Set to true by Preprocess if the links was invalid the last time is was processed. Used to display a warning in the events editor.
};

View File

@@ -174,8 +174,8 @@ void EditLink::OnOkBtClick(wxCommandEvent& event)
{
editedEvent.SetIncludeAllEvents(false);
editedEvent.SetIncludeStartAndEnd(
gd::String(StartEdit->GetValue()).To<int>() - 1,
gd::String(EndEdit->GetValue()).To<int>() - 1);
gd::String(StartEdit->GetValue()).To<std::size_t>() - 1,
gd::String(EndEdit->GetValue()).To<std::size_t>() - 1);
}
EndModal(1);
}