for me the short the cruise the more likely that I will gain weight. On our several cruises of 10 or more nights, I actually loose weight. This is partially due to the fact that I don't have to eat it all at every meal - because I know that there are many, many more very good meals to come. And I have been on over 20 cruises so again, I don't have to eat it all.
On the Panama Canal cruises, with all of those sea days, I typically will walk 3 miles in the mornings on deck 4. That helps a lot. Also living on deck 2 and taking the stairs helps. On some of our other longer cruises (Med and Baltic) - those are so active, long days on shore, lots of walking that maintaining (not gaining or losing) weight is easier.
Took several cruises to figure out that breakfast was killing me. I would take a little of this and a little of that and have an overflowing plate of food, because my "little" wasn't so little. Now I make sure that I do not take a full scoop of anything if I am getting a bit of "everything" - ensuring that a little is in fact little!
Lunches - I try to avoid the buffet. I actually try to avoid having lunch. I will grab a couple of small items of Fruit or a wrap and a couple of sweets from the Cove Cafe (snacks have been free). Infrequently I will grab a soft serve ice cream and sometimes you just gotta have some of the chicken strips - I always ask them to NOT give me any fries, sometimes they do and sometimes they don't. Unfortunately I'm of an age where eating all of the food on your plate has been ingrained into me because of all of the starving children in Africa and China.
Dinners: I eat what I want. And will order multiple desserts - which bug my wife to no end. I usually will only take a bite or two of the "extra" desserts, again bugging my wife.
Bottom line, listen to your body and cut back on the eating after a day or two.